/******/ (function(modules) { // webpackBootstrap
/******/ // install a JSONP callback for chunk loading
/******/ var parentJsonpFunction = window["webpackJsonp"];
/******/ window["webpackJsonp"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
/******/ var moduleId, chunkId, i = 0, resolves = [], result;
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(installedChunks[chunkId]) {
/******/ resolves.push(installedChunks[chunkId][0]);
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
/******/ for(moduleId in moreModules) {
/******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {
/******/ modules[moduleId] = moreModules[moduleId];
/******/ }
/******/ }
/******/ if(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);
/******/ while(resolves.length) {
/******/ resolves.shift()();
/******/ }
/******/ if(executeModules) {
/******/ for(i=0; i < executeModules.length; i++) {
/******/ result = __webpack_require__(__webpack_require__.s = executeModules[i]);
/******/ }
/******/ }
/******/ return result;
/******/ };
/******/
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // objects to store loaded and loading chunks
/******/ var installedChunks = {
/******/ 1: 0
/******/ };
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/ // This file contains only the entry chunk.
/******/ // The chunk loading function for additional chunks
/******/ __webpack_require__.e = function requireEnsure(chunkId) {
/******/ var installedChunkData = installedChunks[chunkId];
/******/ if(installedChunkData === 0) {
/******/ return new Promise(function(resolve) { resolve(); });
/******/ }
/******/
/******/ // a Promise means "currently loading".
/******/ if(installedChunkData) {
/******/ return installedChunkData[2];
/******/ }
/******/
/******/ // setup Promise in chunk cache
/******/ var promise = new Promise(function(resolve, reject) {
/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject];
/******/ });
/******/ installedChunkData[2] = promise;
/******/
/******/ // start chunk loading
/******/ var head = document.getElementsByTagName('head')[0];
/******/ var script = document.createElement('script');
/******/ script.type = 'text/javascript';
/******/ script.charset = 'utf-8';
/******/ script.async = true;
/******/ script.timeout = 120000;
/******/
/******/ if (__webpack_require__.nc) {
/******/ script.setAttribute("nonce", __webpack_require__.nc);
/******/ }
/******/ script.src = __webpack_require__.p + "" + chunkId + ".js";
/******/ var timeout = setTimeout(onScriptComplete, 120000);
/******/ script.onerror = script.onload = onScriptComplete;
/******/ function onScriptComplete() {
/******/ // avoid mem leaks in IE.
/******/ script.onerror = script.onload = null;
/******/ clearTimeout(timeout);
/******/ var chunk = installedChunks[chunkId];
/******/ if(chunk !== 0) {
/******/ if(chunk) {
/******/ chunk[1](new Error('Loading chunk ' + chunkId + ' failed.'));
/******/ }
/******/ installedChunks[chunkId] = undefined;
/******/ }
/******/ };
/******/ head.appendChild(script);
/******/
/******/ return promise;
/******/ };
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "build/";
/******/
/******/ // on error function for async loading
/******/ __webpack_require__.oe = function(err) { console.error(err); throw err; };
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {/* unused harmony export createPlatform */
/* unused harmony export assertPlatform */
/* unused harmony export destroyPlatform */
/* unused harmony export getPlatform */
/* unused harmony export PlatformRef */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return ApplicationRef; });
/* unused harmony export enableProdMode */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_16", function() { return isDevMode; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_13", function() { return createPlatformFactory; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "L", function() { return NgProbeToken; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return APP_ID; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "P", function() { return PACKAGE_ROOT_URL; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "R", function() { return PLATFORM_INITIALIZER; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Q", function() { return PLATFORM_ID; });
/* unused harmony export APP_BOOTSTRAP_LISTENER */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return APP_INITIALIZER; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return ApplicationInitStatus; });
/* unused harmony export DebugElement */
/* unused harmony export DebugNode */
/* unused harmony export asNativeElements */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_15", function() { return getDebugNode; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_6", function() { return Testability; });
/* unused harmony export TestabilityRegistry */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_18", function() { return setTestabilityGetter; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_3", function() { return TRANSLATIONS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_4", function() { return TRANSLATIONS_FORMAT; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "G", function() { return LOCALE_ID; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "H", function() { return MissingTranslationStrategy; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return ApplicationModule; });
/* unused harmony export wtfCreateScope */
/* unused harmony export wtfLeave */
/* unused harmony export wtfStartTimeRange */
/* unused harmony export wtfEndTimeRange */
/* unused harmony export Type */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return EventEmitter; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return ErrorHandler; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Z", function() { return Sanitizer; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_0", function() { return SecurityContext; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ANALYZE_FOR_ENTRY_COMPONENTS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return Attribute; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return ContentChild; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return ContentChildren; });
/* unused harmony export Query */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_8", function() { return ViewChild; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_9", function() { return ViewChildren; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return Component; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return Directive; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return HostBinding; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "y", function() { return HostListener; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "D", function() { return Input; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "O", function() { return Output; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "S", function() { return Pipe; });
/* unused harmony export CUSTOM_ELEMENTS_SCHEMA */
/* unused harmony export NO_ERRORS_SCHEMA */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I", function() { return NgModule; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_11", function() { return ViewEncapsulation; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_7", function() { return Version; });
/* unused harmony export VERSION */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_14", function() { return forwardRef; });
/* unused harmony export resolveForwardRef */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "C", function() { return Injector; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "U", function() { return ReflectiveInjector; });
/* unused harmony export ResolvedReflectiveFactory */
/* unused harmony export ReflectiveKey */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "B", function() { return InjectionToken; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "z", function() { return Inject; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "N", function() { return Optional; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A", function() { return Injectable; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_1", function() { return Self; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_2", function() { return SkipSelf; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return Host; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "M", function() { return NgZone; });
/* unused harmony export RenderComponentType */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "V", function() { return Renderer; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "W", function() { return Renderer2; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "X", function() { return RendererFactory2; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Y", function() { return RendererStyleFlags2; });
/* unused harmony export RootRenderer */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return COMPILER_OPTIONS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return Compiler; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return CompilerFactory; });
/* unused harmony export ModuleWithComponentFactories */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return ComponentFactory; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return ComponentRef; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return ComponentFactoryResolver; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return ElementRef; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "J", function() { return NgModuleFactory; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "K", function() { return NgModuleRef; });
/* unused harmony export NgModuleFactoryLoader */
/* unused harmony export getModuleFactory */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "T", function() { return QueryList; });
/* unused harmony export SystemJsNgModuleLoader */
/* unused harmony export SystemJsNgModuleLoaderConfig */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_5", function() { return TemplateRef; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_10", function() { return ViewContainerRef; });
/* unused harmony export EmbeddedViewRef */
/* unused harmony export ViewRef */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return ChangeDetectionStrategy; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return ChangeDetectorRef; });
/* unused harmony export DefaultIterableDiffer */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "E", function() { return IterableDiffers; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F", function() { return KeyValueDiffers; });
/* unused harmony export SimpleChange */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_12", function() { return WrappedValue; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_17", function() { return platformCore; });
/* unused harmony export ɵALLOW_MULTIPLE_PLATFORMS */
/* unused harmony export ɵAPP_ID_RANDOM_PROVIDER */
/* unused harmony export ɵValueUnwrapper */
/* unused harmony export ɵdevModeEqual */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_33", function() { return isListLikeIterable; });
/* unused harmony export ɵChangeDetectorStatus */
/* unused harmony export ɵisDefaultChangeDetectionStrategy */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_20", function() { return Console; });
/* unused harmony export ɵComponentFactory */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_19", function() { return CodegenComponentFactoryResolver; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_23", function() { return ReflectionCapabilities; });
/* unused harmony export ɵRenderDebugInfo */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_30", function() { return _global; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_36", function() { return looseIdentical; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_48", function() { return stringify; });
/* unused harmony export ɵmakeDecorator */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_34", function() { return isObservable; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_35", function() { return isPromise; });
/* unused harmony export ɵclearProviderOverrides */
/* unused harmony export ɵoverrideProvider */
/* unused harmony export ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_47", function() { return registerModuleFactory; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_21", function() { return EMPTY_ARRAY; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_22", function() { return EMPTY_MAP; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_24", function() { return anchorDef; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_25", function() { return createComponentFactory; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_26", function() { return createNgModuleFactory; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_27", function() { return createRendererType2; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_28", function() { return directiveDef; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_29", function() { return elementDef; });
/* unused harmony export ɵelementEventFullName */
/* unused harmony export ɵgetComponentViewDefinitionFactory */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_31", function() { return inlineInterpolate; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_32", function() { return interpolate; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_37", function() { return moduleDef; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_38", function() { return moduleProvideDef; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_39", function() { return ngContentDef; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_40", function() { return nodeValue; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_42", function() { return pipeDef; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_45", function() { return providerDef; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_41", function() { return pureArrayDef; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_43", function() { return pureObjectDef; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_44", function() { return purePipeDef; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_46", function() { return queryDef; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_49", function() { return textDef; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_50", function() { return unwrapValue; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_51", function() { return viewDef; });
/* unused harmony export AUTO_STYLE */
/* unused harmony export trigger */
/* unused harmony export animate */
/* unused harmony export group */
/* unused harmony export sequence */
/* unused harmony export style */
/* unused harmony export state */
/* unused harmony export keyframes */
/* unused harmony export transition */
/* unused harmony export ɵx */
/* unused harmony export ɵy */
/* unused harmony export ɵbc */
/* unused harmony export ɵz */
/* unused harmony export ɵbb */
/* unused harmony export ɵba */
/* unused harmony export ɵbd */
/* unused harmony export ɵw */
/* unused harmony export ɵk */
/* unused harmony export ɵl */
/* unused harmony export ɵm */
/* unused harmony export ɵf */
/* unused harmony export ɵg */
/* unused harmony export ɵh */
/* unused harmony export ɵi */
/* unused harmony export ɵj */
/* unused harmony export ɵb */
/* unused harmony export ɵc */
/* unused harmony export ɵd */
/* unused harmony export ɵe */
/* unused harmony export ɵn */
/* unused harmony export ɵp */
/* unused harmony export ɵo */
/* unused harmony export ɵs */
/* unused harmony export ɵq */
/* unused harmony export ɵr */
/* unused harmony export ɵa */
/* unused harmony export ɵt */
/* unused harmony export ɵu */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_tslib__ = __webpack_require__(31);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rxjs_Observable__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rxjs_Observable___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_rxjs_Observable__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_observable_merge__ = __webpack_require__(361);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_observable_merge___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_rxjs_observable_merge__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_operator_share__ = __webpack_require__(370);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_operator_share___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_rxjs_operator_share__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_rxjs_Subject__ = __webpack_require__(42);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_rxjs_Subject___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_rxjs_Subject__);
/**
* @license Angular v5.0.3
* (c) 2010-2017 Google, Inc. https://angular.io/
* License: MIT
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Creates a token that can be used in a DI Provider.
*
* Use an `InjectionToken` whenever the type you are injecting is not reified (does not have a
* runtime representation) such as when injecting an interface, callable type, array or
* parametrized type.
*
* `InjectionToken` is parameterized on `T` which is the type of object which will be returned by
* the `Injector`. This provides additional level of type safety.
*
* ```
* interface MyInterface {...}
* var myInterface = injector.get(new InjectionToken<MyInterface>('SomeToken'));
* // myInterface is inferred to be MyInterface.
* ```
*
* ### Example
*
* {\@example core/di/ts/injector_spec.ts region='InjectionToken'}
*
* \@stable
*/
var InjectionToken = (function () {
function InjectionToken(_desc) {
this._desc = _desc;
/**
* \@internal
*/
this.ngMetadataName = 'InjectionToken';
}
/**
* @return {?}
*/
InjectionToken.prototype.toString = /**
* @return {?}
*/
function () { return "InjectionToken " + this._desc; };
return InjectionToken;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* An interface implemented by all Angular type decorators, which allows them to be used as ES7
* decorators as well as
* Angular DSL syntax.
*
* ES7 syntax:
*
* ```
* \@ng.Component({...})
* class MyClass {...}
* ```
* \@stable
* @record
*/
var ANNOTATIONS = '__annotations__';
var PARAMETERS = '__paramaters__';
var PROP_METADATA = '__prop__metadata__';
/**
* @suppress {globalThis}
* @param {?} name
* @param {?=} props
* @param {?=} parentClass
* @param {?=} chainFn
* @return {?}
*/
function makeDecorator(name, props, parentClass, chainFn) {
var /** @type {?} */ metaCtor = makeMetadataCtor(props);
/**
* @param {?} objOrType
* @return {?}
*/
function DecoratorFactory(objOrType) {
if (this instanceof DecoratorFactory) {
metaCtor.call(this, objOrType);
return this;
}
var /** @type {?} */ annotationInstance = new (/** @type {?} */ (DecoratorFactory))(objOrType);
var /** @type {?} */ TypeDecorator = /** @type {?} */ (function TypeDecorator(cls) {
// Use of Object.defineProperty is important since it creates non-enumerable property which
// prevents the property is copied during subclassing.
var /** @type {?} */ annotations = cls.hasOwnProperty(ANNOTATIONS) ?
(/** @type {?} */ (cls))[ANNOTATIONS] :
Object.defineProperty(cls, ANNOTATIONS, { value: [] })[ANNOTATIONS];
annotations.push(annotationInstance);
return cls;
});
if (chainFn)
chainFn(TypeDecorator);
return TypeDecorator;
}
if (parentClass) {
DecoratorFactory.prototype = Object.create(parentClass.prototype);
}
DecoratorFactory.prototype.ngMetadataName = name;
(/** @type {?} */ (DecoratorFactory)).annotationCls = DecoratorFactory;
return /** @type {?} */ (DecoratorFactory);
}
/**
* @param {?=} props
* @return {?}
*/
function makeMetadataCtor(props) {
return function ctor() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (props) {
var /** @type {?} */ values = props.apply(void 0, args);
for (var /** @type {?} */ propName in values) {
this[propName] = values[propName];
}
}
};
}
/**
* @param {?} name
* @param {?=} props
* @param {?=} parentClass
* @return {?}
*/
function makeParamDecorator(name, props, parentClass) {
var /** @type {?} */ metaCtor = makeMetadataCtor(props);
/**
* @param {...?} args
* @return {?}
*/
function ParamDecoratorFactory() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (this instanceof ParamDecoratorFactory) {
metaCtor.apply(this, args);
return this;
}
var /** @type {?} */ annotationInstance = new ((_a = (/** @type {?} */ (ParamDecoratorFactory))).bind.apply(_a, [void 0].concat(args)))();
(/** @type {?} */ (ParamDecorator)).annotation = annotationInstance;
return ParamDecorator;
/**
* @param {?} cls
* @param {?} unusedKey
* @param {?} index
* @return {?}
*/
function ParamDecorator(cls, unusedKey, index) {
// Use of Object.defineProperty is important since it creates non-enumerable property which
// prevents the property is copied during subclassing.
var /** @type {?} */ parameters = cls.hasOwnProperty(PARAMETERS) ?
(/** @type {?} */ (cls))[PARAMETERS] :
Object.defineProperty(cls, PARAMETERS, { value: [] })[PARAMETERS];
// there might be gaps if some in between parameters do not have annotations.
// we pad with nulls.
while (parameters.length <= index) {
parameters.push(null);
}
(parameters[index] = parameters[index] || []).push(annotationInstance);
return cls;
}
var _a;
}
if (parentClass) {
ParamDecoratorFactory.prototype = Object.create(parentClass.prototype);
}
ParamDecoratorFactory.prototype.ngMetadataName = name;
(/** @type {?} */ (ParamDecoratorFactory)).annotationCls = ParamDecoratorFactory;
return ParamDecoratorFactory;
}
/**
* @param {?} name
* @param {?=} props
* @param {?=} parentClass
* @return {?}
*/
function makePropDecorator(name, props, parentClass) {
var /** @type {?} */ metaCtor = makeMetadataCtor(props);
/**
* @param {...?} args
* @return {?}
*/
function PropDecoratorFactory() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (this instanceof PropDecoratorFactory) {
metaCtor.apply(this, args);
return this;
}
var /** @type {?} */ decoratorInstance = new ((_a = (/** @type {?} */ (PropDecoratorFactory))).bind.apply(_a, [void 0].concat(args)))();
return function PropDecorator(target, name) {
var /** @type {?} */ constructor = target.constructor;
// Use of Object.defineProperty is important since it creates non-enumerable property which
// prevents the property is copied during subclassing.
var /** @type {?} */ meta = constructor.hasOwnProperty(PROP_METADATA) ?
(/** @type {?} */ (constructor))[PROP_METADATA] :
Object.defineProperty(constructor, PROP_METADATA, { value: {} })[PROP_METADATA];
meta[name] = meta.hasOwnProperty(name) && meta[name] || [];
meta[name].unshift(decoratorInstance);
};
var _a;
}
if (parentClass) {
PropDecoratorFactory.prototype = Object.create(parentClass.prototype);
}
PropDecoratorFactory.prototype.ngMetadataName = name;
(/** @type {?} */ (PropDecoratorFactory)).annotationCls = PropDecoratorFactory;
return PropDecoratorFactory;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* This token can be used to create a virtual provider that will populate the
* `entryComponents` fields of components and ng modules based on its `useValue`.
* All components that are referenced in the `useValue` value (either directly
* or in a nested array or map) will be added to the `entryComponents` property.
*
* ### Example
* The following example shows how the router can populate the `entryComponents`
* field of an NgModule based on the router configuration which refers
* to components.
*
* ```typescript
* // helper function inside the router
* function provideRoutes(routes) {
* return [
* {provide: ROUTES, useValue: routes},
* {provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: routes, multi: true}
* ];
* }
*
* // user code
* let routes = [
* {path: '/root', component: RootComp},
* {path: '/teams', component: TeamsComp}
* ];
*
* \@NgModule({
* providers: [provideRoutes(routes)]
* })
* class ModuleWithRoutes {}
* ```
*
* \@experimental
*/
var ANALYZE_FOR_ENTRY_COMPONENTS = new InjectionToken('AnalyzeForEntryComponents');
/**
* Type of the Attribute decorator / constructor function.
*
* \@stable
* @record
*/
/**
* Attribute decorator and metadata.
*
* \@stable
* \@Annotation
*/
var Attribute = makeParamDecorator('Attribute', function (attributeName) { return ({ attributeName: attributeName }); });
/**
* Base class for query metadata.
*
* See {\@link ContentChildren}, {\@link ContentChild}, {\@link ViewChildren}, {\@link ViewChild} for
* more information.
*
* \@stable
* @abstract
*/
var Query = (function () {
function Query() {
}
return Query;
}());
/**
* Type of the ContentChildren decorator / constructor function.
*
* See {\@link ContentChildren}.
*
* \@stable
* @record
*/
/**
* ContentChildren decorator and metadata.
*
* \@stable
* \@Annotation
*/
var ContentChildren = makePropDecorator('ContentChildren', function (selector, data) {
if (data === void 0) { data = {}; }
return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ selector: selector, first: false, isViewQuery: false, descendants: false }, data));
}, Query);
/**
* Type of the ContentChild decorator / constructor function.
*
*
* \@stable
* @record
*/
/**
* ContentChild decorator and metadata.
*
* \@stable
* \@Annotation
*/
var ContentChild = makePropDecorator('ContentChild', function (selector, data) {
if (data === void 0) { data = {}; }
return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ selector: selector, first: true, isViewQuery: false, descendants: true }, data));
}, Query);
/**
* Type of the ViewChildren decorator / constructor function.
*
* See {\@link ViewChildren}.
*
* \@stable
* @record
*/
/**
* ViewChildren decorator and metadata.
*
* \@stable
* \@Annotation
*/
var ViewChildren = makePropDecorator('ViewChildren', function (selector, data) {
if (data === void 0) { data = {}; }
return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ selector: selector, first: false, isViewQuery: true, descendants: true }, data));
}, Query);
/**
* Type of the ViewChild decorator / constructor function.
*
* See {\@link ViewChild}
*
* \@stable
* @record
*/
/**
* ViewChild decorator and metadata.
*
* \@stable
* \@Annotation
*/
var ViewChild = makePropDecorator('ViewChild', function (selector, data) {
return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ selector: selector, first: true, isViewQuery: true, descendants: true }, data));
}, Query);
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/** @enum {number} */
var ChangeDetectionStrategy = {
/**
* `OnPush` means that the change detector's mode will be initially set to `CheckOnce`.
*/
OnPush: 0,
/**
* `Default` means that the change detector's mode will be initially set to `CheckAlways`.
*/
Default: 1,
};
ChangeDetectionStrategy[ChangeDetectionStrategy.OnPush] = "OnPush";
ChangeDetectionStrategy[ChangeDetectionStrategy.Default] = "Default";
/** @enum {number} */
var ChangeDetectorStatus = {
/**
* `CheckOnce` means that after calling detectChanges the mode of the change detector
* will become `Checked`.
*/
CheckOnce: 0,
/**
* `Checked` means that the change detector should be skipped until its mode changes to
* `CheckOnce`.
*/
Checked: 1,
/**
* `CheckAlways` means that after calling detectChanges the mode of the change detector
* will remain `CheckAlways`.
*/
CheckAlways: 2,
/**
* `Detached` means that the change detector sub tree is not a part of the main tree and
* should be skipped.
*/
Detached: 3,
/**
* `Errored` means that the change detector encountered an error checking a binding
* or calling a directive lifecycle method and is now in an inconsistent state. Change
* detectors in this state will no longer detect changes.
*/
Errored: 4,
/**
* `Destroyed` means that the change detector is destroyed.
*/
Destroyed: 5,
};
ChangeDetectorStatus[ChangeDetectorStatus.CheckOnce] = "CheckOnce";
ChangeDetectorStatus[ChangeDetectorStatus.Checked] = "Checked";
ChangeDetectorStatus[ChangeDetectorStatus.CheckAlways] = "CheckAlways";
ChangeDetectorStatus[ChangeDetectorStatus.Detached] = "Detached";
ChangeDetectorStatus[ChangeDetectorStatus.Errored] = "Errored";
ChangeDetectorStatus[ChangeDetectorStatus.Destroyed] = "Destroyed";
/**
* @param {?} changeDetectionStrategy
* @return {?}
*/
function isDefaultChangeDetectionStrategy(changeDetectionStrategy) {
return changeDetectionStrategy == null ||
changeDetectionStrategy === ChangeDetectionStrategy.Default;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Type of the Directive decorator / constructor function.
*
* \@stable
* @record
*/
/**
* Directive decorator and metadata.
*
* \@stable
* \@Annotation
*/
var Directive = makeDecorator('Directive', function (dir) {
if (dir === void 0) { dir = {}; }
return dir;
});
/**
* Type of the Component decorator / constructor function.
*
* \@stable
* @record
*/
/**
* Component decorator and metadata.
*
* \@stable
* \@Annotation
*/
var Component = makeDecorator('Component', function (c) {
if (c === void 0) { c = {}; }
return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ changeDetection: ChangeDetectionStrategy.Default }, c));
}, Directive);
/**
* Type of the Pipe decorator / constructor function.
*
* \@stable
* @record
*/
/**
* Pipe decorator and metadata.
*
* \@stable
* \@Annotation
*/
var Pipe = makeDecorator('Pipe', function (p) { return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ pure: true }, p)); });
/**
* Type of the Input decorator / constructor function.
*
* \@stable
* @record
*/
/**
* Input decorator and metadata.
*
* \@stable
* \@Annotation
*/
var Input = makePropDecorator('Input', function (bindingPropertyName) { return ({ bindingPropertyName: bindingPropertyName }); });
/**
* Type of the Output decorator / constructor function.
*
* \@stable
* @record
*/
/**
* Output decorator and metadata.
*
* \@stable
* \@Annotation
*/
var Output = makePropDecorator('Output', function (bindingPropertyName) { return ({ bindingPropertyName: bindingPropertyName }); });
/**
* Type of the HostBinding decorator / constructor function.
*
* \@stable
* @record
*/
/**
* HostBinding decorator and metadata.
*
* \@stable
* \@Annotation
*/
var HostBinding = makePropDecorator('HostBinding', function (hostPropertyName) { return ({ hostPropertyName: hostPropertyName }); });
/**
* Type of the HostListener decorator / constructor function.
*
* \@stable
* @record
*/
/**
* HostListener decorator and metadata.
*
* \@stable
* \@Annotation
*/
var HostListener = makePropDecorator('HostListener', function (eventName, args) { return ({ eventName: eventName, args: args }); });
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* A wrapper around a module that also includes the providers.
*
* \@stable
* @record
*/
/**
* Interface for schema definitions in \@NgModules.
*
* \@experimental
* @record
*/
/**
* Defines a schema that will allow:
* - any non-Angular elements with a `-` in their name,
* - any properties on elements with a `-` in their name which is the common rule for custom
* elements.
*
* \@stable
*/
var CUSTOM_ELEMENTS_SCHEMA = {
name: 'custom-elements'
};
/**
* Defines a schema that will allow any property on any element.
*
* \@experimental
*/
var NO_ERRORS_SCHEMA = {
name: 'no-errors-schema'
};
/**
* Type of the NgModule decorator / constructor function.
*
* \@stable
* @record
*/
/**
* NgModule decorator and metadata.
*
* \@stable
* \@Annotation
*/
var NgModule = makeDecorator('NgModule', function (ngModule) { return ngModule; });
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/** @enum {number} */
var ViewEncapsulation = {
/**
* Emulate `Native` scoping of styles by adding an attribute containing surrogate id to the Host
* Element and pre-processing the style rules provided via {@link Component#styles styles} or
* {@link Component#styleUrls styleUrls}, and adding the new Host Element attribute to all
* selectors.
*
* This is the default option.
*/
Emulated: 0,
/**
* Use the native encapsulation mechanism of the renderer.
*
* For the DOM this means using [Shadow DOM](https://w3c.github.io/webcomponents/spec/shadow/) and
* creating a ShadowRoot for Component's Host Element.
*/
Native: 1,
/**
* Don't provide any template or style encapsulation.
*/
None: 2,
};
ViewEncapsulation[ViewEncapsulation.Emulated] = "Emulated";
ViewEncapsulation[ViewEncapsulation.Native] = "Native";
ViewEncapsulation[ViewEncapsulation.None] = "None";
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* \@whatItDoes Represents the version of Angular
*
* \@stable
*/
var Version = (function () {
function Version(full) {
this.full = full;
this.major = full.split('.')[0];
this.minor = full.split('.')[1];
this.patch = full.split('.').slice(2).join('.');
}
return Version;
}());
/**
* \@stable
*/
var VERSION = new Version('5.0.3');
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Type of the Inject decorator / constructor function.
*
* \@stable
* @record
*/
/**
* Inject decorator and metadata.
*
* \@stable
* \@Annotation
*/
var Inject = makeParamDecorator('Inject', function (token) { return ({ token: token }); });
/**
* Type of the Optional decorator / constructor function.
*
* \@stable
* @record
*/
/**
* Optional decorator and metadata.
*
* \@stable
* \@Annotation
*/
var Optional = makeParamDecorator('Optional');
/**
* Type of the Injectable decorator / constructor function.
*
* \@stable
* @record
*/
/**
* Injectable decorator and metadata.
*
* \@stable
* \@Annotation
*/
var Injectable = makeDecorator('Injectable');
/**
* Type of the Self decorator / constructor function.
*
* \@stable
* @record
*/
/**
* Self decorator and metadata.
*
* \@stable
* \@Annotation
*/
var Self = makeParamDecorator('Self');
/**
* Type of the SkipSelf decorator / constructor function.
*
* \@stable
* @record
*/
/**
* SkipSelf decorator and metadata.
*
* \@stable
* \@Annotation
*/
var SkipSelf = makeParamDecorator('SkipSelf');
/**
* Type of the Host decorator / constructor function.
*
* \@stable
* @record
*/
/**
* Host decorator and metadata.
*
* \@stable
* \@Annotation
*/
var Host = makeParamDecorator('Host');
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var __window = typeof window !== 'undefined' && window;
var __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&
self instanceof WorkerGlobalScope && self;
var __global = typeof global !== 'undefined' && global;
var _global = __window || __global || __self;
var _symbolIterator = null;
/**
* @return {?}
*/
function getSymbolIterator() {
if (!_symbolIterator) {
var /** @type {?} */ Symbol_1 = _global['Symbol'];
if (Symbol_1 && Symbol_1.iterator) {
_symbolIterator = Symbol_1.iterator;
}
else {
// es6-shim specific logic
var /** @type {?} */ keys = Object.getOwnPropertyNames(Map.prototype);
for (var /** @type {?} */ i = 0; i < keys.length; ++i) {
var /** @type {?} */ key = keys[i];
if (key !== 'entries' && key !== 'size' &&
(/** @type {?} */ (Map)).prototype[key] === Map.prototype['entries']) {
_symbolIterator = key;
}
}
}
}
return _symbolIterator;
}
/**
* @param {?} fn
* @return {?}
*/
function scheduleMicroTask(fn) {
Zone.current.scheduleMicroTask('scheduleMicrotask', fn);
}
/**
* @param {?} a
* @param {?} b
* @return {?}
*/
function looseIdentical(a, b) {
return a === b || typeof a === 'number' && typeof b === 'number' && isNaN(a) && isNaN(b);
}
/**
* @param {?} token
* @return {?}
*/
function stringify(token) {
if (typeof token === 'string') {
return token;
}
if (token instanceof Array) {
return '[' + token.map(stringify).join(', ') + ']';
}
if (token == null) {
return '' + token;
}
if (token.overriddenName) {
return "" + token.overriddenName;
}
if (token.name) {
return "" + token.name;
}
var /** @type {?} */ res = token.toString();
if (res == null) {
return '' + res;
}
var /** @type {?} */ newLineIndex = res.indexOf('\n');
return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* An interface that a function passed into {\@link forwardRef} has to implement.
*
* ### Example
*
* {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref_fn'}
* \@experimental
* @record
*/
/**
* Allows to refer to references which are not yet defined.
*
* For instance, `forwardRef` is used when the `token` which we need to refer to for the purposes of
* DI is declared,
* but not yet defined. It is also used when the `token` which we use when creating a query is not
* yet defined.
*
* ### Example
* {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref'}
* \@experimental
* @param {?} forwardRefFn
* @return {?}
*/
function forwardRef(forwardRefFn) {
(/** @type {?} */ (forwardRefFn)).__forward_ref__ = forwardRef;
(/** @type {?} */ (forwardRefFn)).toString = function () { return stringify(this()); };
return (/** @type {?} */ (/** @type {?} */ (forwardRefFn)));
}
/**
* Lazily retrieves the reference value from a forwardRef.
*
* Acts as the identity function when given a non-forward-ref value.
*
* ### Example ([live demo](http://plnkr.co/edit/GU72mJrk1fiodChcmiDR?p=preview))
*
* {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='resolve_forward_ref'}
*
* See: {\@link forwardRef}
* \@experimental
* @param {?} type
* @return {?}
*/
function resolveForwardRef(type) {
if (typeof type === 'function' && type.hasOwnProperty('__forward_ref__') &&
type.__forward_ref__ === forwardRef) {
return (/** @type {?} */ (type))();
}
else {
return type;
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var _THROW_IF_NOT_FOUND = new Object();
var THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
var _NullInjector = (function () {
function _NullInjector() {
}
/**
* @param {?} token
* @param {?=} notFoundValue
* @return {?}
*/
_NullInjector.prototype.get = /**
* @param {?} token
* @param {?=} notFoundValue
* @return {?}
*/
function (token, notFoundValue) {
if (notFoundValue === void 0) { notFoundValue = _THROW_IF_NOT_FOUND; }
if (notFoundValue === _THROW_IF_NOT_FOUND) {
throw new Error("NullInjectorError: No provider for " + stringify(token) + "!");
}
return notFoundValue;
};
return _NullInjector;
}());
/**
* \@whatItDoes Injector interface
* \@howToUse
* ```
* const injector: Injector = ...;
* injector.get(...);
* ```
*
* \@description
* For more details, see the {\@linkDocs guide/dependency-injection "Dependency Injection Guide"}.
*
* ### Example
*
* {\@example core/di/ts/injector_spec.ts region='Injector'}
*
* `Injector` returns itself when given `Injector` as a token:
* {\@example core/di/ts/injector_spec.ts region='injectInjector'}
*
* \@stable
* @abstract
*/
var Injector = (function () {
function Injector() {
}
/**
* Create a new Injector which is configure using `StaticProvider`s.
*
* ### Example
*
* {@example core/di/ts/provider_spec.ts region='ConstructorProvider'}
*/
/**
* Create a new Injector which is configure using `StaticProvider`s.
*
* ### Example
*
* {\@example core/di/ts/provider_spec.ts region='ConstructorProvider'}
* @param {?} providers
* @param {?=} parent
* @return {?}
*/
Injector.create = /**
* Create a new Injector which is configure using `StaticProvider`s.
*
* ### Example
*
* {\@example core/di/ts/provider_spec.ts region='ConstructorProvider'}
* @param {?} providers
* @param {?=} parent
* @return {?}
*/
function (providers, parent) {
return new StaticInjector(providers, parent);
};
Injector.THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
Injector.NULL = new _NullInjector();
return Injector;
}());
var IDENT = function (value) {
return value;
};
var EMPTY = /** @type {?} */ ([]);
var CIRCULAR = IDENT;
var MULTI_PROVIDER_FN = function () {
return Array.prototype.slice.call(arguments);
};
var GET_PROPERTY_NAME = /** @type {?} */ ({});
var ɵ2 = GET_PROPERTY_NAME;
var USE_VALUE = getClosureSafeProperty({ provide: String, useValue: ɵ2 });
var NG_TOKEN_PATH = 'ngTokenPath';
var NG_TEMP_TOKEN_PATH = 'ngTempTokenPath';
var NULL_INJECTOR = Injector.NULL;
var NEW_LINE = /\n/gm;
var NO_NEW_LINE = 'ɵ';
var StaticInjector = (function () {
function StaticInjector(providers, parent) {
if (parent === void 0) { parent = NULL_INJECTOR; }
this.parent = parent;
var /** @type {?} */ records = this._records = new Map();
records.set(Injector, /** @type {?} */ ({ token: Injector, fn: IDENT, deps: EMPTY, value: this, useNew: false }));
recursivelyProcessProviders(records, providers);
}
/**
* @param {?} token
* @param {?=} notFoundValue
* @return {?}
*/
StaticInjector.prototype.get = /**
* @param {?} token
* @param {?=} notFoundValue
* @return {?}
*/
function (token, notFoundValue) {
var /** @type {?} */ record = this._records.get(token);
try {
return tryResolveToken(token, record, this._records, this.parent, notFoundValue);
}
catch (/** @type {?} */ e) {
var /** @type {?} */ tokenPath = e[NG_TEMP_TOKEN_PATH];
e.message = formatError('\n' + e.message, tokenPath);
e[NG_TOKEN_PATH] = tokenPath;
e[NG_TEMP_TOKEN_PATH] = null;
throw e;
}
};
/**
* @return {?}
*/
StaticInjector.prototype.toString = /**
* @return {?}
*/
function () {
var /** @type {?} */ tokens = /** @type {?} */ ([]), /** @type {?} */ records = this._records;
records.forEach(function (v, token) { return tokens.push(stringify(token)); });
return "StaticInjector[" + tokens.join(', ') + "]";
};
return StaticInjector;
}());
/**
* @param {?} provider
* @return {?}
*/
function resolveProvider(provider) {
var /** @type {?} */ deps = computeDeps(provider);
var /** @type {?} */ fn = IDENT;
var /** @type {?} */ value = EMPTY;
var /** @type {?} */ useNew = false;
var /** @type {?} */ provide = resolveForwardRef(provider.provide);
if (USE_VALUE in provider) {
// We need to use USE_VALUE in provider since provider.useValue could be defined as undefined.
value = (/** @type {?} */ (provider)).useValue;
}
else if ((/** @type {?} */ (provider)).useFactory) {
fn = (/** @type {?} */ (provider)).useFactory;
}
else if ((/** @type {?} */ (provider)).useExisting) {
// Just use IDENT
}
else if ((/** @type {?} */ (provider)).useClass) {
useNew = true;
fn = resolveForwardRef((/** @type {?} */ (provider)).useClass);
}
else if (typeof provide == 'function') {
useNew = true;
fn = provide;
}
else {
throw staticError('StaticProvider does not have [useValue|useFactory|useExisting|useClass] or [provide] is not newable', provider);
}
return { deps: deps, fn: fn, useNew: useNew, value: value };
}
/**
* @param {?} token
* @return {?}
*/
function multiProviderMixError(token) {
return staticError('Cannot mix multi providers and regular providers', token);
}
/**
* @param {?} records
* @param {?} provider
* @return {?}
*/
function recursivelyProcessProviders(records, provider) {
if (provider) {
provider = resolveForwardRef(provider);
if (provider instanceof Array) {
// if we have an array recurse into the array
for (var /** @type {?} */ i = 0; i < provider.length; i++) {
recursivelyProcessProviders(records, provider[i]);
}
}
else if (typeof provider === 'function') {
// Functions were supported in ReflectiveInjector, but are not here. For safety give useful
// error messages
throw staticError('Function/Class not supported', provider);
}
else if (provider && typeof provider === 'object' && provider.provide) {
// At this point we have what looks like a provider: {provide: ?, ....}
var /** @type {?} */ token = resolveForwardRef(provider.provide);
var /** @type {?} */ resolvedProvider = resolveProvider(provider);
if (provider.multi === true) {
// This is a multi provider.
var /** @type {?} */ multiProvider = records.get(token);
if (multiProvider) {
if (multiProvider.fn !== MULTI_PROVIDER_FN) {
throw multiProviderMixError(token);
}
}
else {
// Create a placeholder factory which will look up the constituents of the multi provider.
records.set(token, multiProvider = /** @type {?} */ ({
token: provider.provide,
deps: [],
useNew: false,
fn: MULTI_PROVIDER_FN,
value: EMPTY
}));
}
// Treat the provider as the token.
token = provider;
multiProvider.deps.push({ token: token, options: 6 /* Default */ });
}
var /** @type {?} */ record = records.get(token);
if (record && record.fn == MULTI_PROVIDER_FN) {
throw multiProviderMixError(token);
}
records.set(token, resolvedProvider);
}
else {
throw staticError('Unexpected provider', provider);
}
}
}
/**
* @param {?} token
* @param {?} record
* @param {?} records
* @param {?} parent
* @param {?} notFoundValue
* @return {?}
*/
function tryResolveToken(token, record, records, parent, notFoundValue) {
try {
return resolveToken(token, record, records, parent, notFoundValue);
}
catch (/** @type {?} */ e) {
// ensure that 'e' is of type Error.
if (!(e instanceof Error)) {
e = new Error(e);
}
var /** @type {?} */ path = e[NG_TEMP_TOKEN_PATH] = e[NG_TEMP_TOKEN_PATH] || [];
path.unshift(token);
if (record && record.value == CIRCULAR) {
// Reset the Circular flag.
record.value = EMPTY;
}
throw e;
}
}
/**
* @param {?} token
* @param {?} record
* @param {?} records
* @param {?} parent
* @param {?} notFoundValue
* @return {?}
*/
function resolveToken(token, record, records, parent, notFoundValue) {
var /** @type {?} */ value;
if (record) {
// If we don't have a record, this implies that we don't own the provider hence don't know how
// to resolve it.
value = record.value;
if (value == CIRCULAR) {
throw Error(NO_NEW_LINE + 'Circular dependency');
}
else if (value === EMPTY) {
record.value = CIRCULAR;
var /** @type {?} */ obj = undefined;
var /** @type {?} */ useNew = record.useNew;
var /** @type {?} */ fn = record.fn;
var /** @type {?} */ depRecords = record.deps;
var /** @type {?} */ deps = EMPTY;
if (depRecords.length) {
deps = [];
for (var /** @type {?} */ i = 0; i < depRecords.length; i++) {
var /** @type {?} */ depRecord = depRecords[i];
var /** @type {?} */ options = depRecord.options;
var /** @type {?} */ childRecord = options & 2 /* CheckSelf */ ? records.get(depRecord.token) : undefined;
deps.push(tryResolveToken(
// Current Token to resolve
depRecord.token, childRecord, records,
// If we don't know how to resolve dependency and we should not check parent for it,
// than pass in Null injector.
!childRecord && !(options & 4 /* CheckParent */) ? NULL_INJECTOR : parent, options & 1 /* Optional */ ? null : Injector.THROW_IF_NOT_FOUND));
}
}
record.value = value = useNew ? new ((_a = (/** @type {?} */ (fn))).bind.apply(_a, [void 0].concat(deps)))() : fn.apply(obj, deps);
}
}
else {
value = parent.get(token, notFoundValue);
}
return value;
var _a;
}
/**
* @param {?} provider
* @return {?}
*/
function computeDeps(provider) {
var /** @type {?} */ deps = EMPTY;
var /** @type {?} */ providerDeps = (/** @type {?} */ (provider)).deps;
if (providerDeps && providerDeps.length) {
deps = [];
for (var /** @type {?} */ i = 0; i < providerDeps.length; i++) {
var /** @type {?} */ options = 6;
var /** @type {?} */ token = resolveForwardRef(providerDeps[i]);
if (token instanceof Array) {
for (var /** @type {?} */ j = 0, /** @type {?} */ annotations = token; j < annotations.length; j++) {
var /** @type {?} */ annotation = annotations[j];
if (annotation instanceof Optional || annotation == Optional) {
options = options | 1 /* Optional */;
}
else if (annotation instanceof SkipSelf || annotation == SkipSelf) {
options = options & ~2 /* CheckSelf */;
}
else if (annotation instanceof Self || annotation == Self) {
options = options & ~4 /* CheckParent */;
}
else if (annotation instanceof Inject) {
token = (/** @type {?} */ (annotation)).token;
}
else {
token = resolveForwardRef(annotation);
}
}
}
deps.push({ token: token, options: options });
}
}
else if ((/** @type {?} */ (provider)).useExisting) {
var /** @type {?} */ token = resolveForwardRef((/** @type {?} */ (provider)).useExisting);
deps = [{ token: token, options: 6 /* Default */ }];
}
else if (!providerDeps && !(USE_VALUE in provider)) {
// useValue & useExisting are the only ones which are exempt from deps all others need it.
throw staticError('\'deps\' required', provider);
}
return deps;
}
/**
* @param {?} text
* @param {?} obj
* @return {?}
*/
function formatError(text, obj) {
text = text && text.charAt(0) === '\n' && text.charAt(1) == NO_NEW_LINE ? text.substr(2) : text;
var /** @type {?} */ context = stringify(obj);
if (obj instanceof Array) {
context = obj.map(stringify).join(' -> ');
}
else if (typeof obj === 'object') {
var /** @type {?} */ parts = /** @type {?} */ ([]);
for (var /** @type {?} */ key in obj) {
if (obj.hasOwnProperty(key)) {
var /** @type {?} */ value = obj[key];
parts.push(key + ':' + (typeof value === 'string' ? JSON.stringify(value) : stringify(value)));
}
}
context = "{" + parts.join(', ') + "}";
}
return "StaticInjectorError[" + context + "]: " + text.replace(NEW_LINE, '\n ');
}
/**
* @param {?} text
* @param {?} obj
* @return {?}
*/
function staticError(text, obj) {
return new Error(formatError(text, obj));
}
/**
* @template T
* @param {?} objWithPropertyToExtract
* @return {?}
*/
function getClosureSafeProperty(objWithPropertyToExtract) {
for (var /** @type {?} */ key in objWithPropertyToExtract) {
if (objWithPropertyToExtract[key] === GET_PROPERTY_NAME) {
return key;
}
}
throw Error('!prop');
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var ERROR_DEBUG_CONTEXT = 'ngDebugContext';
var ERROR_ORIGINAL_ERROR = 'ngOriginalError';
var ERROR_LOGGER = 'ngErrorLogger';
/**
* @param {?} error
* @return {?}
*/
/**
* @param {?} error
* @return {?}
*/
function getDebugContext(error) {
return (/** @type {?} */ (error))[ERROR_DEBUG_CONTEXT];
}
/**
* @param {?} error
* @return {?}
*/
function getOriginalError(error) {
return (/** @type {?} */ (error))[ERROR_ORIGINAL_ERROR];
}
/**
* @param {?} error
* @return {?}
*/
function getErrorLogger(error) {
return (/** @type {?} */ (error))[ERROR_LOGGER] || defaultErrorLogger;
}
/**
* @param {?} console
* @param {...?} values
* @return {?}
*/
function defaultErrorLogger(console) {
var values = [];
for (var _i = 1; _i < arguments.length; _i++) {
values[_i - 1] = arguments[_i];
}
console.error.apply(console, values);
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* \@whatItDoes Provides a hook for centralized exception handling.
*
* \@description
*
* The default implementation of `ErrorHandler` prints error messages to the `console`. To
* intercept error handling, write a custom exception handler that replaces this default as
* appropriate for your app.
*
* ### Example
*
* ```
* class MyErrorHandler implements ErrorHandler {
* handleError(error) {
* // do something with the exception
* }
* }
*
* \@NgModule({
* providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
* })
* class MyModule {}
* ```
*
* \@stable
*/
var ErrorHandler = (function () {
function ErrorHandler() {
/**
* \@internal
*/
this._console = console;
}
/**
* @param {?} error
* @return {?}
*/
ErrorHandler.prototype.handleError = /**
* @param {?} error
* @return {?}
*/
function (error) {
var /** @type {?} */ originalError = this._findOriginalError(error);
var /** @type {?} */ context = this._findContext(error);
// Note: Browser consoles show the place from where console.error was called.
// We can use this to give users additional information about the error.
var /** @type {?} */ errorLogger = getErrorLogger(error);
errorLogger(this._console, "ERROR", error);
if (originalError) {
errorLogger(this._console, "ORIGINAL ERROR", originalError);
}
if (context) {
errorLogger(this._console, 'ERROR CONTEXT', context);
}
};
/** @internal */
/**
* \@internal
* @param {?} error
* @return {?}
*/
ErrorHandler.prototype._findContext = /**
* \@internal
* @param {?} error
* @return {?}
*/
function (error) {
if (error) {
return getDebugContext(error) ? getDebugContext(error) :
this._findContext(getOriginalError(error));
}
return null;
};
/** @internal */
/**
* \@internal
* @param {?} error
* @return {?}
*/
ErrorHandler.prototype._findOriginalError = /**
* \@internal
* @param {?} error
* @return {?}
*/
function (error) {
var /** @type {?} */ e = getOriginalError(error);
while (e && getOriginalError(e)) {
e = getOriginalError(e);
}
return e;
};
return ErrorHandler;
}());
/**
* @param {?} message
* @param {?} originalError
* @return {?}
*/
function wrappedError(message, originalError) {
var /** @type {?} */ msg = message + " caused by: " + (originalError instanceof Error ? originalError.message : originalError);
var /** @type {?} */ error = Error(msg);
(/** @type {?} */ (error))[ERROR_ORIGINAL_ERROR] = originalError;
return error;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @param {?} keys
* @return {?}
*/
function findFirstClosedCycle(keys) {
var /** @type {?} */ res = [];
for (var /** @type {?} */ i = 0; i < keys.length; ++i) {
if (res.indexOf(keys[i]) > -1) {
res.push(keys[i]);
return res;
}
res.push(keys[i]);
}
return res;
}
/**
* @param {?} keys
* @return {?}
*/
function constructResolvingPath(keys) {
if (keys.length > 1) {
var /** @type {?} */ reversed = findFirstClosedCycle(keys.slice().reverse());
var /** @type {?} */ tokenStrs = reversed.map(function (k) { return stringify(k.token); });
return ' (' + tokenStrs.join(' -> ') + ')';
}
return '';
}
/**
* @record
*/
/**
* @param {?} injector
* @param {?} key
* @param {?} constructResolvingMessage
* @param {?=} originalError
* @return {?}
*/
function injectionError(injector, key, constructResolvingMessage, originalError) {
var /** @type {?} */ keys = [key];
var /** @type {?} */ errMsg = constructResolvingMessage(keys);
var /** @type {?} */ error = /** @type {?} */ ((originalError ? wrappedError(errMsg, originalError) : Error(errMsg)));
error.addKey = addKey;
error.keys = keys;
error.injectors = [injector];
error.constructResolvingMessage = constructResolvingMessage;
(/** @type {?} */ (error))[ERROR_ORIGINAL_ERROR] = originalError;
return error;
}
/**
* @this {?}
* @param {?} injector
* @param {?} key
* @return {?}
*/
function addKey(injector, key) {
this.injectors.push(injector);
this.keys.push(key);
// Note: This updated message won't be reflected in the `.stack` property
this.message = this.constructResolvingMessage(this.keys);
}
/**
* Thrown when trying to retrieve a dependency by key from {\@link Injector}, but the
* {\@link Injector} does not have a {\@link Provider} for the given key.
*
* ### Example ([live demo](http://plnkr.co/edit/vq8D3FRB9aGbnWJqtEPE?p=preview))
*
* ```typescript
* class A {
* constructor(b:B) {}
* }
*
* expect(() => Injector.resolveAndCreate([A])).toThrowError();
* ```
* @param {?} injector
* @param {?} key
* @return {?}
*/
function noProviderError(injector, key) {
return injectionError(injector, key, function (keys) {
var /** @type {?} */ first = stringify(keys[0].token);
return "No provider for " + first + "!" + constructResolvingPath(keys);
});
}
/**
* Thrown when dependencies form a cycle.
*
* ### Example ([live demo](http://plnkr.co/edit/wYQdNos0Tzql3ei1EV9j?p=info))
*
* ```typescript
* var injector = Injector.resolveAndCreate([
* {provide: "one", useFactory: (two) => "two", deps: [[new Inject("two")]]},
* {provide: "two", useFactory: (one) => "one", deps: [[new Inject("one")]]}
* ]);
*
* expect(() => injector.get("one")).toThrowError();
* ```
*
* Retrieving `A` or `B` throws a `CyclicDependencyError` as the graph above cannot be constructed.
* @param {?} injector
* @param {?} key
* @return {?}
*/
function cyclicDependencyError(injector, key) {
return injectionError(injector, key, function (keys) {
return "Cannot instantiate cyclic dependency!" + constructResolvingPath(keys);
});
}
/**
* Thrown when a constructing type returns with an Error.
*
* The `InstantiationError` class contains the original error plus the dependency graph which caused
* this object to be instantiated.
*
* ### Example ([live demo](http://plnkr.co/edit/7aWYdcqTQsP0eNqEdUAf?p=preview))
*
* ```typescript
* class A {
* constructor() {
* throw new Error('message');
* }
* }
*
* var injector = Injector.resolveAndCreate([A]);
* try {
* injector.get(A);
* } catch (e) {
* expect(e instanceof InstantiationError).toBe(true);
* expect(e.originalException.message).toEqual("message");
* expect(e.originalStack).toBeDefined();
* }
* ```
* @param {?} injector
* @param {?} originalException
* @param {?} originalStack
* @param {?} key
* @return {?}
*/
function instantiationError(injector, originalException, originalStack, key) {
return injectionError(injector, key, function (keys) {
var /** @type {?} */ first = stringify(keys[0].token);
return originalException.message + ": Error during instantiation of " + first + "!" + constructResolvingPath(keys) + ".";
}, originalException);
}
/**
* Thrown when an object other then {\@link Provider} (or `Type`) is passed to {\@link Injector}
* creation.
*
* ### Example ([live demo](http://plnkr.co/edit/YatCFbPAMCL0JSSQ4mvH?p=preview))
*
* ```typescript
* expect(() => Injector.resolveAndCreate(["not a type"])).toThrowError();
* ```
* @param {?} provider
* @return {?}
*/
function invalidProviderError(provider) {
return Error("Invalid provider - only instances of Provider and Type are allowed, got: " + provider);
}
/**
* Thrown when the class has no annotation information.
*
* Lack of annotation information prevents the {\@link Injector} from determining which dependencies
* need to be injected into the constructor.
*
* ### Example ([live demo](http://plnkr.co/edit/rHnZtlNS7vJOPQ6pcVkm?p=preview))
*
* ```typescript
* class A {
* constructor(b) {}
* }
*
* expect(() => Injector.resolveAndCreate([A])).toThrowError();
* ```
*
* This error is also thrown when the class not marked with {\@link Injectable} has parameter types.
*
* ```typescript
* class B {}
*
* class A {
* constructor(b:B) {} // no information about the parameter types of A is available at runtime.
* }
*
* expect(() => Injector.resolveAndCreate([A,B])).toThrowError();
* ```
* \@stable
* @param {?} typeOrFunc
* @param {?} params
* @return {?}
*/
function noAnnotationError(typeOrFunc, params) {
var /** @type {?} */ signature = [];
for (var /** @type {?} */ i = 0, /** @type {?} */ ii = params.length; i < ii; i++) {
var /** @type {?} */ parameter = params[i];
if (!parameter || parameter.length == 0) {
signature.push('?');
}
else {
signature.push(parameter.map(stringify).join(' '));
}
}
return Error('Cannot resolve all parameters for \'' + stringify(typeOrFunc) + '\'(' +
signature.join(', ') + '). ' +
'Make sure that all the parameters are decorated with Inject or have valid type annotations and that \'' +
stringify(typeOrFunc) + '\' is decorated with Injectable.');
}
/**
* Thrown when getting an object by index.
*
* ### Example ([live demo](http://plnkr.co/edit/bRs0SX2OTQiJzqvjgl8P?p=preview))
*
* ```typescript
* class A {}
*
* var injector = Injector.resolveAndCreate([A]);
*
* expect(() => injector.getAt(100)).toThrowError();
* ```
* \@stable
* @param {?} index
* @return {?}
*/
function outOfBoundsError(index) {
return Error("Index " + index + " is out-of-bounds.");
}
/**
* Thrown when a multi provider and a regular provider are bound to the same token.
*
* ### Example
*
* ```typescript
* expect(() => Injector.resolveAndCreate([
* { provide: "Strings", useValue: "string1", multi: true},
* { provide: "Strings", useValue: "string2", multi: false}
* ])).toThrowError();
* ```
* @param {?} provider1
* @param {?} provider2
* @return {?}
*/
function mixingMultiProvidersWithRegularProvidersError(provider1, provider2) {
return Error("Cannot mix multi providers and regular providers, got: " + provider1 + " " + provider2);
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* A unique object used for retrieving items from the {\@link ReflectiveInjector}.
*
* Keys have:
* - a system-wide unique `id`.
* - a `token`.
*
* `Key` is used internally by {\@link ReflectiveInjector} because its system-wide unique `id` allows
* the
* injector to store created objects in a more efficient way.
*
* `Key` should not be created directly. {\@link ReflectiveInjector} creates keys automatically when
* resolving
* providers.
* @deprecated No replacement
*/
var ReflectiveKey = (function () {
/**
* Private
*/
function ReflectiveKey(token, id) {
this.token = token;
this.id = id;
if (!token) {
throw new Error('Token must be defined!');
}
this.displayName = stringify(this.token);
}
/**
* Retrieves a `Key` for a token.
*/
/**
* Retrieves a `Key` for a token.
* @param {?} token
* @return {?}
*/
ReflectiveKey.get = /**
* Retrieves a `Key` for a token.
* @param {?} token
* @return {?}
*/
function (token) {
return _globalKeyRegistry.get(resolveForwardRef(token));
};
Object.defineProperty(ReflectiveKey, "numberOfKeys", {
/**
* @returns the number of keys registered in the system.
*/
get: /**
* @return {?} the number of keys registered in the system.
*/
function () { return _globalKeyRegistry.numberOfKeys; },
enumerable: true,
configurable: true
});
return ReflectiveKey;
}());
/**
* \@internal
*/
var KeyRegistry = (function () {
function KeyRegistry() {
this._allKeys = new Map();
}
/**
* @param {?} token
* @return {?}
*/
KeyRegistry.prototype.get = /**
* @param {?} token
* @return {?}
*/
function (token) {
if (token instanceof ReflectiveKey)
return token;
if (this._allKeys.has(token)) {
return /** @type {?} */ ((this._allKeys.get(token)));
}
var /** @type {?} */ newKey = new ReflectiveKey(token, ReflectiveKey.numberOfKeys);
this._allKeys.set(token, newKey);
return newKey;
};
Object.defineProperty(KeyRegistry.prototype, "numberOfKeys", {
get: /**
* @return {?}
*/
function () { return this._allKeys.size; },
enumerable: true,
configurable: true
});
return KeyRegistry;
}());
var _globalKeyRegistry = new KeyRegistry();
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* \@whatItDoes Represents a type that a Component or other object is instances of.
*
* \@description
*
* An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by
* the `MyCustomComponent` constructor function.
*
* \@stable
*/
var Type = Function;
/**
* @param {?} v
* @return {?}
*/
function isType(v) {
return typeof v === 'function';
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Attention: This regex has to hold even if the code is minified!
*/
var DELEGATE_CTOR = /^function\s+\S+\(\)\s*{[\s\S]+\.apply\(this,\s*arguments\)/;
var ReflectionCapabilities = (function () {
function ReflectionCapabilities(reflect) {
this._reflect = reflect || _global['Reflect'];
}
/**
* @return {?}
*/
ReflectionCapabilities.prototype.isReflectionEnabled = /**
* @return {?}
*/
function () { return true; };
/**
* @template T
* @param {?} t
* @return {?}
*/
ReflectionCapabilities.prototype.factory = /**
* @template T
* @param {?} t
* @return {?}
*/
function (t) { return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return new (t.bind.apply(t, [void 0].concat(args)))();
}; };
/** @internal */
/**
* \@internal
* @param {?} paramTypes
* @param {?} paramAnnotations
* @return {?}
*/
ReflectionCapabilities.prototype._zipTypesAndAnnotations = /**
* \@internal
* @param {?} paramTypes
* @param {?} paramAnnotations
* @return {?}
*/
function (paramTypes, paramAnnotations) {
var /** @type {?} */ result;
if (typeof paramTypes === 'undefined') {
result = new Array(paramAnnotations.length);
}
else {
result = new Array(paramTypes.length);
}
for (var /** @type {?} */ i = 0; i < result.length; i++) {
// TS outputs Object for parameters without types, while Traceur omits
// the annotations. For now we preserve the Traceur behavior to aid
// migration, but this can be revisited.
if (typeof paramTypes === 'undefined') {
result[i] = [];
}
else if (paramTypes[i] != Object) {
result[i] = [paramTypes[i]];
}
else {
result[i] = [];
}
if (paramAnnotations && paramAnnotations[i] != null) {
result[i] = result[i].concat(paramAnnotations[i]);
}
}
return result;
};
/**
* @param {?} type
* @param {?} parentCtor
* @return {?}
*/
ReflectionCapabilities.prototype._ownParameters = /**
* @param {?} type
* @param {?} parentCtor
* @return {?}
*/
function (type, parentCtor) {
// If we have no decorators, we only have function.length as metadata.
// In that case, to detect whether a child class declared an own constructor or not,
// we need to look inside of that constructor to check whether it is
// just calling the parent.
// This also helps to work around for https://github.com/Microsoft/TypeScript/issues/12439
// that sets 'design:paramtypes' to []
// if a class inherits from another class but has no ctor declared itself.
if (DELEGATE_CTOR.exec(type.toString())) {
return null;
}
// Prefer the direct API.
if ((/** @type {?} */ (type)).parameters && (/** @type {?} */ (type)).parameters !== parentCtor.parameters) {
return (/** @type {?} */ (type)).parameters;
}
// API of tsickle for lowering decorators to properties on the class.
var /** @type {?} */ tsickleCtorParams = (/** @type {?} */ (type)).ctorParameters;
if (tsickleCtorParams && tsickleCtorParams !== parentCtor.ctorParameters) {
// Newer tsickle uses a function closure
// Retain the non-function case for compatibility with older tsickle
var /** @type {?} */ ctorParameters = typeof tsickleCtorParams === 'function' ? tsickleCtorParams() : tsickleCtorParams;
var /** @type {?} */ paramTypes_1 = ctorParameters.map(function (ctorParam) { return ctorParam && ctorParam.type; });
var /** @type {?} */ paramAnnotations_1 = ctorParameters.map(function (ctorParam) {
return ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators);
});
return this._zipTypesAndAnnotations(paramTypes_1, paramAnnotations_1);
}
// API for metadata created by invoking the decorators.
var /** @type {?} */ paramAnnotations = type.hasOwnProperty(PARAMETERS) && (/** @type {?} */ (type))[PARAMETERS];
var /** @type {?} */ paramTypes = this._reflect && this._reflect.getOwnMetadata &&
this._reflect.getOwnMetadata('design:paramtypes', type);
if (paramTypes || paramAnnotations) {
return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);
}
// If a class has no decorators, at least create metadata
// based on function.length.
// Note: We know that this is a real constructor as we checked
// the content of the constructor above.
return new Array((/** @type {?} */ (type.length))).fill(undefined);
};
/**
* @param {?} type
* @return {?}
*/
ReflectionCapabilities.prototype.parameters = /**
* @param {?} type
* @return {?}
*/
function (type) {
// Note: only report metadata if we have at least one class decorator
// to stay in sync with the static reflector.
if (!isType(type)) {
return [];
}
var /** @type {?} */ parentCtor = getParentCtor(type);
var /** @type {?} */ parameters = this._ownParameters(type, parentCtor);
if (!parameters && parentCtor !== Object) {
parameters = this.parameters(parentCtor);
}
return parameters || [];
};
/**
* @param {?} typeOrFunc
* @param {?} parentCtor
* @return {?}
*/
ReflectionCapabilities.prototype._ownAnnotations = /**
* @param {?} typeOrFunc
* @param {?} parentCtor
* @return {?}
*/
function (typeOrFunc, parentCtor) {
// Prefer the direct API.
if ((/** @type {?} */ (typeOrFunc)).annotations && (/** @type {?} */ (typeOrFunc)).annotations !== parentCtor.annotations) {
var /** @type {?} */ annotations = (/** @type {?} */ (typeOrFunc)).annotations;
if (typeof annotations === 'function' && annotations.annotations) {
annotations = annotations.annotations;
}
return annotations;
}
// API of tsickle for lowering decorators to properties on the class.
if ((/** @type {?} */ (typeOrFunc)).decorators && (/** @type {?} */ (typeOrFunc)).decorators !== parentCtor.decorators) {
return convertTsickleDecoratorIntoMetadata((/** @type {?} */ (typeOrFunc)).decorators);
}
// API for metadata created by invoking the decorators.
if (typeOrFunc.hasOwnProperty(ANNOTATIONS)) {
return (/** @type {?} */ (typeOrFunc))[ANNOTATIONS];
}
return null;
};
/**
* @param {?} typeOrFunc
* @return {?}
*/
ReflectionCapabilities.prototype.annotations = /**
* @param {?} typeOrFunc
* @return {?}
*/
function (typeOrFunc) {
if (!isType(typeOrFunc)) {
return [];
}
var /** @type {?} */ parentCtor = getParentCtor(typeOrFunc);
var /** @type {?} */ ownAnnotations = this._ownAnnotations(typeOrFunc, parentCtor) || [];
var /** @type {?} */ parentAnnotations = parentCtor !== Object ? this.annotations(parentCtor) : [];
return parentAnnotations.concat(ownAnnotations);
};
/**
* @param {?} typeOrFunc
* @param {?} parentCtor
* @return {?}
*/
ReflectionCapabilities.prototype._ownPropMetadata = /**
* @param {?} typeOrFunc
* @param {?} parentCtor
* @return {?}
*/
function (typeOrFunc, parentCtor) {
// Prefer the direct API.
if ((/** @type {?} */ (typeOrFunc)).propMetadata &&
(/** @type {?} */ (typeOrFunc)).propMetadata !== parentCtor.propMetadata) {
var /** @type {?} */ propMetadata = (/** @type {?} */ (typeOrFunc)).propMetadata;
if (typeof propMetadata === 'function' && propMetadata.propMetadata) {
propMetadata = propMetadata.propMetadata;
}
return propMetadata;
}
// API of tsickle for lowering decorators to properties on the class.
if ((/** @type {?} */ (typeOrFunc)).propDecorators &&
(/** @type {?} */ (typeOrFunc)).propDecorators !== parentCtor.propDecorators) {
var /** @type {?} */ propDecorators_1 = (/** @type {?} */ (typeOrFunc)).propDecorators;
var /** @type {?} */ propMetadata_1 = /** @type {?} */ ({});
Object.keys(propDecorators_1).forEach(function (prop) {
propMetadata_1[prop] = convertTsickleDecoratorIntoMetadata(propDecorators_1[prop]);
});
return propMetadata_1;
}
// API for metadata created by invoking the decorators.
if (typeOrFunc.hasOwnProperty(PROP_METADATA)) {
return (/** @type {?} */ (typeOrFunc))[PROP_METADATA];
}
return null;
};
/**
* @param {?} typeOrFunc
* @return {?}
*/
ReflectionCapabilities.prototype.propMetadata = /**
* @param {?} typeOrFunc
* @return {?}
*/
function (typeOrFunc) {
if (!isType(typeOrFunc)) {
return {};
}
var /** @type {?} */ parentCtor = getParentCtor(typeOrFunc);
var /** @type {?} */ propMetadata = {};
if (parentCtor !== Object) {
var /** @type {?} */ parentPropMetadata_1 = this.propMetadata(parentCtor);
Object.keys(parentPropMetadata_1).forEach(function (propName) {
propMetadata[propName] = parentPropMetadata_1[propName];
});
}
var /** @type {?} */ ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor);
if (ownPropMetadata) {
Object.keys(ownPropMetadata).forEach(function (propName) {
var /** @type {?} */ decorators = [];
if (propMetadata.hasOwnProperty(propName)) {
decorators.push.apply(decorators, propMetadata[propName]);
}
decorators.push.apply(decorators, ownPropMetadata[propName]);
propMetadata[propName] = decorators;
});
}
return propMetadata;
};
/**
* @param {?} type
* @param {?} lcProperty
* @return {?}
*/
ReflectionCapabilities.prototype.hasLifecycleHook = /**
* @param {?} type
* @param {?} lcProperty
* @return {?}
*/
function (type, lcProperty) {
return type instanceof Type && lcProperty in type.prototype;
};
/**
* @param {?} name
* @return {?}
*/
ReflectionCapabilities.prototype.getter = /**
* @param {?} name
* @return {?}
*/
function (name) { return /** @type {?} */ (new Function('o', 'return o.' + name + ';')); };
/**
* @param {?} name
* @return {?}
*/
ReflectionCapabilities.prototype.setter = /**
* @param {?} name
* @return {?}
*/
function (name) {
return /** @type {?} */ (new Function('o', 'v', 'return o.' + name + ' = v;'));
};
/**
* @param {?} name
* @return {?}
*/
ReflectionCapabilities.prototype.method = /**
* @param {?} name
* @return {?}
*/
function (name) {
var /** @type {?} */ functionBody = "if (!o." + name + ") throw new Error('\"" + name + "\" is undefined');\n return o." + name + ".apply(o, args);";
return /** @type {?} */ (new Function('o', 'args', functionBody));
};
// There is not a concept of import uri in Js, but this is useful in developing Dart applications.
/**
* @param {?} type
* @return {?}
*/
ReflectionCapabilities.prototype.importUri = /**
* @param {?} type
* @return {?}
*/
function (type) {
// StaticSymbol
if (typeof type === 'object' && type['filePath']) {
return type['filePath'];
}
// Runtime type
return "./" + stringify(type);
};
/**
* @param {?} type
* @return {?}
*/
ReflectionCapabilities.prototype.resourceUri = /**
* @param {?} type
* @return {?}
*/
function (type) { return "./" + stringify(type); };
/**
* @param {?} name
* @param {?} moduleUrl
* @param {?} members
* @param {?} runtime
* @return {?}
*/
ReflectionCapabilities.prototype.resolveIdentifier = /**
* @param {?} name
* @param {?} moduleUrl
* @param {?} members
* @param {?} runtime
* @return {?}
*/
function (name, moduleUrl, members, runtime) {
return runtime;
};
/**
* @param {?} enumIdentifier
* @param {?} name
* @return {?}
*/
ReflectionCapabilities.prototype.resolveEnum = /**
* @param {?} enumIdentifier
* @param {?} name
* @return {?}
*/
function (enumIdentifier, name) { return enumIdentifier[name]; };
return ReflectionCapabilities;
}());
/**
* @param {?} decoratorInvocations
* @return {?}
*/
function convertTsickleDecoratorIntoMetadata(decoratorInvocations) {
if (!decoratorInvocations) {
return [];
}
return decoratorInvocations.map(function (decoratorInvocation) {
var /** @type {?} */ decoratorType = decoratorInvocation.type;
var /** @type {?} */ annotationCls = decoratorType.annotationCls;
var /** @type {?} */ annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : [];
return new (annotationCls.bind.apply(annotationCls, [void 0].concat(annotationArgs)))();
});
}
/**
* @param {?} ctor
* @return {?}
*/
function getParentCtor(ctor) {
var /** @type {?} */ parentProto = Object.getPrototypeOf(ctor.prototype);
var /** @type {?} */ parentCtor = parentProto ? parentProto.constructor : null;
// Note: We always use `Object` as the null value
// to simplify checking later on.
return parentCtor || Object;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Provides access to reflection data about symbols. Used internally by Angular
* to power dependency injection and compilation.
*/
var Reflector = (function () {
function Reflector(reflectionCapabilities) {
this.reflectionCapabilities = reflectionCapabilities;
}
/**
* @param {?} caps
* @return {?}
*/
Reflector.prototype.updateCapabilities = /**
* @param {?} caps
* @return {?}
*/
function (caps) { this.reflectionCapabilities = caps; };
/**
* @param {?} type
* @return {?}
*/
Reflector.prototype.factory = /**
* @param {?} type
* @return {?}
*/
function (type) { return this.reflectionCapabilities.factory(type); };
/**
* @param {?} typeOrFunc
* @return {?}
*/
Reflector.prototype.parameters = /**
* @param {?} typeOrFunc
* @return {?}
*/
function (typeOrFunc) {
return this.reflectionCapabilities.parameters(typeOrFunc);
};
/**
* @param {?} typeOrFunc
* @return {?}
*/
Reflector.prototype.annotations = /**
* @param {?} typeOrFunc
* @return {?}
*/
function (typeOrFunc) {
return this.reflectionCapabilities.annotations(typeOrFunc);
};
/**
* @param {?} typeOrFunc
* @return {?}
*/
Reflector.prototype.propMetadata = /**
* @param {?} typeOrFunc
* @return {?}
*/
function (typeOrFunc) {
return this.reflectionCapabilities.propMetadata(typeOrFunc);
};
/**
* @param {?} type
* @param {?} lcProperty
* @return {?}
*/
Reflector.prototype.hasLifecycleHook = /**
* @param {?} type
* @param {?} lcProperty
* @return {?}
*/
function (type, lcProperty) {
return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty);
};
/**
* @param {?} name
* @return {?}
*/
Reflector.prototype.getter = /**
* @param {?} name
* @return {?}
*/
function (name) { return this.reflectionCapabilities.getter(name); };
/**
* @param {?} name
* @return {?}
*/
Reflector.prototype.setter = /**
* @param {?} name
* @return {?}
*/
function (name) { return this.reflectionCapabilities.setter(name); };
/**
* @param {?} name
* @return {?}
*/
Reflector.prototype.method = /**
* @param {?} name
* @return {?}
*/
function (name) { return this.reflectionCapabilities.method(name); };
/**
* @param {?} type
* @return {?}
*/
Reflector.prototype.importUri = /**
* @param {?} type
* @return {?}
*/
function (type) { return this.reflectionCapabilities.importUri(type); };
/**
* @param {?} type
* @return {?}
*/
Reflector.prototype.resourceUri = /**
* @param {?} type
* @return {?}
*/
function (type) { return this.reflectionCapabilities.resourceUri(type); };
/**
* @param {?} name
* @param {?} moduleUrl
* @param {?} members
* @param {?} runtime
* @return {?}
*/
Reflector.prototype.resolveIdentifier = /**
* @param {?} name
* @param {?} moduleUrl
* @param {?} members
* @param {?} runtime
* @return {?}
*/
function (name, moduleUrl, members, runtime) {
return this.reflectionCapabilities.resolveIdentifier(name, moduleUrl, members, runtime);
};
/**
* @param {?} identifier
* @param {?} name
* @return {?}
*/
Reflector.prototype.resolveEnum = /**
* @param {?} identifier
* @param {?} name
* @return {?}
*/
function (identifier, name) {
return this.reflectionCapabilities.resolveEnum(identifier, name);
};
return Reflector;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* The {\@link Reflector} used internally in Angular to access metadata
* about symbols.
*/
var reflector = new Reflector(new ReflectionCapabilities());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* `Dependency` is used by the framework to extend DI.
* This is internal to Angular and should not be used directly.
*/
var ReflectiveDependency = (function () {
function ReflectiveDependency(key, optional, visibility) {
this.key = key;
this.optional = optional;
this.visibility = visibility;
}
/**
* @param {?} key
* @return {?}
*/
ReflectiveDependency.fromKey = /**
* @param {?} key
* @return {?}
*/
function (key) {
return new ReflectiveDependency(key, false, null);
};
return ReflectiveDependency;
}());
var _EMPTY_LIST = [];
/**
* An internal resolved representation of a {\@link Provider} used by the {\@link Injector}.
*
* It is usually created automatically by `Injector.resolveAndCreate`.
*
* It can be created manually, as follows:
*
* ### Example ([live demo](http://plnkr.co/edit/RfEnhh8kUEI0G3qsnIeT?p%3Dpreview&p=preview))
*
* ```typescript
* var resolvedProviders = Injector.resolve([{ provide: 'message', useValue: 'Hello' }]);
* var injector = Injector.fromResolvedProviders(resolvedProviders);
*
* expect(injector.get('message')).toEqual('Hello');
* ```
*
* \@experimental
* @record
*/
var ResolvedReflectiveProvider_ = (function () {
function ResolvedReflectiveProvider_(key, resolvedFactories, multiProvider) {
this.key = key;
this.resolvedFactories = resolvedFactories;
this.multiProvider = multiProvider;
}
Object.defineProperty(ResolvedReflectiveProvider_.prototype, "resolvedFactory", {
get: /**
* @return {?}
*/
function () { return this.resolvedFactories[0]; },
enumerable: true,
configurable: true
});
return ResolvedReflectiveProvider_;
}());
/**
* An internal resolved representation of a factory function created by resolving {\@link
* Provider}.
* \@experimental
*/
var ResolvedReflectiveFactory = (function () {
function ResolvedReflectiveFactory(factory, dependencies) {
this.factory = factory;
this.dependencies = dependencies;
}
return ResolvedReflectiveFactory;
}());
/**
* Resolve a single provider.
* @param {?} provider
* @return {?}
*/
function resolveReflectiveFactory(provider) {
var /** @type {?} */ factoryFn;
var /** @type {?} */ resolvedDeps;
if (provider.useClass) {
var /** @type {?} */ useClass = resolveForwardRef(provider.useClass);
factoryFn = reflector.factory(useClass);
resolvedDeps = _dependenciesFor(useClass);
}
else if (provider.useExisting) {
factoryFn = function (aliasInstance) { return aliasInstance; };
resolvedDeps = [ReflectiveDependency.fromKey(ReflectiveKey.get(provider.useExisting))];
}
else if (provider.useFactory) {
factoryFn = provider.useFactory;
resolvedDeps = constructDependencies(provider.useFactory, provider.deps);
}
else {
factoryFn = function () { return provider.useValue; };
resolvedDeps = _EMPTY_LIST;
}
return new ResolvedReflectiveFactory(factoryFn, resolvedDeps);
}
/**
* Converts the {\@link Provider} into {\@link ResolvedProvider}.
*
* {\@link Injector} internally only uses {\@link ResolvedProvider}, {\@link Provider} contains
* convenience provider syntax.
* @param {?} provider
* @return {?}
*/
function resolveReflectiveProvider(provider) {
return new ResolvedReflectiveProvider_(ReflectiveKey.get(provider.provide), [resolveReflectiveFactory(provider)], provider.multi || false);
}
/**
* Resolve a list of Providers.
* @param {?} providers
* @return {?}
*/
function resolveReflectiveProviders(providers) {
var /** @type {?} */ normalized = _normalizeProviders(providers, []);
var /** @type {?} */ resolved = normalized.map(resolveReflectiveProvider);
var /** @type {?} */ resolvedProviderMap = mergeResolvedReflectiveProviders(resolved, new Map());
return Array.from(resolvedProviderMap.values());
}
/**
* Merges a list of ResolvedProviders into a list where
* each key is contained exactly once and multi providers
* have been merged.
* @param {?} providers
* @param {?} normalizedProvidersMap
* @return {?}
*/
function mergeResolvedReflectiveProviders(providers, normalizedProvidersMap) {
for (var /** @type {?} */ i = 0; i < providers.length; i++) {
var /** @type {?} */ provider = providers[i];
var /** @type {?} */ existing = normalizedProvidersMap.get(provider.key.id);
if (existing) {
if (provider.multiProvider !== existing.multiProvider) {
throw mixingMultiProvidersWithRegularProvidersError(existing, provider);
}
if (provider.multiProvider) {
for (var /** @type {?} */ j = 0; j < provider.resolvedFactories.length; j++) {
existing.resolvedFactories.push(provider.resolvedFactories[j]);
}
}
else {
normalizedProvidersMap.set(provider.key.id, provider);
}
}
else {
var /** @type {?} */ resolvedProvider = void 0;
if (provider.multiProvider) {
resolvedProvider = new ResolvedReflectiveProvider_(provider.key, provider.resolvedFactories.slice(), provider.multiProvider);
}
else {
resolvedProvider = provider;
}
normalizedProvidersMap.set(provider.key.id, resolvedProvider);
}
}
return normalizedProvidersMap;
}
/**
* @param {?} providers
* @param {?} res
* @return {?}
*/
function _normalizeProviders(providers, res) {
providers.forEach(function (b) {
if (b instanceof Type) {
res.push({ provide: b, useClass: b });
}
else if (b && typeof b == 'object' && (/** @type {?} */ (b)).provide !== undefined) {
res.push(/** @type {?} */ (b));
}
else if (b instanceof Array) {
_normalizeProviders(b, res);
}
else {
throw invalidProviderError(b);
}
});
return res;
}
/**
* @param {?} typeOrFunc
* @param {?=} dependencies
* @return {?}
*/
function constructDependencies(typeOrFunc, dependencies) {
if (!dependencies) {
return _dependenciesFor(typeOrFunc);
}
else {
var /** @type {?} */ params_1 = dependencies.map(function (t) { return [t]; });
return dependencies.map(function (t) { return _extractToken(typeOrFunc, t, params_1); });
}
}
/**
* @param {?} typeOrFunc
* @return {?}
*/
function _dependenciesFor(typeOrFunc) {
var /** @type {?} */ params = reflector.parameters(typeOrFunc);
if (!params)
return [];
if (params.some(function (p) { return p == null; })) {
throw noAnnotationError(typeOrFunc, params);
}
return params.map(function (p) { return _extractToken(typeOrFunc, p, params); });
}
/**
* @param {?} typeOrFunc
* @param {?} metadata
* @param {?} params
* @return {?}
*/
function _extractToken(typeOrFunc, metadata, params) {
var /** @type {?} */ token = null;
var /** @type {?} */ optional = false;
if (!Array.isArray(metadata)) {
if (metadata instanceof Inject) {
return _createDependency(metadata.token, optional, null);
}
else {
return _createDependency(metadata, optional, null);
}
}
var /** @type {?} */ visibility = null;
for (var /** @type {?} */ i = 0; i < metadata.length; ++i) {
var /** @type {?} */ paramMetadata = metadata[i];
if (paramMetadata instanceof Type) {
token = paramMetadata;
}
else if (paramMetadata instanceof Inject) {
token = paramMetadata.token;
}
else if (paramMetadata instanceof Optional) {
optional = true;
}
else if (paramMetadata instanceof Self || paramMetadata instanceof SkipSelf) {
visibility = paramMetadata;
}
else if (paramMetadata instanceof InjectionToken) {
token = paramMetadata;
}
}
token = resolveForwardRef(token);
if (token != null) {
return _createDependency(token, optional, visibility);
}
else {
throw noAnnotationError(typeOrFunc, params);
}
}
/**
* @param {?} token
* @param {?} optional
* @param {?} visibility
* @return {?}
*/
function _createDependency(token, optional, visibility) {
return new ReflectiveDependency(ReflectiveKey.get(token), optional, visibility);
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// Threshold for the dynamic version
var UNDEFINED = new Object();
/**
* A ReflectiveDependency injection container used for instantiating objects and resolving
* dependencies.
*
* An `Injector` is a replacement for a `new` operator, which can automatically resolve the
* constructor dependencies.
*
* In typical use, application code asks for the dependencies in the constructor and they are
* resolved by the `Injector`.
*
* ### Example ([live demo](http://plnkr.co/edit/jzjec0?p=preview))
*
* The following example creates an `Injector` configured to create `Engine` and `Car`.
*
* ```typescript
* \@Injectable()
* class Engine {
* }
*
* \@Injectable()
* class Car {
* constructor(public engine:Engine) {}
* }
*
* var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]);
* var car = injector.get(Car);
* expect(car instanceof Car).toBe(true);
* expect(car.engine instanceof Engine).toBe(true);
* ```
*
* Notice, we don't use the `new` operator because we explicitly want to have the `Injector`
* resolve all of the object's dependencies automatically.
*
* @deprecated from v5 - slow and brings in a lot of code, Use `Injector.create` instead.
* @abstract
*/
var ReflectiveInjector = (function () {
function ReflectiveInjector() {
}
/**
* Turns an array of provider definitions into an array of resolved providers.
*
* A resolution is a process of flattening multiple nested arrays and converting individual
* providers into an array of {@link ResolvedReflectiveProvider}s.
*
* ### Example ([live demo](http://plnkr.co/edit/AiXTHi?p=preview))
*
* ```typescript
* @Injectable()
* class Engine {
* }
*
* @Injectable()
* class Car {
* constructor(public engine:Engine) {}
* }
*
* var providers = ReflectiveInjector.resolve([Car, [[Engine]]]);
*
* expect(providers.length).toEqual(2);
*
* expect(providers[0] instanceof ResolvedReflectiveProvider).toBe(true);
* expect(providers[0].key.displayName).toBe("Car");
* expect(providers[0].dependencies.length).toEqual(1);
* expect(providers[0].factory).toBeDefined();
*
* expect(providers[1].key.displayName).toBe("Engine");
* });
* ```
*
* See {@link ReflectiveInjector#fromResolvedProviders fromResolvedProviders} for more info.
*/
/**
* Turns an array of provider definitions into an array of resolved providers.
*
* A resolution is a process of flattening multiple nested arrays and converting individual
* providers into an array of {\@link ResolvedReflectiveProvider}s.
*
* ### Example ([live demo](http://plnkr.co/edit/AiXTHi?p=preview))
*
* ```typescript
* \@Injectable()
* class Engine {
* }
*
* \@Injectable()
* class Car {
* constructor(public engine:Engine) {}
* }
*
* var providers = ReflectiveInjector.resolve([Car, [[Engine]]]);
*
* expect(providers.length).toEqual(2);
*
* expect(providers[0] instanceof ResolvedReflectiveProvider).toBe(true);
* expect(providers[0].key.displayName).toBe("Car");
* expect(providers[0].dependencies.length).toEqual(1);
* expect(providers[0].factory).toBeDefined();
*
* expect(providers[1].key.displayName).toBe("Engine");
* });
* ```
*
* See {\@link ReflectiveInjector#fromResolvedProviders fromResolvedProviders} for more info.
* @param {?} providers
* @return {?}
*/
ReflectiveInjector.resolve = /**
* Turns an array of provider definitions into an array of resolved providers.
*
* A resolution is a process of flattening multiple nested arrays and converting individual
* providers into an array of {\@link ResolvedReflectiveProvider}s.
*
* ### Example ([live demo](http://plnkr.co/edit/AiXTHi?p=preview))
*
* ```typescript
* \@Injectable()
* class Engine {
* }
*
* \@Injectable()
* class Car {
* constructor(public engine:Engine) {}
* }
*
* var providers = ReflectiveInjector.resolve([Car, [[Engine]]]);
*
* expect(providers.length).toEqual(2);
*
* expect(providers[0] instanceof ResolvedReflectiveProvider).toBe(true);
* expect(providers[0].key.displayName).toBe("Car");
* expect(providers[0].dependencies.length).toEqual(1);
* expect(providers[0].factory).toBeDefined();
*
* expect(providers[1].key.displayName).toBe("Engine");
* });
* ```
*
* See {\@link ReflectiveInjector#fromResolvedProviders fromResolvedProviders} for more info.
* @param {?} providers
* @return {?}
*/
function (providers) {
return resolveReflectiveProviders(providers);
};
/**
* Resolves an array of providers and creates an injector from those providers.
*
* The passed-in providers can be an array of `Type`, {@link Provider},
* or a recursive array of more providers.
*
* ### Example ([live demo](http://plnkr.co/edit/ePOccA?p=preview))
*
* ```typescript
* @Injectable()
* class Engine {
* }
*
* @Injectable()
* class Car {
* constructor(public engine:Engine) {}
* }
*
* var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]);
* expect(injector.get(Car) instanceof Car).toBe(true);
* ```
*
* This function is slower than the corresponding `fromResolvedProviders`
* because it needs to resolve the passed-in providers first.
* See {@link ReflectiveInjector#resolve resolve} and
* {@link ReflectiveInjector#fromResolvedProviders fromResolvedProviders}.
*/
/**
* Resolves an array of providers and creates an injector from those providers.
*
* The passed-in providers can be an array of `Type`, {\@link Provider},
* or a recursive array of more providers.
*
* ### Example ([live demo](http://plnkr.co/edit/ePOccA?p=preview))
*
* ```typescript
* \@Injectable()
* class Engine {
* }
*
* \@Injectable()
* class Car {
* constructor(public engine:Engine) {}
* }
*
* var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]);
* expect(injector.get(Car) instanceof Car).toBe(true);
* ```
*
* This function is slower than the corresponding `fromResolvedProviders`
* because it needs to resolve the passed-in providers first.
* See {\@link ReflectiveInjector#resolve resolve} and
* {\@link ReflectiveInjector#fromResolvedProviders fromResolvedProviders}.
* @param {?} providers
* @param {?=} parent
* @return {?}
*/
ReflectiveInjector.resolveAndCreate = /**
* Resolves an array of providers and creates an injector from those providers.
*
* The passed-in providers can be an array of `Type`, {\@link Provider},
* or a recursive array of more providers.
*
* ### Example ([live demo](http://plnkr.co/edit/ePOccA?p=preview))
*
* ```typescript
* \@Injectable()
* class Engine {
* }
*
* \@Injectable()
* class Car {
* constructor(public engine:Engine) {}
* }
*
* var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]);
* expect(injector.get(Car) instanceof Car).toBe(true);
* ```
*
* This function is slower than the corresponding `fromResolvedProviders`
* because it needs to resolve the passed-in providers first.
* See {\@link ReflectiveInjector#resolve resolve} and
* {\@link ReflectiveInjector#fromResolvedProviders fromResolvedProviders}.
* @param {?} providers
* @param {?=} parent
* @return {?}
*/
function (providers, parent) {
var /** @type {?} */ ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
return ReflectiveInjector.fromResolvedProviders(ResolvedReflectiveProviders, parent);
};
/**
* Creates an injector from previously resolved providers.
*
* This API is the recommended way to construct injectors in performance-sensitive parts.
*
* ### Example ([live demo](http://plnkr.co/edit/KrSMci?p=preview))
*
* ```typescript
* @Injectable()
* class Engine {
* }
*
* @Injectable()
* class Car {
* constructor(public engine:Engine) {}
* }
*
* var providers = ReflectiveInjector.resolve([Car, Engine]);
* var injector = ReflectiveInjector.fromResolvedProviders(providers);
* expect(injector.get(Car) instanceof Car).toBe(true);
* ```
* @experimental
*/
/**
* Creates an injector from previously resolved providers.
*
* This API is the recommended way to construct injectors in performance-sensitive parts.
*
* ### Example ([live demo](http://plnkr.co/edit/KrSMci?p=preview))
*
* ```typescript
* \@Injectable()
* class Engine {
* }
*
* \@Injectable()
* class Car {
* constructor(public engine:Engine) {}
* }
*
* var providers = ReflectiveInjector.resolve([Car, Engine]);
* var injector = ReflectiveInjector.fromResolvedProviders(providers);
* expect(injector.get(Car) instanceof Car).toBe(true);
* ```
* \@experimental
* @param {?} providers
* @param {?=} parent
* @return {?}
*/
ReflectiveInjector.fromResolvedProviders = /**
* Creates an injector from previously resolved providers.
*
* This API is the recommended way to construct injectors in performance-sensitive parts.
*
* ### Example ([live demo](http://plnkr.co/edit/KrSMci?p=preview))
*
* ```typescript
* \@Injectable()
* class Engine {
* }
*
* \@Injectable()
* class Car {
* constructor(public engine:Engine) {}
* }
*
* var providers = ReflectiveInjector.resolve([Car, Engine]);
* var injector = ReflectiveInjector.fromResolvedProviders(providers);
* expect(injector.get(Car) instanceof Car).toBe(true);
* ```
* \@experimental
* @param {?} providers
* @param {?=} parent
* @return {?}
*/
function (providers, parent) {
return new ReflectiveInjector_(providers, parent);
};
return ReflectiveInjector;
}());
var ReflectiveInjector_ = (function () {
/**
* Private
*/
function ReflectiveInjector_(_providers, _parent) {
/**
* \@internal
*/
this._constructionCounter = 0;
this._providers = _providers;
this.parent = _parent || null;
var /** @type {?} */ len = _providers.length;
this.keyIds = new Array(len);
this.objs = new Array(len);
for (var /** @type {?} */ i = 0; i < len; i++) {
this.keyIds[i] = _providers[i].key.id;
this.objs[i] = UNDEFINED;
}
}
/**
* @param {?} token
* @param {?=} notFoundValue
* @return {?}
*/
ReflectiveInjector_.prototype.get = /**
* @param {?} token
* @param {?=} notFoundValue
* @return {?}
*/
function (token, notFoundValue) {
if (notFoundValue === void 0) { notFoundValue = THROW_IF_NOT_FOUND; }
return this._getByKey(ReflectiveKey.get(token), null, notFoundValue);
};
/**
* @param {?} providers
* @return {?}
*/
ReflectiveInjector_.prototype.resolveAndCreateChild = /**
* @param {?} providers
* @return {?}
*/
function (providers) {
var /** @type {?} */ ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
return this.createChildFromResolved(ResolvedReflectiveProviders);
};
/**
* @param {?} providers
* @return {?}
*/
ReflectiveInjector_.prototype.createChildFromResolved = /**
* @param {?} providers
* @return {?}
*/
function (providers) {
var /** @type {?} */ inj = new ReflectiveInjector_(providers);
(/** @type {?} */ (inj)).parent = this;
return inj;
};
/**
* @param {?} provider
* @return {?}
*/
ReflectiveInjector_.prototype.resolveAndInstantiate = /**
* @param {?} provider
* @return {?}
*/
function (provider) {
return this.instantiateResolved(ReflectiveInjector.resolve([provider])[0]);
};
/**
* @param {?} provider
* @return {?}
*/
ReflectiveInjector_.prototype.instantiateResolved = /**
* @param {?} provider
* @return {?}
*/
function (provider) {
return this._instantiateProvider(provider);
};
/**
* @param {?} index
* @return {?}
*/
ReflectiveInjector_.prototype.getProviderAtIndex = /**
* @param {?} index
* @return {?}
*/
function (index) {
if (index < 0 || index >= this._providers.length) {
throw outOfBoundsError(index);
}
return this._providers[index];
};
/** @internal */
/**
* \@internal
* @param {?} provider
* @return {?}
*/
ReflectiveInjector_.prototype._new = /**
* \@internal
* @param {?} provider
* @return {?}
*/
function (provider) {
if (this._constructionCounter++ > this._getMaxNumberOfObjects()) {
throw cyclicDependencyError(this, provider.key);
}
return this._instantiateProvider(provider);
};
/**
* @return {?}
*/
ReflectiveInjector_.prototype._getMaxNumberOfObjects = /**
* @return {?}
*/
function () { return this.objs.length; };
/**
* @param {?} provider
* @return {?}
*/
ReflectiveInjector_.prototype._instantiateProvider = /**
* @param {?} provider
* @return {?}
*/
function (provider) {
if (provider.multiProvider) {
var /** @type {?} */ res = new Array(provider.resolvedFactories.length);
for (var /** @type {?} */ i = 0; i < provider.resolvedFactories.length; ++i) {
res[i] = this._instantiate(provider, provider.resolvedFactories[i]);
}
return res;
}
else {
return this._instantiate(provider, provider.resolvedFactories[0]);
}
};
/**
* @param {?} provider
* @param {?} ResolvedReflectiveFactory
* @return {?}
*/
ReflectiveInjector_.prototype._instantiate = /**
* @param {?} provider
* @param {?} ResolvedReflectiveFactory
* @return {?}
*/
function (provider, ResolvedReflectiveFactory$$1) {
var _this = this;
var /** @type {?} */ factory = ResolvedReflectiveFactory$$1.factory;
var /** @type {?} */ deps;
try {
deps =
ResolvedReflectiveFactory$$1.dependencies.map(function (dep) { return _this._getByReflectiveDependency(dep); });
}
catch (/** @type {?} */ e) {
if (e.addKey) {
e.addKey(this, provider.key);
}
throw e;
}
var /** @type {?} */ obj;
try {
obj = factory.apply(void 0, deps);
}
catch (/** @type {?} */ e) {
throw instantiationError(this, e, e.stack, provider.key);
}
return obj;
};
/**
* @param {?} dep
* @return {?}
*/
ReflectiveInjector_.prototype._getByReflectiveDependency = /**
* @param {?} dep
* @return {?}
*/
function (dep) {
return this._getByKey(dep.key, dep.visibility, dep.optional ? null : THROW_IF_NOT_FOUND);
};
/**
* @param {?} key
* @param {?} visibility
* @param {?} notFoundValue
* @return {?}
*/
ReflectiveInjector_.prototype._getByKey = /**
* @param {?} key
* @param {?} visibility
* @param {?} notFoundValue
* @return {?}
*/
function (key, visibility, notFoundValue) {
if (key === ReflectiveInjector_.INJECTOR_KEY) {
return this;
}
if (visibility instanceof Self) {
return this._getByKeySelf(key, notFoundValue);
}
else {
return this._getByKeyDefault(key, notFoundValue, visibility);
}
};
/**
* @param {?} keyId
* @return {?}
*/
ReflectiveInjector_.prototype._getObjByKeyId = /**
* @param {?} keyId
* @return {?}
*/
function (keyId) {
for (var /** @type {?} */ i = 0; i < this.keyIds.length; i++) {
if (this.keyIds[i] === keyId) {
if (this.objs[i] === UNDEFINED) {
this.objs[i] = this._new(this._providers[i]);
}
return this.objs[i];
}
}
return UNDEFINED;
};
/** @internal */
/**
* \@internal
* @param {?} key
* @param {?} notFoundValue
* @return {?}
*/
ReflectiveInjector_.prototype._throwOrNull = /**
* \@internal
* @param {?} key
* @param {?} notFoundValue
* @return {?}
*/
function (key, notFoundValue) {
if (notFoundValue !== THROW_IF_NOT_FOUND) {
return notFoundValue;
}
else {
throw noProviderError(this, key);
}
};
/** @internal */
/**
* \@internal
* @param {?} key
* @param {?} notFoundValue
* @return {?}
*/
ReflectiveInjector_.prototype._getByKeySelf = /**
* \@internal
* @param {?} key
* @param {?} notFoundValue
* @return {?}
*/
function (key, notFoundValue) {
var /** @type {?} */ obj = this._getObjByKeyId(key.id);
return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue);
};
/** @internal */
/**
* \@internal
* @param {?} key
* @param {?} notFoundValue
* @param {?} visibility
* @return {?}
*/
ReflectiveInjector_.prototype._getByKeyDefault = /**
* \@internal
* @param {?} key
* @param {?} notFoundValue
* @param {?} visibility
* @return {?}
*/
function (key, notFoundValue, visibility) {
var /** @type {?} */ inj;
if (visibility instanceof SkipSelf) {
inj = this.parent;
}
else {
inj = this;
}
while (inj instanceof ReflectiveInjector_) {
var /** @type {?} */ inj_ = /** @type {?} */ (inj);
var /** @type {?} */ obj = inj_._getObjByKeyId(key.id);
if (obj !== UNDEFINED)
return obj;
inj = inj_.parent;
}
if (inj !== null) {
return inj.get(key.token, notFoundValue);
}
else {
return this._throwOrNull(key, notFoundValue);
}
};
Object.defineProperty(ReflectiveInjector_.prototype, "displayName", {
get: /**
* @return {?}
*/
function () {
var /** @type {?} */ providers = _mapProviders(this, function (b) { return ' "' + b.key.displayName + '" '; })
.join(', ');
return "ReflectiveInjector(providers: [" + providers + "])";
},
enumerable: true,
configurable: true
});
/**
* @return {?}
*/
ReflectiveInjector_.prototype.toString = /**
* @return {?}
*/
function () { return this.displayName; };
ReflectiveInjector_.INJECTOR_KEY = ReflectiveKey.get(Injector);
return ReflectiveInjector_;
}());
/**
* @param {?} injector
* @param {?} fn
* @return {?}
*/
function _mapProviders(injector, fn) {
var /** @type {?} */ res = new Array(injector._providers.length);
for (var /** @type {?} */ i = 0; i < injector._providers.length; ++i) {
res[i] = fn(injector.getProviderAtIndex(i));
}
return res;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @module
* @description
* The `di` module provides dependency injection container services.
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Determine if the argument is shaped like a Promise
* @param {?} obj
* @return {?}
*/
function isPromise(obj) {
// allow any Promise/A+ compliant thenable.
// It's up to the caller to ensure that obj.then conforms to the spec
return !!obj && typeof obj.then === 'function';
}
/**
* Determine if the argument is an Observable
* @param {?} obj
* @return {?}
*/
function isObservable(obj) {
// TODO use Symbol.observable when https://github.com/ReactiveX/rxjs/issues/2415 will be resolved
return !!obj && typeof obj.subscribe === 'function';
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* A function that will be executed when an application is initialized.
* \@experimental
*/
var APP_INITIALIZER = new InjectionToken('Application Initializer');
/**
* A class that reflects the state of running {\@link APP_INITIALIZER}s.
*
* \@experimental
*/
var ApplicationInitStatus = (function () {
function ApplicationInitStatus(appInits) {
var _this = this;
this.appInits = appInits;
this.initialized = false;
this.done = false;
this.donePromise = new Promise(function (res, rej) {
_this.resolve = res;
_this.reject = rej;
});
}
/** @internal */
/**
* \@internal
* @return {?}
*/
ApplicationInitStatus.prototype.runInitializers = /**
* \@internal
* @return {?}
*/
function () {
var _this = this;
if (this.initialized) {
return;
}
var /** @type {?} */ asyncInitPromises = [];
var /** @type {?} */ complete = function () {
(/** @type {?} */ (_this)).done = true;
_this.resolve();
};
if (this.appInits) {
for (var /** @type {?} */ i = 0; i < this.appInits.length; i++) {
var /** @type {?} */ initResult = this.appInits[i]();
if (isPromise(initResult)) {
asyncInitPromises.push(initResult);
}
}
}
Promise.all(asyncInitPromises).then(function () { complete(); }).catch(function (e) { _this.reject(e); });
if (asyncInitPromises.length === 0) {
complete();
}
this.initialized = true;
};
ApplicationInitStatus.decorators = [
{ type: Injectable },
];
/** @nocollapse */
ApplicationInitStatus.ctorParameters = function () { return [
{ type: Array, decorators: [{ type: Inject, args: [APP_INITIALIZER,] }, { type: Optional },] },
]; };
return ApplicationInitStatus;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* A DI Token representing a unique string id assigned to the application by Angular and used
* primarily for prefixing application attributes and CSS styles when
* {\@link ViewEncapsulation#Emulated ViewEncapsulation.Emulated} is being used.
*
* If you need to avoid randomly generated value to be used as an application id, you can provide
* a custom value via a DI provider <!-- TODO: provider --> configuring the root {\@link Injector}
* using this token.
* \@experimental
*/
var APP_ID = new InjectionToken('AppId');
/**
* @return {?}
*/
function _appIdRandomProviderFactory() {
return "" + _randomChar() + _randomChar() + _randomChar();
}
/**
* Providers that will generate a random APP_ID_TOKEN.
* \@experimental
*/
var APP_ID_RANDOM_PROVIDER = {
provide: APP_ID,
useFactory: _appIdRandomProviderFactory,
deps: /** @type {?} */ ([]),
};
/**
* @return {?}
*/
function _randomChar() {
return String.fromCharCode(97 + Math.floor(Math.random() * 25));
}
/**
* A function that will be executed when a platform is initialized.
* \@experimental
*/
var PLATFORM_INITIALIZER = new InjectionToken('Platform Initializer');
/**
* A token that indicates an opaque platform id.
* \@experimental
*/
var PLATFORM_ID = new InjectionToken('Platform ID');
/**
* All callbacks provided via this token will be called for every component that is bootstrapped.
* Signature of the callback:
*
* `(componentRef: ComponentRef) => void`.
*
* \@experimental
*/
var APP_BOOTSTRAP_LISTENER = new InjectionToken('appBootstrapListener');
/**
* A token which indicates the root directory of the application
* \@experimental
*/
var PACKAGE_ROOT_URL = new InjectionToken('Application Packages Root URL');
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var Console = (function () {
function Console() {
}
/**
* @param {?} message
* @return {?}
*/
Console.prototype.log = /**
* @param {?} message
* @return {?}
*/
function (message) {
// tslint:disable-next-line:no-console
console.log(message);
};
// Note: for reporting errors use `DOM.logError()` as it is platform specific
/**
* @param {?} message
* @return {?}
*/
Console.prototype.warn = /**
* @param {?} message
* @return {?}
*/
function (message) {
// tslint:disable-next-line:no-console
console.warn(message);
};
Console.decorators = [
{ type: Injectable },
];
/** @nocollapse */
Console.ctorParameters = function () { return []; };
return Console;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Combination of NgModuleFactory and ComponentFactorys.
*
* \@experimental
*/
var ModuleWithComponentFactories = (function () {
function ModuleWithComponentFactories(ngModuleFactory, componentFactories) {
this.ngModuleFactory = ngModuleFactory;
this.componentFactories = componentFactories;
}
return ModuleWithComponentFactories;
}());
/**
* @return {?}
*/
function _throwError() {
throw new Error("Runtime compiler is not loaded");
}
/**
* Low-level service for running the angular compiler during runtime
* to create {\@link ComponentFactory}s, which
* can later be used to create and render a Component instance.
*
* Each `\@NgModule` provides an own `Compiler` to its injector,
* that will use the directives/pipes of the ng module for compilation
* of components.
* \@stable
*/
var Compiler = (function () {
function Compiler() {
}
/**
* Compiles the given NgModule and all of its components. All templates of the components listed
* in `entryComponents` have to be inlined.
*/
/**
* Compiles the given NgModule and all of its components. All templates of the components listed
* in `entryComponents` have to be inlined.
* @template T
* @param {?} moduleType
* @return {?}
*/
Compiler.prototype.compileModuleSync = /**
* Compiles the given NgModule and all of its components. All templates of the components listed
* in `entryComponents` have to be inlined.
* @template T
* @param {?} moduleType
* @return {?}
*/
function (moduleType) { throw _throwError(); };
/**
* Compiles the given NgModule and all of its components
*/
/**
* Compiles the given NgModule and all of its components
* @template T
* @param {?} moduleType
* @return {?}
*/
Compiler.prototype.compileModuleAsync = /**
* Compiles the given NgModule and all of its components
* @template T
* @param {?} moduleType
* @return {?}
*/
function (moduleType) { throw _throwError(); };
/**
* Same as {@link #compileModuleSync} but also creates ComponentFactories for all components.
*/
/**
* Same as {\@link #compileModuleSync} but also creates ComponentFactories for all components.
* @template T
* @param {?} moduleType
* @return {?}
*/
Compiler.prototype.compileModuleAndAllComponentsSync = /**
* Same as {\@link #compileModuleSync} but also creates ComponentFactories for all components.
* @template T
* @param {?} moduleType
* @return {?}
*/
function (moduleType) {
throw _throwError();
};
/**
* Same as {@link #compileModuleAsync} but also creates ComponentFactories for all components.
*/
/**
* Same as {\@link #compileModuleAsync} but also creates ComponentFactories for all components.
* @template T
* @param {?} moduleType
* @return {?}
*/
Compiler.prototype.compileModuleAndAllComponentsAsync = /**
* Same as {\@link #compileModuleAsync} but also creates ComponentFactories for all components.
* @template T
* @param {?} moduleType
* @return {?}
*/
function (moduleType) {
throw _throwError();
};
/**
* Clears all caches.
*/
/**
* Clears all caches.
* @return {?}
*/
Compiler.prototype.clearCache = /**
* Clears all caches.
* @return {?}
*/
function () { };
/**
* Clears the cache for the given component/ngModule.
*/
/**
* Clears the cache for the given component/ngModule.
* @param {?} type
* @return {?}
*/
Compiler.prototype.clearCacheFor = /**
* Clears the cache for the given component/ngModule.
* @param {?} type
* @return {?}
*/
function (type) { };
Compiler.decorators = [
{ type: Injectable },
];
/** @nocollapse */
Compiler.ctorParameters = function () { return []; };
return Compiler;
}());
/**
* Token to provide CompilerOptions in the platform injector.
*
* \@experimental
*/
var COMPILER_OPTIONS = new InjectionToken('compilerOptions');
/**
* A factory for creating a Compiler
*
* \@experimental
* @abstract
*/
var CompilerFactory = (function () {
function CompilerFactory() {
}
return CompilerFactory;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Represents an instance of a Component created via a {\@link ComponentFactory}.
*
* `ComponentRef` provides access to the Component Instance as well other objects related to this
* Component Instance and allows you to destroy the Component Instance via the {\@link #destroy}
* method.
* \@stable
* @abstract
*/
var ComponentRef = (function () {
function ComponentRef() {
}
return ComponentRef;
}());
/**
* \@stable
* @abstract
*/
var ComponentFactory = (function () {
function ComponentFactory() {
}
return ComponentFactory;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @param {?} component
* @return {?}
*/
function noComponentFactoryError(component) {
var /** @type {?} */ error = Error("No component factory found for " + stringify(component) + ". Did you add it to @NgModule.entryComponents?");
(/** @type {?} */ (error))[ERROR_COMPONENT] = component;
return error;
}
var ERROR_COMPONENT = 'ngComponent';
/**
* @param {?} error
* @return {?}
*/
var _NullComponentFactoryResolver = (function () {
function _NullComponentFactoryResolver() {
}
/**
* @template T
* @param {?} component
* @return {?}
*/
_NullComponentFactoryResolver.prototype.resolveComponentFactory = /**
* @template T
* @param {?} component
* @return {?}
*/
function (component) {
throw noComponentFactoryError(component);
};
return _NullComponentFactoryResolver;
}());
/**
* \@stable
* @abstract
*/
var ComponentFactoryResolver = (function () {
function ComponentFactoryResolver() {
}
ComponentFactoryResolver.NULL = new _NullComponentFactoryResolver();
return ComponentFactoryResolver;
}());
var CodegenComponentFactoryResolver = (function () {
function CodegenComponentFactoryResolver(factories, _parent, _ngModule) {
this._parent = _parent;
this._ngModule = _ngModule;
this._factories = new Map();
for (var /** @type {?} */ i = 0; i < factories.length; i++) {
var /** @type {?} */ factory = factories[i];
this._factories.set(factory.componentType, factory);
}
}
/**
* @template T
* @param {?} component
* @return {?}
*/
CodegenComponentFactoryResolver.prototype.resolveComponentFactory = /**
* @template T
* @param {?} component
* @return {?}
*/
function (component) {
var /** @type {?} */ factory = this._factories.get(component);
if (!factory && this._parent) {
factory = this._parent.resolveComponentFactory(component);
}
if (!factory) {
throw noComponentFactoryError(component);
}
return new ComponentFactoryBoundToModule(factory, this._ngModule);
};
return CodegenComponentFactoryResolver;
}());
var ComponentFactoryBoundToModule = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ComponentFactoryBoundToModule, _super);
function ComponentFactoryBoundToModule(factory, ngModule) {
var _this = _super.call(this) || this;
_this.factory = factory;
_this.ngModule = ngModule;
return _this;
}
Object.defineProperty(ComponentFactoryBoundToModule.prototype, "selector", {
get: /**
* @return {?}
*/
function () { return this.factory.selector; },
enumerable: true,
configurable: true
});
Object.defineProperty(ComponentFactoryBoundToModule.prototype, "componentType", {
get: /**
* @return {?}
*/
function () { return this.factory.componentType; },
enumerable: true,
configurable: true
});
Object.defineProperty(ComponentFactoryBoundToModule.prototype, "ngContentSelectors", {
get: /**
* @return {?}
*/
function () { return this.factory.ngContentSelectors; },
enumerable: true,
configurable: true
});
Object.defineProperty(ComponentFactoryBoundToModule.prototype, "inputs", {
get: /**
* @return {?}
*/
function () { return this.factory.inputs; },
enumerable: true,
configurable: true
});
Object.defineProperty(ComponentFactoryBoundToModule.prototype, "outputs", {
get: /**
* @return {?}
*/
function () { return this.factory.outputs; },
enumerable: true,
configurable: true
});
/**
* @param {?} injector
* @param {?=} projectableNodes
* @param {?=} rootSelectorOrNode
* @param {?=} ngModule
* @return {?}
*/
ComponentFactoryBoundToModule.prototype.create = /**
* @param {?} injector
* @param {?=} projectableNodes
* @param {?=} rootSelectorOrNode
* @param {?=} ngModule
* @return {?}
*/
function (injector, projectableNodes, rootSelectorOrNode, ngModule) {
return this.factory.create(injector, projectableNodes, rootSelectorOrNode, ngModule || this.ngModule);
};
return ComponentFactoryBoundToModule;
}(ComponentFactory));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Represents an instance of an NgModule created via a {\@link NgModuleFactory}.
*
* `NgModuleRef` provides access to the NgModule Instance as well other objects related to this
* NgModule Instance.
*
* \@stable
* @abstract
*/
var NgModuleRef = (function () {
function NgModuleRef() {
}
return NgModuleRef;
}());
/**
* @record
*/
/**
* \@experimental
* @abstract
*/
var NgModuleFactory = (function () {
function NgModuleFactory() {
}
return NgModuleFactory;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* A scope function for the Web Tracing Framework (WTF).
*
* \@experimental
* @record
*/
/**
* @record
*/
/**
* @record
*/
var trace;
var events;
/**
* @return {?}
*/
function detectWTF() {
var /** @type {?} */ wtf = (/** @type {?} */ (_global /** TODO #9100 */) /** TODO #9100 */)['wtf'];
if (wtf) {
trace = wtf['trace'];
if (trace) {
events = trace['events'];
return true;
}
}
return false;
}
/**
* @param {?} signature
* @param {?=} flags
* @return {?}
*/
function createScope(signature, flags) {
if (flags === void 0) { flags = null; }
return events.createScope(signature, flags);
}
/**
* @template T
* @param {?} scope
* @param {?=} returnValue
* @return {?}
*/
function leave(scope, returnValue) {
trace.leaveScope(scope, returnValue);
return returnValue;
}
/**
* @param {?} rangeType
* @param {?} action
* @return {?}
*/
function startTimeRange(rangeType, action) {
return trace.beginTimeRange(rangeType, action);
}
/**
* @param {?} range
* @return {?}
*/
function endTimeRange(range) {
trace.endTimeRange(range);
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* True if WTF is enabled.
*/
var wtfEnabled = detectWTF();
/**
* @param {?=} arg0
* @param {?=} arg1
* @return {?}
*/
function noopScope(arg0, arg1) {
return null;
}
/**
* Create trace scope.
*
* Scopes must be strictly nested and are analogous to stack frames, but
* do not have to follow the stack frames. Instead it is recommended that they follow logical
* nesting. You may want to use
* [Event
* Signatures](http://google.github.io/tracing-framework/instrumenting-code.html#custom-events)
* as they are defined in WTF.
*
* Used to mark scope entry. The return value is used to leave the scope.
*
* var myScope = wtfCreateScope('MyClass#myMethod(ascii someVal)');
*
* someMethod() {
* var s = myScope('Foo'); // 'Foo' gets stored in tracing UI
* // DO SOME WORK HERE
* return wtfLeave(s, 123); // Return value 123
* }
*
* Note, adding try-finally block around the work to ensure that `wtfLeave` gets called can
* negatively impact the performance of your application. For this reason we recommend that
* you don't add them to ensure that `wtfLeave` gets called. In production `wtfLeave` is a noop and
* so try-finally block has no value. When debugging perf issues, skipping `wtfLeave`, do to
* exception, will produce incorrect trace, but presence of exception signifies logic error which
* needs to be fixed before the app should be profiled. Add try-finally only when you expect that
* an exception is expected during normal execution while profiling.
*
* \@experimental
*/
var wtfCreateScope = wtfEnabled ? createScope : function (signature, flags) { return noopScope; };
/**
* Used to mark end of Scope.
*
* - `scope` to end.
* - `returnValue` (optional) to be passed to the WTF.
*
* Returns the `returnValue for easy chaining.
* \@experimental
*/
var wtfLeave = wtfEnabled ? leave : function (s, r) { return r; };
/**
* Used to mark Async start. Async are similar to scope but they don't have to be strictly nested.
* The return value is used in the call to [endAsync]. Async ranges only work if WTF has been
* enabled.
*
* someMethod() {
* var s = wtfStartTimeRange('HTTP:GET', 'some.url');
* var future = new Future.delay(5).then((_) {
* wtfEndTimeRange(s);
* });
* }
* \@experimental
*/
var wtfStartTimeRange = wtfEnabled ? startTimeRange : function (rangeType, action) { return null; };
/**
* Ends a async time range operation.
* [range] is the return value from [wtfStartTimeRange] Async ranges only work if WTF has been
* enabled.
* \@experimental
*/
var wtfEndTimeRange = wtfEnabled ? endTimeRange : function (r) { return null; };
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Use by directives and components to emit custom Events.
*
* ### Examples
*
* In the following example, `Zippy` alternatively emits `open` and `close` events when its
* title gets clicked:
*
* ```
* \@Component({
* selector: 'zippy',
* template: `
* <div class="zippy">
* <div (click)="toggle()">Toggle</div>
* <div [hidden]="!visible">
* <ng-content></ng-content>
* </div>
* </div>`})
* export class Zippy {
* visible: boolean = true;
* \@Output() open: EventEmitter<any> = new EventEmitter();
* \@Output() close: EventEmitter<any> = new EventEmitter();
*
* toggle() {
* this.visible = !this.visible;
* if (this.visible) {
* this.open.emit(null);
* } else {
* this.close.emit(null);
* }
* }
* }
* ```
*
* The events payload can be accessed by the parameter `$event` on the components output event
* handler:
*
* ```
* <zippy (open)="onOpen($event)" (close)="onClose($event)"></zippy>
* ```
*
* Uses Rx.Observable but provides an adapter to make it work as specified here:
* https://github.com/jhusain/observable-spec
*
* Once a reference implementation of the spec is available, switch to it.
* \@stable
*/
var EventEmitter = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(EventEmitter, _super);
/**
* Creates an instance of {@link EventEmitter}, which depending on `isAsync`,
* delivers events synchronously or asynchronously.
*
* @param isAsync By default, events are delivered synchronously (default value: `false`).
* Set to `true` for asynchronous event delivery.
*/
function EventEmitter(isAsync) {
if (isAsync === void 0) { isAsync = false; }
var _this = _super.call(this) || this;
_this.__isAsync = isAsync;
return _this;
}
/**
* @param {?=} value
* @return {?}
*/
EventEmitter.prototype.emit = /**
* @param {?=} value
* @return {?}
*/
function (value) { _super.prototype.next.call(this, value); };
/**
* @param {?=} generatorOrNext
* @param {?=} error
* @param {?=} complete
* @return {?}
*/
EventEmitter.prototype.subscribe = /**
* @param {?=} generatorOrNext
* @param {?=} error
* @param {?=} complete
* @return {?}
*/
function (generatorOrNext, error, complete) {
var /** @type {?} */ schedulerFn;
var /** @type {?} */ errorFn = function (err) { return null; };
var /** @type {?} */ completeFn = function () { return null; };
if (generatorOrNext && typeof generatorOrNext === 'object') {
schedulerFn = this.__isAsync ? function (value) {
setTimeout(function () { return generatorOrNext.next(value); });
} : function (value) { generatorOrNext.next(value); };
if (generatorOrNext.error) {
errorFn = this.__isAsync ? function (err) { setTimeout(function () { return generatorOrNext.error(err); }); } :
function (err) { generatorOrNext.error(err); };
}
if (generatorOrNext.complete) {
completeFn = this.__isAsync ? function () { setTimeout(function () { return generatorOrNext.complete(); }); } :
function () { generatorOrNext.complete(); };
}
}
else {
schedulerFn = this.__isAsync ? function (value) { setTimeout(function () { return generatorOrNext(value); }); } :
function (value) { generatorOrNext(value); };
if (error) {
errorFn =
this.__isAsync ? function (err) { setTimeout(function () { return error(err); }); } : function (err) { error(err); };
}
if (complete) {
completeFn =
this.__isAsync ? function () { setTimeout(function () { return complete(); }); } : function () { complete(); };
}
}
return _super.prototype.subscribe.call(this, schedulerFn, errorFn, completeFn);
};
return EventEmitter;
}(__WEBPACK_IMPORTED_MODULE_4_rxjs_Subject__["Subject"]));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* An injectable service for executing work inside or outside of the Angular zone.
*
* The most common use of this service is to optimize performance when starting a work consisting of
* one or more asynchronous tasks that don't require UI updates or error handling to be handled by
* Angular. Such tasks can be kicked off via {\@link #runOutsideAngular} and if needed, these tasks
* can reenter the Angular zone via {\@link #run}.
*
* <!-- TODO: add/fix links to:
* - docs explaining zones and the use of zones in Angular and change-detection
* - link to runOutsideAngular/run (throughout this file!)
* -->
*
* ### Example
*
* ```
* import {Component, NgZone} from '\@angular/core';
* import {NgIf} from '\@angular/common';
*
* \@Component({
* selector: 'ng-zone-demo'.
* template: `
* <h2>Demo: NgZone</h2>
*
* <p>Progress: {{progress}}%</p>
* <p *ngIf="progress >= 100">Done processing {{label}} of Angular zone!</p>
*
* <button (click)="processWithinAngularZone()">Process within Angular zone</button>
* <button (click)="processOutsideOfAngularZone()">Process outside of Angular zone</button>
* `,
* })
* export class NgZoneDemo {
* progress: number = 0;
* label: string;
*
* constructor(private _ngZone: NgZone) {}
*
* // Loop inside the Angular zone
* // so the UI DOES refresh after each setTimeout cycle
* processWithinAngularZone() {
* this.label = 'inside';
* this.progress = 0;
* this._increaseProgress(() => console.log('Inside Done!'));
* }
*
* // Loop outside of the Angular zone
* // so the UI DOES NOT refresh after each setTimeout cycle
* processOutsideOfAngularZone() {
* this.label = 'outside';
* this.progress = 0;
* this._ngZone.runOutsideAngular(() => {
* this._increaseProgress(() => {
* // reenter the Angular zone and display done
* this._ngZone.run(() => {console.log('Outside Done!') });
* }}));
* }
*
* _increaseProgress(doneCallback: () => void) {
* this.progress += 1;
* console.log(`Current progress: ${this.progress}%`);
*
* if (this.progress < 100) {
* window.setTimeout(() => this._increaseProgress(doneCallback)), 10)
* } else {
* doneCallback();
* }
* }
* }
* ```
*
* \@experimental
*/
var NgZone = (function () {
function NgZone(_a) {
var _b = _a.enableLongStackTrace, enableLongStackTrace = _b === void 0 ? false : _b;
this.hasPendingMicrotasks = false;
this.hasPendingMacrotasks = false;
/**
* Whether there are no outstanding microtasks or macrotasks.
*/
this.isStable = true;
/**
* Notifies when code enters Angular Zone. This gets fired first on VM Turn.
*/
this.onUnstable = new EventEmitter(false);
/**
* Notifies when there is no more microtasks enqueued in the current VM Turn.
* This is a hint for Angular to do change detection, which may enqueue more microtasks.
* For this reason this event can fire multiple times per VM Turn.
*/
this.onMicrotaskEmpty = new EventEmitter(false);
/**
* Notifies when the last `onMicrotaskEmpty` has run and there are no more microtasks, which
* implies we are about to relinquish VM turn.
* This event gets called just once.
*/
this.onStable = new EventEmitter(false);
/**
* Notifies that an error has been delivered.
*/
this.onError = new EventEmitter(false);
if (typeof Zone == 'undefined') {
throw new Error("In this configuration Angular requires Zone.js");
}
Zone.assertZonePatched();
var /** @type {?} */ self = /** @type {?} */ ((this));
self._nesting = 0;
self._outer = self._inner = Zone.current;
if ((/** @type {?} */ (Zone))['wtfZoneSpec']) {
self._inner = self._inner.fork((/** @type {?} */ (Zone))['wtfZoneSpec']);
}
if (enableLongStackTrace && (/** @type {?} */ (Zone))['longStackTraceZoneSpec']) {
self._inner = self._inner.fork((/** @type {?} */ (Zone))['longStackTraceZoneSpec']);
}
forkInnerZoneWithAngularBehavior(self);
}
/**
* @return {?}
*/
NgZone.isInAngularZone = /**
* @return {?}
*/
function () { return Zone.current.get('isAngularZone') === true; };
/**
* @return {?}
*/
NgZone.assertInAngularZone = /**
* @return {?}
*/
function () {
if (!NgZone.isInAngularZone()) {
throw new Error('Expected to be in Angular Zone, but it is not!');
}
};
/**
* @return {?}
*/
NgZone.assertNotInAngularZone = /**
* @return {?}
*/
function () {
if (NgZone.isInAngularZone()) {
throw new Error('Expected to not be in Angular Zone, but it is!');
}
};
/**
* Executes the `fn` function synchronously within the Angular zone and returns value returned by
* the function.
*
* Running functions via `run` allows you to reenter Angular zone from a task that was executed
* outside of the Angular zone (typically started via {@link #runOutsideAngular}).
*
* Any future tasks or microtasks scheduled from within this function will continue executing from
* within the Angular zone.
*
* If a synchronous error happens it will be rethrown and not reported via `onError`.
*/
/**
* Executes the `fn` function synchronously within the Angular zone and returns value returned by
* the function.
*
* Running functions via `run` allows you to reenter Angular zone from a task that was executed
* outside of the Angular zone (typically started via {\@link #runOutsideAngular}).
*
* Any future tasks or microtasks scheduled from within this function will continue executing from
* within the Angular zone.
*
* If a synchronous error happens it will be rethrown and not reported via `onError`.
* @template T
* @param {?} fn
* @param {?=} applyThis
* @param {?=} applyArgs
* @return {?}
*/
NgZone.prototype.run = /**
* Executes the `fn` function synchronously within the Angular zone and returns value returned by
* the function.
*
* Running functions via `run` allows you to reenter Angular zone from a task that was executed
* outside of the Angular zone (typically started via {\@link #runOutsideAngular}).
*
* Any future tasks or microtasks scheduled from within this function will continue executing from
* within the Angular zone.
*
* If a synchronous error happens it will be rethrown and not reported via `onError`.
* @template T
* @param {?} fn
* @param {?=} applyThis
* @param {?=} applyArgs
* @return {?}
*/
function (fn, applyThis, applyArgs) {
return /** @type {?} */ ((/** @type {?} */ ((this)))._inner.run(fn, applyThis, applyArgs));
};
/**
* Executes the `fn` function synchronously within the Angular zone as a task and returns value
* returned by the function.
*
* Running functions via `run` allows you to reenter Angular zone from a task that was executed
* outside of the Angular zone (typically started via {@link #runOutsideAngular}).
*
* Any future tasks or microtasks scheduled from within this function will continue executing from
* within the Angular zone.
*
* If a synchronous error happens it will be rethrown and not reported via `onError`.
*/
/**
* Executes the `fn` function synchronously within the Angular zone as a task and returns value
* returned by the function.
*
* Running functions via `run` allows you to reenter Angular zone from a task that was executed
* outside of the Angular zone (typically started via {\@link #runOutsideAngular}).
*
* Any future tasks or microtasks scheduled from within this function will continue executing from
* within the Angular zone.
*
* If a synchronous error happens it will be rethrown and not reported via `onError`.
* @template T
* @param {?} fn
* @param {?=} applyThis
* @param {?=} applyArgs
* @param {?=} name
* @return {?}
*/
NgZone.prototype.runTask = /**
* Executes the `fn` function synchronously within the Angular zone as a task and returns value
* returned by the function.
*
* Running functions via `run` allows you to reenter Angular zone from a task that was executed
* outside of the Angular zone (typically started via {\@link #runOutsideAngular}).
*
* Any future tasks or microtasks scheduled from within this function will continue executing from
* within the Angular zone.
*
* If a synchronous error happens it will be rethrown and not reported via `onError`.
* @template T
* @param {?} fn
* @param {?=} applyThis
* @param {?=} applyArgs
* @param {?=} name
* @return {?}
*/
function (fn, applyThis, applyArgs, name) {
var /** @type {?} */ zone = (/** @type {?} */ ((this)))._inner;
var /** @type {?} */ task = zone.scheduleEventTask('NgZoneEvent: ' + name, fn, EMPTY_PAYLOAD, noop, noop);
try {
return /** @type {?} */ (zone.runTask(task, applyThis, applyArgs));
}
finally {
zone.cancelTask(task);
}
};
/**
* Same as `run`, except that synchronous errors are caught and forwarded via `onError` and not
* rethrown.
*/
/**
* Same as `run`, except that synchronous errors are caught and forwarded via `onError` and not
* rethrown.
* @template T
* @param {?} fn
* @param {?=} applyThis
* @param {?=} applyArgs
* @return {?}
*/
NgZone.prototype.runGuarded = /**
* Same as `run`, except that synchronous errors are caught and forwarded via `onError` and not
* rethrown.
* @template T
* @param {?} fn
* @param {?=} applyThis
* @param {?=} applyArgs
* @return {?}
*/
function (fn, applyThis, applyArgs) {
return /** @type {?} */ ((/** @type {?} */ ((this)))._inner.runGuarded(fn, applyThis, applyArgs));
};
/**
* Executes the `fn` function synchronously in Angular's parent zone and returns value returned by
* the function.
*
* Running functions via {@link #runOutsideAngular} allows you to escape Angular's zone and do
* work that
* doesn't trigger Angular change-detection or is subject to Angular's error handling.
*
* Any future tasks or microtasks scheduled from within this function will continue executing from
* outside of the Angular zone.
*
* Use {@link #run} to reenter the Angular zone and do work that updates the application model.
*/
/**
* Executes the `fn` function synchronously in Angular's parent zone and returns value returned by
* the function.
*
* Running functions via {\@link #runOutsideAngular} allows you to escape Angular's zone and do
* work that
* doesn't trigger Angular change-detection or is subject to Angular's error handling.
*
* Any future tasks or microtasks scheduled from within this function will continue executing from
* outside of the Angular zone.
*
* Use {\@link #run} to reenter the Angular zone and do work that updates the application model.
* @template T
* @param {?} fn
* @return {?}
*/
NgZone.prototype.runOutsideAngular = /**
* Executes the `fn` function synchronously in Angular's parent zone and returns value returned by
* the function.
*
* Running functions via {\@link #runOutsideAngular} allows you to escape Angular's zone and do
* work that
* doesn't trigger Angular change-detection or is subject to Angular's error handling.
*
* Any future tasks or microtasks scheduled from within this function will continue executing from
* outside of the Angular zone.
*
* Use {\@link #run} to reenter the Angular zone and do work that updates the application model.
* @template T
* @param {?} fn
* @return {?}
*/
function (fn) {
return /** @type {?} */ ((/** @type {?} */ ((this)))._outer.run(fn));
};
return NgZone;
}());
/**
* @return {?}
*/
function noop() { }
var EMPTY_PAYLOAD = {};
/**
* @param {?} zone
* @return {?}
*/
function checkStable(zone) {
if (zone._nesting == 0 && !zone.hasPendingMicrotasks && !zone.isStable) {
try {
zone._nesting++;
zone.onMicrotaskEmpty.emit(null);
}
finally {
zone._nesting--;
if (!zone.hasPendingMicrotasks) {
try {
zone.runOutsideAngular(function () { return zone.onStable.emit(null); });
}
finally {
zone.isStable = true;
}
}
}
}
}
/**
* @param {?} zone
* @return {?}
*/
function forkInnerZoneWithAngularBehavior(zone) {
zone._inner = zone._inner.fork({
name: 'angular',
properties: /** @type {?} */ ({ 'isAngularZone': true }),
onInvokeTask: function (delegate, current, target, task, applyThis, applyArgs) {
try {
onEnter(zone);
return delegate.invokeTask(target, task, applyThis, applyArgs);
}
finally {
onLeave(zone);
}
},
onInvoke: function (delegate, current, target, callback, applyThis, applyArgs, source) {
try {
onEnter(zone);
return delegate.invoke(target, callback, applyThis, applyArgs, source);
}
finally {
onLeave(zone);
}
},
onHasTask: function (delegate, current, target, hasTaskState) {
delegate.hasTask(target, hasTaskState);
if (current === target) {
// We are only interested in hasTask events which originate from our zone
// (A child hasTask event is not interesting to us)
if (hasTaskState.change == 'microTask') {
zone.hasPendingMicrotasks = hasTaskState.microTask;
checkStable(zone);
}
else if (hasTaskState.change == 'macroTask') {
zone.hasPendingMacrotasks = hasTaskState.macroTask;
}
}
},
onHandleError: function (delegate, current, target, error) {
delegate.handleError(target, error);
zone.runOutsideAngular(function () { return zone.onError.emit(error); });
return false;
}
});
}
/**
* @param {?} zone
* @return {?}
*/
function onEnter(zone) {
zone._nesting++;
if (zone.isStable) {
zone.isStable = false;
zone.onUnstable.emit(null);
}
}
/**
* @param {?} zone
* @return {?}
*/
function onLeave(zone) {
zone._nesting--;
checkStable(zone);
}
/**
* Provides a noop implementation of `NgZone` which does nothing. This zone requires explicit calls
* to framework to perform rendering.
*
* \@internal
*/
var NoopNgZone = (function () {
function NoopNgZone() {
this.hasPendingMicrotasks = false;
this.hasPendingMacrotasks = false;
this.isStable = true;
this.onUnstable = new EventEmitter();
this.onMicrotaskEmpty = new EventEmitter();
this.onStable = new EventEmitter();
this.onError = new EventEmitter();
}
/**
* @param {?} fn
* @return {?}
*/
NoopNgZone.prototype.run = /**
* @param {?} fn
* @return {?}
*/
function (fn) { return fn(); };
/**
* @param {?} fn
* @return {?}
*/
NoopNgZone.prototype.runGuarded = /**
* @param {?} fn
* @return {?}
*/
function (fn) { return fn(); };
/**
* @param {?} fn
* @return {?}
*/
NoopNgZone.prototype.runOutsideAngular = /**
* @param {?} fn
* @return {?}
*/
function (fn) { return fn(); };
/**
* @template T
* @param {?} fn
* @return {?}
*/
NoopNgZone.prototype.runTask = /**
* @template T
* @param {?} fn
* @return {?}
*/
function (fn) { return fn(); };
return NoopNgZone;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* The Testability service provides testing hooks that can be accessed from
* the browser and by services such as Protractor. Each bootstrapped Angular
* application on the page will have an instance of Testability.
* \@experimental
*/
var Testability = (function () {
function Testability(_ngZone) {
this._ngZone = _ngZone;
/**
* \@internal
*/
this._pendingCount = 0;
/**
* \@internal
*/
this._isZoneStable = true;
/**
* Whether any work was done since the last 'whenStable' callback. This is
* useful to detect if this could have potentially destabilized another
* component while it is stabilizing.
* \@internal
*/
this._didWork = false;
/**
* \@internal
*/
this._callbacks = [];
this._watchAngularEvents();
}
/** @internal */
/**
* \@internal
* @return {?}
*/
Testability.prototype._watchAngularEvents = /**
* \@internal
* @return {?}
*/
function () {
var _this = this;
this._ngZone.onUnstable.subscribe({
next: function () {
_this._didWork = true;
_this._isZoneStable = false;
}
});
this._ngZone.runOutsideAngular(function () {
_this._ngZone.onStable.subscribe({
next: function () {
NgZone.assertNotInAngularZone();
scheduleMicroTask(function () {
_this._isZoneStable = true;
_this._runCallbacksIfReady();
});
}
});
});
};
/**
* Increases the number of pending request
*/
/**
* Increases the number of pending request
* @return {?}
*/
Testability.prototype.increasePendingRequestCount = /**
* Increases the number of pending request
* @return {?}
*/
function () {
this._pendingCount += 1;
this._didWork = true;
return this._pendingCount;
};
/**
* Decreases the number of pending request
*/
/**
* Decreases the number of pending request
* @return {?}
*/
Testability.prototype.decreasePendingRequestCount = /**
* Decreases the number of pending request
* @return {?}
*/
function () {
this._pendingCount -= 1;
if (this._pendingCount < 0) {
throw new Error('pending async requests below zero');
}
this._runCallbacksIfReady();
return this._pendingCount;
};
/**
* Whether an associated application is stable
*/
/**
* Whether an associated application is stable
* @return {?}
*/
Testability.prototype.isStable = /**
* Whether an associated application is stable
* @return {?}
*/
function () {
return this._isZoneStable && this._pendingCount == 0 && !this._ngZone.hasPendingMacrotasks;
};
/** @internal */
/**
* \@internal
* @return {?}
*/
Testability.prototype._runCallbacksIfReady = /**
* \@internal
* @return {?}
*/
function () {
var _this = this;
if (this.isStable()) {
// Schedules the call backs in a new frame so that it is always async.
scheduleMicroTask(function () {
while (_this._callbacks.length !== 0) {
(/** @type {?} */ ((_this._callbacks.pop())))(_this._didWork);
}
_this._didWork = false;
});
}
else {
// Not Ready
this._didWork = true;
}
};
/**
* Run callback when the application is stable
* @param callback function to be called after the application is stable
*/
/**
* Run callback when the application is stable
* @param {?} callback function to be called after the application is stable
* @return {?}
*/
Testability.prototype.whenStable = /**
* Run callback when the application is stable
* @param {?} callback function to be called after the application is stable
* @return {?}
*/
function (callback) {
this._callbacks.push(callback);
this._runCallbacksIfReady();
};
/**
* Get the number of pending requests
*/
/**
* Get the number of pending requests
* @return {?}
*/
Testability.prototype.getPendingRequestCount = /**
* Get the number of pending requests
* @return {?}
*/
function () { return this._pendingCount; };
/**
* Find providers by name
* @param using The root element to search from
* @param provider The name of binding variable
* @param exactMatch Whether using exactMatch
*/
/**
* Find providers by name
* @param {?} using The root element to search from
* @param {?} provider The name of binding variable
* @param {?} exactMatch Whether using exactMatch
* @return {?}
*/
Testability.prototype.findProviders = /**
* Find providers by name
* @param {?} using The root element to search from
* @param {?} provider The name of binding variable
* @param {?} exactMatch Whether using exactMatch
* @return {?}
*/
function (using, provider, exactMatch) {
// TODO(juliemr): implement.
return [];
};
Testability.decorators = [
{ type: Injectable },
];
/** @nocollapse */
Testability.ctorParameters = function () { return [
{ type: NgZone, },
]; };
return Testability;
}());
/**
* A global registry of {\@link Testability} instances for specific elements.
* \@experimental
*/
var TestabilityRegistry = (function () {
function TestabilityRegistry() {
/**
* \@internal
*/
this._applications = new Map();
_testabilityGetter.addToWindow(this);
}
/**
* Registers an application with a testability hook so that it can be tracked
* @param token token of application, root element
* @param testability Testability hook
*/
/**
* Registers an application with a testability hook so that it can be tracked
* @param {?} token token of application, root element
* @param {?} testability Testability hook
* @return {?}
*/
TestabilityRegistry.prototype.registerApplication = /**
* Registers an application with a testability hook so that it can be tracked
* @param {?} token token of application, root element
* @param {?} testability Testability hook
* @return {?}
*/
function (token, testability) {
this._applications.set(token, testability);
};
/**
* Unregisters an application.
* @param token token of application, root element
*/
/**
* Unregisters an application.
* @param {?} token token of application, root element
* @return {?}
*/
TestabilityRegistry.prototype.unregisterApplication = /**
* Unregisters an application.
* @param {?} token token of application, root element
* @return {?}
*/
function (token) { this._applications.delete(token); };
/**
* Unregisters all applications
*/
/**
* Unregisters all applications
* @return {?}
*/
TestabilityRegistry.prototype.unregisterAllApplications = /**
* Unregisters all applications
* @return {?}
*/
function () { this._applications.clear(); };
/**
* Get a testability hook associated with the application
* @param elem root element
*/
/**
* Get a testability hook associated with the application
* @param {?} elem root element
* @return {?}
*/
TestabilityRegistry.prototype.getTestability = /**
* Get a testability hook associated with the application
* @param {?} elem root element
* @return {?}
*/
function (elem) { return this._applications.get(elem) || null; };
/**
* Get all registered testabilities
*/
/**
* Get all registered testabilities
* @return {?}
*/
TestabilityRegistry.prototype.getAllTestabilities = /**
* Get all registered testabilities
* @return {?}
*/
function () { return Array.from(this._applications.values()); };
/**
* Get all registered applications(root elements)
*/
/**
* Get all registered applications(root elements)
* @return {?}
*/
TestabilityRegistry.prototype.getAllRootElements = /**
* Get all registered applications(root elements)
* @return {?}
*/
function () { return Array.from(this._applications.keys()); };
/**
* Find testability of a node in the Tree
* @param elem node
* @param findInAncestors whether finding testability in ancestors if testability was not found in
* current node
*/
/**
* Find testability of a node in the Tree
* @param {?} elem node
* @param {?=} findInAncestors whether finding testability in ancestors if testability was not found in
* current node
* @return {?}
*/
TestabilityRegistry.prototype.findTestabilityInTree = /**
* Find testability of a node in the Tree
* @param {?} elem node
* @param {?=} findInAncestors whether finding testability in ancestors if testability was not found in
* current node
* @return {?}
*/
function (elem, findInAncestors) {
if (findInAncestors === void 0) { findInAncestors = true; }
return _testabilityGetter.findTestabilityInTree(this, elem, findInAncestors);
};
TestabilityRegistry.decorators = [
{ type: Injectable },
];
/** @nocollapse */
TestabilityRegistry.ctorParameters = function () { return []; };
return TestabilityRegistry;
}());
/**
* Adapter interface for retrieving the `Testability` service associated for a
* particular context.
*
* \@experimental Testability apis are primarily intended to be used by e2e test tool vendors like
* the Protractor team.
* @record
*/
var _NoopGetTestability = (function () {
function _NoopGetTestability() {
}
/**
* @param {?} registry
* @return {?}
*/
_NoopGetTestability.prototype.addToWindow = /**
* @param {?} registry
* @return {?}
*/
function (registry) { };
/**
* @param {?} registry
* @param {?} elem
* @param {?} findInAncestors
* @return {?}
*/
_NoopGetTestability.prototype.findTestabilityInTree = /**
* @param {?} registry
* @param {?} elem
* @param {?} findInAncestors
* @return {?}
*/
function (registry, elem, findInAncestors) {
return null;
};
return _NoopGetTestability;
}());
/**
* Set the {\@link GetTestability} implementation used by the Angular testing framework.
* \@experimental
* @param {?} getter
* @return {?}
*/
function setTestabilityGetter(getter) {
_testabilityGetter = getter;
}
var _testabilityGetter = new _NoopGetTestability();
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var _devMode = true;
var _runModeLocked = false;
var _platform;
var ALLOW_MULTIPLE_PLATFORMS = new InjectionToken('AllowMultipleToken');
/**
* Disable Angular's development mode, which turns off assertions and other
* checks within the framework.
*
* One important assertion this disables verifies that a change detection pass
* does not result in additional changes to any bindings (also known as
* unidirectional data flow).
*
* \@stable
* @return {?}
*/
function enableProdMode() {
if (_runModeLocked) {
throw new Error('Cannot enable prod mode after platform setup.');
}
_devMode = false;
}
/**
* Returns whether Angular is in development mode. After called once,
* the value is locked and won't change any more.
*
* By default, this is true, unless a user calls `enableProdMode` before calling this.
*
* \@experimental APIs related to application bootstrap are currently under review.
* @return {?}
*/
function isDevMode() {
_runModeLocked = true;
return _devMode;
}
/**
* A token for third-party components that can register themselves with NgProbe.
*
* \@experimental
*/
var NgProbeToken = (function () {
function NgProbeToken(name, token) {
this.name = name;
this.token = token;
}
return NgProbeToken;
}());
/**
* Creates a platform.
* Platforms have to be eagerly created via this function.
*
* \@experimental APIs related to application bootstrap are currently under review.
* @param {?} injector
* @return {?}
*/
function createPlatform(injector) {
if (_platform && !_platform.destroyed &&
!_platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
throw new Error('There can be only one platform. Destroy the previous one to create a new one.');
}
_platform = injector.get(PlatformRef);
var /** @type {?} */ inits = injector.get(PLATFORM_INITIALIZER, null);
if (inits)
inits.forEach(function (init) { return init(); });
return _platform;
}
/**
* Creates a factory for a platform
*
* \@experimental APIs related to application bootstrap are currently under review.
* @param {?} parentPlatformFactory
* @param {?} name
* @param {?=} providers
* @return {?}
*/
function createPlatformFactory(parentPlatformFactory, name, providers) {
if (providers === void 0) { providers = []; }
var /** @type {?} */ marker = new InjectionToken("Platform: " + name);
return function (extraProviders) {
if (extraProviders === void 0) { extraProviders = []; }
var /** @type {?} */ platform = getPlatform();
if (!platform || platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
if (parentPlatformFactory) {
parentPlatformFactory(providers.concat(extraProviders).concat({ provide: marker, useValue: true }));
}
else {
createPlatform(Injector.create(providers.concat(extraProviders).concat({ provide: marker, useValue: true })));
}
}
return assertPlatform(marker);
};
}
/**
* Checks that there currently is a platform which contains the given token as a provider.
*
* \@experimental APIs related to application bootstrap are currently under review.
* @param {?} requiredToken
* @return {?}
*/
function assertPlatform(requiredToken) {
var /** @type {?} */ platform = getPlatform();
if (!platform) {
throw new Error('No platform exists!');
}
if (!platform.injector.get(requiredToken, null)) {
throw new Error('A platform with a different configuration has been created. Please destroy it first.');
}
return platform;
}
/**
* Destroy the existing platform.
*
* \@experimental APIs related to application bootstrap are currently under review.
* @return {?}
*/
function destroyPlatform() {
if (_platform && !_platform.destroyed) {
_platform.destroy();
}
}
/**
* Returns the current platform.
*
* \@experimental APIs related to application bootstrap are currently under review.
* @return {?}
*/
function getPlatform() {
return _platform && !_platform.destroyed ? _platform : null;
}
/**
* Provides additional options to the bootstraping process.
*
* \@stable
* @record
*/
/**
* The Angular platform is the entry point for Angular on a web page. Each page
* has exactly one platform, and services (such as reflection) which are common
* to every Angular application running on the page are bound in its scope.
*
* A page's platform is initialized implicitly when a platform is created via a platform factory
* (e.g. {\@link platformBrowser}), or explicitly by calling the {\@link createPlatform} function.
*
* \@stable
*/
var PlatformRef = (function () {
/** @internal */
function PlatformRef(_injector) {
this._injector = _injector;
this._modules = [];
this._destroyListeners = [];
this._destroyed = false;
}
/**
* Creates an instance of an `@NgModule` for the given platform
* for offline compilation.
*
* ## Simple Example
*
* ```typescript
* my_module.ts:
*
* @NgModule({
* imports: [BrowserModule]
* })
* class MyModule {}
*
* main.ts:
* import {MyModuleNgFactory} from './my_module.ngfactory';
* import {platformBrowser} from '@angular/platform-browser';
*
* let moduleRef = platformBrowser().bootstrapModuleFactory(MyModuleNgFactory);
* ```
*
* @experimental APIs related to application bootstrap are currently under review.
*/
/**
* Creates an instance of an `\@NgModule` for the given platform
* for offline compilation.
*
* ## Simple Example
*
* ```typescript
* my_module.ts:
*
* \@NgModule({
* imports: [BrowserModule]
* })
* class MyModule {}
*
* main.ts:
* import {MyModuleNgFactory} from './my_module.ngfactory';
* import {platformBrowser} from '\@angular/platform-browser';
*
* let moduleRef = platformBrowser().bootstrapModuleFactory(MyModuleNgFactory);
* ```
*
* \@experimental APIs related to application bootstrap are currently under review.
* @template M
* @param {?} moduleFactory
* @param {?=} options
* @return {?}
*/
PlatformRef.prototype.bootstrapModuleFactory = /**
* Creates an instance of an `\@NgModule` for the given platform
* for offline compilation.
*
* ## Simple Example
*
* ```typescript
* my_module.ts:
*
* \@NgModule({
* imports: [BrowserModule]
* })
* class MyModule {}
*
* main.ts:
* import {MyModuleNgFactory} from './my_module.ngfactory';
* import {platformBrowser} from '\@angular/platform-browser';
*
* let moduleRef = platformBrowser().bootstrapModuleFactory(MyModuleNgFactory);
* ```
*
* \@experimental APIs related to application bootstrap are currently under review.
* @template M
* @param {?} moduleFactory
* @param {?=} options
* @return {?}
*/
function (moduleFactory, options) {
var _this = this;
// Note: We need to create the NgZone _before_ we instantiate the module,
// as instantiating the module creates some providers eagerly.
// So we create a mini parent injector that just contains the new NgZone and
// pass that as parent to the NgModuleFactory.
var /** @type {?} */ ngZoneOption = options ? options.ngZone : undefined;
var /** @type {?} */ ngZone = getNgZone(ngZoneOption);
// Attention: Don't use ApplicationRef.run here,
// as we want to be sure that all possible constructor calls are inside `ngZone.run`!
return ngZone.run(function () {
var /** @type {?} */ ngZoneInjector = Injector.create([{ provide: NgZone, useValue: ngZone }], _this.injector);
var /** @type {?} */ moduleRef = /** @type {?} */ (moduleFactory.create(ngZoneInjector));
var /** @type {?} */ exceptionHandler = moduleRef.injector.get(ErrorHandler, null);
if (!exceptionHandler) {
throw new Error('No ErrorHandler. Is platform module (BrowserModule) included?');
}
moduleRef.onDestroy(function () { return remove(_this._modules, moduleRef); }); /** @type {?} */
((ngZone)).runOutsideAngular(function () { return /** @type {?} */ ((ngZone)).onError.subscribe({ next: function (error) { exceptionHandler.handleError(error); } }); });
return _callAndReportToErrorHandler(exceptionHandler, /** @type {?} */ ((ngZone)), function () {
var /** @type {?} */ initStatus = moduleRef.injector.get(ApplicationInitStatus);
initStatus.runInitializers();
return initStatus.donePromise.then(function () {
_this._moduleDoBootstrap(moduleRef);
return moduleRef;
});
});
});
};
/**
* Creates an instance of an `@NgModule` for a given platform using the given runtime compiler.
*
* ## Simple Example
*
* ```typescript
* @NgModule({
* imports: [BrowserModule]
* })
* class MyModule {}
*
* let moduleRef = platformBrowser().bootstrapModule(MyModule);
* ```
* @stable
*/
/**
* Creates an instance of an `\@NgModule` for a given platform using the given runtime compiler.
*
* ## Simple Example
*
* ```typescript
* \@NgModule({
* imports: [BrowserModule]
* })
* class MyModule {}
*
* let moduleRef = platformBrowser().bootstrapModule(MyModule);
* ```
* \@stable
* @template M
* @param {?} moduleType
* @param {?=} compilerOptions
* @return {?}
*/
PlatformRef.prototype.bootstrapModule = /**
* Creates an instance of an `\@NgModule` for a given platform using the given runtime compiler.
*
* ## Simple Example
*
* ```typescript
* \@NgModule({
* imports: [BrowserModule]
* })
* class MyModule {}
*
* let moduleRef = platformBrowser().bootstrapModule(MyModule);
* ```
* \@stable
* @template M
* @param {?} moduleType
* @param {?=} compilerOptions
* @return {?}
*/
function (moduleType, compilerOptions) {
var _this = this;
if (compilerOptions === void 0) { compilerOptions = []; }
var /** @type {?} */ compilerFactory = this.injector.get(CompilerFactory);
var /** @type {?} */ options = optionsReducer({}, compilerOptions);
var /** @type {?} */ compiler = compilerFactory.createCompiler([options]);
return compiler.compileModuleAsync(moduleType)
.then(function (moduleFactory) { return _this.bootstrapModuleFactory(moduleFactory, options); });
};
/**
* @param {?} moduleRef
* @return {?}
*/
PlatformRef.prototype._moduleDoBootstrap = /**
* @param {?} moduleRef
* @return {?}
*/
function (moduleRef) {
var /** @type {?} */ appRef = /** @type {?} */ (moduleRef.injector.get(ApplicationRef));
if (moduleRef._bootstrapComponents.length > 0) {
moduleRef._bootstrapComponents.forEach(function (f) { return appRef.bootstrap(f); });
}
else if (moduleRef.instance.ngDoBootstrap) {
moduleRef.instance.ngDoBootstrap(appRef);
}
else {
throw new Error("The module " + stringify(moduleRef.instance.constructor) + " was bootstrapped, but it does not declare \"@NgModule.bootstrap\" components nor a \"ngDoBootstrap\" method. " +
"Please define one of these.");
}
this._modules.push(moduleRef);
};
/**
* Register a listener to be called when the platform is disposed.
*/
/**
* Register a listener to be called when the platform is disposed.
* @param {?} callback
* @return {?}
*/
PlatformRef.prototype.onDestroy = /**
* Register a listener to be called when the platform is disposed.
* @param {?} callback
* @return {?}
*/
function (callback) { this._destroyListeners.push(callback); };
Object.defineProperty(PlatformRef.prototype, "injector", {
/**
* Retrieve the platform {@link Injector}, which is the parent injector for
* every Angular application on the page and provides singleton providers.
*/
get: /**
* Retrieve the platform {\@link Injector}, which is the parent injector for
* every Angular application on the page and provides singleton providers.
* @return {?}
*/
function () { return this._injector; },
enumerable: true,
configurable: true
});
/**
* Destroy the Angular platform and all Angular applications on the page.
*/
/**
* Destroy the Angular platform and all Angular applications on the page.
* @return {?}
*/
PlatformRef.prototype.destroy = /**
* Destroy the Angular platform and all Angular applications on the page.
* @return {?}
*/
function () {
if (this._destroyed) {
throw new Error('The platform has already been destroyed!');
}
this._modules.slice().forEach(function (module) { return module.destroy(); });
this._destroyListeners.forEach(function (listener) { return listener(); });
this._destroyed = true;
};
Object.defineProperty(PlatformRef.prototype, "destroyed", {
get: /**
* @return {?}
*/
function () { return this._destroyed; },
enumerable: true,
configurable: true
});
PlatformRef.decorators = [
{ type: Injectable },
];
/** @nocollapse */
PlatformRef.ctorParameters = function () { return [
{ type: Injector, },
]; };
return PlatformRef;
}());
/**
* @param {?=} ngZoneOption
* @return {?}
*/
function getNgZone(ngZoneOption) {
var /** @type {?} */ ngZone;
if (ngZoneOption === 'noop') {
ngZone = new NoopNgZone();
}
else {
ngZone = (ngZoneOption === 'zone.js' ? undefined : ngZoneOption) ||
new NgZone({ enableLongStackTrace: isDevMode() });
}
return ngZone;
}
/**
* @param {?} errorHandler
* @param {?} ngZone
* @param {?} callback
* @return {?}
*/
function _callAndReportToErrorHandler(errorHandler, ngZone, callback) {
try {
var /** @type {?} */ result = callback();
if (isPromise(result)) {
return result.catch(function (e) {
ngZone.runOutsideAngular(function () { return errorHandler.handleError(e); });
// rethrow as the exception handler might not do it
throw e;
});
}
return result;
}
catch (/** @type {?} */ e) {
ngZone.runOutsideAngular(function () { return errorHandler.handleError(e); });
// rethrow as the exception handler might not do it
throw e;
}
}
/**
* @template T
* @param {?} dst
* @param {?} objs
* @return {?}
*/
function optionsReducer(dst, objs) {
if (Array.isArray(objs)) {
dst = objs.reduce(optionsReducer, dst);
}
else {
dst = Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({}, dst, (/** @type {?} */ (objs)));
}
return dst;
}
/**
* A reference to an Angular application running on a page.
*
* \@stable
*/
var ApplicationRef = (function () {
/** @internal */
function ApplicationRef(_zone, _console, _injector, _exceptionHandler, _componentFactoryResolver, _initStatus) {
var _this = this;
this._zone = _zone;
this._console = _console;
this._injector = _injector;
this._exceptionHandler = _exceptionHandler;
this._componentFactoryResolver = _componentFactoryResolver;
this._initStatus = _initStatus;
this._bootstrapListeners = [];
this._views = [];
this._runningTick = false;
this._enforceNoNewChanges = false;
this._stable = true;
/**
* Get a list of component types registered to this application.
* This list is populated even before the component is created.
*/
this.componentTypes = [];
/**
* Get a list of components registered to this application.
*/
this.components = [];
this._enforceNoNewChanges = isDevMode();
this._zone.onMicrotaskEmpty.subscribe({ next: function () { _this._zone.run(function () { _this.tick(); }); } });
var /** @type {?} */ isCurrentlyStable = new __WEBPACK_IMPORTED_MODULE_1_rxjs_Observable__["Observable"](function (observer) {
_this._stable = _this._zone.isStable && !_this._zone.hasPendingMacrotasks &&
!_this._zone.hasPendingMicrotasks;
_this._zone.runOutsideAngular(function () {
observer.next(_this._stable);
observer.complete();
});
});
var /** @type {?} */ isStable = new __WEBPACK_IMPORTED_MODULE_1_rxjs_Observable__["Observable"](function (observer) {
// Create the subscription to onStable outside the Angular Zone so that
// the callback is run outside the Angular Zone.
var /** @type {?} */ stableSub;
_this._zone.runOutsideAngular(function () {
stableSub = _this._zone.onStable.subscribe(function () {
NgZone.assertNotInAngularZone();
// Check whether there are no pending macro/micro tasks in the next tick
// to allow for NgZone to update the state.
scheduleMicroTask(function () {
if (!_this._stable && !_this._zone.hasPendingMacrotasks &&
!_this._zone.hasPendingMicrotasks) {
_this._stable = true;
observer.next(true);
}
});
});
});
var /** @type {?} */ unstableSub = _this._zone.onUnstable.subscribe(function () {
NgZone.assertInAngularZone();
if (_this._stable) {
_this._stable = false;
_this._zone.runOutsideAngular(function () { observer.next(false); });
}
});
return function () {
stableSub.unsubscribe();
unstableSub.unsubscribe();
};
});
(/** @type {?} */ (this)).isStable =
Object(__WEBPACK_IMPORTED_MODULE_2_rxjs_observable_merge__["merge"])(isCurrentlyStable, __WEBPACK_IMPORTED_MODULE_3_rxjs_operator_share__["share"].call(isStable));
}
/**
* Bootstrap a new component at the root level of the application.
*
* ### Bootstrap process
*
* When bootstrapping a new root component into an application, Angular mounts the
* specified application component onto DOM elements identified by the [componentType]'s
* selector and kicks off automatic change detection to finish initializing the component.
*
* Optionally, a component can be mounted onto a DOM element that does not match the
* [componentType]'s selector.
*
* ### Example
* {@example core/ts/platform/platform.ts region='longform'}
*/
/**
* Bootstrap a new component at the root level of the application.
*
* ### Bootstrap process
*
* When bootstrapping a new root component into an application, Angular mounts the
* specified application component onto DOM elements identified by the [componentType]'s
* selector and kicks off automatic change detection to finish initializing the component.
*
* Optionally, a component can be mounted onto a DOM element that does not match the
* [componentType]'s selector.
*
* ### Example
* {\@example core/ts/platform/platform.ts region='longform'}
* @template C
* @param {?} componentOrFactory
* @param {?=} rootSelectorOrNode
* @return {?}
*/
ApplicationRef.prototype.bootstrap = /**
* Bootstrap a new component at the root level of the application.
*
* ### Bootstrap process
*
* When bootstrapping a new root component into an application, Angular mounts the
* specified application component onto DOM elements identified by the [componentType]'s
* selector and kicks off automatic change detection to finish initializing the component.
*
* Optionally, a component can be mounted onto a DOM element that does not match the
* [componentType]'s selector.
*
* ### Example
* {\@example core/ts/platform/platform.ts region='longform'}
* @template C
* @param {?} componentOrFactory
* @param {?=} rootSelectorOrNode
* @return {?}
*/
function (componentOrFactory, rootSelectorOrNode) {
var _this = this;
if (!this._initStatus.done) {
throw new Error('Cannot bootstrap as there are still asynchronous initializers running. Bootstrap components in the `ngDoBootstrap` method of the root module.');
}
var /** @type {?} */ componentFactory;
if (componentOrFactory instanceof ComponentFactory) {
componentFactory = componentOrFactory;
}
else {
componentFactory =
/** @type {?} */ ((this._componentFactoryResolver.resolveComponentFactory(componentOrFactory)));
}
this.componentTypes.push(componentFactory.componentType);
// Create a factory associated with the current module if it's not bound to some other
var /** @type {?} */ ngModule = componentFactory instanceof ComponentFactoryBoundToModule ?
null :
this._injector.get(NgModuleRef);
var /** @type {?} */ selectorOrNode = rootSelectorOrNode || componentFactory.selector;
var /** @type {?} */ compRef = componentFactory.create(Injector.NULL, [], selectorOrNode, ngModule);
compRef.onDestroy(function () { _this._unloadComponent(compRef); });
var /** @type {?} */ testability = compRef.injector.get(Testability, null);
if (testability) {
compRef.injector.get(TestabilityRegistry)
.registerApplication(compRef.location.nativeElement, testability);
}
this._loadComponent(compRef);
if (isDevMode()) {
this._console.log("Angular is running in the development mode. Call enableProdMode() to enable the production mode.");
}
return compRef;
};
/**
* Invoke this method to explicitly process change detection and its side-effects.
*
* In development mode, `tick()` also performs a second change detection cycle to ensure that no
* further changes are detected. If additional changes are picked up during this second cycle,
* bindings in the app have side-effects that cannot be resolved in a single change detection
* pass.
* In this case, Angular throws an error, since an Angular application can only have one change
* detection pass during which all change detection must complete.
*/
/**
* Invoke this method to explicitly process change detection and its side-effects.
*
* In development mode, `tick()` also performs a second change detection cycle to ensure that no
* further changes are detected. If additional changes are picked up during this second cycle,
* bindings in the app have side-effects that cannot be resolved in a single change detection
* pass.
* In this case, Angular throws an error, since an Angular application can only have one change
* detection pass during which all change detection must complete.
* @return {?}
*/
ApplicationRef.prototype.tick = /**
* Invoke this method to explicitly process change detection and its side-effects.
*
* In development mode, `tick()` also performs a second change detection cycle to ensure that no
* further changes are detected. If additional changes are picked up during this second cycle,
* bindings in the app have side-effects that cannot be resolved in a single change detection
* pass.
* In this case, Angular throws an error, since an Angular application can only have one change
* detection pass during which all change detection must complete.
* @return {?}
*/
function () {
var _this = this;
if (this._runningTick) {
throw new Error('ApplicationRef.tick is called recursively');
}
var /** @type {?} */ scope = ApplicationRef._tickScope();
try {
this._runningTick = true;
this._views.forEach(function (view) { return view.detectChanges(); });
if (this._enforceNoNewChanges) {
this._views.forEach(function (view) { return view.checkNoChanges(); });
}
}
catch (/** @type {?} */ e) {
// Attention: Don't rethrow as it could cancel subscriptions to Observables!
this._zone.runOutsideAngular(function () { return _this._exceptionHandler.handleError(e); });
}
finally {
this._runningTick = false;
wtfLeave(scope);
}
};
/**
* Attaches a view so that it will be dirty checked.
* The view will be automatically detached when it is destroyed.
* This will throw if the view is already attached to a ViewContainer.
*/
/**
* Attaches a view so that it will be dirty checked.
* The view will be automatically detached when it is destroyed.
* This will throw if the view is already attached to a ViewContainer.
* @param {?} viewRef
* @return {?}
*/
ApplicationRef.prototype.attachView = /**
* Attaches a view so that it will be dirty checked.
* The view will be automatically detached when it is destroyed.
* This will throw if the view is already attached to a ViewContainer.
* @param {?} viewRef
* @return {?}
*/
function (viewRef) {
var /** @type {?} */ view = (/** @type {?} */ (viewRef));
this._views.push(view);
view.attachToAppRef(this);
};
/**
* Detaches a view from dirty checking again.
*/
/**
* Detaches a view from dirty checking again.
* @param {?} viewRef
* @return {?}
*/
ApplicationRef.prototype.detachView = /**
* Detaches a view from dirty checking again.
* @param {?} viewRef
* @return {?}
*/
function (viewRef) {
var /** @type {?} */ view = (/** @type {?} */ (viewRef));
remove(this._views, view);
view.detachFromAppRef();
};
/**
* @param {?} componentRef
* @return {?}
*/
ApplicationRef.prototype._loadComponent = /**
* @param {?} componentRef
* @return {?}
*/
function (componentRef) {
this.attachView(componentRef.hostView);
this.tick();
this.components.push(componentRef);
// Get the listeners lazily to prevent DI cycles.
var /** @type {?} */ listeners = this._injector.get(APP_BOOTSTRAP_LISTENER, []).concat(this._bootstrapListeners);
listeners.forEach(function (listener) { return listener(componentRef); });
};
/**
* @param {?} componentRef
* @return {?}
*/
ApplicationRef.prototype._unloadComponent = /**
* @param {?} componentRef
* @return {?}
*/
function (componentRef) {
this.detachView(componentRef.hostView);
remove(this.components, componentRef);
};
/** @internal */
/**
* \@internal
* @return {?}
*/
ApplicationRef.prototype.ngOnDestroy = /**
* \@internal
* @return {?}
*/
function () {
// TODO(alxhub): Dispose of the NgZone.
this._views.slice().forEach(function (view) { return view.destroy(); });
};
Object.defineProperty(ApplicationRef.prototype, "viewCount", {
/**
* Returns the number of attached views.
*/
get: /**
* Returns the number of attached views.
* @return {?}
*/
function () { return this._views.length; },
enumerable: true,
configurable: true
});
/**
* \@internal
*/
ApplicationRef._tickScope = wtfCreateScope('ApplicationRef#tick()');
ApplicationRef.decorators = [
{ type: Injectable },
];
/** @nocollapse */
ApplicationRef.ctorParameters = function () { return [
{ type: NgZone, },
{ type: Console, },
{ type: Injector, },
{ type: ErrorHandler, },
{ type: ComponentFactoryResolver, },
{ type: ApplicationInitStatus, },
]; };
return ApplicationRef;
}());
/**
* @template T
* @param {?} list
* @param {?} el
* @return {?}
*/
function remove(list, el) {
var /** @type {?} */ index = list.indexOf(el);
if (index > -1) {
list.splice(index, 1);
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// Public API for Zone
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @deprecated Use `RendererType2` (and `Renderer2`) instead.
*/
var RenderComponentType = (function () {
function RenderComponentType(id, templateUrl, slotCount, encapsulation, styles, animations) {
this.id = id;
this.templateUrl = templateUrl;
this.slotCount = slotCount;
this.encapsulation = encapsulation;
this.styles = styles;
this.animations = animations;
}
return RenderComponentType;
}());
/**
* @deprecated Debug info is handeled internally in the view engine now.
* @abstract
*/
var RenderDebugInfo = (function () {
function RenderDebugInfo() {
}
return RenderDebugInfo;
}());
/**
* @deprecated Use the `Renderer2` instead.
* @record
*/
/**
* @deprecated Use the `Renderer2` instead.
* @abstract
*/
var Renderer = (function () {
function Renderer() {
}
return Renderer;
}());
var Renderer2Interceptor = new InjectionToken('Renderer2Interceptor');
/**
* Injectable service that provides a low-level interface for modifying the UI.
*
* Use this service to bypass Angular's templating and make custom UI changes that can't be
* expressed declaratively. For example if you need to set a property or an attribute whose name is
* not statically known, use {\@link Renderer#setElementProperty setElementProperty} or
* {\@link Renderer#setElementAttribute setElementAttribute} respectively.
*
* If you are implementing a custom renderer, you must implement this interface.
*
* The default Renderer implementation is `DomRenderer`. Also available is `WebWorkerRenderer`.
*
* @deprecated Use `RendererFactory2` instead.
* @abstract
*/
var RootRenderer = (function () {
function RootRenderer() {
}
return RootRenderer;
}());
/**
* \@experimental
* @record
*/
/**
* \@experimental
* @abstract
*/
var RendererFactory2 = (function () {
function RendererFactory2() {
}
return RendererFactory2;
}());
/** @enum {number} */
var RendererStyleFlags2 = {
Important: 1,
DashCase: 2,
};
RendererStyleFlags2[RendererStyleFlags2.Important] = "Important";
RendererStyleFlags2[RendererStyleFlags2.DashCase] = "DashCase";
/**
* \@experimental
* @abstract
*/
var Renderer2 = (function () {
function Renderer2() {
}
return Renderer2;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// Public API for render
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* A wrapper around a native element inside of a View.
*
* An `ElementRef` is backed by a render-specific element. In the browser, this is usually a DOM
* element.
*
* \@security Permitting direct access to the DOM can make your application more vulnerable to
* XSS attacks. Carefully review any use of `ElementRef` in your code. For more detail, see the
* [Security Guide](http://g.co/ng/security).
*
* \@stable
*/
var ElementRef = (function () {
function ElementRef(nativeElement) {
this.nativeElement = nativeElement;
}
return ElementRef;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Used to load ng module factories.
* \@stable
* @abstract
*/
var NgModuleFactoryLoader = (function () {
function NgModuleFactoryLoader() {
}
return NgModuleFactoryLoader;
}());
var moduleFactories = new Map();
/**
* Registers a loaded module. Should only be called from generated NgModuleFactory code.
* \@experimental
* @param {?} id
* @param {?} factory
* @return {?}
*/
function registerModuleFactory(id, factory) {
var /** @type {?} */ existing = moduleFactories.get(id);
if (existing) {
throw new Error("Duplicate module registered for " + id + " - " + existing.moduleType.name + " vs " + factory.moduleType.name);
}
moduleFactories.set(id, factory);
}
/**
* @return {?}
*/
/**
* Returns the NgModuleFactory with the given id, if it exists and has been loaded.
* Factories for modules that do not specify an `id` cannot be retrieved. Throws if the module
* cannot be found.
* \@experimental
* @param {?} id
* @return {?}
*/
function getModuleFactory(id) {
var /** @type {?} */ factory = moduleFactories.get(id);
if (!factory)
throw new Error("No module with ID " + id + " loaded");
return factory;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* An unmodifiable list of items that Angular keeps up to date when the state
* of the application changes.
*
* The type of object that {\@link ViewChildren}, {\@link ContentChildren}, and {\@link QueryList}
* provide.
*
* Implements an iterable interface, therefore it can be used in both ES6
* javascript `for (var i of items)` loops as well as in Angular templates with
* `*ngFor="let i of myList"`.
*
* Changes can be observed by subscribing to the changes `Observable`.
*
* NOTE: In the future this class will implement an `Observable` interface.
*
* ### Example ([live demo](http://plnkr.co/edit/RX8sJnQYl9FWuSCWme5z?p=preview))
* ```typescript
* \@Component({...})
* class Container {
* \@ViewChildren(Item) items:QueryList<Item>;
* }
* ```
* \@stable
*/
var QueryList = (function () {
function QueryList() {
this.dirty = true;
this._results = [];
this.changes = new EventEmitter();
}
Object.defineProperty(QueryList.prototype, "length", {
get: /**
* @return {?}
*/
function () { return this._results.length; },
enumerable: true,
configurable: true
});
Object.defineProperty(QueryList.prototype, "first", {
get: /**
* @return {?}
*/
function () { return this._results[0]; },
enumerable: true,
configurable: true
});
Object.defineProperty(QueryList.prototype, "last", {
get: /**
* @return {?}
*/
function () { return this._results[this.length - 1]; },
enumerable: true,
configurable: true
});
/**
* See
* [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
*/
/**
* See
* [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
* @template U
* @param {?} fn
* @return {?}
*/
QueryList.prototype.map = /**
* See
* [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
* @template U
* @param {?} fn
* @return {?}
*/
function (fn) { return this._results.map(fn); };
/**
* See
* [Array.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)
*/
/**
* See
* [Array.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)
* @param {?} fn
* @return {?}
*/
QueryList.prototype.filter = /**
* See
* [Array.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)
* @param {?} fn
* @return {?}
*/
function (fn) {
return this._results.filter(fn);
};
/**
* See
* [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)
*/
/**
* See
* [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)
* @param {?} fn
* @return {?}
*/
QueryList.prototype.find = /**
* See
* [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)
* @param {?} fn
* @return {?}
*/
function (fn) {
return this._results.find(fn);
};
/**
* See
* [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)
*/
/**
* See
* [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)
* @template U
* @param {?} fn
* @param {?} init
* @return {?}
*/
QueryList.prototype.reduce = /**
* See
* [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)
* @template U
* @param {?} fn
* @param {?} init
* @return {?}
*/
function (fn, init) {
return this._results.reduce(fn, init);
};
/**
* See
* [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)
*/
/**
* See
* [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)
* @param {?} fn
* @return {?}
*/
QueryList.prototype.forEach = /**
* See
* [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)
* @param {?} fn
* @return {?}
*/
function (fn) { this._results.forEach(fn); };
/**
* See
* [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some)
*/
/**
* See
* [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some)
* @param {?} fn
* @return {?}
*/
QueryList.prototype.some = /**
* See
* [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some)
* @param {?} fn
* @return {?}
*/
function (fn) {
return this._results.some(fn);
};
/**
* @return {?}
*/
QueryList.prototype.toArray = /**
* @return {?}
*/
function () { return this._results.slice(); };
/**
* @return {?}
*/
QueryList.prototype[getSymbolIterator()] = /**
* @return {?}
*/
function () { return (/** @type {?} */ (this._results))[getSymbolIterator()](); };
/**
* @return {?}
*/
QueryList.prototype.toString = /**
* @return {?}
*/
function () { return this._results.toString(); };
/**
* @param {?} res
* @return {?}
*/
QueryList.prototype.reset = /**
* @param {?} res
* @return {?}
*/
function (res) {
this._results = flatten(res);
(/** @type {?} */ (this)).dirty = false;
};
/**
* @return {?}
*/
QueryList.prototype.notifyOnChanges = /**
* @return {?}
*/
function () { (/** @type {?} */ (this.changes)).emit(this); };
/** internal */
/**
* internal
* @return {?}
*/
QueryList.prototype.setDirty = /**
* internal
* @return {?}
*/
function () { (/** @type {?} */ (this)).dirty = true; };
/** internal */
/**
* internal
* @return {?}
*/
QueryList.prototype.destroy = /**
* internal
* @return {?}
*/
function () {
(/** @type {?} */ (this.changes)).complete();
(/** @type {?} */ (this.changes)).unsubscribe();
};
return QueryList;
}());
/**
* @template T
* @param {?} list
* @return {?}
*/
function flatten(list) {
return list.reduce(function (flat, item) {
var /** @type {?} */ flatItem = Array.isArray(item) ? flatten(item) : item;
return (/** @type {?} */ (flat)).concat(flatItem);
}, []);
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var _SEPARATOR = '#';
var FACTORY_CLASS_SUFFIX = 'NgFactory';
/**
* Configuration for SystemJsNgModuleLoader.
* token.
*
* \@experimental
* @abstract
*/
var SystemJsNgModuleLoaderConfig = (function () {
function SystemJsNgModuleLoaderConfig() {
}
return SystemJsNgModuleLoaderConfig;
}());
var DEFAULT_CONFIG = {
factoryPathPrefix: '',
factoryPathSuffix: '.ngfactory',
};
/**
* NgModuleFactoryLoader that uses SystemJS to load NgModuleFactory
* \@experimental
*/
var SystemJsNgModuleLoader = (function () {
function SystemJsNgModuleLoader(_compiler, config) {
this._compiler = _compiler;
this._config = config || DEFAULT_CONFIG;
}
/**
* @param {?} path
* @return {?}
*/
SystemJsNgModuleLoader.prototype.load = /**
* @param {?} path
* @return {?}
*/
function (path) {
var /** @type {?} */ offlineMode = this._compiler instanceof Compiler;
return offlineMode ? this.loadFactory(path) : this.loadAndCompile(path);
};
/**
* @param {?} path
* @return {?}
*/
SystemJsNgModuleLoader.prototype.loadAndCompile = /**
* @param {?} path
* @return {?}
*/
function (path) {
var _this = this;
var _a = path.split(_SEPARATOR), module = _a[0], exportName = _a[1];
if (exportName === undefined) {
exportName = 'default';
}
return __webpack_require__(133)(module)
.then(function (module) { return module[exportName]; })
.then(function (type) { return checkNotEmpty(type, module, exportName); })
.then(function (type) { return _this._compiler.compileModuleAsync(type); });
};
/**
* @param {?} path
* @return {?}
*/
SystemJsNgModuleLoader.prototype.loadFactory = /**
* @param {?} path
* @return {?}
*/
function (path) {
var _a = path.split(_SEPARATOR), module = _a[0], exportName = _a[1];
var /** @type {?} */ factoryClassSuffix = FACTORY_CLASS_SUFFIX;
if (exportName === undefined) {
exportName = 'default';
factoryClassSuffix = '';
}
return __webpack_require__(133)(this._config.factoryPathPrefix + module + this._config.factoryPathSuffix)
.then(function (module) { return module[exportName + factoryClassSuffix]; })
.then(function (factory) { return checkNotEmpty(factory, module, exportName); });
};
SystemJsNgModuleLoader.decorators = [
{ type: Injectable },
];
/** @nocollapse */
SystemJsNgModuleLoader.ctorParameters = function () { return [
{ type: Compiler, },
{ type: SystemJsNgModuleLoaderConfig, decorators: [{ type: Optional },] },
]; };
return SystemJsNgModuleLoader;
}());
/**
* @param {?} value
* @param {?} modulePath
* @param {?} exportName
* @return {?}
*/
function checkNotEmpty(value, modulePath, exportName) {
if (!value) {
throw new Error("Cannot find '" + exportName + "' in '" + modulePath + "'");
}
return value;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Represents an Embedded Template that can be used to instantiate Embedded Views.
*
* You can access a `TemplateRef`, in two ways. Via a directive placed on a `<ng-template>` element
* (or directive prefixed with `*`) and have the `TemplateRef` for this Embedded View injected into
* the constructor of the directive using the `TemplateRef` Token. Alternatively you can query for
* the `TemplateRef` from a Component or a Directive via {\@link Query}.
*
* To instantiate Embedded Views based on a Template, use {\@link ViewContainerRef#
* createEmbeddedView}, which will create the View and attach it to the View Container.
* \@stable
* @abstract
*/
var TemplateRef = (function () {
function TemplateRef() {
}
return TemplateRef;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Represents a container where one or more Views can be attached.
*
* The container can contain two kinds of Views. Host Views, created by instantiating a
* {\@link Component} via {\@link #createComponent}, and Embedded Views, created by instantiating an
* {\@link TemplateRef Embedded Template} via {\@link #createEmbeddedView}.
*
* The location of the View Container within the containing View is specified by the Anchor
* `element`. Each View Container can have only one Anchor Element and each Anchor Element can only
* have a single View Container.
*
* Root elements of Views attached to this container become siblings of the Anchor Element in
* the Rendered View.
*
* To access a `ViewContainerRef` of an Element, you can either place a {\@link Directive} injected
* with `ViewContainerRef` on the Element, or you obtain it via a {\@link ViewChild} query.
* \@stable
* @abstract
*/
var ViewContainerRef = (function () {
function ViewContainerRef() {
}
return ViewContainerRef;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* \@stable
* @abstract
*/
var ChangeDetectorRef = (function () {
function ChangeDetectorRef() {
}
return ChangeDetectorRef;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* \@stable
* @abstract
*/
var ViewRef = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ViewRef, _super);
function ViewRef() {
return _super !== null && _super.apply(this, arguments) || this;
}
return ViewRef;
}(ChangeDetectorRef));
/**
* Represents an Angular View.
*
* <!-- TODO: move the next two paragraphs to the dev guide -->
* A View is a fundamental building block of the application UI. It is the smallest grouping of
* Elements which are created and destroyed together.
*
* Properties of elements in a View can change, but the structure (number and order) of elements in
* a View cannot. Changing the structure of Elements can only be done by inserting, moving or
* removing nested Views via a {\@link ViewContainerRef}. Each View can contain many View Containers.
* <!-- /TODO -->
*
* ### Example
*
* Given this template...
*
* ```
* Count: {{items.length}}
* <ul>
* <li *ngFor="let item of items">{{item}}</li>
* </ul>
* ```
*
* We have two {\@link TemplateRef}s:
*
* Outer {\@link TemplateRef}:
* ```
* Count: {{items.length}}
* <ul>
* <ng-template ngFor let-item [ngForOf]="items"></ng-template>
* </ul>
* ```
*
* Inner {\@link TemplateRef}:
* ```
* <li>{{item}}</li>
* ```
*
* Notice that the original template is broken down into two separate {\@link TemplateRef}s.
*
* The outer/inner {\@link TemplateRef}s are then assembled into views like so:
*
* ```
* <!-- ViewRef: outer-0 -->
* Count: 2
* <ul>
* <ng-template view-container-ref></ng-template>
* <!-- ViewRef: inner-1 --><li>first</li><!-- /ViewRef: inner-1 -->
* <!-- ViewRef: inner-2 --><li>second</li><!-- /ViewRef: inner-2 -->
* </ul>
* <!-- /ViewRef: outer-0 -->
* ```
* \@experimental
* @abstract
*/
var EmbeddedViewRef = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(EmbeddedViewRef, _super);
function EmbeddedViewRef() {
return _super !== null && _super.apply(this, arguments) || this;
}
return EmbeddedViewRef;
}(ViewRef));
/**
* @record
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// Public API for compiler
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var EventListener = (function () {
function EventListener(name, callback) {
this.name = name;
this.callback = callback;
}
return EventListener;
}());
/**
* \@experimental All debugging apis are currently experimental.
*/
var DebugNode = (function () {
function DebugNode(nativeNode, parent, _debugContext) {
this._debugContext = _debugContext;
this.nativeNode = nativeNode;
if (parent && parent instanceof DebugElement) {
parent.addChild(this);
}
else {
this.parent = null;
}
this.listeners = [];
}
Object.defineProperty(DebugNode.prototype, "injector", {
get: /**
* @return {?}
*/
function () { return this._debugContext.injector; },
enumerable: true,
configurable: true
});
Object.defineProperty(DebugNode.prototype, "componentInstance", {
get: /**
* @return {?}
*/
function () { return this._debugContext.component; },
enumerable: true,
configurable: true
});
Object.defineProperty(DebugNode.prototype, "context", {
get: /**
* @return {?}
*/
function () { return this._debugContext.context; },
enumerable: true,
configurable: true
});
Object.defineProperty(DebugNode.prototype, "references", {
get: /**
* @return {?}
*/
function () { return this._debugContext.references; },
enumerable: true,
configurable: true
});
Object.defineProperty(DebugNode.prototype, "providerTokens", {
get: /**
* @return {?}
*/
function () { return this._debugContext.providerTokens; },
enumerable: true,
configurable: true
});
return DebugNode;
}());
/**
* \@experimental All debugging apis are currently experimental.
*/
var DebugElement = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(DebugElement, _super);
function DebugElement(nativeNode, parent, _debugContext) {
var _this = _super.call(this, nativeNode, parent, _debugContext) || this;
_this.properties = {};
_this.attributes = {};
_this.classes = {};
_this.styles = {};
_this.childNodes = [];
_this.nativeElement = nativeNode;
return _this;
}
/**
* @param {?} child
* @return {?}
*/
DebugElement.prototype.addChild = /**
* @param {?} child
* @return {?}
*/
function (child) {
if (child) {
this.childNodes.push(child);
child.parent = this;
}
};
/**
* @param {?} child
* @return {?}
*/
DebugElement.prototype.removeChild = /**
* @param {?} child
* @return {?}
*/
function (child) {
var /** @type {?} */ childIndex = this.childNodes.indexOf(child);
if (childIndex !== -1) {
child.parent = null;
this.childNodes.splice(childIndex, 1);
}
};
/**
* @param {?} child
* @param {?} newChildren
* @return {?}
*/
DebugElement.prototype.insertChildrenAfter = /**
* @param {?} child
* @param {?} newChildren
* @return {?}
*/
function (child, newChildren) {
var _this = this;
var /** @type {?} */ siblingIndex = this.childNodes.indexOf(child);
if (siblingIndex !== -1) {
(_a = this.childNodes).splice.apply(_a, [siblingIndex + 1, 0].concat(newChildren));
newChildren.forEach(function (c) {
if (c.parent) {
c.parent.removeChild(c);
}
c.parent = _this;
});
}
var _a;
};
/**
* @param {?} refChild
* @param {?} newChild
* @return {?}
*/
DebugElement.prototype.insertBefore = /**
* @param {?} refChild
* @param {?} newChild
* @return {?}
*/
function (refChild, newChild) {
var /** @type {?} */ refIndex = this.childNodes.indexOf(refChild);
if (refIndex === -1) {
this.addChild(newChild);
}
else {
if (newChild.parent) {
newChild.parent.removeChild(newChild);
}
newChild.parent = this;
this.childNodes.splice(refIndex, 0, newChild);
}
};
/**
* @param {?} predicate
* @return {?}
*/
DebugElement.prototype.query = /**
* @param {?} predicate
* @return {?}
*/
function (predicate) {
var /** @type {?} */ results = this.queryAll(predicate);
return results[0] || null;
};
/**
* @param {?} predicate
* @return {?}
*/
DebugElement.prototype.queryAll = /**
* @param {?} predicate
* @return {?}
*/
function (predicate) {
var /** @type {?} */ matches = [];
_queryElementChildren(this, predicate, matches);
return matches;
};
/**
* @param {?} predicate
* @return {?}
*/
DebugElement.prototype.queryAllNodes = /**
* @param {?} predicate
* @return {?}
*/
function (predicate) {
var /** @type {?} */ matches = [];
_queryNodeChildren(this, predicate, matches);
return matches;
};
Object.defineProperty(DebugElement.prototype, "children", {
get: /**
* @return {?}
*/
function () {
return /** @type {?} */ (this.childNodes.filter(function (node) { return node instanceof DebugElement; }));
},
enumerable: true,
configurable: true
});
/**
* @param {?} eventName
* @param {?} eventObj
* @return {?}
*/
DebugElement.prototype.triggerEventHandler = /**
* @param {?} eventName
* @param {?} eventObj
* @return {?}
*/
function (eventName, eventObj) {
this.listeners.forEach(function (listener) {
if (listener.name == eventName) {
listener.callback(eventObj);
}
});
};
return DebugElement;
}(DebugNode));
/**
* \@experimental
* @param {?} debugEls
* @return {?}
*/
function asNativeElements(debugEls) {
return debugEls.map(function (el) { return el.nativeElement; });
}
/**
* @param {?} element
* @param {?} predicate
* @param {?} matches
* @return {?}
*/
function _queryElementChildren(element, predicate, matches) {
element.childNodes.forEach(function (node) {
if (node instanceof DebugElement) {
if (predicate(node)) {
matches.push(node);
}
_queryElementChildren(node, predicate, matches);
}
});
}
/**
* @param {?} parentNode
* @param {?} predicate
* @param {?} matches
* @return {?}
*/
function _queryNodeChildren(parentNode, predicate, matches) {
if (parentNode instanceof DebugElement) {
parentNode.childNodes.forEach(function (node) {
if (predicate(node)) {
matches.push(node);
}
if (node instanceof DebugElement) {
_queryNodeChildren(node, predicate, matches);
}
});
}
}
// Need to keep the nodes in a global Map so that multiple angular apps are supported.
var _nativeNodeToDebugNode = new Map();
/**
* \@experimental
* @param {?} nativeNode
* @return {?}
*/
function getDebugNode(nativeNode) {
return _nativeNodeToDebugNode.get(nativeNode) || null;
}
/**
* @return {?}
*/
/**
* @param {?} node
* @return {?}
*/
function indexDebugNode(node) {
_nativeNodeToDebugNode.set(node.nativeNode, node);
}
/**
* @param {?} node
* @return {?}
*/
function removeDebugNodeFromIndex(node) {
_nativeNodeToDebugNode.delete(node.nativeNode);
}
/**
* A boolean-valued function over a value, possibly including context information
* regarding that value's position in an array.
*
* \@experimental All debugging apis are currently experimental.
* @record
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @param {?} a
* @param {?} b
* @return {?}
*/
function devModeEqual(a, b) {
var /** @type {?} */ isListLikeIterableA = isListLikeIterable(a);
var /** @type {?} */ isListLikeIterableB = isListLikeIterable(b);
if (isListLikeIterableA && isListLikeIterableB) {
return areIterablesEqual(a, b, devModeEqual);
}
else {
var /** @type {?} */ isAObject = a && (typeof a === 'object' || typeof a === 'function');
var /** @type {?} */ isBObject = b && (typeof b === 'object' || typeof b === 'function');
if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) {
return true;
}
else {
return looseIdentical(a, b);
}
}
}
/**
* Indicates that the result of a {\@link Pipe} transformation has changed even though the
* reference
* has not changed.
*
* The wrapped value will be unwrapped by change detection, and the unwrapped value will be stored.
*
* Example:
*
* ```
* if (this._latestValue === this._latestReturnedValue) {
* return this._latestReturnedValue;
* } else {
* this._latestReturnedValue = this._latestValue;
* return WrappedValue.wrap(this._latestValue); // this will force update
* }
* ```
* \@stable
*/
var WrappedValue = (function () {
function WrappedValue(wrapped) {
this.wrapped = wrapped;
}
/**
* @param {?} value
* @return {?}
*/
WrappedValue.wrap = /**
* @param {?} value
* @return {?}
*/
function (value) { return new WrappedValue(value); };
return WrappedValue;
}());
/**
* Helper class for unwrapping WrappedValue s
*/
var ValueUnwrapper = (function () {
function ValueUnwrapper() {
this.hasWrappedValue = false;
}
/**
* @param {?} value
* @return {?}
*/
ValueUnwrapper.prototype.unwrap = /**
* @param {?} value
* @return {?}
*/
function (value) {
if (value instanceof WrappedValue) {
this.hasWrappedValue = true;
return value.wrapped;
}
return value;
};
/**
* @return {?}
*/
ValueUnwrapper.prototype.reset = /**
* @return {?}
*/
function () { this.hasWrappedValue = false; };
return ValueUnwrapper;
}());
/**
* Represents a basic change from a previous to a new value.
* \@stable
*/
var SimpleChange = (function () {
function SimpleChange(previousValue, currentValue, firstChange) {
this.previousValue = previousValue;
this.currentValue = currentValue;
this.firstChange = firstChange;
}
/**
* Check whether the new value is the first value assigned.
*/
/**
* Check whether the new value is the first value assigned.
* @return {?}
*/
SimpleChange.prototype.isFirstChange = /**
* Check whether the new value is the first value assigned.
* @return {?}
*/
function () { return this.firstChange; };
return SimpleChange;
}());
/**
* @param {?} obj
* @return {?}
*/
function isListLikeIterable(obj) {
if (!isJsObject(obj))
return false;
return Array.isArray(obj) ||
(!(obj instanceof Map) &&
// JS Map are iterables but return entries as [k, v]
getSymbolIterator() in obj); // JS Iterable have a Symbol.iterator prop
}
/**
* @param {?} a
* @param {?} b
* @param {?} comparator
* @return {?}
*/
function areIterablesEqual(a, b, comparator) {
var /** @type {?} */ iterator1 = a[getSymbolIterator()]();
var /** @type {?} */ iterator2 = b[getSymbolIterator()]();
while (true) {
var /** @type {?} */ item1 = iterator1.next();
var /** @type {?} */ item2 = iterator2.next();
if (item1.done && item2.done)
return true;
if (item1.done || item2.done)
return false;
if (!comparator(item1.value, item2.value))
return false;
}
}
/**
* @param {?} obj
* @param {?} fn
* @return {?}
*/
function iterateListLike(obj, fn) {
if (Array.isArray(obj)) {
for (var /** @type {?} */ i = 0; i < obj.length; i++) {
fn(obj[i]);
}
}
else {
var /** @type {?} */ iterator = obj[getSymbolIterator()]();
var /** @type {?} */ item = void 0;
while (!((item = iterator.next()).done)) {
fn(item.value);
}
}
}
/**
* @param {?} o
* @return {?}
*/
function isJsObject(o) {
return o !== null && (typeof o === 'function' || typeof o === 'object');
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var DefaultIterableDifferFactory = (function () {
function DefaultIterableDifferFactory() {
}
/**
* @param {?} obj
* @return {?}
*/
DefaultIterableDifferFactory.prototype.supports = /**
* @param {?} obj
* @return {?}
*/
function (obj) { return isListLikeIterable(obj); };
/**
* @template V
* @param {?=} trackByFn
* @return {?}
*/
DefaultIterableDifferFactory.prototype.create = /**
* @template V
* @param {?=} trackByFn
* @return {?}
*/
function (trackByFn) {
return new DefaultIterableDiffer(trackByFn);
};
return DefaultIterableDifferFactory;
}());
var trackByIdentity = function (index, item) { return item; };
/**
* @deprecated v4.0.0 - Should not be part of public API.
*/
var DefaultIterableDiffer = (function () {
function DefaultIterableDiffer(trackByFn) {
this.length = 0;
this._linkedRecords = null;
this._unlinkedRecords = null;
this._previousItHead = null;
this._itHead = null;
this._itTail = null;
this._additionsHead = null;
this._additionsTail = null;
this._movesHead = null;
this._movesTail = null;
this._removalsHead = null;
this._removalsTail = null;
this._identityChangesHead = null;
this._identityChangesTail = null;
this._trackByFn = trackByFn || trackByIdentity;
}
/**
* @param {?} fn
* @return {?}
*/
DefaultIterableDiffer.prototype.forEachItem = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
var /** @type {?} */ record;
for (record = this._itHead; record !== null; record = record._next) {
fn(record);
}
};
/**
* @param {?} fn
* @return {?}
*/
DefaultIterableDiffer.prototype.forEachOperation = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
var /** @type {?} */ nextIt = this._itHead;
var /** @type {?} */ nextRemove = this._removalsHead;
var /** @type {?} */ addRemoveOffset = 0;
var /** @type {?} */ moveOffsets = null;
while (nextIt || nextRemove) {
// Figure out which is the next record to process
// Order: remove, add, move
var /** @type {?} */ record = !nextRemove ||
nextIt && /** @type {?} */ ((nextIt.currentIndex)) < getPreviousIndex(nextRemove, addRemoveOffset, moveOffsets) ?
/** @type {?} */ ((nextIt)) :
nextRemove;
var /** @type {?} */ adjPreviousIndex = getPreviousIndex(record, addRemoveOffset, moveOffsets);
var /** @type {?} */ currentIndex = record.currentIndex;
// consume the item, and adjust the addRemoveOffset and update moveDistance if necessary
if (record === nextRemove) {
addRemoveOffset--;
nextRemove = nextRemove._nextRemoved;
}
else {
nextIt = /** @type {?} */ ((nextIt))._next;
if (record.previousIndex == null) {
addRemoveOffset++;
}
else {
// INVARIANT: currentIndex < previousIndex
if (!moveOffsets)
moveOffsets = [];
var /** @type {?} */ localMovePreviousIndex = adjPreviousIndex - addRemoveOffset;
var /** @type {?} */ localCurrentIndex = /** @type {?} */ ((currentIndex)) - addRemoveOffset;
if (localMovePreviousIndex != localCurrentIndex) {
for (var /** @type {?} */ i = 0; i < localMovePreviousIndex; i++) {
var /** @type {?} */ offset = i < moveOffsets.length ? moveOffsets[i] : (moveOffsets[i] = 0);
var /** @type {?} */ index = offset + i;
if (localCurrentIndex <= index && index < localMovePreviousIndex) {
moveOffsets[i] = offset + 1;
}
}
var /** @type {?} */ previousIndex = record.previousIndex;
moveOffsets[previousIndex] = localCurrentIndex - localMovePreviousIndex;
}
}
}
if (adjPreviousIndex !== currentIndex) {
fn(record, adjPreviousIndex, currentIndex);
}
}
};
/**
* @param {?} fn
* @return {?}
*/
DefaultIterableDiffer.prototype.forEachPreviousItem = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
var /** @type {?} */ record;
for (record = this._previousItHead; record !== null; record = record._nextPrevious) {
fn(record);
}
};
/**
* @param {?} fn
* @return {?}
*/
DefaultIterableDiffer.prototype.forEachAddedItem = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
var /** @type {?} */ record;
for (record = this._additionsHead; record !== null; record = record._nextAdded) {
fn(record);
}
};
/**
* @param {?} fn
* @return {?}
*/
DefaultIterableDiffer.prototype.forEachMovedItem = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
var /** @type {?} */ record;
for (record = this._movesHead; record !== null; record = record._nextMoved) {
fn(record);
}
};
/**
* @param {?} fn
* @return {?}
*/
DefaultIterableDiffer.prototype.forEachRemovedItem = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
var /** @type {?} */ record;
for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
fn(record);
}
};
/**
* @param {?} fn
* @return {?}
*/
DefaultIterableDiffer.prototype.forEachIdentityChange = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
var /** @type {?} */ record;
for (record = this._identityChangesHead; record !== null; record = record._nextIdentityChange) {
fn(record);
}
};
/**
* @param {?} collection
* @return {?}
*/
DefaultIterableDiffer.prototype.diff = /**
* @param {?} collection
* @return {?}
*/
function (collection) {
if (collection == null)
collection = [];
if (!isListLikeIterable(collection)) {
throw new Error("Error trying to diff '" + stringify(collection) + "'. Only arrays and iterables are allowed");
}
if (this.check(collection)) {
return this;
}
else {
return null;
}
};
/**
* @return {?}
*/
DefaultIterableDiffer.prototype.onDestroy = /**
* @return {?}
*/
function () { };
/**
* @param {?} collection
* @return {?}
*/
DefaultIterableDiffer.prototype.check = /**
* @param {?} collection
* @return {?}
*/
function (collection) {
var _this = this;
this._reset();
var /** @type {?} */ record = this._itHead;
var /** @type {?} */ mayBeDirty = false;
var /** @type {?} */ index;
var /** @type {?} */ item;
var /** @type {?} */ itemTrackBy;
if (Array.isArray(collection)) {
(/** @type {?} */ (this)).length = collection.length;
for (var /** @type {?} */ index_1 = 0; index_1 < this.length; index_1++) {
item = collection[index_1];
itemTrackBy = this._trackByFn(index_1, item);
if (record === null || !looseIdentical(record.trackById, itemTrackBy)) {
record = this._mismatch(record, item, itemTrackBy, index_1);
mayBeDirty = true;
}
else {
if (mayBeDirty) {
// TODO(misko): can we limit this to duplicates only?
record = this._verifyReinsertion(record, item, itemTrackBy, index_1);
}
if (!looseIdentical(record.item, item))
this._addIdentityChange(record, item);
}
record = record._next;
}
}
else {
index = 0;
iterateListLike(collection, function (item) {
itemTrackBy = _this._trackByFn(index, item);
if (record === null || !looseIdentical(record.trackById, itemTrackBy)) {
record = _this._mismatch(record, item, itemTrackBy, index);
mayBeDirty = true;
}
else {
if (mayBeDirty) {
// TODO(misko): can we limit this to duplicates only?
record = _this._verifyReinsertion(record, item, itemTrackBy, index);
}
if (!looseIdentical(record.item, item))
_this._addIdentityChange(record, item);
}
record = record._next;
index++;
});
(/** @type {?} */ (this)).length = index;
}
this._truncate(record);
(/** @type {?} */ (this)).collection = collection;
return this.isDirty;
};
Object.defineProperty(DefaultIterableDiffer.prototype, "isDirty", {
/* CollectionChanges is considered dirty if it has any additions, moves, removals, or identity
* changes.
*/
get: /**
* @return {?}
*/
function () {
return this._additionsHead !== null || this._movesHead !== null ||
this._removalsHead !== null || this._identityChangesHead !== null;
},
enumerable: true,
configurable: true
});
/**
* Reset the state of the change objects to show no changes. This means set previousKey to
* currentKey, and clear all of the queues (additions, moves, removals).
* Set the previousIndexes of moved and added items to their currentIndexes
* Reset the list of additions, moves and removals
*
* @internal
*/
/**
* Reset the state of the change objects to show no changes. This means set previousKey to
* currentKey, and clear all of the queues (additions, moves, removals).
* Set the previousIndexes of moved and added items to their currentIndexes
* Reset the list of additions, moves and removals
*
* \@internal
* @return {?}
*/
DefaultIterableDiffer.prototype._reset = /**
* Reset the state of the change objects to show no changes. This means set previousKey to
* currentKey, and clear all of the queues (additions, moves, removals).
* Set the previousIndexes of moved and added items to their currentIndexes
* Reset the list of additions, moves and removals
*
* \@internal
* @return {?}
*/
function () {
if (this.isDirty) {
var /** @type {?} */ record = void 0;
var /** @type {?} */ nextRecord = void 0;
for (record = this._previousItHead = this._itHead; record !== null; record = record._next) {
record._nextPrevious = record._next;
}
for (record = this._additionsHead; record !== null; record = record._nextAdded) {
record.previousIndex = record.currentIndex;
}
this._additionsHead = this._additionsTail = null;
for (record = this._movesHead; record !== null; record = nextRecord) {
record.previousIndex = record.currentIndex;
nextRecord = record._nextMoved;
}
this._movesHead = this._movesTail = null;
this._removalsHead = this._removalsTail = null;
this._identityChangesHead = this._identityChangesTail = null;
// todo(vicb) when assert gets supported
// assert(!this.isDirty);
}
};
/**
* This is the core function which handles differences between collections.
*
* - `record` is the record which we saw at this position last time. If null then it is a new
* item.
* - `item` is the current item in the collection
* - `index` is the position of the item in the collection
*
* @internal
*/
/**
* This is the core function which handles differences between collections.
*
* - `record` is the record which we saw at this position last time. If null then it is a new
* item.
* - `item` is the current item in the collection
* - `index` is the position of the item in the collection
*
* \@internal
* @param {?} record
* @param {?} item
* @param {?} itemTrackBy
* @param {?} index
* @return {?}
*/
DefaultIterableDiffer.prototype._mismatch = /**
* This is the core function which handles differences between collections.
*
* - `record` is the record which we saw at this position last time. If null then it is a new
* item.
* - `item` is the current item in the collection
* - `index` is the position of the item in the collection
*
* \@internal
* @param {?} record
* @param {?} item
* @param {?} itemTrackBy
* @param {?} index
* @return {?}
*/
function (record, item, itemTrackBy, index) {
// The previous record after which we will append the current one.
var /** @type {?} */ previousRecord;
if (record === null) {
previousRecord = this._itTail;
}
else {
previousRecord = record._prev;
// Remove the record from the collection since we know it does not match the item.
this._remove(record);
}
// Attempt to see if we have seen the item before.
record = this._linkedRecords === null ? null : this._linkedRecords.get(itemTrackBy, index);
if (record !== null) {
// We have seen this before, we need to move it forward in the collection.
// But first we need to check if identity changed, so we can update in view if necessary
if (!looseIdentical(record.item, item))
this._addIdentityChange(record, item);
this._moveAfter(record, previousRecord, index);
}
else {
// Never seen it, check evicted list.
record = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
if (record !== null) {
// It is an item which we have evicted earlier: reinsert it back into the list.
// But first we need to check if identity changed, so we can update in view if necessary
if (!looseIdentical(record.item, item))
this._addIdentityChange(record, item);
this._reinsertAfter(record, previousRecord, index);
}
else {
// It is a new item: add it.
record =
this._addAfter(new IterableChangeRecord_(item, itemTrackBy), previousRecord, index);
}
}
return record;
};
/**
* This check is only needed if an array contains duplicates. (Short circuit of nothing dirty)
*
* Use case: `[a, a]` => `[b, a, a]`
*
* If we did not have this check then the insertion of `b` would:
* 1) evict first `a`
* 2) insert `b` at `0` index.
* 3) leave `a` at index `1` as is. <-- this is wrong!
* 3) reinsert `a` at index 2. <-- this is wrong!
*
* The correct behavior is:
* 1) evict first `a`
* 2) insert `b` at `0` index.
* 3) reinsert `a` at index 1.
* 3) move `a` at from `1` to `2`.
*
*
* Double check that we have not evicted a duplicate item. We need to check if the item type may
* have already been removed:
* The insertion of b will evict the first 'a'. If we don't reinsert it now it will be reinserted
* at the end. Which will show up as the two 'a's switching position. This is incorrect, since a
* better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a'
* at the end.
*
* @internal
*/
/**
* This check is only needed if an array contains duplicates. (Short circuit of nothing dirty)
*
* Use case: `[a, a]` => `[b, a, a]`
*
* If we did not have this check then the insertion of `b` would:
* 1) evict first `a`
* 2) insert `b` at `0` index.
* 3) leave `a` at index `1` as is. <-- this is wrong!
* 3) reinsert `a` at index 2. <-- this is wrong!
*
* The correct behavior is:
* 1) evict first `a`
* 2) insert `b` at `0` index.
* 3) reinsert `a` at index 1.
* 3) move `a` at from `1` to `2`.
*
*
* Double check that we have not evicted a duplicate item. We need to check if the item type may
* have already been removed:
* The insertion of b will evict the first 'a'. If we don't reinsert it now it will be reinserted
* at the end. Which will show up as the two 'a's switching position. This is incorrect, since a
* better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a'
* at the end.
*
* \@internal
* @param {?} record
* @param {?} item
* @param {?} itemTrackBy
* @param {?} index
* @return {?}
*/
DefaultIterableDiffer.prototype._verifyReinsertion = /**
* This check is only needed if an array contains duplicates. (Short circuit of nothing dirty)
*
* Use case: `[a, a]` => `[b, a, a]`
*
* If we did not have this check then the insertion of `b` would:
* 1) evict first `a`
* 2) insert `b` at `0` index.
* 3) leave `a` at index `1` as is. <-- this is wrong!
* 3) reinsert `a` at index 2. <-- this is wrong!
*
* The correct behavior is:
* 1) evict first `a`
* 2) insert `b` at `0` index.
* 3) reinsert `a` at index 1.
* 3) move `a` at from `1` to `2`.
*
*
* Double check that we have not evicted a duplicate item. We need to check if the item type may
* have already been removed:
* The insertion of b will evict the first 'a'. If we don't reinsert it now it will be reinserted
* at the end. Which will show up as the two 'a's switching position. This is incorrect, since a
* better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a'
* at the end.
*
* \@internal
* @param {?} record
* @param {?} item
* @param {?} itemTrackBy
* @param {?} index
* @return {?}
*/
function (record, item, itemTrackBy, index) {
var /** @type {?} */ reinsertRecord = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
if (reinsertRecord !== null) {
record = this._reinsertAfter(reinsertRecord, /** @type {?} */ ((record._prev)), index);
}
else if (record.currentIndex != index) {
record.currentIndex = index;
this._addToMoves(record, index);
}
return record;
};
/**
* Get rid of any excess {@link IterableChangeRecord_}s from the previous collection
*
* - `record` The first excess {@link IterableChangeRecord_}.
*
* @internal
*/
/**
* Get rid of any excess {\@link IterableChangeRecord_}s from the previous collection
*
* - `record` The first excess {\@link IterableChangeRecord_}.
*
* \@internal
* @param {?} record
* @return {?}
*/
DefaultIterableDiffer.prototype._truncate = /**
* Get rid of any excess {\@link IterableChangeRecord_}s from the previous collection
*
* - `record` The first excess {\@link IterableChangeRecord_}.
*
* \@internal
* @param {?} record
* @return {?}
*/
function (record) {
// Anything after that needs to be removed;
while (record !== null) {
var /** @type {?} */ nextRecord = record._next;
this._addToRemovals(this._unlink(record));
record = nextRecord;
}
if (this._unlinkedRecords !== null) {
this._unlinkedRecords.clear();
}
if (this._additionsTail !== null) {
this._additionsTail._nextAdded = null;
}
if (this._movesTail !== null) {
this._movesTail._nextMoved = null;
}
if (this._itTail !== null) {
this._itTail._next = null;
}
if (this._removalsTail !== null) {
this._removalsTail._nextRemoved = null;
}
if (this._identityChangesTail !== null) {
this._identityChangesTail._nextIdentityChange = null;
}
};
/** @internal */
/**
* \@internal
* @param {?} record
* @param {?} prevRecord
* @param {?} index
* @return {?}
*/
DefaultIterableDiffer.prototype._reinsertAfter = /**
* \@internal
* @param {?} record
* @param {?} prevRecord
* @param {?} index
* @return {?}
*/
function (record, prevRecord, index) {
if (this._unlinkedRecords !== null) {
this._unlinkedRecords.remove(record);
}
var /** @type {?} */ prev = record._prevRemoved;
var /** @type {?} */ next = record._nextRemoved;
if (prev === null) {
this._removalsHead = next;
}
else {
prev._nextRemoved = next;
}
if (next === null) {
this._removalsTail = prev;
}
else {
next._prevRemoved = prev;
}
this._insertAfter(record, prevRecord, index);
this._addToMoves(record, index);
return record;
};
/** @internal */
/**
* \@internal
* @param {?} record
* @param {?} prevRecord
* @param {?} index
* @return {?}
*/
DefaultIterableDiffer.prototype._moveAfter = /**
* \@internal
* @param {?} record
* @param {?} prevRecord
* @param {?} index
* @return {?}
*/
function (record, prevRecord, index) {
this._unlink(record);
this._insertAfter(record, prevRecord, index);
this._addToMoves(record, index);
return record;
};
/** @internal */
/**
* \@internal
* @param {?} record
* @param {?} prevRecord
* @param {?} index
* @return {?}
*/
DefaultIterableDiffer.prototype._addAfter = /**
* \@internal
* @param {?} record
* @param {?} prevRecord
* @param {?} index
* @return {?}
*/
function (record, prevRecord, index) {
this._insertAfter(record, prevRecord, index);
if (this._additionsTail === null) {
// todo(vicb)
// assert(this._additionsHead === null);
this._additionsTail = this._additionsHead = record;
}
else {
// todo(vicb)
// assert(_additionsTail._nextAdded === null);
// assert(record._nextAdded === null);
this._additionsTail = this._additionsTail._nextAdded = record;
}
return record;
};
/** @internal */
/**
* \@internal
* @param {?} record
* @param {?} prevRecord
* @param {?} index
* @return {?}
*/
DefaultIterableDiffer.prototype._insertAfter = /**
* \@internal
* @param {?} record
* @param {?} prevRecord
* @param {?} index
* @return {?}
*/
function (record, prevRecord, index) {
// todo(vicb)
// assert(record != prevRecord);
// assert(record._next === null);
// assert(record._prev === null);
var /** @type {?} */ next = prevRecord === null ? this._itHead : prevRecord._next;
// todo(vicb)
// assert(next != record);
// assert(prevRecord != record);
record._next = next;
record._prev = prevRecord;
if (next === null) {
this._itTail = record;
}
else {
next._prev = record;
}
if (prevRecord === null) {
this._itHead = record;
}
else {
prevRecord._next = record;
}
if (this._linkedRecords === null) {
this._linkedRecords = new _DuplicateMap();
}
this._linkedRecords.put(record);
record.currentIndex = index;
return record;
};
/** @internal */
/**
* \@internal
* @param {?} record
* @return {?}
*/
DefaultIterableDiffer.prototype._remove = /**
* \@internal
* @param {?} record
* @return {?}
*/
function (record) {
return this._addToRemovals(this._unlink(record));
};
/** @internal */
/**
* \@internal
* @param {?} record
* @return {?}
*/
DefaultIterableDiffer.prototype._unlink = /**
* \@internal
* @param {?} record
* @return {?}
*/
function (record) {
if (this._linkedRecords !== null) {
this._linkedRecords.remove(record);
}
var /** @type {?} */ prev = record._prev;
var /** @type {?} */ next = record._next;
// todo(vicb)
// assert((record._prev = null) === null);
// assert((record._next = null) === null);
if (prev === null) {
this._itHead = next;
}
else {
prev._next = next;
}
if (next === null) {
this._itTail = prev;
}
else {
next._prev = prev;
}
return record;
};
/** @internal */
/**
* \@internal
* @param {?} record
* @param {?} toIndex
* @return {?}
*/
DefaultIterableDiffer.prototype._addToMoves = /**
* \@internal
* @param {?} record
* @param {?} toIndex
* @return {?}
*/
function (record, toIndex) {
// todo(vicb)
// assert(record._nextMoved === null);
if (record.previousIndex === toIndex) {
return record;
}
if (this._movesTail === null) {
// todo(vicb)
// assert(_movesHead === null);
this._movesTail = this._movesHead = record;
}
else {
// todo(vicb)
// assert(_movesTail._nextMoved === null);
this._movesTail = this._movesTail._nextMoved = record;
}
return record;
};
/**
* @param {?} record
* @return {?}
*/
DefaultIterableDiffer.prototype._addToRemovals = /**
* @param {?} record
* @return {?}
*/
function (record) {
if (this._unlinkedRecords === null) {
this._unlinkedRecords = new _DuplicateMap();
}
this._unlinkedRecords.put(record);
record.currentIndex = null;
record._nextRemoved = null;
if (this._removalsTail === null) {
// todo(vicb)
// assert(_removalsHead === null);
this._removalsTail = this._removalsHead = record;
record._prevRemoved = null;
}
else {
// todo(vicb)
// assert(_removalsTail._nextRemoved === null);
// assert(record._nextRemoved === null);
record._prevRemoved = this._removalsTail;
this._removalsTail = this._removalsTail._nextRemoved = record;
}
return record;
};
/** @internal */
/**
* \@internal
* @param {?} record
* @param {?} item
* @return {?}
*/
DefaultIterableDiffer.prototype._addIdentityChange = /**
* \@internal
* @param {?} record
* @param {?} item
* @return {?}
*/
function (record, item) {
record.item = item;
if (this._identityChangesTail === null) {
this._identityChangesTail = this._identityChangesHead = record;
}
else {
this._identityChangesTail = this._identityChangesTail._nextIdentityChange = record;
}
return record;
};
return DefaultIterableDiffer;
}());
/**
* \@stable
*/
var IterableChangeRecord_ = (function () {
function IterableChangeRecord_(item, trackById) {
this.item = item;
this.trackById = trackById;
this.currentIndex = null;
this.previousIndex = null;
/**
* \@internal
*/
this._nextPrevious = null;
/**
* \@internal
*/
this._prev = null;
/**
* \@internal
*/
this._next = null;
/**
* \@internal
*/
this._prevDup = null;
/**
* \@internal
*/
this._nextDup = null;
/**
* \@internal
*/
this._prevRemoved = null;
/**
* \@internal
*/
this._nextRemoved = null;
/**
* \@internal
*/
this._nextAdded = null;
/**
* \@internal
*/
this._nextMoved = null;
/**
* \@internal
*/
this._nextIdentityChange = null;
}
return IterableChangeRecord_;
}());
var _DuplicateItemRecordList = (function () {
function _DuplicateItemRecordList() {
/**
* \@internal
*/
this._head = null;
/**
* \@internal
*/
this._tail = null;
}
/**
* Append the record to the list of duplicates.
*
* Note: by design all records in the list of duplicates hold the same value in record.item.
*/
/**
* Append the record to the list of duplicates.
*
* Note: by design all records in the list of duplicates hold the same value in record.item.
* @param {?} record
* @return {?}
*/
_DuplicateItemRecordList.prototype.add = /**
* Append the record to the list of duplicates.
*
* Note: by design all records in the list of duplicates hold the same value in record.item.
* @param {?} record
* @return {?}
*/
function (record) {
if (this._head === null) {
this._head = this._tail = record;
record._nextDup = null;
record._prevDup = null;
}
else {
/** @type {?} */ ((
// todo(vicb)
// assert(record.item == _head.item ||
// record.item is num && record.item.isNaN && _head.item is num && _head.item.isNaN);
this._tail))._nextDup = record;
record._prevDup = this._tail;
record._nextDup = null;
this._tail = record;
}
};
// Returns a IterableChangeRecord_ having IterableChangeRecord_.trackById == trackById and
// IterableChangeRecord_.currentIndex >= atOrAfterIndex
/**
* @param {?} trackById
* @param {?} atOrAfterIndex
* @return {?}
*/
_DuplicateItemRecordList.prototype.get = /**
* @param {?} trackById
* @param {?} atOrAfterIndex
* @return {?}
*/
function (trackById, atOrAfterIndex) {
var /** @type {?} */ record;
for (record = this._head; record !== null; record = record._nextDup) {
if ((atOrAfterIndex === null || atOrAfterIndex <= /** @type {?} */ ((record.currentIndex))) &&
looseIdentical(record.trackById, trackById)) {
return record;
}
}
return null;
};
/**
* Remove one {@link IterableChangeRecord_} from the list of duplicates.
*
* Returns whether the list of duplicates is empty.
*/
/**
* Remove one {\@link IterableChangeRecord_} from the list of duplicates.
*
* Returns whether the list of duplicates is empty.
* @param {?} record
* @return {?}
*/
_DuplicateItemRecordList.prototype.remove = /**
* Remove one {\@link IterableChangeRecord_} from the list of duplicates.
*
* Returns whether the list of duplicates is empty.
* @param {?} record
* @return {?}
*/
function (record) {
// todo(vicb)
// assert(() {
// // verify that the record being removed is in the list.
// for (IterableChangeRecord_ cursor = _head; cursor != null; cursor = cursor._nextDup) {
// if (identical(cursor, record)) return true;
// }
// return false;
//});
var /** @type {?} */ prev = record._prevDup;
var /** @type {?} */ next = record._nextDup;
if (prev === null) {
this._head = next;
}
else {
prev._nextDup = next;
}
if (next === null) {
this._tail = prev;
}
else {
next._prevDup = prev;
}
return this._head === null;
};
return _DuplicateItemRecordList;
}());
var _DuplicateMap = (function () {
function _DuplicateMap() {
this.map = new Map();
}
/**
* @param {?} record
* @return {?}
*/
_DuplicateMap.prototype.put = /**
* @param {?} record
* @return {?}
*/
function (record) {
var /** @type {?} */ key = record.trackById;
var /** @type {?} */ duplicates = this.map.get(key);
if (!duplicates) {
duplicates = new _DuplicateItemRecordList();
this.map.set(key, duplicates);
}
duplicates.add(record);
};
/**
* Retrieve the `value` using key. Because the IterableChangeRecord_ value may be one which we
* have already iterated over, we use the `atOrAfterIndex` to pretend it is not there.
*
* Use case: `[a, b, c, a, a]` if we are at index `3` which is the second `a` then asking if we
* have any more `a`s needs to return the second `a`.
*/
/**
* Retrieve the `value` using key. Because the IterableChangeRecord_ value may be one which we
* have already iterated over, we use the `atOrAfterIndex` to pretend it is not there.
*
* Use case: `[a, b, c, a, a]` if we are at index `3` which is the second `a` then asking if we
* have any more `a`s needs to return the second `a`.
* @param {?} trackById
* @param {?} atOrAfterIndex
* @return {?}
*/
_DuplicateMap.prototype.get = /**
* Retrieve the `value` using key. Because the IterableChangeRecord_ value may be one which we
* have already iterated over, we use the `atOrAfterIndex` to pretend it is not there.
*
* Use case: `[a, b, c, a, a]` if we are at index `3` which is the second `a` then asking if we
* have any more `a`s needs to return the second `a`.
* @param {?} trackById
* @param {?} atOrAfterIndex
* @return {?}
*/
function (trackById, atOrAfterIndex) {
var /** @type {?} */ key = trackById;
var /** @type {?} */ recordList = this.map.get(key);
return recordList ? recordList.get(trackById, atOrAfterIndex) : null;
};
/**
* Removes a {@link IterableChangeRecord_} from the list of duplicates.
*
* The list of duplicates also is removed from the map if it gets empty.
*/
/**
* Removes a {\@link IterableChangeRecord_} from the list of duplicates.
*
* The list of duplicates also is removed from the map if it gets empty.
* @param {?} record
* @return {?}
*/
_DuplicateMap.prototype.remove = /**
* Removes a {\@link IterableChangeRecord_} from the list of duplicates.
*
* The list of duplicates also is removed from the map if it gets empty.
* @param {?} record
* @return {?}
*/
function (record) {
var /** @type {?} */ key = record.trackById;
var /** @type {?} */ recordList = /** @type {?} */ ((this.map.get(key)));
// Remove the list of duplicates when it gets empty
if (recordList.remove(record)) {
this.map.delete(key);
}
return record;
};
Object.defineProperty(_DuplicateMap.prototype, "isEmpty", {
get: /**
* @return {?}
*/
function () { return this.map.size === 0; },
enumerable: true,
configurable: true
});
/**
* @return {?}
*/
_DuplicateMap.prototype.clear = /**
* @return {?}
*/
function () { this.map.clear(); };
return _DuplicateMap;
}());
/**
* @param {?} item
* @param {?} addRemoveOffset
* @param {?} moveOffsets
* @return {?}
*/
function getPreviousIndex(item, addRemoveOffset, moveOffsets) {
var /** @type {?} */ previousIndex = item.previousIndex;
if (previousIndex === null)
return previousIndex;
var /** @type {?} */ moveOffset = 0;
if (moveOffsets && previousIndex < moveOffsets.length) {
moveOffset = moveOffsets[previousIndex];
}
return previousIndex + addRemoveOffset + moveOffset;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var DefaultKeyValueDifferFactory = (function () {
function DefaultKeyValueDifferFactory() {
}
/**
* @param {?} obj
* @return {?}
*/
DefaultKeyValueDifferFactory.prototype.supports = /**
* @param {?} obj
* @return {?}
*/
function (obj) { return obj instanceof Map || isJsObject(obj); };
/**
* @template K, V
* @return {?}
*/
DefaultKeyValueDifferFactory.prototype.create = /**
* @template K, V
* @return {?}
*/
function () { return new DefaultKeyValueDiffer(); };
return DefaultKeyValueDifferFactory;
}());
var DefaultKeyValueDiffer = (function () {
function DefaultKeyValueDiffer() {
this._records = new Map();
this._mapHead = null;
this._appendAfter = null;
this._previousMapHead = null;
this._changesHead = null;
this._changesTail = null;
this._additionsHead = null;
this._additionsTail = null;
this._removalsHead = null;
this._removalsTail = null;
}
Object.defineProperty(DefaultKeyValueDiffer.prototype, "isDirty", {
get: /**
* @return {?}
*/
function () {
return this._additionsHead !== null || this._changesHead !== null ||
this._removalsHead !== null;
},
enumerable: true,
configurable: true
});
/**
* @param {?} fn
* @return {?}
*/
DefaultKeyValueDiffer.prototype.forEachItem = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
var /** @type {?} */ record;
for (record = this._mapHead; record !== null; record = record._next) {
fn(record);
}
};
/**
* @param {?} fn
* @return {?}
*/
DefaultKeyValueDiffer.prototype.forEachPreviousItem = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
var /** @type {?} */ record;
for (record = this._previousMapHead; record !== null; record = record._nextPrevious) {
fn(record);
}
};
/**
* @param {?} fn
* @return {?}
*/
DefaultKeyValueDiffer.prototype.forEachChangedItem = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
var /** @type {?} */ record;
for (record = this._changesHead; record !== null; record = record._nextChanged) {
fn(record);
}
};
/**
* @param {?} fn
* @return {?}
*/
DefaultKeyValueDiffer.prototype.forEachAddedItem = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
var /** @type {?} */ record;
for (record = this._additionsHead; record !== null; record = record._nextAdded) {
fn(record);
}
};
/**
* @param {?} fn
* @return {?}
*/
DefaultKeyValueDiffer.prototype.forEachRemovedItem = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
var /** @type {?} */ record;
for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
fn(record);
}
};
/**
* @param {?=} map
* @return {?}
*/
DefaultKeyValueDiffer.prototype.diff = /**
* @param {?=} map
* @return {?}
*/
function (map) {
if (!map) {
map = new Map();
}
else if (!(map instanceof Map || isJsObject(map))) {
throw new Error("Error trying to diff '" + stringify(map) + "'. Only maps and objects are allowed");
}
return this.check(map) ? this : null;
};
/**
* @return {?}
*/
DefaultKeyValueDiffer.prototype.onDestroy = /**
* @return {?}
*/
function () { };
/**
* Check the current state of the map vs the previous.
* The algorithm is optimised for when the keys do no change.
*/
/**
* Check the current state of the map vs the previous.
* The algorithm is optimised for when the keys do no change.
* @param {?} map
* @return {?}
*/
DefaultKeyValueDiffer.prototype.check = /**
* Check the current state of the map vs the previous.
* The algorithm is optimised for when the keys do no change.
* @param {?} map
* @return {?}
*/
function (map) {
var _this = this;
this._reset();
var /** @type {?} */ insertBefore = this._mapHead;
this._appendAfter = null;
this._forEach(map, function (value, key) {
if (insertBefore && insertBefore.key === key) {
_this._maybeAddToChanges(insertBefore, value);
_this._appendAfter = insertBefore;
insertBefore = insertBefore._next;
}
else {
var /** @type {?} */ record = _this._getOrCreateRecordForKey(key, value);
insertBefore = _this._insertBeforeOrAppend(insertBefore, record);
}
});
// Items remaining at the end of the list have been deleted
if (insertBefore) {
if (insertBefore._prev) {
insertBefore._prev._next = null;
}
this._removalsHead = insertBefore;
for (var /** @type {?} */ record = insertBefore; record !== null; record = record._nextRemoved) {
if (record === this._mapHead) {
this._mapHead = null;
}
this._records.delete(record.key);
record._nextRemoved = record._next;
record.previousValue = record.currentValue;
record.currentValue = null;
record._prev = null;
record._next = null;
}
}
// Make sure tails have no next records from previous runs
if (this._changesTail)
this._changesTail._nextChanged = null;
if (this._additionsTail)
this._additionsTail._nextAdded = null;
return this.isDirty;
};
/**
* Inserts a record before `before` or append at the end of the list when `before` is null.
*
* Notes:
* - This method appends at `this._appendAfter`,
* - This method updates `this._appendAfter`,
* - The return value is the new value for the insertion pointer.
* @param {?} before
* @param {?} record
* @return {?}
*/
DefaultKeyValueDiffer.prototype._insertBeforeOrAppend = /**
* Inserts a record before `before` or append at the end of the list when `before` is null.
*
* Notes:
* - This method appends at `this._appendAfter`,
* - This method updates `this._appendAfter`,
* - The return value is the new value for the insertion pointer.
* @param {?} before
* @param {?} record
* @return {?}
*/
function (before, record) {
if (before) {
var /** @type {?} */ prev = before._prev;
record._next = before;
record._prev = prev;
before._prev = record;
if (prev) {
prev._next = record;
}
if (before === this._mapHead) {
this._mapHead = record;
}
this._appendAfter = before;
return before;
}
if (this._appendAfter) {
this._appendAfter._next = record;
record._prev = this._appendAfter;
}
else {
this._mapHead = record;
}
this._appendAfter = record;
return null;
};
/**
* @param {?} key
* @param {?} value
* @return {?}
*/
DefaultKeyValueDiffer.prototype._getOrCreateRecordForKey = /**
* @param {?} key
* @param {?} value
* @return {?}
*/
function (key, value) {
if (this._records.has(key)) {
var /** @type {?} */ record_1 = /** @type {?} */ ((this._records.get(key)));
this._maybeAddToChanges(record_1, value);
var /** @type {?} */ prev = record_1._prev;
var /** @type {?} */ next = record_1._next;
if (prev) {
prev._next = next;
}
if (next) {
next._prev = prev;
}
record_1._next = null;
record_1._prev = null;
return record_1;
}
var /** @type {?} */ record = new KeyValueChangeRecord_(key);
this._records.set(key, record);
record.currentValue = value;
this._addToAdditions(record);
return record;
};
/** @internal */
/**
* \@internal
* @return {?}
*/
DefaultKeyValueDiffer.prototype._reset = /**
* \@internal
* @return {?}
*/
function () {
if (this.isDirty) {
var /** @type {?} */ record = void 0;
// let `_previousMapHead` contain the state of the map before the changes
this._previousMapHead = this._mapHead;
for (record = this._previousMapHead; record !== null; record = record._next) {
record._nextPrevious = record._next;
}
// Update `record.previousValue` with the value of the item before the changes
// We need to update all changed items (that's those which have been added and changed)
for (record = this._changesHead; record !== null; record = record._nextChanged) {
record.previousValue = record.currentValue;
}
for (record = this._additionsHead; record != null; record = record._nextAdded) {
record.previousValue = record.currentValue;
}
this._changesHead = this._changesTail = null;
this._additionsHead = this._additionsTail = null;
this._removalsHead = null;
}
};
/**
* @param {?} record
* @param {?} newValue
* @return {?}
*/
DefaultKeyValueDiffer.prototype._maybeAddToChanges = /**
* @param {?} record
* @param {?} newValue
* @return {?}
*/
function (record, newValue) {
if (!looseIdentical(newValue, record.currentValue)) {
record.previousValue = record.currentValue;
record.currentValue = newValue;
this._addToChanges(record);
}
};
/**
* @param {?} record
* @return {?}
*/
DefaultKeyValueDiffer.prototype._addToAdditions = /**
* @param {?} record
* @return {?}
*/
function (record) {
if (this._additionsHead === null) {
this._additionsHead = this._additionsTail = record;
}
else {
/** @type {?} */ ((this._additionsTail))._nextAdded = record;
this._additionsTail = record;
}
};
/**
* @param {?} record
* @return {?}
*/
DefaultKeyValueDiffer.prototype._addToChanges = /**
* @param {?} record
* @return {?}
*/
function (record) {
if (this._changesHead === null) {
this._changesHead = this._changesTail = record;
}
else {
/** @type {?} */ ((this._changesTail))._nextChanged = record;
this._changesTail = record;
}
};
/**
* \@internal
* @template K, V
* @param {?} obj
* @param {?} fn
* @return {?}
*/
DefaultKeyValueDiffer.prototype._forEach = /**
* \@internal
* @template K, V
* @param {?} obj
* @param {?} fn
* @return {?}
*/
function (obj, fn) {
if (obj instanceof Map) {
obj.forEach(fn);
}
else {
Object.keys(obj).forEach(function (k) { return fn(obj[k], k); });
}
};
return DefaultKeyValueDiffer;
}());
/**
* \@stable
*/
var KeyValueChangeRecord_ = (function () {
function KeyValueChangeRecord_(key) {
this.key = key;
this.previousValue = null;
this.currentValue = null;
/**
* \@internal
*/
this._nextPrevious = null;
/**
* \@internal
*/
this._next = null;
/**
* \@internal
*/
this._prev = null;
/**
* \@internal
*/
this._nextAdded = null;
/**
* \@internal
*/
this._nextRemoved = null;
/**
* \@internal
*/
this._nextChanged = null;
}
return KeyValueChangeRecord_;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* A strategy for tracking changes over time to an iterable. Used by {\@link NgForOf} to
* respond to changes in an iterable by effecting equivalent changes in the DOM.
*
* \@stable
* @record
*/
/**
* An object describing the changes in the `Iterable` collection since last time
* `IterableDiffer#diff()` was invoked.
*
* \@stable
* @record
*/
/**
* Record representing the item change information.
*
* \@stable
* @record
*/
/**
* @deprecated v4.0.0 - Use IterableChangeRecord instead.
* @record
*/
/**
* An optional function passed into {\@link NgForOf} that defines how to track
* items in an iterable (e.g. fby index or id)
*
* \@stable
* @record
*/
/**
* Provides a factory for {\@link IterableDiffer}.
*
* \@stable
* @record
*/
/**
* A repository of different iterable diffing strategies used by NgFor, NgClass, and others.
* \@stable
*/
var IterableDiffers = (function () {
function IterableDiffers(factories) {
this.factories = factories;
}
/**
* @param {?} factories
* @param {?=} parent
* @return {?}
*/
IterableDiffers.create = /**
* @param {?} factories
* @param {?=} parent
* @return {?}
*/
function (factories, parent) {
if (parent != null) {
var /** @type {?} */ copied = parent.factories.slice();
factories = factories.concat(copied);
return new IterableDiffers(factories);
}
else {
return new IterableDiffers(factories);
}
};
/**
* Takes an array of {@link IterableDifferFactory} and returns a provider used to extend the
* inherited {@link IterableDiffers} instance with the provided factories and return a new
* {@link IterableDiffers} instance.
*
* The following example shows how to extend an existing list of factories,
* which will only be applied to the injector for this component and its children.
* This step is all that's required to make a new {@link IterableDiffer} available.
*
* ### Example
*
* ```
* @Component({
* viewProviders: [
* IterableDiffers.extend([new ImmutableListDiffer()])
* ]
* })
* ```
*/
/**
* Takes an array of {\@link IterableDifferFactory} and returns a provider used to extend the
* inherited {\@link IterableDiffers} instance with the provided factories and return a new
* {\@link IterableDiffers} instance.
*
* The following example shows how to extend an existing list of factories,
* which will only be applied to the injector for this component and its children.
* This step is all that's required to make a new {\@link IterableDiffer} available.
*
* ### Example
*
* ```
* \@Component({
* viewProviders: [
* IterableDiffers.extend([new ImmutableListDiffer()])
* ]
* })
* ```
* @param {?} factories
* @return {?}
*/
IterableDiffers.extend = /**
* Takes an array of {\@link IterableDifferFactory} and returns a provider used to extend the
* inherited {\@link IterableDiffers} instance with the provided factories and return a new
* {\@link IterableDiffers} instance.
*
* The following example shows how to extend an existing list of factories,
* which will only be applied to the injector for this component and its children.
* This step is all that's required to make a new {\@link IterableDiffer} available.
*
* ### Example
*
* ```
* \@Component({
* viewProviders: [
* IterableDiffers.extend([new ImmutableListDiffer()])
* ]
* })
* ```
* @param {?} factories
* @return {?}
*/
function (factories) {
return {
provide: IterableDiffers,
useFactory: function (parent) {
if (!parent) {
// Typically would occur when calling IterableDiffers.extend inside of dependencies passed
// to
// bootstrap(), which would override default pipes instead of extending them.
throw new Error('Cannot extend IterableDiffers without a parent injector');
}
return IterableDiffers.create(factories, parent);
},
// Dependency technically isn't optional, but we can provide a better error message this way.
deps: [[IterableDiffers, new SkipSelf(), new Optional()]]
};
};
/**
* @param {?} iterable
* @return {?}
*/
IterableDiffers.prototype.find = /**
* @param {?} iterable
* @return {?}
*/
function (iterable) {
var /** @type {?} */ factory = this.factories.find(function (f) { return f.supports(iterable); });
if (factory != null) {
return factory;
}
else {
throw new Error("Cannot find a differ supporting object '" + iterable + "' of type '" + getTypeNameForDebugging(iterable) + "'");
}
};
return IterableDiffers;
}());
/**
* @param {?} type
* @return {?}
*/
function getTypeNameForDebugging(type) {
return type['name'] || typeof type;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* A differ that tracks changes made to an object over time.
*
* \@stable
* @record
*/
/**
* An object describing the changes in the `Map` or `{[k:string]: string}` since last time
* `KeyValueDiffer#diff()` was invoked.
*
* \@stable
* @record
*/
/**
* Record representing the item change information.
*
* \@stable
* @record
*/
/**
* Provides a factory for {\@link KeyValueDiffer}.
*
* \@stable
* @record
*/
/**
* A repository of different Map diffing strategies used by NgClass, NgStyle, and others.
* \@stable
*/
var KeyValueDiffers = (function () {
function KeyValueDiffers(factories) {
this.factories = factories;
}
/**
* @template S
* @param {?} factories
* @param {?=} parent
* @return {?}
*/
KeyValueDiffers.create = /**
* @template S
* @param {?} factories
* @param {?=} parent
* @return {?}
*/
function (factories, parent) {
if (parent) {
var /** @type {?} */ copied = parent.factories.slice();
factories = factories.concat(copied);
}
return new KeyValueDiffers(factories);
};
/**
* Takes an array of {@link KeyValueDifferFactory} and returns a provider used to extend the
* inherited {@link KeyValueDiffers} instance with the provided factories and return a new
* {@link KeyValueDiffers} instance.
*
* The following example shows how to extend an existing list of factories,
* which will only be applied to the injector for this component and its children.
* This step is all that's required to make a new {@link KeyValueDiffer} available.
*
* ### Example
*
* ```
* @Component({
* viewProviders: [
* KeyValueDiffers.extend([new ImmutableMapDiffer()])
* ]
* })
* ```
*/
/**
* Takes an array of {\@link KeyValueDifferFactory} and returns a provider used to extend the
* inherited {\@link KeyValueDiffers} instance with the provided factories and return a new
* {\@link KeyValueDiffers} instance.
*
* The following example shows how to extend an existing list of factories,
* which will only be applied to the injector for this component and its children.
* This step is all that's required to make a new {\@link KeyValueDiffer} available.
*
* ### Example
*
* ```
* \@Component({
* viewProviders: [
* KeyValueDiffers.extend([new ImmutableMapDiffer()])
* ]
* })
* ```
* @template S
* @param {?} factories
* @return {?}
*/
KeyValueDiffers.extend = /**
* Takes an array of {\@link KeyValueDifferFactory} and returns a provider used to extend the
* inherited {\@link KeyValueDiffers} instance with the provided factories and return a new
* {\@link KeyValueDiffers} instance.
*
* The following example shows how to extend an existing list of factories,
* which will only be applied to the injector for this component and its children.
* This step is all that's required to make a new {\@link KeyValueDiffer} available.
*
* ### Example
*
* ```
* \@Component({
* viewProviders: [
* KeyValueDiffers.extend([new ImmutableMapDiffer()])
* ]
* })
* ```
* @template S
* @param {?} factories
* @return {?}
*/
function (factories) {
return {
provide: KeyValueDiffers,
useFactory: function (parent) {
if (!parent) {
// Typically would occur when calling KeyValueDiffers.extend inside of dependencies passed
// to bootstrap(), which would override default pipes instead of extending them.
throw new Error('Cannot extend KeyValueDiffers without a parent injector');
}
return KeyValueDiffers.create(factories, parent);
},
// Dependency technically isn't optional, but we can provide a better error message this way.
deps: [[KeyValueDiffers, new SkipSelf(), new Optional()]]
};
};
/**
* @param {?} kv
* @return {?}
*/
KeyValueDiffers.prototype.find = /**
* @param {?} kv
* @return {?}
*/
function (kv) {
var /** @type {?} */ factory = this.factories.find(function (f) { return f.supports(kv); });
if (factory) {
return factory;
}
throw new Error("Cannot find a differ supporting object '" + kv + "'");
};
return KeyValueDiffers;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Structural diffing for `Object`s and `Map`s.
*/
var keyValDiff = [new DefaultKeyValueDifferFactory()];
/**
* Structural diffing for `Iterable` types such as `Array`s.
*/
var iterableDiff = [new DefaultIterableDifferFactory()];
var defaultIterableDiffers = new IterableDiffers(iterableDiff);
var defaultKeyValueDiffers = new KeyValueDiffers(keyValDiff);
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @module
* @description
* Change detection enables data binding in Angular.
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var _CORE_PLATFORM_PROVIDERS = [
// Set a default platform name for platforms that don't set it explicitly.
{ provide: PLATFORM_ID, useValue: 'unknown' },
{ provide: PlatformRef, deps: [Injector] },
{ provide: TestabilityRegistry, deps: [] },
{ provide: Console, deps: [] },
];
/**
* This platform has to be included in any other platform
*
* \@experimental
*/
var platformCore = createPlatformFactory(null, 'core', _CORE_PLATFORM_PROVIDERS);
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* \@experimental i18n support is experimental.
*/
var LOCALE_ID = new InjectionToken('LocaleId');
/**
* \@experimental i18n support is experimental.
*/
var TRANSLATIONS = new InjectionToken('Translations');
/**
* \@experimental i18n support is experimental.
*/
var TRANSLATIONS_FORMAT = new InjectionToken('TranslationsFormat');
/** @enum {number} */
var MissingTranslationStrategy = {
Error: 0,
Warning: 1,
Ignore: 2,
};
MissingTranslationStrategy[MissingTranslationStrategy.Error] = "Error";
MissingTranslationStrategy[MissingTranslationStrategy.Warning] = "Warning";
MissingTranslationStrategy[MissingTranslationStrategy.Ignore] = "Ignore";
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @return {?}
*/
function _iterableDiffersFactory() {
return defaultIterableDiffers;
}
/**
* @return {?}
*/
function _keyValueDiffersFactory() {
return defaultKeyValueDiffers;
}
/**
* @param {?=} locale
* @return {?}
*/
function _localeFactory(locale) {
return locale || 'en-US';
}
/**
* This module includes the providers of \@angular/core that are needed
* to bootstrap components via `ApplicationRef`.
*
* \@experimental
*/
var ApplicationModule = (function () {
// Inject ApplicationRef to make it eager...
function ApplicationModule(appRef) {
}
ApplicationModule.decorators = [
{ type: NgModule, args: [{
providers: [
ApplicationRef,
ApplicationInitStatus,
Compiler,
APP_ID_RANDOM_PROVIDER,
{ provide: IterableDiffers, useFactory: _iterableDiffersFactory },
{ provide: KeyValueDiffers, useFactory: _keyValueDiffersFactory },
{
provide: LOCALE_ID,
useFactory: _localeFactory,
deps: [[new Inject(LOCALE_ID), new Optional(), new SkipSelf()]]
},
]
},] },
];
/** @nocollapse */
ApplicationModule.ctorParameters = function () { return [
{ type: ApplicationRef, },
]; };
return ApplicationModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/** @enum {number} */
var SecurityContext = {
NONE: 0,
HTML: 1,
STYLE: 2,
SCRIPT: 3,
URL: 4,
RESOURCE_URL: 5,
};
SecurityContext[SecurityContext.NONE] = "NONE";
SecurityContext[SecurityContext.HTML] = "HTML";
SecurityContext[SecurityContext.STYLE] = "STYLE";
SecurityContext[SecurityContext.SCRIPT] = "SCRIPT";
SecurityContext[SecurityContext.URL] = "URL";
SecurityContext[SecurityContext.RESOURCE_URL] = "RESOURCE_URL";
/**
* Sanitizer is used by the views to sanitize potentially dangerous values.
*
* \@stable
* @abstract
*/
var Sanitizer = (function () {
function Sanitizer() {
}
return Sanitizer;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Factory for ViewDefinitions/NgModuleDefinitions.
* We use a function so we can reexeute it in case an error happens and use the given logger
* function to log the error from the definition of the node, which is shown in all browser
* logs.
* @record
*/
/**
* Function to call console.error at the right source location. This is an indirection
* via another function as browser will log the location that actually called
* `console.error`.
* @record
*/
/**
* @record
*/
/**
* @record
*/
/**
* @record
*/
/**
* @record
*/
/**
* @record
*/
/**
* @record
*/
/**
* @record
*/
/**
* @record
*/
/**
* A node definition in the view.
*
* Note: We use one type for all nodes so that loops that loop over all nodes
* of a ViewDefinition stay monomorphic!
* @record
*/
/**
* @record
*/
/**
* @record
*/
/**
* @record
*/
/**
* @record
*/
/**
* @record
*/
/**
* @record
*/
/**
* @record
*/
/**
* @record
*/
/**
* @record
*/
/**
* @record
*/
/**
* @record
*/
/**
* @record
*/
/**
* View instance data.
* Attention: Adding fields to this is performance sensitive!
* @record
*/
/**
* @record
*/
/**
* Data for an instantiated NodeType.Text.
*
* Attention: Adding fields to this is performance sensitive!
* @record
*/
/**
* Accessor for view.nodes, enforcing that every usage site stays monomorphic.
* @param {?} view
* @param {?} index
* @return {?}
*/
function asTextData(view, index) {
return /** @type {?} */ (view.nodes[index]);
}
/**
* Data for an instantiated NodeType.Element.
*
* Attention: Adding fields to this is performance sensitive!
* @record
*/
/**
* @record
*/
/**
* @record
*/
/**
* Accessor for view.nodes, enforcing that every usage site stays monomorphic.
* @param {?} view
* @param {?} index
* @return {?}
*/
function asElementData(view, index) {
return /** @type {?} */ (view.nodes[index]);
}
/**
* Data for an instantiated NodeType.Provider.
*
* Attention: Adding fields to this is performance sensitive!
* @record
*/
/**
* Accessor for view.nodes, enforcing that every usage site stays monomorphic.
* @param {?} view
* @param {?} index
* @return {?}
*/
function asProviderData(view, index) {
return /** @type {?} */ (view.nodes[index]);
}
/**
* Data for an instantiated NodeType.PureExpression.
*
* Attention: Adding fields to this is performance sensitive!
* @record
*/
/**
* Accessor for view.nodes, enforcing that every usage site stays monomorphic.
* @param {?} view
* @param {?} index
* @return {?}
*/
function asPureExpressionData(view, index) {
return /** @type {?} */ (view.nodes[index]);
}
/**
* Accessor for view.nodes, enforcing that every usage site stays monomorphic.
* @param {?} view
* @param {?} index
* @return {?}
*/
function asQueryList(view, index) {
return /** @type {?} */ (view.nodes[index]);
}
/**
* @record
*/
/**
* @abstract
*/
var DebugContext = (function () {
function DebugContext() {
}
return DebugContext;
}());
/**
* @record
*/
/**
* This object is used to prevent cycles in the source files and to have a place where
* debug mode can hook it. It is lazily filled when `isDevMode` is known.
*/
var Services = {
setCurrentNode: /** @type {?} */ ((undefined)),
createRootView: /** @type {?} */ ((undefined)),
createEmbeddedView: /** @type {?} */ ((undefined)),
createComponentView: /** @type {?} */ ((undefined)),
createNgModuleRef: /** @type {?} */ ((undefined)),
overrideProvider: /** @type {?} */ ((undefined)),
clearProviderOverrides: /** @type {?} */ ((undefined)),
checkAndUpdateView: /** @type {?} */ ((undefined)),
checkNoChangesView: /** @type {?} */ ((undefined)),
destroyView: /** @type {?} */ ((undefined)),
resolveDep: /** @type {?} */ ((undefined)),
createDebugContext: /** @type {?} */ ((undefined)),
handleEvent: /** @type {?} */ ((undefined)),
updateDirectives: /** @type {?} */ ((undefined)),
updateRenderer: /** @type {?} */ ((undefined)),
dirtyParentQueries: /** @type {?} */ ((undefined)),
};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @param {?} context
* @param {?} oldValue
* @param {?} currValue
* @param {?} isFirstCheck
* @return {?}
*/
function expressionChangedAfterItHasBeenCheckedError(context, oldValue, currValue, isFirstCheck) {
var /** @type {?} */ msg = "ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '" + oldValue + "'. Current value: '" + currValue + "'.";
if (isFirstCheck) {
msg +=
" It seems like the view has been created after its parent and its children have been dirty checked." +
" Has it been created in a change detection hook ?";
}
return viewDebugError(msg, context);
}
/**
* @param {?} err
* @param {?} context
* @return {?}
*/
function viewWrappedDebugError(err, context) {
if (!(err instanceof Error)) {
// errors that are not Error instances don't have a stack,
// so it is ok to wrap them into a new Error object...
err = new Error(err.toString());
}
_addDebugContext(err, context);
return err;
}
/**
* @param {?} msg
* @param {?} context
* @return {?}
*/
function viewDebugError(msg, context) {
var /** @type {?} */ err = new Error(msg);
_addDebugContext(err, context);
return err;
}
/**
* @param {?} err
* @param {?} context
* @return {?}
*/
function _addDebugContext(err, context) {
(/** @type {?} */ (err))[ERROR_DEBUG_CONTEXT] = context;
(/** @type {?} */ (err))[ERROR_LOGGER] = context.logError.bind(context);
}
/**
* @param {?} err
* @return {?}
*/
function isViewDebugError(err) {
return !!getDebugContext(err);
}
/**
* @param {?} action
* @return {?}
*/
function viewDestroyedError(action) {
return new Error("ViewDestroyedError: Attempt to use a destroyed view: " + action);
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var NOOP = function () { };
var _tokenKeyCache = new Map();
/**
* @param {?} token
* @return {?}
*/
function tokenKey(token) {
var /** @type {?} */ key = _tokenKeyCache.get(token);
if (!key) {
key = stringify(token) + '_' + _tokenKeyCache.size;
_tokenKeyCache.set(token, key);
}
return key;
}
/**
* @param {?} view
* @param {?} nodeIdx
* @param {?} bindingIdx
* @param {?} value
* @return {?}
*/
function unwrapValue(view, nodeIdx, bindingIdx, value) {
if (value instanceof WrappedValue) {
value = value.wrapped;
var /** @type {?} */ globalBindingIdx = view.def.nodes[nodeIdx].bindingIndex + bindingIdx;
var /** @type {?} */ oldValue = view.oldValues[globalBindingIdx];
if (oldValue instanceof WrappedValue) {
oldValue = oldValue.wrapped;
}
view.oldValues[globalBindingIdx] = new WrappedValue(oldValue);
}
return value;
}
var UNDEFINED_RENDERER_TYPE_ID = '$$undefined';
var EMPTY_RENDERER_TYPE_ID = '$$empty';
/**
* @param {?} values
* @return {?}
*/
function createRendererType2(values) {
return {
id: UNDEFINED_RENDERER_TYPE_ID,
styles: values.styles,
encapsulation: values.encapsulation,
data: values.data
};
}
var _renderCompCount = 0;
/**
* @param {?=} type
* @return {?}
*/
function resolveRendererType2(type) {
if (type && type.id === UNDEFINED_RENDERER_TYPE_ID) {
// first time we see this RendererType2. Initialize it...
var /** @type {?} */ isFilled = ((type.encapsulation != null && type.encapsulation !== ViewEncapsulation.None) ||
type.styles.length || Object.keys(type.data).length);
if (isFilled) {
type.id = "c" + _renderCompCount++;
}
else {
type.id = EMPTY_RENDERER_TYPE_ID;
}
}
if (type && type.id === EMPTY_RENDERER_TYPE_ID) {
type = null;
}
return type || null;
}
/**
* @param {?} view
* @param {?} def
* @param {?} bindingIdx
* @param {?} value
* @return {?}
*/
function checkBinding(view, def, bindingIdx, value) {
var /** @type {?} */ oldValues = view.oldValues;
if ((view.state & 2 /* FirstCheck */) ||
!looseIdentical(oldValues[def.bindingIndex + bindingIdx], value)) {
return true;
}
return false;
}
/**
* @param {?} view
* @param {?} def
* @param {?} bindingIdx
* @param {?} value
* @return {?}
*/
function checkAndUpdateBinding(view, def, bindingIdx, value) {
if (checkBinding(view, def, bindingIdx, value)) {
view.oldValues[def.bindingIndex + bindingIdx] = value;
return true;
}
return false;
}
/**
* @param {?} view
* @param {?} def
* @param {?} bindingIdx
* @param {?} value
* @return {?}
*/
function checkBindingNoChanges(view, def, bindingIdx, value) {
var /** @type {?} */ oldValue = view.oldValues[def.bindingIndex + bindingIdx];
if ((view.state & 1 /* BeforeFirstCheck */) || !devModeEqual(oldValue, value)) {
throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, def.nodeIndex), oldValue, value, (view.state & 1 /* BeforeFirstCheck */) !== 0);
}
}
/**
* @param {?} view
* @return {?}
*/
function markParentViewsForCheck(view) {
var /** @type {?} */ currView = view;
while (currView) {
if (currView.def.flags & 2 /* OnPush */) {
currView.state |= 8 /* ChecksEnabled */;
}
currView = currView.viewContainerParent || currView.parent;
}
}
/**
* @param {?} view
* @param {?} endView
* @return {?}
*/
function markParentViewsForCheckProjectedViews(view, endView) {
var /** @type {?} */ currView = view;
while (currView && currView !== endView) {
currView.state |= 64 /* CheckProjectedViews */;
currView = currView.viewContainerParent || currView.parent;
}
}
/**
* @param {?} view
* @param {?} nodeIndex
* @param {?} eventName
* @param {?} event
* @return {?}
*/
function dispatchEvent(view, nodeIndex, eventName, event) {
try {
var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex];
var /** @type {?} */ startView = nodeDef.flags & 33554432 /* ComponentView */ ?
asElementData(view, nodeIndex).componentView :
view;
markParentViewsForCheck(startView);
return Services.handleEvent(view, nodeIndex, eventName, event);
}
catch (/** @type {?} */ e) {
// Attention: Don't rethrow, as it would cancel Observable subscriptions!
view.root.errorHandler.handleError(e);
}
}
/**
* @param {?} view
* @return {?}
*/
function declaredViewContainer(view) {
if (view.parent) {
var /** @type {?} */ parentView = view.parent;
return asElementData(parentView, /** @type {?} */ ((view.parentNodeDef)).nodeIndex);
}
return null;
}
/**
* for component views, this is the host element.
* for embedded views, this is the index of the parent node
* that contains the view container.
* @param {?} view
* @return {?}
*/
function viewParentEl(view) {
var /** @type {?} */ parentView = view.parent;
if (parentView) {
return /** @type {?} */ ((view.parentNodeDef)).parent;
}
else {
return null;
}
}
/**
* @param {?} view
* @param {?} def
* @return {?}
*/
function renderNode(view, def) {
switch (def.flags & 201347067 /* Types */) {
case 1 /* TypeElement */:
return asElementData(view, def.nodeIndex).renderElement;
case 2 /* TypeText */:
return asTextData(view, def.nodeIndex).renderText;
}
}
/**
* @param {?} target
* @param {?} name
* @return {?}
*/
function elementEventFullName(target, name) {
return target ? target + ":" + name : name;
}
/**
* @param {?} view
* @return {?}
*/
function isComponentView(view) {
return !!view.parent && !!(/** @type {?} */ ((view.parentNodeDef)).flags & 32768 /* Component */);
}
/**
* @param {?} view
* @return {?}
*/
function isEmbeddedView(view) {
return !!view.parent && !(/** @type {?} */ ((view.parentNodeDef)).flags & 32768 /* Component */);
}
/**
* @param {?} queryId
* @return {?}
*/
function filterQueryId(queryId) {
return 1 << (queryId % 32);
}
/**
* @param {?} matchedQueriesDsl
* @return {?}
*/
function splitMatchedQueriesDsl(matchedQueriesDsl) {
var /** @type {?} */ matchedQueries = {};
var /** @type {?} */ matchedQueryIds = 0;
var /** @type {?} */ references = {};
if (matchedQueriesDsl) {
matchedQueriesDsl.forEach(function (_a) {
var queryId = _a[0], valueType = _a[1];
if (typeof queryId === 'number') {
matchedQueries[queryId] = valueType;
matchedQueryIds |= filterQueryId(queryId);
}
else {
references[queryId] = valueType;
}
});
}
return { matchedQueries: matchedQueries, references: references, matchedQueryIds: matchedQueryIds };
}
/**
* @param {?} deps
* @return {?}
*/
function splitDepsDsl(deps) {
return deps.map(function (value) {
var /** @type {?} */ token;
var /** @type {?} */ flags;
if (Array.isArray(value)) {
flags = value[0], token = value[1];
}
else {
flags = 0 /* None */;
token = value;
}
return { flags: flags, token: token, tokenKey: tokenKey(token) };
});
}
/**
* @param {?} view
* @param {?} renderHost
* @param {?} def
* @return {?}
*/
function getParentRenderElement(view, renderHost, def) {
var /** @type {?} */ renderParent = def.renderParent;
if (renderParent) {
if ((renderParent.flags & 1 /* TypeElement */) === 0 ||
(renderParent.flags & 33554432 /* ComponentView */) === 0 ||
(/** @type {?} */ ((renderParent.element)).componentRendererType && /** @type {?} */ ((/** @type {?} */ ((renderParent.element)).componentRendererType)).encapsulation === ViewEncapsulation.Native)) {
// only children of non components, or children of components with native encapsulation should
// be attached.
return asElementData(view, /** @type {?} */ ((def.renderParent)).nodeIndex).renderElement;
}
}
else {
return renderHost;
}
}
var DEFINITION_CACHE = new WeakMap();
/**
* @template D
* @param {?} factory
* @return {?}
*/
function resolveDefinition(factory) {
var /** @type {?} */ value = /** @type {?} */ (((DEFINITION_CACHE.get(factory))));
if (!value) {
value = factory(function () { return NOOP; });
value.factory = factory;
DEFINITION_CACHE.set(factory, value);
}
return value;
}
/**
* @param {?} view
* @return {?}
*/
function rootRenderNodes(view) {
var /** @type {?} */ renderNodes = [];
visitRootRenderNodes(view, 0 /* Collect */, undefined, undefined, renderNodes);
return renderNodes;
}
/**
* @param {?} view
* @param {?} action
* @param {?} parentNode
* @param {?} nextSibling
* @param {?=} target
* @return {?}
*/
function visitRootRenderNodes(view, action, parentNode, nextSibling, target) {
// We need to re-compute the parent node in case the nodes have been moved around manually
if (action === 3 /* RemoveChild */) {
parentNode = view.renderer.parentNode(renderNode(view, /** @type {?} */ ((view.def.lastRenderRootNode))));
}
visitSiblingRenderNodes(view, action, 0, view.def.nodes.length - 1, parentNode, nextSibling, target);
}
/**
* @param {?} view
* @param {?} action
* @param {?} startIndex
* @param {?} endIndex
* @param {?} parentNode
* @param {?} nextSibling
* @param {?=} target
* @return {?}
*/
function visitSiblingRenderNodes(view, action, startIndex, endIndex, parentNode, nextSibling, target) {
for (var /** @type {?} */ i = startIndex; i <= endIndex; i++) {
var /** @type {?} */ nodeDef = view.def.nodes[i];
if (nodeDef.flags & (1 /* TypeElement */ | 2 /* TypeText */ | 8 /* TypeNgContent */)) {
visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target);
}
// jump to next sibling
i += nodeDef.childCount;
}
}
/**
* @param {?} view
* @param {?} ngContentIndex
* @param {?} action
* @param {?} parentNode
* @param {?} nextSibling
* @param {?=} target
* @return {?}
*/
function visitProjectedRenderNodes(view, ngContentIndex, action, parentNode, nextSibling, target) {
var /** @type {?} */ compView = view;
while (compView && !isComponentView(compView)) {
compView = compView.parent;
}
var /** @type {?} */ hostView = /** @type {?} */ ((compView)).parent;
var /** @type {?} */ hostElDef = viewParentEl(/** @type {?} */ ((compView)));
var /** @type {?} */ startIndex = /** @type {?} */ ((hostElDef)).nodeIndex + 1;
var /** @type {?} */ endIndex = /** @type {?} */ ((hostElDef)).nodeIndex + /** @type {?} */ ((hostElDef)).childCount;
for (var /** @type {?} */ i = startIndex; i <= endIndex; i++) {
var /** @type {?} */ nodeDef = /** @type {?} */ ((hostView)).def.nodes[i];
if (nodeDef.ngContentIndex === ngContentIndex) {
visitRenderNode(/** @type {?} */ ((hostView)), nodeDef, action, parentNode, nextSibling, target);
}
// jump to next sibling
i += nodeDef.childCount;
}
if (!/** @type {?} */ ((hostView)).parent) {
// a root view
var /** @type {?} */ projectedNodes = view.root.projectableNodes[ngContentIndex];
if (projectedNodes) {
for (var /** @type {?} */ i = 0; i < projectedNodes.length; i++) {
execRenderNodeAction(view, projectedNodes[i], action, parentNode, nextSibling, target);
}
}
}
}
/**
* @param {?} view
* @param {?} nodeDef
* @param {?} action
* @param {?} parentNode
* @param {?} nextSibling
* @param {?=} target
* @return {?}
*/
function visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target) {
if (nodeDef.flags & 8 /* TypeNgContent */) {
visitProjectedRenderNodes(view, /** @type {?} */ ((nodeDef.ngContent)).index, action, parentNode, nextSibling, target);
}
else {
var /** @type {?} */ rn = renderNode(view, nodeDef);
if (action === 3 /* RemoveChild */ && (nodeDef.flags & 33554432 /* ComponentView */) &&
(nodeDef.bindingFlags & 48 /* CatSyntheticProperty */)) {
// Note: we might need to do both actions.
if (nodeDef.bindingFlags & (16 /* SyntheticProperty */)) {
execRenderNodeAction(view, rn, action, parentNode, nextSibling, target);
}
if (nodeDef.bindingFlags & (32 /* SyntheticHostProperty */)) {
var /** @type {?} */ compView = asElementData(view, nodeDef.nodeIndex).componentView;
execRenderNodeAction(compView, rn, action, parentNode, nextSibling, target);
}
}
else {
execRenderNodeAction(view, rn, action, parentNode, nextSibling, target);
}
if (nodeDef.flags & 16777216 /* EmbeddedViews */) {
var /** @type {?} */ embeddedViews = /** @type {?} */ ((asElementData(view, nodeDef.nodeIndex).viewContainer))._embeddedViews;
for (var /** @type {?} */ k = 0; k < embeddedViews.length; k++) {
visitRootRenderNodes(embeddedViews[k], action, parentNode, nextSibling, target);
}
}
if (nodeDef.flags & 1 /* TypeElement */ && !/** @type {?} */ ((nodeDef.element)).name) {
visitSiblingRenderNodes(view, action, nodeDef.nodeIndex + 1, nodeDef.nodeIndex + nodeDef.childCount, parentNode, nextSibling, target);
}
}
}
/**
* @param {?} view
* @param {?} renderNode
* @param {?} action
* @param {?} parentNode
* @param {?} nextSibling
* @param {?=} target
* @return {?}
*/
function execRenderNodeAction(view, renderNode, action, parentNode, nextSibling, target) {
var /** @type {?} */ renderer = view.renderer;
switch (action) {
case 1 /* AppendChild */:
renderer.appendChild(parentNode, renderNode);
break;
case 2 /* InsertBefore */:
renderer.insertBefore(parentNode, renderNode, nextSibling);
break;
case 3 /* RemoveChild */:
renderer.removeChild(parentNode, renderNode);
break;
case 0 /* Collect */:
/** @type {?} */ ((target)).push(renderNode);
break;
}
}
var NS_PREFIX_RE = /^:([^:]+):(.+)$/;
/**
* @param {?} name
* @return {?}
*/
function splitNamespace(name) {
if (name[0] === ':') {
var /** @type {?} */ match = /** @type {?} */ ((name.match(NS_PREFIX_RE)));
return [match[1], match[2]];
}
return ['', name];
}
/**
* @param {?} bindings
* @return {?}
*/
function calcBindingFlags(bindings) {
var /** @type {?} */ flags = 0;
for (var /** @type {?} */ i = 0; i < bindings.length; i++) {
flags |= bindings[i].flags;
}
return flags;
}
/**
* @param {?} valueCount
* @param {?} constAndInterp
* @return {?}
*/
function interpolate(valueCount, constAndInterp) {
var /** @type {?} */ result = '';
for (var /** @type {?} */ i = 0; i < valueCount * 2; i = i + 2) {
result = result + constAndInterp[i] + _toStringWithNull(constAndInterp[i + 1]);
}
return result + constAndInterp[valueCount * 2];
}
/**
* @param {?} valueCount
* @param {?} c0
* @param {?} a1
* @param {?} c1
* @param {?=} a2
* @param {?=} c2
* @param {?=} a3
* @param {?=} c3
* @param {?=} a4
* @param {?=} c4
* @param {?=} a5
* @param {?=} c5
* @param {?=} a6
* @param {?=} c6
* @param {?=} a7
* @param {?=} c7
* @param {?=} a8
* @param {?=} c8
* @param {?=} a9
* @param {?=} c9
* @return {?}
*/
function inlineInterpolate(valueCount, c0, a1, c1, a2, c2, a3, c3, a4, c4, a5, c5, a6, c6, a7, c7, a8, c8, a9, c9) {
switch (valueCount) {
case 1:
return c0 + _toStringWithNull(a1) + c1;
case 2:
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2;
case 3:
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
c3;
case 4:
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
c3 + _toStringWithNull(a4) + c4;
case 5:
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5;
case 6:
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + c6;
case 7:
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
c6 + _toStringWithNull(a7) + c7;
case 8:
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8;
case 9:
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8 + _toStringWithNull(a9) + c9;
default:
throw new Error("Does not support more than 9 expressions");
}
}
/**
* @param {?} v
* @return {?}
*/
function _toStringWithNull(v) {
return v != null ? v.toString() : '';
}
var EMPTY_ARRAY = [];
var EMPTY_MAP = {};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @param {?} flags
* @param {?} matchedQueriesDsl
* @param {?} ngContentIndex
* @param {?} childCount
* @param {?=} handleEvent
* @param {?=} templateFactory
* @return {?}
*/
function anchorDef(flags, matchedQueriesDsl, ngContentIndex, childCount, handleEvent, templateFactory) {
flags |= 1 /* TypeElement */;
var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds;
var /** @type {?} */ template = templateFactory ? resolveDefinition(templateFactory) : null;
return {
// will bet set by the view definition
nodeIndex: -1,
parent: null,
renderParent: null,
bindingIndex: -1,
outputIndex: -1,
// regular values
flags: flags,
checkIndex: -1,
childFlags: 0,
directChildFlags: 0,
childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references, ngContentIndex: ngContentIndex, childCount: childCount,
bindings: [],
bindingFlags: 0,
outputs: [],
element: {
ns: null,
name: null,
attrs: null, template: template,
componentProvider: null,
componentView: null,
componentRendererType: null,
publicProviders: null,
allProviders: null,
handleEvent: handleEvent || NOOP
},
provider: null,
text: null,
query: null,
ngContent: null
};
}
/**
* @param {?} checkIndex
* @param {?} flags
* @param {?} matchedQueriesDsl
* @param {?} ngContentIndex
* @param {?} childCount
* @param {?} namespaceAndName
* @param {?=} fixedAttrs
* @param {?=} bindings
* @param {?=} outputs
* @param {?=} handleEvent
* @param {?=} componentView
* @param {?=} componentRendererType
* @return {?}
*/
function elementDef(checkIndex, flags, matchedQueriesDsl, ngContentIndex, childCount, namespaceAndName, fixedAttrs, bindings, outputs, handleEvent, componentView, componentRendererType) {
if (fixedAttrs === void 0) { fixedAttrs = []; }
if (!handleEvent) {
handleEvent = NOOP;
}
var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds;
var /** @type {?} */ ns = /** @type {?} */ ((null));
var /** @type {?} */ name = /** @type {?} */ ((null));
if (namespaceAndName) {
_b = splitNamespace(namespaceAndName), ns = _b[0], name = _b[1];
}
bindings = bindings || [];
var /** @type {?} */ bindingDefs = new Array(bindings.length);
for (var /** @type {?} */ i = 0; i < bindings.length; i++) {
var _c = bindings[i], bindingFlags = _c[0], namespaceAndName_1 = _c[1], suffixOrSecurityContext = _c[2];
var _d = splitNamespace(namespaceAndName_1), ns_1 = _d[0], name_1 = _d[1];
var /** @type {?} */ securityContext = /** @type {?} */ ((undefined));
var /** @type {?} */ suffix = /** @type {?} */ ((undefined));
switch (bindingFlags & 15 /* Types */) {
case 4 /* TypeElementStyle */:
suffix = /** @type {?} */ (suffixOrSecurityContext);
break;
case 1 /* TypeElementAttribute */:
case 8 /* TypeProperty */:
securityContext = /** @type {?} */ (suffixOrSecurityContext);
break;
}
bindingDefs[i] =
{ flags: bindingFlags, ns: ns_1, name: name_1, nonMinifiedName: name_1, securityContext: securityContext, suffix: suffix };
}
outputs = outputs || [];
var /** @type {?} */ outputDefs = new Array(outputs.length);
for (var /** @type {?} */ i = 0; i < outputs.length; i++) {
var _e = outputs[i], target = _e[0], eventName = _e[1];
outputDefs[i] = {
type: 0 /* ElementOutput */,
target: /** @type {?} */ (target), eventName: eventName,
propName: null
};
}
fixedAttrs = fixedAttrs || [];
var /** @type {?} */ attrs = /** @type {?} */ (fixedAttrs.map(function (_a) {
var namespaceAndName = _a[0], value = _a[1];
var _b = splitNamespace(namespaceAndName), ns = _b[0], name = _b[1];
return [ns, name, value];
}));
componentRendererType = resolveRendererType2(componentRendererType);
if (componentView) {
flags |= 33554432 /* ComponentView */;
}
flags |= 1 /* TypeElement */;
return {
// will bet set by the view definition
nodeIndex: -1,
parent: null,
renderParent: null,
bindingIndex: -1,
outputIndex: -1,
// regular values
checkIndex: checkIndex,
flags: flags,
childFlags: 0,
directChildFlags: 0,
childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references, ngContentIndex: ngContentIndex, childCount: childCount,
bindings: bindingDefs,
bindingFlags: calcBindingFlags(bindingDefs),
outputs: outputDefs,
element: {
ns: ns,
name: name,
attrs: attrs,
template: null,
// will bet set by the view definition
componentProvider: null,
componentView: componentView || null,
componentRendererType: componentRendererType,
publicProviders: null,
allProviders: null,
handleEvent: handleEvent || NOOP,
},
provider: null,
text: null,
query: null,
ngContent: null
};
var _b;
}
/**
* @param {?} view
* @param {?} renderHost
* @param {?} def
* @return {?}
*/
function createElement(view, renderHost, def) {
var /** @type {?} */ elDef = /** @type {?} */ ((def.element));
var /** @type {?} */ rootSelectorOrNode = view.root.selectorOrNode;
var /** @type {?} */ renderer = view.renderer;
var /** @type {?} */ el;
if (view.parent || !rootSelectorOrNode) {
if (elDef.name) {
el = renderer.createElement(elDef.name, elDef.ns);
}
else {
el = renderer.createComment('');
}
var /** @type {?} */ parentEl = getParentRenderElement(view, renderHost, def);
if (parentEl) {
renderer.appendChild(parentEl, el);
}
}
else {
el = renderer.selectRootElement(rootSelectorOrNode);
}
if (elDef.attrs) {
for (var /** @type {?} */ i = 0; i < elDef.attrs.length; i++) {
var _a = elDef.attrs[i], ns = _a[0], name_2 = _a[1], value = _a[2];
renderer.setAttribute(el, name_2, value, ns);
}
}
return el;
}
/**
* @param {?} view
* @param {?} compView
* @param {?} def
* @param {?} el
* @return {?}
*/
function listenToElementOutputs(view, compView, def, el) {
for (var /** @type {?} */ i = 0; i < def.outputs.length; i++) {
var /** @type {?} */ output = def.outputs[i];
var /** @type {?} */ handleEventClosure = renderEventHandlerClosure(view, def.nodeIndex, elementEventFullName(output.target, output.eventName));
var /** @type {?} */ listenTarget = output.target;
var /** @type {?} */ listenerView = view;
if (output.target === 'component') {
listenTarget = null;
listenerView = compView;
}
var /** @type {?} */ disposable = /** @type {?} */ (listenerView.renderer.listen(listenTarget || el, output.eventName, handleEventClosure)); /** @type {?} */
((view.disposables))[def.outputIndex + i] = disposable;
}
}
/**
* @param {?} view
* @param {?} index
* @param {?} eventName
* @return {?}
*/
function renderEventHandlerClosure(view, index, eventName) {
return function (event) { return dispatchEvent(view, index, eventName, event); };
}
/**
* @param {?} view
* @param {?} def
* @param {?} v0
* @param {?} v1
* @param {?} v2
* @param {?} v3
* @param {?} v4
* @param {?} v5
* @param {?} v6
* @param {?} v7
* @param {?} v8
* @param {?} v9
* @return {?}
*/
function checkAndUpdateElementInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
var /** @type {?} */ bindLen = def.bindings.length;
var /** @type {?} */ changed = false;
if (bindLen > 0 && checkAndUpdateElementValue(view, def, 0, v0))
changed = true;
if (bindLen > 1 && checkAndUpdateElementValue(view, def, 1, v1))
changed = true;
if (bindLen > 2 && checkAndUpdateElementValue(view, def, 2, v2))
changed = true;
if (bindLen > 3 && checkAndUpdateElementValue(view, def, 3, v3))
changed = true;
if (bindLen > 4 && checkAndUpdateElementValue(view, def, 4, v4))
changed = true;
if (bindLen > 5 && checkAndUpdateElementValue(view, def, 5, v5))
changed = true;
if (bindLen > 6 && checkAndUpdateElementValue(view, def, 6, v6))
changed = true;
if (bindLen > 7 && checkAndUpdateElementValue(view, def, 7, v7))
changed = true;
if (bindLen > 8 && checkAndUpdateElementValue(view, def, 8, v8))
changed = true;
if (bindLen > 9 && checkAndUpdateElementValue(view, def, 9, v9))
changed = true;
return changed;
}
/**
* @param {?} view
* @param {?} def
* @param {?} values
* @return {?}
*/
function checkAndUpdateElementDynamic(view, def, values) {
var /** @type {?} */ changed = false;
for (var /** @type {?} */ i = 0; i < values.length; i++) {
if (checkAndUpdateElementValue(view, def, i, values[i]))
changed = true;
}
return changed;
}
/**
* @param {?} view
* @param {?} def
* @param {?} bindingIdx
* @param {?} value
* @return {?}
*/
function checkAndUpdateElementValue(view, def, bindingIdx, value) {
if (!checkAndUpdateBinding(view, def, bindingIdx, value)) {
return false;
}
var /** @type {?} */ binding = def.bindings[bindingIdx];
var /** @type {?} */ elData = asElementData(view, def.nodeIndex);
var /** @type {?} */ renderNode$$1 = elData.renderElement;
var /** @type {?} */ name = /** @type {?} */ ((binding.name));
switch (binding.flags & 15 /* Types */) {
case 1 /* TypeElementAttribute */:
setElementAttribute(view, binding, renderNode$$1, binding.ns, name, value);
break;
case 2 /* TypeElementClass */:
setElementClass(view, renderNode$$1, name, value);
break;
case 4 /* TypeElementStyle */:
setElementStyle(view, binding, renderNode$$1, name, value);
break;
case 8 /* TypeProperty */:
var /** @type {?} */ bindView = (def.flags & 33554432 /* ComponentView */ &&
binding.flags & 32 /* SyntheticHostProperty */) ?
elData.componentView :
view;
setElementProperty(bindView, binding, renderNode$$1, name, value);
break;
}
return true;
}
/**
* @param {?} view
* @param {?} binding
* @param {?} renderNode
* @param {?} ns
* @param {?} name
* @param {?} value
* @return {?}
*/
function setElementAttribute(view, binding, renderNode$$1, ns, name, value) {
var /** @type {?} */ securityContext = binding.securityContext;
var /** @type {?} */ renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value;
renderValue = renderValue != null ? renderValue.toString() : null;
var /** @type {?} */ renderer = view.renderer;
if (value != null) {
renderer.setAttribute(renderNode$$1, name, renderValue, ns);
}
else {
renderer.removeAttribute(renderNode$$1, name, ns);
}
}
/**
* @param {?} view
* @param {?} renderNode
* @param {?} name
* @param {?} value
* @return {?}
*/
function setElementClass(view, renderNode$$1, name, value) {
var /** @type {?} */ renderer = view.renderer;
if (value) {
renderer.addClass(renderNode$$1, name);
}
else {
renderer.removeClass(renderNode$$1, name);
}
}
/**
* @param {?} view
* @param {?} binding
* @param {?} renderNode
* @param {?} name
* @param {?} value
* @return {?}
*/
function setElementStyle(view, binding, renderNode$$1, name, value) {
var /** @type {?} */ renderValue = view.root.sanitizer.sanitize(SecurityContext.STYLE, /** @type {?} */ (value));
if (renderValue != null) {
renderValue = renderValue.toString();
var /** @type {?} */ unit = binding.suffix;
if (unit != null) {
renderValue = renderValue + unit;
}
}
else {
renderValue = null;
}
var /** @type {?} */ renderer = view.renderer;
if (renderValue != null) {
renderer.setStyle(renderNode$$1, name, renderValue);
}
else {
renderer.removeStyle(renderNode$$1, name);
}
}
/**
* @param {?} view
* @param {?} binding
* @param {?} renderNode
* @param {?} name
* @param {?} value
* @return {?}
*/
function setElementProperty(view, binding, renderNode$$1, name, value) {
var /** @type {?} */ securityContext = binding.securityContext;
var /** @type {?} */ renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value;
view.renderer.setProperty(renderNode$$1, name, renderValue);
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var UNDEFINED_VALUE = new Object();
var InjectorRefTokenKey$1 = tokenKey(Injector);
var NgModuleRefTokenKey = tokenKey(NgModuleRef);
/**
* @param {?} flags
* @param {?} token
* @param {?} value
* @param {?} deps
* @return {?}
*/
function moduleProvideDef(flags, token, value, deps) {
// Need to resolve forwardRefs as e.g. for `useValue` we
// lowered the expression and then stopped evaluating it,
// i.e. also didn't unwrap it.
value = resolveForwardRef(value);
var /** @type {?} */ depDefs = splitDepsDsl(deps);
return {
// will bet set by the module definition
index: -1,
deps: depDefs, flags: flags, token: token, value: value
};
}
/**
* @param {?} providers
* @return {?}
*/
function moduleDef(providers) {
var /** @type {?} */ providersByKey = {};
for (var /** @type {?} */ i = 0; i < providers.length; i++) {
var /** @type {?} */ provider = providers[i];
provider.index = i;
providersByKey[tokenKey(provider.token)] = provider;
}
return {
// Will be filled later...
factory: null,
providersByKey: providersByKey,
providers: providers
};
}
/**
* @param {?} data
* @return {?}
*/
function initNgModule(data) {
var /** @type {?} */ def = data._def;
var /** @type {?} */ providers = data._providers = new Array(def.providers.length);
for (var /** @type {?} */ i = 0; i < def.providers.length; i++) {
var /** @type {?} */ provDef = def.providers[i];
if (!(provDef.flags & 4096 /* LazyProvider */)) {
providers[i] = _createProviderInstance$1(data, provDef);
}
}
}
/**
* @param {?} data
* @param {?} depDef
* @param {?=} notFoundValue
* @return {?}
*/
function resolveNgModuleDep(data, depDef, notFoundValue) {
if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
if (depDef.flags & 8 /* Value */) {
return depDef.token;
}
if (depDef.flags & 2 /* Optional */) {
notFoundValue = null;
}
if (depDef.flags & 1 /* SkipSelf */) {
return data._parent.get(depDef.token, notFoundValue);
}
var /** @type {?} */ tokenKey$$1 = depDef.tokenKey;
switch (tokenKey$$1) {
case InjectorRefTokenKey$1:
case NgModuleRefTokenKey:
return data;
}
var /** @type {?} */ providerDef = data._def.providersByKey[tokenKey$$1];
if (providerDef) {
var /** @type {?} */ providerInstance = data._providers[providerDef.index];
if (providerInstance === undefined) {
providerInstance = data._providers[providerDef.index] =
_createProviderInstance$1(data, providerDef);
}
return providerInstance === UNDEFINED_VALUE ? undefined : providerInstance;
}
return data._parent.get(depDef.token, notFoundValue);
}
/**
* @param {?} ngModule
* @param {?} providerDef
* @return {?}
*/
function _createProviderInstance$1(ngModule, providerDef) {
var /** @type {?} */ injectable;
switch (providerDef.flags & 201347067 /* Types */) {
case 512 /* TypeClassProvider */:
injectable = _createClass(ngModule, providerDef.value, providerDef.deps);
break;
case 1024 /* TypeFactoryProvider */:
injectable = _callFactory(ngModule, providerDef.value, providerDef.deps);
break;
case 2048 /* TypeUseExistingProvider */:
injectable = resolveNgModuleDep(ngModule, providerDef.deps[0]);
break;
case 256 /* TypeValueProvider */:
injectable = providerDef.value;
break;
}
return injectable === undefined ? UNDEFINED_VALUE : injectable;
}
/**
* @param {?} ngModule
* @param {?} ctor
* @param {?} deps
* @return {?}
*/
function _createClass(ngModule, ctor, deps) {
var /** @type {?} */ len = deps.length;
switch (len) {
case 0:
return new ctor();
case 1:
return new ctor(resolveNgModuleDep(ngModule, deps[0]));
case 2:
return new ctor(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]));
case 3:
return new ctor(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]), resolveNgModuleDep(ngModule, deps[2]));
default:
var /** @type {?} */ depValues = new Array(len);
for (var /** @type {?} */ i = 0; i < len; i++) {
depValues[i] = resolveNgModuleDep(ngModule, deps[i]);
}
return new (ctor.bind.apply(ctor, [void 0].concat(depValues)))();
}
}
/**
* @param {?} ngModule
* @param {?} factory
* @param {?} deps
* @return {?}
*/
function _callFactory(ngModule, factory, deps) {
var /** @type {?} */ len = deps.length;
switch (len) {
case 0:
return factory();
case 1:
return factory(resolveNgModuleDep(ngModule, deps[0]));
case 2:
return factory(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]));
case 3:
return factory(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]), resolveNgModuleDep(ngModule, deps[2]));
default:
var /** @type {?} */ depValues = Array(len);
for (var /** @type {?} */ i = 0; i < len; i++) {
depValues[i] = resolveNgModuleDep(ngModule, deps[i]);
}
return factory.apply(void 0, depValues);
}
}
/**
* @param {?} ngModule
* @param {?} lifecycles
* @return {?}
*/
function callNgModuleLifecycle(ngModule, lifecycles) {
var /** @type {?} */ def = ngModule._def;
for (var /** @type {?} */ i = 0; i < def.providers.length; i++) {
var /** @type {?} */ provDef = def.providers[i];
if (provDef.flags & 131072 /* OnDestroy */) {
var /** @type {?} */ instance = ngModule._providers[i];
if (instance && instance !== UNDEFINED_VALUE) {
instance.ngOnDestroy();
}
}
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @param {?} parentView
* @param {?} elementData
* @param {?} viewIndex
* @param {?} view
* @return {?}
*/
function attachEmbeddedView(parentView, elementData, viewIndex, view) {
var /** @type {?} */ embeddedViews = /** @type {?} */ ((elementData.viewContainer))._embeddedViews;
if (viewIndex === null || viewIndex === undefined) {
viewIndex = embeddedViews.length;
}
view.viewContainerParent = parentView;
addToArray(embeddedViews, /** @type {?} */ ((viewIndex)), view);
attachProjectedView(elementData, view);
Services.dirtyParentQueries(view);
var /** @type {?} */ prevView = /** @type {?} */ ((viewIndex)) > 0 ? embeddedViews[/** @type {?} */ ((viewIndex)) - 1] : null;
renderAttachEmbeddedView(elementData, prevView, view);
}
/**
* @param {?} vcElementData
* @param {?} view
* @return {?}
*/
function attachProjectedView(vcElementData, view) {
var /** @type {?} */ dvcElementData = declaredViewContainer(view);
if (!dvcElementData || dvcElementData === vcElementData ||
view.state & 16 /* IsProjectedView */) {
return;
}
// Note: For performance reasons, we
// - add a view to template._projectedViews only 1x throughout its lifetime,
// and remove it not until the view is destroyed.
// (hard, as when a parent view is attached/detached we would need to attach/detach all
// nested projected views as well, even accross component boundaries).
// - don't track the insertion order of views in the projected views array
// (hard, as when the views of the same template are inserted different view containers)
view.state |= 16 /* IsProjectedView */;
var /** @type {?} */ projectedViews = dvcElementData.template._projectedViews;
if (!projectedViews) {
projectedViews = dvcElementData.template._projectedViews = [];
}
projectedViews.push(view);
// Note: we are changing the NodeDef here as we cannot calculate
// the fact whether a template is used for projection during compilation.
markNodeAsProjectedTemplate(/** @type {?} */ ((view.parent)).def, /** @type {?} */ ((view.parentNodeDef)));
}
/**
* @param {?} viewDef
* @param {?} nodeDef
* @return {?}
*/
function markNodeAsProjectedTemplate(viewDef, nodeDef) {
if (nodeDef.flags & 4 /* ProjectedTemplate */) {
return;
}
viewDef.nodeFlags |= 4 /* ProjectedTemplate */;
nodeDef.flags |= 4 /* ProjectedTemplate */;
var /** @type {?} */ parentNodeDef = nodeDef.parent;
while (parentNodeDef) {
parentNodeDef.childFlags |= 4 /* ProjectedTemplate */;
parentNodeDef = parentNodeDef.parent;
}
}
/**
* @param {?} elementData
* @param {?=} viewIndex
* @return {?}
*/
function detachEmbeddedView(elementData, viewIndex) {
var /** @type {?} */ embeddedViews = /** @type {?} */ ((elementData.viewContainer))._embeddedViews;
if (viewIndex == null || viewIndex >= embeddedViews.length) {
viewIndex = embeddedViews.length - 1;
}
if (viewIndex < 0) {
return null;
}
var /** @type {?} */ view = embeddedViews[viewIndex];
view.viewContainerParent = null;
removeFromArray(embeddedViews, viewIndex);
// See attachProjectedView for why we don't update projectedViews here.
Services.dirtyParentQueries(view);
renderDetachView(view);
return view;
}
/**
* @param {?} view
* @return {?}
*/
function detachProjectedView(view) {
if (!(view.state & 16 /* IsProjectedView */)) {
return;
}
var /** @type {?} */ dvcElementData = declaredViewContainer(view);
if (dvcElementData) {
var /** @type {?} */ projectedViews = dvcElementData.template._projectedViews;
if (projectedViews) {
removeFromArray(projectedViews, projectedViews.indexOf(view));
Services.dirtyParentQueries(view);
}
}
}
/**
* @param {?} elementData
* @param {?} oldViewIndex
* @param {?} newViewIndex
* @return {?}
*/
function moveEmbeddedView(elementData, oldViewIndex, newViewIndex) {
var /** @type {?} */ embeddedViews = /** @type {?} */ ((elementData.viewContainer))._embeddedViews;
var /** @type {?} */ view = embeddedViews[oldViewIndex];
removeFromArray(embeddedViews, oldViewIndex);
if (newViewIndex == null) {
newViewIndex = embeddedViews.length;
}
addToArray(embeddedViews, newViewIndex, view);
// Note: Don't need to change projectedViews as the order in there
// as always invalid...
Services.dirtyParentQueries(view);
renderDetachView(view);
var /** @type {?} */ prevView = newViewIndex > 0 ? embeddedViews[newViewIndex - 1] : null;
renderAttachEmbeddedView(elementData, prevView, view);
return view;
}
/**
* @param {?} elementData
* @param {?} prevView
* @param {?} view
* @return {?}
*/
function renderAttachEmbeddedView(elementData, prevView, view) {
var /** @type {?} */ prevRenderNode = prevView ? renderNode(prevView, /** @type {?} */ ((prevView.def.lastRenderRootNode))) :
elementData.renderElement;
var /** @type {?} */ parentNode = view.renderer.parentNode(prevRenderNode);
var /** @type {?} */ nextSibling = view.renderer.nextSibling(prevRenderNode);
// Note: We can't check if `nextSibling` is present, as on WebWorkers it will always be!
// However, browsers automatically do `appendChild` when there is no `nextSibling`.
visitRootRenderNodes(view, 2 /* InsertBefore */, parentNode, nextSibling, undefined);
}
/**
* @param {?} view
* @return {?}
*/
function renderDetachView(view) {
visitRootRenderNodes(view, 3 /* RemoveChild */, null, null, undefined);
}
/**
* @param {?} arr
* @param {?} index
* @param {?} value
* @return {?}
*/
function addToArray(arr, index, value) {
// perf: array.push is faster than array.splice!
if (index >= arr.length) {
arr.push(value);
}
else {
arr.splice(index, 0, value);
}
}
/**
* @param {?} arr
* @param {?} index
* @return {?}
*/
function removeFromArray(arr, index) {
// perf: array.pop is faster than array.splice!
if (index >= arr.length - 1) {
arr.pop();
}
else {
arr.splice(index, 1);
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var EMPTY_CONTEXT = new Object();
/**
* @param {?} selector
* @param {?} componentType
* @param {?} viewDefFactory
* @param {?} inputs
* @param {?} outputs
* @param {?} ngContentSelectors
* @return {?}
*/
function createComponentFactory(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors) {
return new ComponentFactory_(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors);
}
/**
* @param {?} componentFactory
* @return {?}
*/
function getComponentViewDefinitionFactory(componentFactory) {
return (/** @type {?} */ (componentFactory)).viewDefFactory;
}
var ComponentFactory_ = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ComponentFactory_, _super);
function ComponentFactory_(selector, componentType, viewDefFactory, _inputs, _outputs, ngContentSelectors) {
var _this =
// Attention: this ctor is called as top level function.
// Putting any logic in here will destroy closure tree shaking!
_super.call(this) || this;
_this.selector = selector;
_this.componentType = componentType;
_this._inputs = _inputs;
_this._outputs = _outputs;
_this.ngContentSelectors = ngContentSelectors;
_this.viewDefFactory = viewDefFactory;
return _this;
}
Object.defineProperty(ComponentFactory_.prototype, "inputs", {
get: /**
* @return {?}
*/
function () {
var /** @type {?} */ inputsArr = [];
var /** @type {?} */ inputs = /** @type {?} */ ((this._inputs));
for (var /** @type {?} */ propName in inputs) {
var /** @type {?} */ templateName = inputs[propName];
inputsArr.push({ propName: propName, templateName: templateName });
}
return inputsArr;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ComponentFactory_.prototype, "outputs", {
get: /**
* @return {?}
*/
function () {
var /** @type {?} */ outputsArr = [];
for (var /** @type {?} */ propName in this._outputs) {
var /** @type {?} */ templateName = this._outputs[propName];
outputsArr.push({ propName: propName, templateName: templateName });
}
return outputsArr;
},
enumerable: true,
configurable: true
});
/**
* Creates a new component.
*/
/**
* Creates a new component.
* @param {?} injector
* @param {?=} projectableNodes
* @param {?=} rootSelectorOrNode
* @param {?=} ngModule
* @return {?}
*/
ComponentFactory_.prototype.create = /**
* Creates a new component.
* @param {?} injector
* @param {?=} projectableNodes
* @param {?=} rootSelectorOrNode
* @param {?=} ngModule
* @return {?}
*/
function (injector, projectableNodes, rootSelectorOrNode, ngModule) {
if (!ngModule) {
throw new Error('ngModule should be provided');
}
var /** @type {?} */ viewDef = resolveDefinition(this.viewDefFactory);
var /** @type {?} */ componentNodeIndex = /** @type {?} */ ((/** @type {?} */ ((viewDef.nodes[0].element)).componentProvider)).nodeIndex;
var /** @type {?} */ view = Services.createRootView(injector, projectableNodes || [], rootSelectorOrNode, viewDef, ngModule, EMPTY_CONTEXT);
var /** @type {?} */ component = asProviderData(view, componentNodeIndex).instance;
if (rootSelectorOrNode) {
view.renderer.setAttribute(asElementData(view, 0).renderElement, 'ng-version', VERSION.full);
}
return new ComponentRef_(view, new ViewRef_(view), component);
};
return ComponentFactory_;
}(ComponentFactory));
var ComponentRef_ = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ComponentRef_, _super);
function ComponentRef_(_view, _viewRef, _component) {
var _this = _super.call(this) || this;
_this._view = _view;
_this._viewRef = _viewRef;
_this._component = _component;
_this._elDef = _this._view.def.nodes[0];
_this.hostView = _viewRef;
_this.changeDetectorRef = _viewRef;
_this.instance = _component;
return _this;
}
Object.defineProperty(ComponentRef_.prototype, "location", {
get: /**
* @return {?}
*/
function () {
return new ElementRef(asElementData(this._view, this._elDef.nodeIndex).renderElement);
},
enumerable: true,
configurable: true
});
Object.defineProperty(ComponentRef_.prototype, "injector", {
get: /**
* @return {?}
*/
function () { return new Injector_(this._view, this._elDef); },
enumerable: true,
configurable: true
});
Object.defineProperty(ComponentRef_.prototype, "componentType", {
get: /**
* @return {?}
*/
function () { return /** @type {?} */ (this._component.constructor); },
enumerable: true,
configurable: true
});
/**
* @return {?}
*/
ComponentRef_.prototype.destroy = /**
* @return {?}
*/
function () { this._viewRef.destroy(); };
/**
* @param {?} callback
* @return {?}
*/
ComponentRef_.prototype.onDestroy = /**
* @param {?} callback
* @return {?}
*/
function (callback) { this._viewRef.onDestroy(callback); };
return ComponentRef_;
}(ComponentRef));
/**
* @param {?} view
* @param {?} elDef
* @param {?} elData
* @return {?}
*/
function createViewContainerData(view, elDef, elData) {
return new ViewContainerRef_(view, elDef, elData);
}
var ViewContainerRef_ = (function () {
function ViewContainerRef_(_view, _elDef, _data) {
this._view = _view;
this._elDef = _elDef;
this._data = _data;
/**
* \@internal
*/
this._embeddedViews = [];
}
Object.defineProperty(ViewContainerRef_.prototype, "element", {
get: /**
* @return {?}
*/
function () { return new ElementRef(this._data.renderElement); },
enumerable: true,
configurable: true
});
Object.defineProperty(ViewContainerRef_.prototype, "injector", {
get: /**
* @return {?}
*/
function () { return new Injector_(this._view, this._elDef); },
enumerable: true,
configurable: true
});
Object.defineProperty(ViewContainerRef_.prototype, "parentInjector", {
get: /**
* @return {?}
*/
function () {
var /** @type {?} */ view = this._view;
var /** @type {?} */ elDef = this._elDef.parent;
while (!elDef && view) {
elDef = viewParentEl(view);
view = /** @type {?} */ ((view.parent));
}
return view ? new Injector_(view, elDef) : new Injector_(this._view, null);
},
enumerable: true,
configurable: true
});
/**
* @return {?}
*/
ViewContainerRef_.prototype.clear = /**
* @return {?}
*/
function () {
var /** @type {?} */ len = this._embeddedViews.length;
for (var /** @type {?} */ i = len - 1; i >= 0; i--) {
var /** @type {?} */ view = /** @type {?} */ ((detachEmbeddedView(this._data, i)));
Services.destroyView(view);
}
};
/**
* @param {?} index
* @return {?}
*/
ViewContainerRef_.prototype.get = /**
* @param {?} index
* @return {?}
*/
function (index) {
var /** @type {?} */ view = this._embeddedViews[index];
if (view) {
var /** @type {?} */ ref = new ViewRef_(view);
ref.attachToViewContainerRef(this);
return ref;
}
return null;
};
Object.defineProperty(ViewContainerRef_.prototype, "length", {
get: /**
* @return {?}
*/
function () { return this._embeddedViews.length; },
enumerable: true,
configurable: true
});
/**
* @template C
* @param {?} templateRef
* @param {?=} context
* @param {?=} index
* @return {?}
*/
ViewContainerRef_.prototype.createEmbeddedView = /**
* @template C
* @param {?} templateRef
* @param {?=} context
* @param {?=} index
* @return {?}
*/
function (templateRef, context, index) {
var /** @type {?} */ viewRef = templateRef.createEmbeddedView(context || /** @type {?} */ ({}));
this.insert(viewRef, index);
return viewRef;
};
/**
* @template C
* @param {?} componentFactory
* @param {?=} index
* @param {?=} injector
* @param {?=} projectableNodes
* @param {?=} ngModuleRef
* @return {?}
*/
ViewContainerRef_.prototype.createComponent = /**
* @template C
* @param {?} componentFactory
* @param {?=} index
* @param {?=} injector
* @param {?=} projectableNodes
* @param {?=} ngModuleRef
* @return {?}
*/
function (componentFactory, index, injector, projectableNodes, ngModuleRef) {
var /** @type {?} */ contextInjector = injector || this.parentInjector;
if (!ngModuleRef && !(componentFactory instanceof ComponentFactoryBoundToModule)) {
ngModuleRef = contextInjector.get(NgModuleRef);
}
var /** @type {?} */ componentRef = componentFactory.create(contextInjector, projectableNodes, undefined, ngModuleRef);
this.insert(componentRef.hostView, index);
return componentRef;
};
/**
* @param {?} viewRef
* @param {?=} index
* @return {?}
*/
ViewContainerRef_.prototype.insert = /**
* @param {?} viewRef
* @param {?=} index
* @return {?}
*/
function (viewRef, index) {
if (viewRef.destroyed) {
throw new Error('Cannot insert a destroyed View in a ViewContainer!');
}
var /** @type {?} */ viewRef_ = /** @type {?} */ (viewRef);
var /** @type {?} */ viewData = viewRef_._view;
attachEmbeddedView(this._view, this._data, index, viewData);
viewRef_.attachToViewContainerRef(this);
return viewRef;
};
/**
* @param {?} viewRef
* @param {?} currentIndex
* @return {?}
*/
ViewContainerRef_.prototype.move = /**
* @param {?} viewRef
* @param {?} currentIndex
* @return {?}
*/
function (viewRef, currentIndex) {
if (viewRef.destroyed) {
throw new Error('Cannot move a destroyed View in a ViewContainer!');
}
var /** @type {?} */ previousIndex = this._embeddedViews.indexOf(viewRef._view);
moveEmbeddedView(this._data, previousIndex, currentIndex);
return viewRef;
};
/**
* @param {?} viewRef
* @return {?}
*/
ViewContainerRef_.prototype.indexOf = /**
* @param {?} viewRef
* @return {?}
*/
function (viewRef) {
return this._embeddedViews.indexOf((/** @type {?} */ (viewRef))._view);
};
/**
* @param {?=} index
* @return {?}
*/
ViewContainerRef_.prototype.remove = /**
* @param {?=} index
* @return {?}
*/
function (index) {
var /** @type {?} */ viewData = detachEmbeddedView(this._data, index);
if (viewData) {
Services.destroyView(viewData);
}
};
/**
* @param {?=} index
* @return {?}
*/
ViewContainerRef_.prototype.detach = /**
* @param {?=} index
* @return {?}
*/
function (index) {
var /** @type {?} */ view = detachEmbeddedView(this._data, index);
return view ? new ViewRef_(view) : null;
};
return ViewContainerRef_;
}());
/**
* @param {?} view
* @return {?}
*/
function createChangeDetectorRef(view) {
return new ViewRef_(view);
}
var ViewRef_ = (function () {
function ViewRef_(_view) {
this._view = _view;
this._viewContainerRef = null;
this._appRef = null;
}
Object.defineProperty(ViewRef_.prototype, "rootNodes", {
get: /**
* @return {?}
*/
function () { return rootRenderNodes(this._view); },
enumerable: true,
configurable: true
});
Object.defineProperty(ViewRef_.prototype, "context", {
get: /**
* @return {?}
*/
function () { return this._view.context; },
enumerable: true,
configurable: true
});
Object.defineProperty(ViewRef_.prototype, "destroyed", {
get: /**
* @return {?}
*/
function () { return (this._view.state & 128 /* Destroyed */) !== 0; },
enumerable: true,
configurable: true
});
/**
* @return {?}
*/
ViewRef_.prototype.markForCheck = /**
* @return {?}
*/
function () { markParentViewsForCheck(this._view); };
/**
* @return {?}
*/
ViewRef_.prototype.detach = /**
* @return {?}
*/
function () { this._view.state &= ~4 /* Attached */; };
/**
* @return {?}
*/
ViewRef_.prototype.detectChanges = /**
* @return {?}
*/
function () {
var /** @type {?} */ fs = this._view.root.rendererFactory;
if (fs.begin) {
fs.begin();
}
Services.checkAndUpdateView(this._view);
if (fs.end) {
fs.end();
}
};
/**
* @return {?}
*/
ViewRef_.prototype.checkNoChanges = /**
* @return {?}
*/
function () { Services.checkNoChangesView(this._view); };
/**
* @return {?}
*/
ViewRef_.prototype.reattach = /**
* @return {?}
*/
function () { this._view.state |= 4 /* Attached */; };
/**
* @param {?} callback
* @return {?}
*/
ViewRef_.prototype.onDestroy = /**
* @param {?} callback
* @return {?}
*/
function (callback) {
if (!this._view.disposables) {
this._view.disposables = [];
}
this._view.disposables.push(/** @type {?} */ (callback));
};
/**
* @return {?}
*/
ViewRef_.prototype.destroy = /**
* @return {?}
*/
function () {
if (this._appRef) {
this._appRef.detachView(this);
}
else if (this._viewContainerRef) {
this._viewContainerRef.detach(this._viewContainerRef.indexOf(this));
}
Services.destroyView(this._view);
};
/**
* @return {?}
*/
ViewRef_.prototype.detachFromAppRef = /**
* @return {?}
*/
function () {
this._appRef = null;
renderDetachView(this._view);
Services.dirtyParentQueries(this._view);
};
/**
* @param {?} appRef
* @return {?}
*/
ViewRef_.prototype.attachToAppRef = /**
* @param {?} appRef
* @return {?}
*/
function (appRef) {
if (this._viewContainerRef) {
throw new Error('This view is already attached to a ViewContainer!');
}
this._appRef = appRef;
};
/**
* @param {?} vcRef
* @return {?}
*/
ViewRef_.prototype.attachToViewContainerRef = /**
* @param {?} vcRef
* @return {?}
*/
function (vcRef) {
if (this._appRef) {
throw new Error('This view is already attached directly to the ApplicationRef!');
}
this._viewContainerRef = vcRef;
};
return ViewRef_;
}());
/**
* @param {?} view
* @param {?} def
* @return {?}
*/
function createTemplateData(view, def) {
return new TemplateRef_(view, def);
}
var TemplateRef_ = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(TemplateRef_, _super);
function TemplateRef_(_parentView, _def) {
var _this = _super.call(this) || this;
_this._parentView = _parentView;
_this._def = _def;
return _this;
}
/**
* @param {?} context
* @return {?}
*/
TemplateRef_.prototype.createEmbeddedView = /**
* @param {?} context
* @return {?}
*/
function (context) {
return new ViewRef_(Services.createEmbeddedView(this._parentView, this._def, /** @type {?} */ ((/** @type {?} */ ((this._def.element)).template)), context));
};
Object.defineProperty(TemplateRef_.prototype, "elementRef", {
get: /**
* @return {?}
*/
function () {
return new ElementRef(asElementData(this._parentView, this._def.nodeIndex).renderElement);
},
enumerable: true,
configurable: true
});
return TemplateRef_;
}(TemplateRef));
/**
* @param {?} view
* @param {?} elDef
* @return {?}
*/
function createInjector(view, elDef) {
return new Injector_(view, elDef);
}
var Injector_ = (function () {
function Injector_(view, elDef) {
this.view = view;
this.elDef = elDef;
}
/**
* @param {?} token
* @param {?=} notFoundValue
* @return {?}
*/
Injector_.prototype.get = /**
* @param {?} token
* @param {?=} notFoundValue
* @return {?}
*/
function (token, notFoundValue) {
if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
var /** @type {?} */ allowPrivateServices = this.elDef ? (this.elDef.flags & 33554432 /* ComponentView */) !== 0 : false;
return Services.resolveDep(this.view, this.elDef, allowPrivateServices, { flags: 0 /* None */, token: token, tokenKey: tokenKey(token) }, notFoundValue);
};
return Injector_;
}());
/**
* @param {?} view
* @param {?} index
* @return {?}
*/
function nodeValue(view, index) {
var /** @type {?} */ def = view.def.nodes[index];
if (def.flags & 1 /* TypeElement */) {
var /** @type {?} */ elData = asElementData(view, def.nodeIndex);
return /** @type {?} */ ((def.element)).template ? elData.template : elData.renderElement;
}
else if (def.flags & 2 /* TypeText */) {
return asTextData(view, def.nodeIndex).renderText;
}
else if (def.flags & (20224 /* CatProvider */ | 16 /* TypePipe */)) {
return asProviderData(view, def.nodeIndex).instance;
}
throw new Error("Illegal state: read nodeValue for node index " + index);
}
/**
* @param {?} view
* @return {?}
*/
function createRendererV1(view) {
return new RendererAdapter(view.renderer);
}
var RendererAdapter = (function () {
function RendererAdapter(delegate) {
this.delegate = delegate;
}
/**
* @param {?} selectorOrNode
* @return {?}
*/
RendererAdapter.prototype.selectRootElement = /**
* @param {?} selectorOrNode
* @return {?}
*/
function (selectorOrNode) {
return this.delegate.selectRootElement(selectorOrNode);
};
/**
* @param {?} parent
* @param {?} namespaceAndName
* @return {?}
*/
RendererAdapter.prototype.createElement = /**
* @param {?} parent
* @param {?} namespaceAndName
* @return {?}
*/
function (parent, namespaceAndName) {
var _a = splitNamespace(namespaceAndName), ns = _a[0], name = _a[1];
var /** @type {?} */ el = this.delegate.createElement(name, ns);
if (parent) {
this.delegate.appendChild(parent, el);
}
return el;
};
/**
* @param {?} hostElement
* @return {?}
*/
RendererAdapter.prototype.createViewRoot = /**
* @param {?} hostElement
* @return {?}
*/
function (hostElement) { return hostElement; };
/**
* @param {?} parentElement
* @return {?}
*/
RendererAdapter.prototype.createTemplateAnchor = /**
* @param {?} parentElement
* @return {?}
*/
function (parentElement) {
var /** @type {?} */ comment = this.delegate.createComment('');
if (parentElement) {
this.delegate.appendChild(parentElement, comment);
}
return comment;
};
/**
* @param {?} parentElement
* @param {?} value
* @return {?}
*/
RendererAdapter.prototype.createText = /**
* @param {?} parentElement
* @param {?} value
* @return {?}
*/
function (parentElement, value) {
var /** @type {?} */ node = this.delegate.createText(value);
if (parentElement) {
this.delegate.appendChild(parentElement, node);
}
return node;
};
/**
* @param {?} parentElement
* @param {?} nodes
* @return {?}
*/
RendererAdapter.prototype.projectNodes = /**
* @param {?} parentElement
* @param {?} nodes
* @return {?}
*/
function (parentElement, nodes) {
for (var /** @type {?} */ i = 0; i < nodes.length; i++) {
this.delegate.appendChild(parentElement, nodes[i]);
}
};
/**
* @param {?} node
* @param {?} viewRootNodes
* @return {?}
*/
RendererAdapter.prototype.attachViewAfter = /**
* @param {?} node
* @param {?} viewRootNodes
* @return {?}
*/
function (node, viewRootNodes) {
var /** @type {?} */ parentElement = this.delegate.parentNode(node);
var /** @type {?} */ nextSibling = this.delegate.nextSibling(node);
for (var /** @type {?} */ i = 0; i < viewRootNodes.length; i++) {
this.delegate.insertBefore(parentElement, viewRootNodes[i], nextSibling);
}
};
/**
* @param {?} viewRootNodes
* @return {?}
*/
RendererAdapter.prototype.detachView = /**
* @param {?} viewRootNodes
* @return {?}
*/
function (viewRootNodes) {
for (var /** @type {?} */ i = 0; i < viewRootNodes.length; i++) {
var /** @type {?} */ node = viewRootNodes[i];
var /** @type {?} */ parentElement = this.delegate.parentNode(node);
this.delegate.removeChild(parentElement, node);
}
};
/**
* @param {?} hostElement
* @param {?} viewAllNodes
* @return {?}
*/
RendererAdapter.prototype.destroyView = /**
* @param {?} hostElement
* @param {?} viewAllNodes
* @return {?}
*/
function (hostElement, viewAllNodes) {
for (var /** @type {?} */ i = 0; i < viewAllNodes.length; i++) {
/** @type {?} */ ((this.delegate.destroyNode))(viewAllNodes[i]);
}
};
/**
* @param {?} renderElement
* @param {?} name
* @param {?} callback
* @return {?}
*/
RendererAdapter.prototype.listen = /**
* @param {?} renderElement
* @param {?} name
* @param {?} callback
* @return {?}
*/
function (renderElement, name, callback) {
return this.delegate.listen(renderElement, name, /** @type {?} */ (callback));
};
/**
* @param {?} target
* @param {?} name
* @param {?} callback
* @return {?}
*/
RendererAdapter.prototype.listenGlobal = /**
* @param {?} target
* @param {?} name
* @param {?} callback
* @return {?}
*/
function (target, name, callback) {
return this.delegate.listen(target, name, /** @type {?} */ (callback));
};
/**
* @param {?} renderElement
* @param {?} propertyName
* @param {?} propertyValue
* @return {?}
*/
RendererAdapter.prototype.setElementProperty = /**
* @param {?} renderElement
* @param {?} propertyName
* @param {?} propertyValue
* @return {?}
*/
function (renderElement, propertyName, propertyValue) {
this.delegate.setProperty(renderElement, propertyName, propertyValue);
};
/**
* @param {?} renderElement
* @param {?} namespaceAndName
* @param {?} attributeValue
* @return {?}
*/
RendererAdapter.prototype.setElementAttribute = /**
* @param {?} renderElement
* @param {?} namespaceAndName
* @param {?} attributeValue
* @return {?}
*/
function (renderElement, namespaceAndName, attributeValue) {
var _a = splitNamespace(namespaceAndName), ns = _a[0], name = _a[1];
if (attributeValue != null) {
this.delegate.setAttribute(renderElement, name, attributeValue, ns);
}
else {
this.delegate.removeAttribute(renderElement, name, ns);
}
};
/**
* @param {?} renderElement
* @param {?} propertyName
* @param {?} propertyValue
* @return {?}
*/
RendererAdapter.prototype.setBindingDebugInfo = /**
* @param {?} renderElement
* @param {?} propertyName
* @param {?} propertyValue
* @return {?}
*/
function (renderElement, propertyName, propertyValue) { };
/**
* @param {?} renderElement
* @param {?} className
* @param {?} isAdd
* @return {?}
*/
RendererAdapter.prototype.setElementClass = /**
* @param {?} renderElement
* @param {?} className
* @param {?} isAdd
* @return {?}
*/
function (renderElement, className, isAdd) {
if (isAdd) {
this.delegate.addClass(renderElement, className);
}
else {
this.delegate.removeClass(renderElement, className);
}
};
/**
* @param {?} renderElement
* @param {?} styleName
* @param {?} styleValue
* @return {?}
*/
RendererAdapter.prototype.setElementStyle = /**
* @param {?} renderElement
* @param {?} styleName
* @param {?} styleValue
* @return {?}
*/
function (renderElement, styleName, styleValue) {
if (styleValue != null) {
this.delegate.setStyle(renderElement, styleName, styleValue);
}
else {
this.delegate.removeStyle(renderElement, styleName);
}
};
/**
* @param {?} renderElement
* @param {?} methodName
* @param {?} args
* @return {?}
*/
RendererAdapter.prototype.invokeElementMethod = /**
* @param {?} renderElement
* @param {?} methodName
* @param {?} args
* @return {?}
*/
function (renderElement, methodName, args) {
(/** @type {?} */ (renderElement))[methodName].apply(renderElement, args);
};
/**
* @param {?} renderNode
* @param {?} text
* @return {?}
*/
RendererAdapter.prototype.setText = /**
* @param {?} renderNode
* @param {?} text
* @return {?}
*/
function (renderNode$$1, text) { this.delegate.setValue(renderNode$$1, text); };
/**
* @return {?}
*/
RendererAdapter.prototype.animate = /**
* @return {?}
*/
function () { throw new Error('Renderer.animate is no longer supported!'); };
return RendererAdapter;
}());
/**
* @param {?} moduleType
* @param {?} parent
* @param {?} bootstrapComponents
* @param {?} def
* @return {?}
*/
function createNgModuleRef(moduleType, parent, bootstrapComponents, def) {
return new NgModuleRef_(moduleType, parent, bootstrapComponents, def);
}
var NgModuleRef_ = (function () {
function NgModuleRef_(_moduleType, _parent, _bootstrapComponents, _def) {
this._moduleType = _moduleType;
this._parent = _parent;
this._bootstrapComponents = _bootstrapComponents;
this._def = _def;
this._destroyListeners = [];
this._destroyed = false;
initNgModule(this);
}
/**
* @param {?} token
* @param {?=} notFoundValue
* @return {?}
*/
NgModuleRef_.prototype.get = /**
* @param {?} token
* @param {?=} notFoundValue
* @return {?}
*/
function (token, notFoundValue) {
if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
return resolveNgModuleDep(this, { token: token, tokenKey: tokenKey(token), flags: 0 /* None */ }, notFoundValue);
};
Object.defineProperty(NgModuleRef_.prototype, "instance", {
get: /**
* @return {?}
*/
function () { return this.get(this._moduleType); },
enumerable: true,
configurable: true
});
Object.defineProperty(NgModuleRef_.prototype, "componentFactoryResolver", {
get: /**
* @return {?}
*/
function () { return this.get(ComponentFactoryResolver); },
enumerable: true,
configurable: true
});
Object.defineProperty(NgModuleRef_.prototype, "injector", {
get: /**
* @return {?}
*/
function () { return this; },
enumerable: true,
configurable: true
});
/**
* @return {?}
*/
NgModuleRef_.prototype.destroy = /**
* @return {?}
*/
function () {
if (this._destroyed) {
throw new Error("The ng module " + stringify(this.instance.constructor) + " has already been destroyed.");
}
this._destroyed = true;
callNgModuleLifecycle(this, 131072 /* OnDestroy */);
this._destroyListeners.forEach(function (listener) { return listener(); });
};
/**
* @param {?} callback
* @return {?}
*/
NgModuleRef_.prototype.onDestroy = /**
* @param {?} callback
* @return {?}
*/
function (callback) { this._destroyListeners.push(callback); };
return NgModuleRef_;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var RendererV1TokenKey = tokenKey(Renderer);
var Renderer2TokenKey = tokenKey(Renderer2);
var ElementRefTokenKey = tokenKey(ElementRef);
var ViewContainerRefTokenKey = tokenKey(ViewContainerRef);
var TemplateRefTokenKey = tokenKey(TemplateRef);
var ChangeDetectorRefTokenKey = tokenKey(ChangeDetectorRef);
var InjectorRefTokenKey = tokenKey(Injector);
/**
* @param {?} checkIndex
* @param {?} flags
* @param {?} matchedQueries
* @param {?} childCount
* @param {?} ctor
* @param {?} deps
* @param {?=} props
* @param {?=} outputs
* @return {?}
*/
function directiveDef(checkIndex, flags, matchedQueries, childCount, ctor, deps, props, outputs) {
var /** @type {?} */ bindings = [];
if (props) {
for (var /** @type {?} */ prop in props) {
var _a = props[prop], bindingIndex = _a[0], nonMinifiedName = _a[1];
bindings[bindingIndex] = {
flags: 8 /* TypeProperty */,
name: prop, nonMinifiedName: nonMinifiedName,
ns: null,
securityContext: null,
suffix: null
};
}
}
var /** @type {?} */ outputDefs = [];
if (outputs) {
for (var /** @type {?} */ propName in outputs) {
outputDefs.push({ type: 1 /* DirectiveOutput */, propName: propName, target: null, eventName: outputs[propName] });
}
}
flags |= 16384 /* TypeDirective */;
return _def(checkIndex, flags, matchedQueries, childCount, ctor, ctor, deps, bindings, outputDefs);
}
/**
* @param {?} flags
* @param {?} ctor
* @param {?} deps
* @return {?}
*/
function pipeDef(flags, ctor, deps) {
flags |= 16 /* TypePipe */;
return _def(-1, flags, null, 0, ctor, ctor, deps);
}
/**
* @param {?} flags
* @param {?} matchedQueries
* @param {?} token
* @param {?} value
* @param {?} deps
* @return {?}
*/
function providerDef(flags, matchedQueries, token, value, deps) {
return _def(-1, flags, matchedQueries, 0, token, value, deps);
}
/**
* @param {?} checkIndex
* @param {?} flags
* @param {?} matchedQueriesDsl
* @param {?} childCount
* @param {?} token
* @param {?} value
* @param {?} deps
* @param {?=} bindings
* @param {?=} outputs
* @return {?}
*/
function _def(checkIndex, flags, matchedQueriesDsl, childCount, token, value, deps, bindings, outputs) {
var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds;
if (!outputs) {
outputs = [];
}
if (!bindings) {
bindings = [];
}
// Need to resolve forwardRefs as e.g. for `useValue` we
// lowered the expression and then stopped evaluating it,
// i.e. also didn't unwrap it.
value = resolveForwardRef(value);
var /** @type {?} */ depDefs = splitDepsDsl(deps);
return {
// will bet set by the view definition
nodeIndex: -1,
parent: null,
renderParent: null,
bindingIndex: -1,
outputIndex: -1,
// regular values
checkIndex: checkIndex,
flags: flags,
childFlags: 0,
directChildFlags: 0,
childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references,
ngContentIndex: -1, childCount: childCount, bindings: bindings,
bindingFlags: calcBindingFlags(bindings), outputs: outputs,
element: null,
provider: { token: token, value: value, deps: depDefs },
text: null,
query: null,
ngContent: null
};
}
/**
* @param {?} view
* @param {?} def
* @return {?}
*/
function createProviderInstance(view, def) {
return _createProviderInstance(view, def);
}
/**
* @param {?} view
* @param {?} def
* @return {?}
*/
function createPipeInstance(view, def) {
// deps are looked up from component.
var /** @type {?} */ compView = view;
while (compView.parent && !isComponentView(compView)) {
compView = compView.parent;
}
// pipes can see the private services of the component
var /** @type {?} */ allowPrivateServices = true;
// pipes are always eager and classes!
return createClass(/** @type {?} */ ((compView.parent)), /** @type {?} */ ((viewParentEl(compView))), allowPrivateServices, /** @type {?} */ ((def.provider)).value, /** @type {?} */ ((def.provider)).deps);
}
/**
* @param {?} view
* @param {?} def
* @return {?}
*/
function createDirectiveInstance(view, def) {
// components can see other private services, other directives can't.
var /** @type {?} */ allowPrivateServices = (def.flags & 32768 /* Component */) > 0;
// directives are always eager and classes!
var /** @type {?} */ instance = createClass(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((def.provider)).value, /** @type {?} */ ((def.provider)).deps);
if (def.outputs.length) {
for (var /** @type {?} */ i = 0; i < def.outputs.length; i++) {
var /** @type {?} */ output = def.outputs[i];
var /** @type {?} */ subscription = instance[/** @type {?} */ ((output.propName))].subscribe(eventHandlerClosure(view, /** @type {?} */ ((def.parent)).nodeIndex, output.eventName)); /** @type {?} */
((view.disposables))[def.outputIndex + i] = subscription.unsubscribe.bind(subscription);
}
}
return instance;
}
/**
* @param {?} view
* @param {?} index
* @param {?} eventName
* @return {?}
*/
function eventHandlerClosure(view, index, eventName) {
return function (event) { return dispatchEvent(view, index, eventName, event); };
}
/**
* @param {?} view
* @param {?} def
* @param {?} v0
* @param {?} v1
* @param {?} v2
* @param {?} v3
* @param {?} v4
* @param {?} v5
* @param {?} v6
* @param {?} v7
* @param {?} v8
* @param {?} v9
* @return {?}
*/
function checkAndUpdateDirectiveInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
var /** @type {?} */ providerData = asProviderData(view, def.nodeIndex);
var /** @type {?} */ directive = providerData.instance;
var /** @type {?} */ changed = false;
var /** @type {?} */ changes = /** @type {?} */ ((undefined));
var /** @type {?} */ bindLen = def.bindings.length;
if (bindLen > 0 && checkBinding(view, def, 0, v0)) {
changed = true;
changes = updateProp(view, providerData, def, 0, v0, changes);
}
if (bindLen > 1 && checkBinding(view, def, 1, v1)) {
changed = true;
changes = updateProp(view, providerData, def, 1, v1, changes);
}
if (bindLen > 2 && checkBinding(view, def, 2, v2)) {
changed = true;
changes = updateProp(view, providerData, def, 2, v2, changes);
}
if (bindLen > 3 && checkBinding(view, def, 3, v3)) {
changed = true;
changes = updateProp(view, providerData, def, 3, v3, changes);
}
if (bindLen > 4 && checkBinding(view, def, 4, v4)) {
changed = true;
changes = updateProp(view, providerData, def, 4, v4, changes);
}
if (bindLen > 5 && checkBinding(view, def, 5, v5)) {
changed = true;
changes = updateProp(view, providerData, def, 5, v5, changes);
}
if (bindLen > 6 && checkBinding(view, def, 6, v6)) {
changed = true;
changes = updateProp(view, providerData, def, 6, v6, changes);
}
if (bindLen > 7 && checkBinding(view, def, 7, v7)) {
changed = true;
changes = updateProp(view, providerData, def, 7, v7, changes);
}
if (bindLen > 8 && checkBinding(view, def, 8, v8)) {
changed = true;
changes = updateProp(view, providerData, def, 8, v8, changes);
}
if (bindLen > 9 && checkBinding(view, def, 9, v9)) {
changed = true;
changes = updateProp(view, providerData, def, 9, v9, changes);
}
if (changes) {
directive.ngOnChanges(changes);
}
if ((view.state & 2 /* FirstCheck */) && (def.flags & 65536 /* OnInit */)) {
directive.ngOnInit();
}
if (def.flags & 262144 /* DoCheck */) {
directive.ngDoCheck();
}
return changed;
}
/**
* @param {?} view
* @param {?} def
* @param {?} values
* @return {?}
*/
function checkAndUpdateDirectiveDynamic(view, def, values) {
var /** @type {?} */ providerData = asProviderData(view, def.nodeIndex);
var /** @type {?} */ directive = providerData.instance;
var /** @type {?} */ changed = false;
var /** @type {?} */ changes = /** @type {?} */ ((undefined));
for (var /** @type {?} */ i = 0; i < values.length; i++) {
if (checkBinding(view, def, i, values[i])) {
changed = true;
changes = updateProp(view, providerData, def, i, values[i], changes);
}
}
if (changes) {
directive.ngOnChanges(changes);
}
if ((view.state & 2 /* FirstCheck */) && (def.flags & 65536 /* OnInit */)) {
directive.ngOnInit();
}
if (def.flags & 262144 /* DoCheck */) {
directive.ngDoCheck();
}
return changed;
}
/**
* @param {?} view
* @param {?} def
* @return {?}
*/
function _createProviderInstance(view, def) {
// private services can see other private services
var /** @type {?} */ allowPrivateServices = (def.flags & 8192 /* PrivateProvider */) > 0;
var /** @type {?} */ providerDef = def.provider;
switch (def.flags & 201347067 /* Types */) {
case 512 /* TypeClassProvider */:
return createClass(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((providerDef)).value, /** @type {?} */ ((providerDef)).deps);
case 1024 /* TypeFactoryProvider */:
return callFactory(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((providerDef)).value, /** @type {?} */ ((providerDef)).deps);
case 2048 /* TypeUseExistingProvider */:
return resolveDep(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((providerDef)).deps[0]);
case 256 /* TypeValueProvider */:
return /** @type {?} */ ((providerDef)).value;
}
}
/**
* @param {?} view
* @param {?} elDef
* @param {?} allowPrivateServices
* @param {?} ctor
* @param {?} deps
* @return {?}
*/
function createClass(view, elDef, allowPrivateServices, ctor, deps) {
var /** @type {?} */ len = deps.length;
switch (len) {
case 0:
return new ctor();
case 1:
return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]));
case 2:
return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]));
case 3:
return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2]));
default:
var /** @type {?} */ depValues = new Array(len);
for (var /** @type {?} */ i = 0; i < len; i++) {
depValues[i] = resolveDep(view, elDef, allowPrivateServices, deps[i]);
}
return new (ctor.bind.apply(ctor, [void 0].concat(depValues)))();
}
}
/**
* @param {?} view
* @param {?} elDef
* @param {?} allowPrivateServices
* @param {?} factory
* @param {?} deps
* @return {?}
*/
function callFactory(view, elDef, allowPrivateServices, factory, deps) {
var /** @type {?} */ len = deps.length;
switch (len) {
case 0:
return factory();
case 1:
return factory(resolveDep(view, elDef, allowPrivateServices, deps[0]));
case 2:
return factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]));
case 3:
return factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2]));
default:
var /** @type {?} */ depValues = Array(len);
for (var /** @type {?} */ i = 0; i < len; i++) {
depValues[i] = resolveDep(view, elDef, allowPrivateServices, deps[i]);
}
return factory.apply(void 0, depValues);
}
}
// This default value is when checking the hierarchy for a token.
//
// It means both:
// - the token is not provided by the current injector,
// - only the element injectors should be checked (ie do not check module injectors
//
// mod1
// /
// el1 mod2
// \ /
// el2
//
// When requesting el2.injector.get(token), we should check in the following order and return the
// first found value:
// - el2.injector.get(token, default)
// - el1.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) -> do not check the module
// - mod2.injector.get(token, default)
var NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {};
/**
* @param {?} view
* @param {?} elDef
* @param {?} allowPrivateServices
* @param {?} depDef
* @param {?=} notFoundValue
* @return {?}
*/
function resolveDep(view, elDef, allowPrivateServices, depDef, notFoundValue) {
if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
if (depDef.flags & 8 /* Value */) {
return depDef.token;
}
var /** @type {?} */ startView = view;
if (depDef.flags & 2 /* Optional */) {
notFoundValue = null;
}
var /** @type {?} */ tokenKey$$1 = depDef.tokenKey;
if (tokenKey$$1 === ChangeDetectorRefTokenKey) {
// directives on the same element as a component should be able to control the change detector
// of that component as well.
allowPrivateServices = !!(elDef && /** @type {?} */ ((elDef.element)).componentView);
}
if (elDef && (depDef.flags & 1 /* SkipSelf */)) {
allowPrivateServices = false;
elDef = /** @type {?} */ ((elDef.parent));
}
while (view) {
if (elDef) {
switch (tokenKey$$1) {
case RendererV1TokenKey: {
var /** @type {?} */ compView = findCompView(view, elDef, allowPrivateServices);
return createRendererV1(compView);
}
case Renderer2TokenKey: {
var /** @type {?} */ compView = findCompView(view, elDef, allowPrivateServices);
return compView.renderer;
}
case ElementRefTokenKey:
return new ElementRef(asElementData(view, elDef.nodeIndex).renderElement);
case ViewContainerRefTokenKey:
return asElementData(view, elDef.nodeIndex).viewContainer;
case TemplateRefTokenKey: {
if (/** @type {?} */ ((elDef.element)).template) {
return asElementData(view, elDef.nodeIndex).template;
}
break;
}
case ChangeDetectorRefTokenKey: {
var /** @type {?} */ cdView = findCompView(view, elDef, allowPrivateServices);
return createChangeDetectorRef(cdView);
}
case InjectorRefTokenKey:
return createInjector(view, elDef);
default:
var /** @type {?} */ providerDef_1 = /** @type {?} */ (((allowPrivateServices ? /** @type {?} */ ((elDef.element)).allProviders : /** @type {?} */ ((elDef.element)).publicProviders)))[tokenKey$$1];
if (providerDef_1) {
var /** @type {?} */ providerData = asProviderData(view, providerDef_1.nodeIndex);
if (!providerData) {
providerData = { instance: _createProviderInstance(view, providerDef_1) };
view.nodes[providerDef_1.nodeIndex] = /** @type {?} */ (providerData);
}
return providerData.instance;
}
}
}
allowPrivateServices = isComponentView(view);
elDef = /** @type {?} */ ((viewParentEl(view)));
view = /** @type {?} */ ((view.parent));
}
var /** @type {?} */ value = startView.root.injector.get(depDef.token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR);
if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
// Return the value from the root element injector when
// - it provides it
// (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
// - the module injector should not be checked
// (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
return value;
}
return startView.root.ngModule.injector.get(depDef.token, notFoundValue);
}
/**
* @param {?} view
* @param {?} elDef
* @param {?} allowPrivateServices
* @return {?}
*/
function findCompView(view, elDef, allowPrivateServices) {
var /** @type {?} */ compView;
if (allowPrivateServices) {
compView = asElementData(view, elDef.nodeIndex).componentView;
}
else {
compView = view;
while (compView.parent && !isComponentView(compView)) {
compView = compView.parent;
}
}
return compView;
}
/**
* @param {?} view
* @param {?} providerData
* @param {?} def
* @param {?} bindingIdx
* @param {?} value
* @param {?} changes
* @return {?}
*/
function updateProp(view, providerData, def, bindingIdx, value, changes) {
if (def.flags & 32768 /* Component */) {
var /** @type {?} */ compView = asElementData(view, /** @type {?} */ ((def.parent)).nodeIndex).componentView;
if (compView.def.flags & 2 /* OnPush */) {
compView.state |= 8 /* ChecksEnabled */;
}
}
var /** @type {?} */ binding = def.bindings[bindingIdx];
var /** @type {?} */ propName = /** @type {?} */ ((binding.name));
// Note: This is still safe with Closure Compiler as
// the user passed in the property name as an object has to `providerDef`,
// so Closure Compiler will have renamed the property correctly already.
providerData.instance[propName] = value;
if (def.flags & 524288 /* OnChanges */) {
changes = changes || {};
var /** @type {?} */ oldValue = view.oldValues[def.bindingIndex + bindingIdx];
if (oldValue instanceof WrappedValue) {
oldValue = oldValue.wrapped;
}
var /** @type {?} */ binding_1 = def.bindings[bindingIdx];
changes[/** @type {?} */ ((binding_1.nonMinifiedName))] =
new SimpleChange(oldValue, value, (view.state & 2 /* FirstCheck */) !== 0);
}
view.oldValues[def.bindingIndex + bindingIdx] = value;
return changes;
}
/**
* @param {?} view
* @param {?} lifecycles
* @return {?}
*/
function callLifecycleHooksChildrenFirst(view, lifecycles) {
if (!(view.def.nodeFlags & lifecycles)) {
return;
}
var /** @type {?} */ nodes = view.def.nodes;
for (var /** @type {?} */ i = 0; i < nodes.length; i++) {
var /** @type {?} */ nodeDef = nodes[i];
var /** @type {?} */ parent_1 = nodeDef.parent;
if (!parent_1 && nodeDef.flags & lifecycles) {
// matching root node (e.g. a pipe)
callProviderLifecycles(view, i, nodeDef.flags & lifecycles);
}
if ((nodeDef.childFlags & lifecycles) === 0) {
// no child matches one of the lifecycles
i += nodeDef.childCount;
}
while (parent_1 && (parent_1.flags & 1 /* TypeElement */) &&
i === parent_1.nodeIndex + parent_1.childCount) {
// last child of an element
if (parent_1.directChildFlags & lifecycles) {
callElementProvidersLifecycles(view, parent_1, lifecycles);
}
parent_1 = parent_1.parent;
}
}
}
/**
* @param {?} view
* @param {?} elDef
* @param {?} lifecycles
* @return {?}
*/
function callElementProvidersLifecycles(view, elDef, lifecycles) {
for (var /** @type {?} */ i = elDef.nodeIndex + 1; i <= elDef.nodeIndex + elDef.childCount; i++) {
var /** @type {?} */ nodeDef = view.def.nodes[i];
if (nodeDef.flags & lifecycles) {
callProviderLifecycles(view, i, nodeDef.flags & lifecycles);
}
// only visit direct children
i += nodeDef.childCount;
}
}
/**
* @param {?} view
* @param {?} index
* @param {?} lifecycles
* @return {?}
*/
function callProviderLifecycles(view, index, lifecycles) {
var /** @type {?} */ providerData = asProviderData(view, index);
if (!providerData) {
return;
}
var /** @type {?} */ provider = providerData.instance;
if (!provider) {
return;
}
Services.setCurrentNode(view, index);
if (lifecycles & 1048576 /* AfterContentInit */) {
provider.ngAfterContentInit();
}
if (lifecycles & 2097152 /* AfterContentChecked */) {
provider.ngAfterContentChecked();
}
if (lifecycles & 4194304 /* AfterViewInit */) {
provider.ngAfterViewInit();
}
if (lifecycles & 8388608 /* AfterViewChecked */) {
provider.ngAfterViewChecked();
}
if (lifecycles & 131072 /* OnDestroy */) {
provider.ngOnDestroy();
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @param {?} flags
* @param {?} id
* @param {?} bindings
* @return {?}
*/
function queryDef(flags, id, bindings) {
var /** @type {?} */ bindingDefs = [];
for (var /** @type {?} */ propName in bindings) {
var /** @type {?} */ bindingType = bindings[propName];
bindingDefs.push({ propName: propName, bindingType: bindingType });
}
return {
// will bet set by the view definition
nodeIndex: -1,
parent: null,
renderParent: null,
bindingIndex: -1,
outputIndex: -1,
// regular values
// TODO(vicb): check
checkIndex: -1, flags: flags,
childFlags: 0,
directChildFlags: 0,
childMatchedQueries: 0,
ngContentIndex: -1,
matchedQueries: {},
matchedQueryIds: 0,
references: {},
childCount: 0,
bindings: [],
bindingFlags: 0,
outputs: [],
element: null,
provider: null,
text: null,
query: { id: id, filterId: filterQueryId(id), bindings: bindingDefs },
ngContent: null
};
}
/**
* @return {?}
*/
function createQuery() {
return new QueryList();
}
/**
* @param {?} view
* @return {?}
*/
function dirtyParentQueries(view) {
var /** @type {?} */ queryIds = view.def.nodeMatchedQueries;
while (view.parent && isEmbeddedView(view)) {
var /** @type {?} */ tplDef = /** @type {?} */ ((view.parentNodeDef));
view = view.parent;
// content queries
var /** @type {?} */ end = tplDef.nodeIndex + tplDef.childCount;
for (var /** @type {?} */ i = 0; i <= end; i++) {
var /** @type {?} */ nodeDef = view.def.nodes[i];
if ((nodeDef.flags & 67108864 /* TypeContentQuery */) &&
(nodeDef.flags & 536870912 /* DynamicQuery */) &&
(/** @type {?} */ ((nodeDef.query)).filterId & queryIds) === /** @type {?} */ ((nodeDef.query)).filterId) {
asQueryList(view, i).setDirty();
}
if ((nodeDef.flags & 1 /* TypeElement */ && i + nodeDef.childCount < tplDef.nodeIndex) ||
!(nodeDef.childFlags & 67108864 /* TypeContentQuery */) ||
!(nodeDef.childFlags & 536870912 /* DynamicQuery */)) {
// skip elements that don't contain the template element or no query.
i += nodeDef.childCount;
}
}
}
// view queries
if (view.def.nodeFlags & 134217728 /* TypeViewQuery */) {
for (var /** @type {?} */ i = 0; i < view.def.nodes.length; i++) {
var /** @type {?} */ nodeDef = view.def.nodes[i];
if ((nodeDef.flags & 134217728 /* TypeViewQuery */) && (nodeDef.flags & 536870912 /* DynamicQuery */)) {
asQueryList(view, i).setDirty();
}
// only visit the root nodes
i += nodeDef.childCount;
}
}
}
/**
* @param {?} view
* @param {?} nodeDef
* @return {?}
*/
function checkAndUpdateQuery(view, nodeDef) {
var /** @type {?} */ queryList = asQueryList(view, nodeDef.nodeIndex);
if (!queryList.dirty) {
return;
}
var /** @type {?} */ directiveInstance;
var /** @type {?} */ newValues = /** @type {?} */ ((undefined));
if (nodeDef.flags & 67108864 /* TypeContentQuery */) {
var /** @type {?} */ elementDef = /** @type {?} */ ((/** @type {?} */ ((nodeDef.parent)).parent));
newValues = calcQueryValues(view, elementDef.nodeIndex, elementDef.nodeIndex + elementDef.childCount, /** @type {?} */ ((nodeDef.query)), []);
directiveInstance = asProviderData(view, /** @type {?} */ ((nodeDef.parent)).nodeIndex).instance;
}
else if (nodeDef.flags & 134217728 /* TypeViewQuery */) {
newValues = calcQueryValues(view, 0, view.def.nodes.length - 1, /** @type {?} */ ((nodeDef.query)), []);
directiveInstance = view.component;
}
queryList.reset(newValues);
var /** @type {?} */ bindings = /** @type {?} */ ((nodeDef.query)).bindings;
var /** @type {?} */ notify = false;
for (var /** @type {?} */ i = 0; i < bindings.length; i++) {
var /** @type {?} */ binding = bindings[i];
var /** @type {?} */ boundValue = void 0;
switch (binding.bindingType) {
case 0 /* First */:
boundValue = queryList.first;
break;
case 1 /* All */:
boundValue = queryList;
notify = true;
break;
}
directiveInstance[binding.propName] = boundValue;
}
if (notify) {
queryList.notifyOnChanges();
}
}
/**
* @param {?} view
* @param {?} startIndex
* @param {?} endIndex
* @param {?} queryDef
* @param {?} values
* @return {?}
*/
function calcQueryValues(view, startIndex, endIndex, queryDef, values) {
for (var /** @type {?} */ i = startIndex; i <= endIndex; i++) {
var /** @type {?} */ nodeDef = view.def.nodes[i];
var /** @type {?} */ valueType = nodeDef.matchedQueries[queryDef.id];
if (valueType != null) {
values.push(getQueryValue(view, nodeDef, valueType));
}
if (nodeDef.flags & 1 /* TypeElement */ && /** @type {?} */ ((nodeDef.element)).template &&
(/** @type {?} */ ((/** @type {?} */ ((nodeDef.element)).template)).nodeMatchedQueries & queryDef.filterId) ===
queryDef.filterId) {
var /** @type {?} */ elementData = asElementData(view, i);
// check embedded views that were attached at the place of their template,
// but process child nodes first if some match the query (see issue #16568)
if ((nodeDef.childMatchedQueries & queryDef.filterId) === queryDef.filterId) {
calcQueryValues(view, i + 1, i + nodeDef.childCount, queryDef, values);
i += nodeDef.childCount;
}
if (nodeDef.flags & 16777216 /* EmbeddedViews */) {
var /** @type {?} */ embeddedViews = /** @type {?} */ ((elementData.viewContainer))._embeddedViews;
for (var /** @type {?} */ k = 0; k < embeddedViews.length; k++) {
var /** @type {?} */ embeddedView = embeddedViews[k];
var /** @type {?} */ dvc = declaredViewContainer(embeddedView);
if (dvc && dvc === elementData) {
calcQueryValues(embeddedView, 0, embeddedView.def.nodes.length - 1, queryDef, values);
}
}
}
var /** @type {?} */ projectedViews = elementData.template._projectedViews;
if (projectedViews) {
for (var /** @type {?} */ k = 0; k < projectedViews.length; k++) {
var /** @type {?} */ projectedView = projectedViews[k];
calcQueryValues(projectedView, 0, projectedView.def.nodes.length - 1, queryDef, values);
}
}
}
if ((nodeDef.childMatchedQueries & queryDef.filterId) !== queryDef.filterId) {
// if no child matches the query, skip the children.
i += nodeDef.childCount;
}
}
return values;
}
/**
* @param {?} view
* @param {?} nodeDef
* @param {?} queryValueType
* @return {?}
*/
function getQueryValue(view, nodeDef, queryValueType) {
if (queryValueType != null) {
// a match
switch (queryValueType) {
case 1 /* RenderElement */:
return asElementData(view, nodeDef.nodeIndex).renderElement;
case 0 /* ElementRef */:
return new ElementRef(asElementData(view, nodeDef.nodeIndex).renderElement);
case 2 /* TemplateRef */:
return asElementData(view, nodeDef.nodeIndex).template;
case 3 /* ViewContainerRef */:
return asElementData(view, nodeDef.nodeIndex).viewContainer;
case 4 /* Provider */:
return asProviderData(view, nodeDef.nodeIndex).instance;
}
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @param {?} ngContentIndex
* @param {?} index
* @return {?}
*/
function ngContentDef(ngContentIndex, index) {
return {
// will bet set by the view definition
nodeIndex: -1,
parent: null,
renderParent: null,
bindingIndex: -1,
outputIndex: -1,
// regular values
checkIndex: -1,
flags: 8 /* TypeNgContent */,
childFlags: 0,
directChildFlags: 0,
childMatchedQueries: 0,
matchedQueries: {},
matchedQueryIds: 0,
references: {}, ngContentIndex: ngContentIndex,
childCount: 0,
bindings: [],
bindingFlags: 0,
outputs: [],
element: null,
provider: null,
text: null,
query: null,
ngContent: { index: index }
};
}
/**
* @param {?} view
* @param {?} renderHost
* @param {?} def
* @return {?}
*/
function appendNgContent(view, renderHost, def) {
var /** @type {?} */ parentEl = getParentRenderElement(view, renderHost, def);
if (!parentEl) {
// Nothing to do if there is no parent element.
return;
}
var /** @type {?} */ ngContentIndex = /** @type {?} */ ((def.ngContent)).index;
visitProjectedRenderNodes(view, ngContentIndex, 1 /* AppendChild */, parentEl, null, undefined);
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @param {?} checkIndex
* @param {?} argCount
* @return {?}
*/
function purePipeDef(checkIndex, argCount) {
// argCount + 1 to include the pipe as first arg
return _pureExpressionDef(128 /* TypePurePipe */, checkIndex, new Array(argCount + 1));
}
/**
* @param {?} checkIndex
* @param {?} argCount
* @return {?}
*/
function pureArrayDef(checkIndex, argCount) {
return _pureExpressionDef(32 /* TypePureArray */, checkIndex, new Array(argCount));
}
/**
* @param {?} checkIndex
* @param {?} propToIndex
* @return {?}
*/
function pureObjectDef(checkIndex, propToIndex) {
var /** @type {?} */ keys = Object.keys(propToIndex);
var /** @type {?} */ nbKeys = keys.length;
var /** @type {?} */ propertyNames = new Array(nbKeys);
for (var /** @type {?} */ i = 0; i < nbKeys; i++) {
var /** @type {?} */ key = keys[i];
var /** @type {?} */ index = propToIndex[key];
propertyNames[index] = key;
}
return _pureExpressionDef(64 /* TypePureObject */, checkIndex, propertyNames);
}
/**
* @param {?} flags
* @param {?} checkIndex
* @param {?} propertyNames
* @return {?}
*/
function _pureExpressionDef(flags, checkIndex, propertyNames) {
var /** @type {?} */ bindings = new Array(propertyNames.length);
for (var /** @type {?} */ i = 0; i < propertyNames.length; i++) {
var /** @type {?} */ prop = propertyNames[i];
bindings[i] = {
flags: 8 /* TypeProperty */,
name: prop,
ns: null,
nonMinifiedName: prop,
securityContext: null,
suffix: null
};
}
return {
// will bet set by the view definition
nodeIndex: -1,
parent: null,
renderParent: null,
bindingIndex: -1,
outputIndex: -1,
// regular values
checkIndex: checkIndex,
flags: flags,
childFlags: 0,
directChildFlags: 0,
childMatchedQueries: 0,
matchedQueries: {},
matchedQueryIds: 0,
references: {},
ngContentIndex: -1,
childCount: 0, bindings: bindings,
bindingFlags: calcBindingFlags(bindings),
outputs: [],
element: null,
provider: null,
text: null,
query: null,
ngContent: null
};
}
/**
* @param {?} view
* @param {?} def
* @return {?}
*/
function createPureExpression(view, def) {
return { value: undefined };
}
/**
* @param {?} view
* @param {?} def
* @param {?} v0
* @param {?} v1
* @param {?} v2
* @param {?} v3
* @param {?} v4
* @param {?} v5
* @param {?} v6
* @param {?} v7
* @param {?} v8
* @param {?} v9
* @return {?}
*/
function checkAndUpdatePureExpressionInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
var /** @type {?} */ bindings = def.bindings;
var /** @type {?} */ changed = false;
var /** @type {?} */ bindLen = bindings.length;
if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0))
changed = true;
if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1))
changed = true;
if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2))
changed = true;
if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3))
changed = true;
if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4))
changed = true;
if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5))
changed = true;
if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6))
changed = true;
if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7))
changed = true;
if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8))
changed = true;
if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9))
changed = true;
if (changed) {
var /** @type {?} */ data = asPureExpressionData(view, def.nodeIndex);
var /** @type {?} */ value = void 0;
switch (def.flags & 201347067 /* Types */) {
case 32 /* TypePureArray */:
value = new Array(bindings.length);
if (bindLen > 0)
value[0] = v0;
if (bindLen > 1)
value[1] = v1;
if (bindLen > 2)
value[2] = v2;
if (bindLen > 3)
value[3] = v3;
if (bindLen > 4)
value[4] = v4;
if (bindLen > 5)
value[5] = v5;
if (bindLen > 6)
value[6] = v6;
if (bindLen > 7)
value[7] = v7;
if (bindLen > 8)
value[8] = v8;
if (bindLen > 9)
value[9] = v9;
break;
case 64 /* TypePureObject */:
value = {};
if (bindLen > 0)
value[/** @type {?} */ ((bindings[0].name))] = v0;
if (bindLen > 1)
value[/** @type {?} */ ((bindings[1].name))] = v1;
if (bindLen > 2)
value[/** @type {?} */ ((bindings[2].name))] = v2;
if (bindLen > 3)
value[/** @type {?} */ ((bindings[3].name))] = v3;
if (bindLen > 4)
value[/** @type {?} */ ((bindings[4].name))] = v4;
if (bindLen > 5)
value[/** @type {?} */ ((bindings[5].name))] = v5;
if (bindLen > 6)
value[/** @type {?} */ ((bindings[6].name))] = v6;
if (bindLen > 7)
value[/** @type {?} */ ((bindings[7].name))] = v7;
if (bindLen > 8)
value[/** @type {?} */ ((bindings[8].name))] = v8;
if (bindLen > 9)
value[/** @type {?} */ ((bindings[9].name))] = v9;
break;
case 128 /* TypePurePipe */:
var /** @type {?} */ pipe = v0;
switch (bindLen) {
case 1:
value = pipe.transform(v0);
break;
case 2:
value = pipe.transform(v1);
break;
case 3:
value = pipe.transform(v1, v2);
break;
case 4:
value = pipe.transform(v1, v2, v3);
break;
case 5:
value = pipe.transform(v1, v2, v3, v4);
break;
case 6:
value = pipe.transform(v1, v2, v3, v4, v5);
break;
case 7:
value = pipe.transform(v1, v2, v3, v4, v5, v6);
break;
case 8:
value = pipe.transform(v1, v2, v3, v4, v5, v6, v7);
break;
case 9:
value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8);
break;
case 10:
value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8, v9);
break;
}
break;
}
data.value = value;
}
return changed;
}
/**
* @param {?} view
* @param {?} def
* @param {?} values
* @return {?}
*/
function checkAndUpdatePureExpressionDynamic(view, def, values) {
var /** @type {?} */ bindings = def.bindings;
var /** @type {?} */ changed = false;
for (var /** @type {?} */ i = 0; i < values.length; i++) {
// Note: We need to loop over all values, so that
// the old values are updates as well!
if (checkAndUpdateBinding(view, def, i, values[i])) {
changed = true;
}
}
if (changed) {
var /** @type {?} */ data = asPureExpressionData(view, def.nodeIndex);
var /** @type {?} */ value = void 0;
switch (def.flags & 201347067 /* Types */) {
case 32 /* TypePureArray */:
value = values;
break;
case 64 /* TypePureObject */:
value = {};
for (var /** @type {?} */ i = 0; i < values.length; i++) {
value[/** @type {?} */ ((bindings[i].name))] = values[i];
}
break;
case 128 /* TypePurePipe */:
var /** @type {?} */ pipe = values[0];
var /** @type {?} */ params = values.slice(1);
value = pipe.transform.apply(pipe, params);
break;
}
data.value = value;
}
return changed;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @param {?} checkIndex
* @param {?} ngContentIndex
* @param {?} staticText
* @return {?}
*/
function textDef(checkIndex, ngContentIndex, staticText) {
var /** @type {?} */ bindings = new Array(staticText.length - 1);
for (var /** @type {?} */ i = 1; i < staticText.length; i++) {
bindings[i - 1] = {
flags: 8 /* TypeProperty */,
name: null,
ns: null,
nonMinifiedName: null,
securityContext: null,
suffix: staticText[i],
};
}
return {
// will bet set by the view definition
nodeIndex: -1,
parent: null,
renderParent: null,
bindingIndex: -1,
outputIndex: -1,
// regular values
checkIndex: checkIndex,
flags: 2 /* TypeText */,
childFlags: 0,
directChildFlags: 0,
childMatchedQueries: 0,
matchedQueries: {},
matchedQueryIds: 0,
references: {}, ngContentIndex: ngContentIndex,
childCount: 0, bindings: bindings,
bindingFlags: 8 /* TypeProperty */,
outputs: [],
element: null,
provider: null,
text: { prefix: staticText[0] },
query: null,
ngContent: null,
};
}
/**
* @param {?} view
* @param {?} renderHost
* @param {?} def
* @return {?}
*/
function createText(view, renderHost, def) {
var /** @type {?} */ renderNode$$1;
var /** @type {?} */ renderer = view.renderer;
renderNode$$1 = renderer.createText(/** @type {?} */ ((def.text)).prefix);
var /** @type {?} */ parentEl = getParentRenderElement(view, renderHost, def);
if (parentEl) {
renderer.appendChild(parentEl, renderNode$$1);
}
return { renderText: renderNode$$1 };
}
/**
* @param {?} view
* @param {?} def
* @param {?} v0
* @param {?} v1
* @param {?} v2
* @param {?} v3
* @param {?} v4
* @param {?} v5
* @param {?} v6
* @param {?} v7
* @param {?} v8
* @param {?} v9
* @return {?}
*/
function checkAndUpdateTextInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
var /** @type {?} */ changed = false;
var /** @type {?} */ bindings = def.bindings;
var /** @type {?} */ bindLen = bindings.length;
if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0))
changed = true;
if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1))
changed = true;
if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2))
changed = true;
if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3))
changed = true;
if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4))
changed = true;
if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5))
changed = true;
if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6))
changed = true;
if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7))
changed = true;
if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8))
changed = true;
if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9))
changed = true;
if (changed) {
var /** @type {?} */ value = /** @type {?} */ ((def.text)).prefix;
if (bindLen > 0)
value += _addInterpolationPart(v0, bindings[0]);
if (bindLen > 1)
value += _addInterpolationPart(v1, bindings[1]);
if (bindLen > 2)
value += _addInterpolationPart(v2, bindings[2]);
if (bindLen > 3)
value += _addInterpolationPart(v3, bindings[3]);
if (bindLen > 4)
value += _addInterpolationPart(v4, bindings[4]);
if (bindLen > 5)
value += _addInterpolationPart(v5, bindings[5]);
if (bindLen > 6)
value += _addInterpolationPart(v6, bindings[6]);
if (bindLen > 7)
value += _addInterpolationPart(v7, bindings[7]);
if (bindLen > 8)
value += _addInterpolationPart(v8, bindings[8]);
if (bindLen > 9)
value += _addInterpolationPart(v9, bindings[9]);
var /** @type {?} */ renderNode$$1 = asTextData(view, def.nodeIndex).renderText;
view.renderer.setValue(renderNode$$1, value);
}
return changed;
}
/**
* @param {?} view
* @param {?} def
* @param {?} values
* @return {?}
*/
function checkAndUpdateTextDynamic(view, def, values) {
var /** @type {?} */ bindings = def.bindings;
var /** @type {?} */ changed = false;
for (var /** @type {?} */ i = 0; i < values.length; i++) {
// Note: We need to loop over all values, so that
// the old values are updates as well!
if (checkAndUpdateBinding(view, def, i, values[i])) {
changed = true;
}
}
if (changed) {
var /** @type {?} */ value = '';
for (var /** @type {?} */ i = 0; i < values.length; i++) {
value = value + _addInterpolationPart(values[i], bindings[i]);
}
value = /** @type {?} */ ((def.text)).prefix + value;
var /** @type {?} */ renderNode$$1 = asTextData(view, def.nodeIndex).renderText;
view.renderer.setValue(renderNode$$1, value);
}
return changed;
}
/**
* @param {?} value
* @param {?} binding
* @return {?}
*/
function _addInterpolationPart(value, binding) {
var /** @type {?} */ valueStr = value != null ? value.toString() : '';
return valueStr + binding.suffix;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @param {?} flags
* @param {?} nodes
* @param {?=} updateDirectives
* @param {?=} updateRenderer
* @return {?}
*/
function viewDef(flags, nodes, updateDirectives, updateRenderer) {
// clone nodes and set auto calculated values
var /** @type {?} */ viewBindingCount = 0;
var /** @type {?} */ viewDisposableCount = 0;
var /** @type {?} */ viewNodeFlags = 0;
var /** @type {?} */ viewRootNodeFlags = 0;
var /** @type {?} */ viewMatchedQueries = 0;
var /** @type {?} */ currentParent = null;
var /** @type {?} */ currentRenderParent = null;
var /** @type {?} */ currentElementHasPublicProviders = false;
var /** @type {?} */ currentElementHasPrivateProviders = false;
var /** @type {?} */ lastRenderRootNode = null;
for (var /** @type {?} */ i = 0; i < nodes.length; i++) {
var /** @type {?} */ node = nodes[i];
node.nodeIndex = i;
node.parent = currentParent;
node.bindingIndex = viewBindingCount;
node.outputIndex = viewDisposableCount;
node.renderParent = currentRenderParent;
viewNodeFlags |= node.flags;
viewMatchedQueries |= node.matchedQueryIds;
if (node.element) {
var /** @type {?} */ elDef = node.element;
elDef.publicProviders =
currentParent ? /** @type {?} */ ((currentParent.element)).publicProviders : Object.create(null);
elDef.allProviders = elDef.publicProviders;
// Note: We assume that all providers of an element are before any child element!
currentElementHasPublicProviders = false;
currentElementHasPrivateProviders = false;
if (node.element.template) {
viewMatchedQueries |= node.element.template.nodeMatchedQueries;
}
}
validateNode(currentParent, node, nodes.length);
viewBindingCount += node.bindings.length;
viewDisposableCount += node.outputs.length;
if (!currentRenderParent && (node.flags & 3 /* CatRenderNode */)) {
lastRenderRootNode = node;
}
if (node.flags & 20224 /* CatProvider */) {
if (!currentElementHasPublicProviders) {
currentElementHasPublicProviders = true; /** @type {?} */
((/** @type {?} */ ((currentParent)).element)).publicProviders = Object.create(/** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).publicProviders); /** @type {?} */
((/** @type {?} */ ((currentParent)).element)).allProviders = /** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).publicProviders;
}
var /** @type {?} */ isPrivateService = (node.flags & 8192 /* PrivateProvider */) !== 0;
var /** @type {?} */ isComponent = (node.flags & 32768 /* Component */) !== 0;
if (!isPrivateService || isComponent) {
/** @type {?} */ ((/** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).publicProviders))[tokenKey(/** @type {?} */ ((node.provider)).token)] = node;
}
else {
if (!currentElementHasPrivateProviders) {
currentElementHasPrivateProviders = true; /** @type {?} */
((/** @type {?} */ ((currentParent)).element)).allProviders = Object.create(/** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).publicProviders);
} /** @type {?} */
((/** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).allProviders))[tokenKey(/** @type {?} */ ((node.provider)).token)] = node;
}
if (isComponent) {
/** @type {?} */ ((/** @type {?} */ ((currentParent)).element)).componentProvider = node;
}
}
if (currentParent) {
currentParent.childFlags |= node.flags;
currentParent.directChildFlags |= node.flags;
currentParent.childMatchedQueries |= node.matchedQueryIds;
if (node.element && node.element.template) {
currentParent.childMatchedQueries |= node.element.template.nodeMatchedQueries;
}
}
else {
viewRootNodeFlags |= node.flags;
}
if (node.childCount > 0) {
currentParent = node;
if (!isNgContainer(node)) {
currentRenderParent = node;
}
}
else {
// When the current node has no children, check if it is the last children of its parent.
// When it is, propagate the flags up.
// The loop is required because an element could be the last transitive children of several
// elements. We loop to either the root or the highest opened element (= with remaining
// children)
while (currentParent && i === currentParent.nodeIndex + currentParent.childCount) {
var /** @type {?} */ newParent = currentParent.parent;
if (newParent) {
newParent.childFlags |= currentParent.childFlags;
newParent.childMatchedQueries |= currentParent.childMatchedQueries;
}
currentParent = newParent;
// We also need to update the render parent & account for ng-container
if (currentParent && isNgContainer(currentParent)) {
currentRenderParent = currentParent.renderParent;
}
else {
currentRenderParent = currentParent;
}
}
}
}
var /** @type {?} */ handleEvent = function (view, nodeIndex, eventName, event) { return /** @type {?} */ ((/** @type {?} */ ((nodes[nodeIndex].element)).handleEvent))(view, eventName, event); };
return {
// Will be filled later...
factory: null,
nodeFlags: viewNodeFlags,
rootNodeFlags: viewRootNodeFlags,
nodeMatchedQueries: viewMatchedQueries, flags: flags,
nodes: nodes,
updateDirectives: updateDirectives || NOOP,
updateRenderer: updateRenderer || NOOP, handleEvent: handleEvent,
bindingCount: viewBindingCount,
outputCount: viewDisposableCount, lastRenderRootNode: lastRenderRootNode
};
}
/**
* @param {?} node
* @return {?}
*/
function isNgContainer(node) {
return (node.flags & 1 /* TypeElement */) !== 0 && /** @type {?} */ ((node.element)).name === null;
}
/**
* @param {?} parent
* @param {?} node
* @param {?} nodeCount
* @return {?}
*/
function validateNode(parent, node, nodeCount) {
var /** @type {?} */ template = node.element && node.element.template;
if (template) {
if (!template.lastRenderRootNode) {
throw new Error("Illegal State: Embedded templates without nodes are not allowed!");
}
if (template.lastRenderRootNode &&
template.lastRenderRootNode.flags & 16777216 /* EmbeddedViews */) {
throw new Error("Illegal State: Last root node of a template can't have embedded views, at index " + node.nodeIndex + "!");
}
}
if (node.flags & 20224 /* CatProvider */) {
var /** @type {?} */ parentFlags = parent ? parent.flags : 0;
if ((parentFlags & 1 /* TypeElement */) === 0) {
throw new Error("Illegal State: StaticProvider/Directive nodes need to be children of elements or anchors, at index " + node.nodeIndex + "!");
}
}
if (node.query) {
if (node.flags & 67108864 /* TypeContentQuery */ &&
(!parent || (parent.flags & 16384 /* TypeDirective */) === 0)) {
throw new Error("Illegal State: Content Query nodes need to be children of directives, at index " + node.nodeIndex + "!");
}
if (node.flags & 134217728 /* TypeViewQuery */ && parent) {
throw new Error("Illegal State: View Query nodes have to be top level nodes, at index " + node.nodeIndex + "!");
}
}
if (node.childCount) {
var /** @type {?} */ parentEnd = parent ? parent.nodeIndex + parent.childCount : nodeCount - 1;
if (node.nodeIndex <= parentEnd && node.nodeIndex + node.childCount > parentEnd) {
throw new Error("Illegal State: childCount of node leads outside of parent, at index " + node.nodeIndex + "!");
}
}
}
/**
* @param {?} parent
* @param {?} anchorDef
* @param {?} viewDef
* @param {?=} context
* @return {?}
*/
function createEmbeddedView(parent, anchorDef$$1, viewDef, context) {
// embedded views are seen as siblings to the anchor, so we need
// to get the parent of the anchor and use it as parentIndex.
var /** @type {?} */ view = createView(parent.root, parent.renderer, parent, anchorDef$$1, viewDef);
initView(view, parent.component, context);
createViewNodes(view);
return view;
}
/**
* @param {?} root
* @param {?} def
* @param {?=} context
* @return {?}
*/
function createRootView(root, def, context) {
var /** @type {?} */ view = createView(root, root.renderer, null, null, def);
initView(view, context, context);
createViewNodes(view);
return view;
}
/**
* @param {?} parentView
* @param {?} nodeDef
* @param {?} viewDef
* @param {?} hostElement
* @return {?}
*/
function createComponentView(parentView, nodeDef, viewDef, hostElement) {
var /** @type {?} */ rendererType = /** @type {?} */ ((nodeDef.element)).componentRendererType;
var /** @type {?} */ compRenderer;
if (!rendererType) {
compRenderer = parentView.root.renderer;
}
else {
compRenderer = parentView.root.rendererFactory.createRenderer(hostElement, rendererType);
}
return createView(parentView.root, compRenderer, parentView, /** @type {?} */ ((nodeDef.element)).componentProvider, viewDef);
}
/**
* @param {?} root
* @param {?} renderer
* @param {?} parent
* @param {?} parentNodeDef
* @param {?} def
* @return {?}
*/
function createView(root, renderer, parent, parentNodeDef, def) {
var /** @type {?} */ nodes = new Array(def.nodes.length);
var /** @type {?} */ disposables = def.outputCount ? new Array(def.outputCount) : null;
var /** @type {?} */ view = {
def: def,
parent: parent,
viewContainerParent: null, parentNodeDef: parentNodeDef,
context: null,
component: null, nodes: nodes,
state: 13 /* CatInit */, root: root, renderer: renderer,
oldValues: new Array(def.bindingCount), disposables: disposables
};
return view;
}
/**
* @param {?} view
* @param {?} component
* @param {?} context
* @return {?}
*/
function initView(view, component, context) {
view.component = component;
view.context = context;
}
/**
* @param {?} view
* @return {?}
*/
function createViewNodes(view) {
var /** @type {?} */ renderHost;
if (isComponentView(view)) {
var /** @type {?} */ hostDef = view.parentNodeDef;
renderHost = asElementData(/** @type {?} */ ((view.parent)), /** @type {?} */ ((/** @type {?} */ ((hostDef)).parent)).nodeIndex).renderElement;
}
var /** @type {?} */ def = view.def;
var /** @type {?} */ nodes = view.nodes;
for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) {
var /** @type {?} */ nodeDef = def.nodes[i];
Services.setCurrentNode(view, i);
var /** @type {?} */ nodeData = void 0;
switch (nodeDef.flags & 201347067 /* Types */) {
case 1 /* TypeElement */:
var /** @type {?} */ el = /** @type {?} */ (createElement(view, renderHost, nodeDef));
var /** @type {?} */ componentView = /** @type {?} */ ((undefined));
if (nodeDef.flags & 33554432 /* ComponentView */) {
var /** @type {?} */ compViewDef = resolveDefinition(/** @type {?} */ ((/** @type {?} */ ((nodeDef.element)).componentView)));
componentView = Services.createComponentView(view, nodeDef, compViewDef, el);
}
listenToElementOutputs(view, componentView, nodeDef, el);
nodeData = /** @type {?} */ ({
renderElement: el,
componentView: componentView,
viewContainer: null,
template: /** @type {?} */ ((nodeDef.element)).template ? createTemplateData(view, nodeDef) : undefined
});
if (nodeDef.flags & 16777216 /* EmbeddedViews */) {
nodeData.viewContainer = createViewContainerData(view, nodeDef, nodeData);
}
break;
case 2 /* TypeText */:
nodeData = /** @type {?} */ (createText(view, renderHost, nodeDef));
break;
case 512 /* TypeClassProvider */:
case 1024 /* TypeFactoryProvider */:
case 2048 /* TypeUseExistingProvider */:
case 256 /* TypeValueProvider */: {
nodeData = nodes[i];
if (!nodeData && !(nodeDef.flags & 4096 /* LazyProvider */)) {
var /** @type {?} */ instance = createProviderInstance(view, nodeDef);
nodeData = /** @type {?} */ ({ instance: instance });
}
break;
}
case 16 /* TypePipe */: {
var /** @type {?} */ instance = createPipeInstance(view, nodeDef);
nodeData = /** @type {?} */ ({ instance: instance });
break;
}
case 16384 /* TypeDirective */: {
nodeData = nodes[i];
if (!nodeData) {
var /** @type {?} */ instance = createDirectiveInstance(view, nodeDef);
nodeData = /** @type {?} */ ({ instance: instance });
}
if (nodeDef.flags & 32768 /* Component */) {
var /** @type {?} */ compView = asElementData(view, /** @type {?} */ ((nodeDef.parent)).nodeIndex).componentView;
initView(compView, nodeData.instance, nodeData.instance);
}
break;
}
case 32 /* TypePureArray */:
case 64 /* TypePureObject */:
case 128 /* TypePurePipe */:
nodeData = /** @type {?} */ (createPureExpression(view, nodeDef));
break;
case 67108864 /* TypeContentQuery */:
case 134217728 /* TypeViewQuery */:
nodeData = /** @type {?} */ (createQuery());
break;
case 8 /* TypeNgContent */:
appendNgContent(view, renderHost, nodeDef);
// no runtime data needed for NgContent...
nodeData = undefined;
break;
}
nodes[i] = nodeData;
}
// Create the ViewData.nodes of component views after we created everything else,
// so that e.g. ng-content works
execComponentViewsAction(view, ViewAction.CreateViewNodes);
// fill static content and view queries
execQueriesAction(view, 67108864 /* TypeContentQuery */ | 134217728 /* TypeViewQuery */, 268435456 /* StaticQuery */, 0 /* CheckAndUpdate */);
}
/**
* @param {?} view
* @return {?}
*/
function checkNoChangesView(view) {
markProjectedViewsForCheck(view);
Services.updateDirectives(view, 1 /* CheckNoChanges */);
execEmbeddedViewsAction(view, ViewAction.CheckNoChanges);
Services.updateRenderer(view, 1 /* CheckNoChanges */);
execComponentViewsAction(view, ViewAction.CheckNoChanges);
// Note: We don't check queries for changes as we didn't do this in v2.x.
// TODO(tbosch): investigate if we can enable the check again in v5.x with a nicer error message.
view.state &= ~(64 /* CheckProjectedViews */ | 32 /* CheckProjectedView */);
}
/**
* @param {?} view
* @return {?}
*/
function checkAndUpdateView(view) {
if (view.state & 1 /* BeforeFirstCheck */) {
view.state &= ~1 /* BeforeFirstCheck */;
view.state |= 2 /* FirstCheck */;
}
else {
view.state &= ~2 /* FirstCheck */;
}
markProjectedViewsForCheck(view);
Services.updateDirectives(view, 0 /* CheckAndUpdate */);
execEmbeddedViewsAction(view, ViewAction.CheckAndUpdate);
execQueriesAction(view, 67108864 /* TypeContentQuery */, 536870912 /* DynamicQuery */, 0 /* CheckAndUpdate */);
callLifecycleHooksChildrenFirst(view, 2097152 /* AfterContentChecked */ |
(view.state & 2 /* FirstCheck */ ? 1048576 /* AfterContentInit */ : 0));
Services.updateRenderer(view, 0 /* CheckAndUpdate */);
execComponentViewsAction(view, ViewAction.CheckAndUpdate);
execQueriesAction(view, 134217728 /* TypeViewQuery */, 536870912 /* DynamicQuery */, 0 /* CheckAndUpdate */);
callLifecycleHooksChildrenFirst(view, 8388608 /* AfterViewChecked */ |
(view.state & 2 /* FirstCheck */ ? 4194304 /* AfterViewInit */ : 0));
if (view.def.flags & 2 /* OnPush */) {
view.state &= ~8 /* ChecksEnabled */;
}
view.state &= ~(64 /* CheckProjectedViews */ | 32 /* CheckProjectedView */);
}
/**
* @param {?} view
* @param {?} nodeDef
* @param {?} argStyle
* @param {?=} v0
* @param {?=} v1
* @param {?=} v2
* @param {?=} v3
* @param {?=} v4
* @param {?=} v5
* @param {?=} v6
* @param {?=} v7
* @param {?=} v8
* @param {?=} v9
* @return {?}
*/
function checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
if (argStyle === 0 /* Inline */) {
return checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
}
else {
return checkAndUpdateNodeDynamic(view, nodeDef, v0);
}
}
/**
* @param {?} view
* @return {?}
*/
function markProjectedViewsForCheck(view) {
var /** @type {?} */ def = view.def;
if (!(def.nodeFlags & 4 /* ProjectedTemplate */)) {
return;
}
for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) {
var /** @type {?} */ nodeDef = def.nodes[i];
if (nodeDef.flags & 4 /* ProjectedTemplate */) {
var /** @type {?} */ projectedViews = asElementData(view, i).template._projectedViews;
if (projectedViews) {
for (var /** @type {?} */ i_1 = 0; i_1 < projectedViews.length; i_1++) {
var /** @type {?} */ projectedView = projectedViews[i_1];
projectedView.state |= 32 /* CheckProjectedView */;
markParentViewsForCheckProjectedViews(projectedView, view);
}
}
}
else if ((nodeDef.childFlags & 4 /* ProjectedTemplate */) === 0) {
// a parent with leafs
// no child is a component,
// then skip the children
i += nodeDef.childCount;
}
}
}
/**
* @param {?} view
* @param {?} nodeDef
* @param {?=} v0
* @param {?=} v1
* @param {?=} v2
* @param {?=} v3
* @param {?=} v4
* @param {?=} v5
* @param {?=} v6
* @param {?=} v7
* @param {?=} v8
* @param {?=} v9
* @return {?}
*/
function checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
switch (nodeDef.flags & 201347067 /* Types */) {
case 1 /* TypeElement */:
return checkAndUpdateElementInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
case 2 /* TypeText */:
return checkAndUpdateTextInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
case 16384 /* TypeDirective */:
return checkAndUpdateDirectiveInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
case 32 /* TypePureArray */:
case 64 /* TypePureObject */:
case 128 /* TypePurePipe */:
return checkAndUpdatePureExpressionInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
default:
throw 'unreachable';
}
}
/**
* @param {?} view
* @param {?} nodeDef
* @param {?} values
* @return {?}
*/
function checkAndUpdateNodeDynamic(view, nodeDef, values) {
switch (nodeDef.flags & 201347067 /* Types */) {
case 1 /* TypeElement */:
return checkAndUpdateElementDynamic(view, nodeDef, values);
case 2 /* TypeText */:
return checkAndUpdateTextDynamic(view, nodeDef, values);
case 16384 /* TypeDirective */:
return checkAndUpdateDirectiveDynamic(view, nodeDef, values);
case 32 /* TypePureArray */:
case 64 /* TypePureObject */:
case 128 /* TypePurePipe */:
return checkAndUpdatePureExpressionDynamic(view, nodeDef, values);
default:
throw 'unreachable';
}
}
/**
* @param {?} view
* @param {?} nodeDef
* @param {?} argStyle
* @param {?=} v0
* @param {?=} v1
* @param {?=} v2
* @param {?=} v3
* @param {?=} v4
* @param {?=} v5
* @param {?=} v6
* @param {?=} v7
* @param {?=} v8
* @param {?=} v9
* @return {?}
*/
function checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
if (argStyle === 0 /* Inline */) {
checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
}
else {
checkNoChangesNodeDynamic(view, nodeDef, v0);
}
// Returning false is ok here as we would have thrown in case of a change.
return false;
}
/**
* @param {?} view
* @param {?} nodeDef
* @param {?} v0
* @param {?} v1
* @param {?} v2
* @param {?} v3
* @param {?} v4
* @param {?} v5
* @param {?} v6
* @param {?} v7
* @param {?} v8
* @param {?} v9
* @return {?}
*/
function checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
var /** @type {?} */ bindLen = nodeDef.bindings.length;
if (bindLen > 0)
checkBindingNoChanges(view, nodeDef, 0, v0);
if (bindLen > 1)
checkBindingNoChanges(view, nodeDef, 1, v1);
if (bindLen > 2)
checkBindingNoChanges(view, nodeDef, 2, v2);
if (bindLen > 3)
checkBindingNoChanges(view, nodeDef, 3, v3);
if (bindLen > 4)
checkBindingNoChanges(view, nodeDef, 4, v4);
if (bindLen > 5)
checkBindingNoChanges(view, nodeDef, 5, v5);
if (bindLen > 6)
checkBindingNoChanges(view, nodeDef, 6, v6);
if (bindLen > 7)
checkBindingNoChanges(view, nodeDef, 7, v7);
if (bindLen > 8)
checkBindingNoChanges(view, nodeDef, 8, v8);
if (bindLen > 9)
checkBindingNoChanges(view, nodeDef, 9, v9);
}
/**
* @param {?} view
* @param {?} nodeDef
* @param {?} values
* @return {?}
*/
function checkNoChangesNodeDynamic(view, nodeDef, values) {
for (var /** @type {?} */ i = 0; i < values.length; i++) {
checkBindingNoChanges(view, nodeDef, i, values[i]);
}
}
/**
* Workaround https://github.com/angular/tsickle/issues/497
* @suppress {misplacedTypeAnnotation}
* @param {?} view
* @param {?} nodeDef
* @return {?}
*/
function checkNoChangesQuery(view, nodeDef) {
var /** @type {?} */ queryList = asQueryList(view, nodeDef.nodeIndex);
if (queryList.dirty) {
throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, nodeDef.nodeIndex), "Query " + (/** @type {?} */ ((nodeDef.query))).id + " not dirty", "Query " + (/** @type {?} */ ((nodeDef.query))).id + " dirty", (view.state & 1 /* BeforeFirstCheck */) !== 0);
}
}
/**
* @param {?} view
* @return {?}
*/
function destroyView(view) {
if (view.state & 128 /* Destroyed */) {
return;
}
execEmbeddedViewsAction(view, ViewAction.Destroy);
execComponentViewsAction(view, ViewAction.Destroy);
callLifecycleHooksChildrenFirst(view, 131072 /* OnDestroy */);
if (view.disposables) {
for (var /** @type {?} */ i = 0; i < view.disposables.length; i++) {
view.disposables[i]();
}
}
detachProjectedView(view);
if (view.renderer.destroyNode) {
destroyViewNodes(view);
}
if (isComponentView(view)) {
view.renderer.destroy();
}
view.state |= 128 /* Destroyed */;
}
/**
* @param {?} view
* @return {?}
*/
function destroyViewNodes(view) {
var /** @type {?} */ len = view.def.nodes.length;
for (var /** @type {?} */ i = 0; i < len; i++) {
var /** @type {?} */ def = view.def.nodes[i];
if (def.flags & 1 /* TypeElement */) {
/** @type {?} */ ((view.renderer.destroyNode))(asElementData(view, i).renderElement);
}
else if (def.flags & 2 /* TypeText */) {
/** @type {?} */ ((view.renderer.destroyNode))(asTextData(view, i).renderText);
}
else if (def.flags & 67108864 /* TypeContentQuery */ || def.flags & 134217728 /* TypeViewQuery */) {
asQueryList(view, i).destroy();
}
}
}
/** @enum {number} */
var ViewAction = {
CreateViewNodes: 0,
CheckNoChanges: 1,
CheckNoChangesProjectedViews: 2,
CheckAndUpdate: 3,
CheckAndUpdateProjectedViews: 4,
Destroy: 5,
};
ViewAction[ViewAction.CreateViewNodes] = "CreateViewNodes";
ViewAction[ViewAction.CheckNoChanges] = "CheckNoChanges";
ViewAction[ViewAction.CheckNoChangesProjectedViews] = "CheckNoChangesProjectedViews";
ViewAction[ViewAction.CheckAndUpdate] = "CheckAndUpdate";
ViewAction[ViewAction.CheckAndUpdateProjectedViews] = "CheckAndUpdateProjectedViews";
ViewAction[ViewAction.Destroy] = "Destroy";
/**
* @param {?} view
* @param {?} action
* @return {?}
*/
function execComponentViewsAction(view, action) {
var /** @type {?} */ def = view.def;
if (!(def.nodeFlags & 33554432 /* ComponentView */)) {
return;
}
for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) {
var /** @type {?} */ nodeDef = def.nodes[i];
if (nodeDef.flags & 33554432 /* ComponentView */) {
// a leaf
callViewAction(asElementData(view, i).componentView, action);
}
else if ((nodeDef.childFlags & 33554432 /* ComponentView */) === 0) {
// a parent with leafs
// no child is a component,
// then skip the children
i += nodeDef.childCount;
}
}
}
/**
* @param {?} view
* @param {?} action
* @return {?}
*/
function execEmbeddedViewsAction(view, action) {
var /** @type {?} */ def = view.def;
if (!(def.nodeFlags & 16777216 /* EmbeddedViews */)) {
return;
}
for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) {
var /** @type {?} */ nodeDef = def.nodes[i];
if (nodeDef.flags & 16777216 /* EmbeddedViews */) {
// a leaf
var /** @type {?} */ embeddedViews = /** @type {?} */ ((asElementData(view, i).viewContainer))._embeddedViews;
for (var /** @type {?} */ k = 0; k < embeddedViews.length; k++) {
callViewAction(embeddedViews[k], action);
}
}
else if ((nodeDef.childFlags & 16777216 /* EmbeddedViews */) === 0) {
// a parent with leafs
// no child is a component,
// then skip the children
i += nodeDef.childCount;
}
}
}
/**
* @param {?} view
* @param {?} action
* @return {?}
*/
function callViewAction(view, action) {
var /** @type {?} */ viewState = view.state;
switch (action) {
case ViewAction.CheckNoChanges:
if ((viewState & 128 /* Destroyed */) === 0) {
if ((viewState & 12 /* CatDetectChanges */) === 12 /* CatDetectChanges */) {
checkNoChangesView(view);
}
else if (viewState & 64 /* CheckProjectedViews */) {
execProjectedViewsAction(view, ViewAction.CheckNoChangesProjectedViews);
}
}
break;
case ViewAction.CheckNoChangesProjectedViews:
if ((viewState & 128 /* Destroyed */) === 0) {
if (viewState & 32 /* CheckProjectedView */) {
checkNoChangesView(view);
}
else if (viewState & 64 /* CheckProjectedViews */) {
execProjectedViewsAction(view, action);
}
}
break;
case ViewAction.CheckAndUpdate:
if ((viewState & 128 /* Destroyed */) === 0) {
if ((viewState & 12 /* CatDetectChanges */) === 12 /* CatDetectChanges */) {
checkAndUpdateView(view);
}
else if (viewState & 64 /* CheckProjectedViews */) {
execProjectedViewsAction(view, ViewAction.CheckAndUpdateProjectedViews);
}
}
break;
case ViewAction.CheckAndUpdateProjectedViews:
if ((viewState & 128 /* Destroyed */) === 0) {
if (viewState & 32 /* CheckProjectedView */) {
checkAndUpdateView(view);
}
else if (viewState & 64 /* CheckProjectedViews */) {
execProjectedViewsAction(view, action);
}
}
break;
case ViewAction.Destroy:
// Note: destroyView recurses over all views,
// so we don't need to special case projected views here.
destroyView(view);
break;
case ViewAction.CreateViewNodes:
createViewNodes(view);
break;
}
}
/**
* @param {?} view
* @param {?} action
* @return {?}
*/
function execProjectedViewsAction(view, action) {
execEmbeddedViewsAction(view, action);
execComponentViewsAction(view, action);
}
/**
* @param {?} view
* @param {?} queryFlags
* @param {?} staticDynamicQueryFlag
* @param {?} checkType
* @return {?}
*/
function execQueriesAction(view, queryFlags, staticDynamicQueryFlag, checkType) {
if (!(view.def.nodeFlags & queryFlags) || !(view.def.nodeFlags & staticDynamicQueryFlag)) {
return;
}
var /** @type {?} */ nodeCount = view.def.nodes.length;
for (var /** @type {?} */ i = 0; i < nodeCount; i++) {
var /** @type {?} */ nodeDef = view.def.nodes[i];
if ((nodeDef.flags & queryFlags) && (nodeDef.flags & staticDynamicQueryFlag)) {
Services.setCurrentNode(view, nodeDef.nodeIndex);
switch (checkType) {
case 0 /* CheckAndUpdate */:
checkAndUpdateQuery(view, nodeDef);
break;
case 1 /* CheckNoChanges */:
checkNoChangesQuery(view, nodeDef);
break;
}
}
if (!(nodeDef.childFlags & queryFlags) || !(nodeDef.childFlags & staticDynamicQueryFlag)) {
// no child has a matching query
// then skip the children
i += nodeDef.childCount;
}
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var initialized = false;
/**
* @return {?}
*/
function initServicesIfNeeded() {
if (initialized) {
return;
}
initialized = true;
var /** @type {?} */ services = isDevMode() ? createDebugServices() : createProdServices();
Services.setCurrentNode = services.setCurrentNode;
Services.createRootView = services.createRootView;
Services.createEmbeddedView = services.createEmbeddedView;
Services.createComponentView = services.createComponentView;
Services.createNgModuleRef = services.createNgModuleRef;
Services.overrideProvider = services.overrideProvider;
Services.clearProviderOverrides = services.clearProviderOverrides;
Services.checkAndUpdateView = services.checkAndUpdateView;
Services.checkNoChangesView = services.checkNoChangesView;
Services.destroyView = services.destroyView;
Services.resolveDep = resolveDep;
Services.createDebugContext = services.createDebugContext;
Services.handleEvent = services.handleEvent;
Services.updateDirectives = services.updateDirectives;
Services.updateRenderer = services.updateRenderer;
Services.dirtyParentQueries = dirtyParentQueries;
}
/**
* @return {?}
*/
function createProdServices() {
return {
setCurrentNode: function () { },
createRootView: createProdRootView,
createEmbeddedView: createEmbeddedView,
createComponentView: createComponentView,
createNgModuleRef: createNgModuleRef,
overrideProvider: NOOP,
clearProviderOverrides: NOOP,
checkAndUpdateView: checkAndUpdateView,
checkNoChangesView: checkNoChangesView,
destroyView: destroyView,
createDebugContext: function (view, nodeIndex) { return new DebugContext_(view, nodeIndex); },
handleEvent: function (view, nodeIndex, eventName, event) {
return view.def.handleEvent(view, nodeIndex, eventName, event);
},
updateDirectives: function (view, checkType) {
return view.def.updateDirectives(checkType === 0 /* CheckAndUpdate */ ? prodCheckAndUpdateNode :
prodCheckNoChangesNode, view);
},
updateRenderer: function (view, checkType) {
return view.def.updateRenderer(checkType === 0 /* CheckAndUpdate */ ? prodCheckAndUpdateNode :
prodCheckNoChangesNode, view);
},
};
}
/**
* @return {?}
*/
function createDebugServices() {
return {
setCurrentNode: debugSetCurrentNode,
createRootView: debugCreateRootView,
createEmbeddedView: debugCreateEmbeddedView,
createComponentView: debugCreateComponentView,
createNgModuleRef: debugCreateNgModuleRef,
overrideProvider: debugOverrideProvider,
clearProviderOverrides: debugClearProviderOverrides,
checkAndUpdateView: debugCheckAndUpdateView,
checkNoChangesView: debugCheckNoChangesView,
destroyView: debugDestroyView,
createDebugContext: function (view, nodeIndex) { return new DebugContext_(view, nodeIndex); },
handleEvent: debugHandleEvent,
updateDirectives: debugUpdateDirectives,
updateRenderer: debugUpdateRenderer,
};
}
/**
* @param {?} elInjector
* @param {?} projectableNodes
* @param {?} rootSelectorOrNode
* @param {?} def
* @param {?} ngModule
* @param {?=} context
* @return {?}
*/
function createProdRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) {
var /** @type {?} */ rendererFactory = ngModule.injector.get(RendererFactory2);
return createRootView(createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode), def, context);
}
/**
* @param {?} elInjector
* @param {?} projectableNodes
* @param {?} rootSelectorOrNode
* @param {?} def
* @param {?} ngModule
* @param {?=} context
* @return {?}
*/
function debugCreateRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) {
var /** @type {?} */ rendererFactory = ngModule.injector.get(RendererFactory2);
var /** @type {?} */ root = createRootData(elInjector, ngModule, new DebugRendererFactory2(rendererFactory), projectableNodes, rootSelectorOrNode);
var /** @type {?} */ defWithOverride = applyProviderOverridesToView(def);
return callWithDebugContext(DebugAction.create, createRootView, null, [root, defWithOverride, context]);
}
/**
* @param {?} elInjector
* @param {?} ngModule
* @param {?} rendererFactory
* @param {?} projectableNodes
* @param {?} rootSelectorOrNode
* @return {?}
*/
function createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode) {
var /** @type {?} */ sanitizer = ngModule.injector.get(Sanitizer);
var /** @type {?} */ errorHandler = ngModule.injector.get(ErrorHandler);
var /** @type {?} */ renderer = rendererFactory.createRenderer(null, null);
return {
ngModule: ngModule,
injector: elInjector, projectableNodes: projectableNodes,
selectorOrNode: rootSelectorOrNode, sanitizer: sanitizer, rendererFactory: rendererFactory, renderer: renderer, errorHandler: errorHandler
};
}
/**
* @param {?} parentView
* @param {?} anchorDef
* @param {?} viewDef
* @param {?=} context
* @return {?}
*/
function debugCreateEmbeddedView(parentView, anchorDef, viewDef$$1, context) {
var /** @type {?} */ defWithOverride = applyProviderOverridesToView(viewDef$$1);
return callWithDebugContext(DebugAction.create, createEmbeddedView, null, [parentView, anchorDef, defWithOverride, context]);
}
/**
* @param {?} parentView
* @param {?} nodeDef
* @param {?} viewDef
* @param {?} hostElement
* @return {?}
*/
function debugCreateComponentView(parentView, nodeDef, viewDef$$1, hostElement) {
var /** @type {?} */ defWithOverride = applyProviderOverridesToView(viewDef$$1);
return callWithDebugContext(DebugAction.create, createComponentView, null, [parentView, nodeDef, defWithOverride, hostElement]);
}
/**
* @param {?} moduleType
* @param {?} parentInjector
* @param {?} bootstrapComponents
* @param {?} def
* @return {?}
*/
function debugCreateNgModuleRef(moduleType, parentInjector, bootstrapComponents, def) {
var /** @type {?} */ defWithOverride = applyProviderOverridesToNgModule(def);
return createNgModuleRef(moduleType, parentInjector, bootstrapComponents, defWithOverride);
}
var providerOverrides = new Map();
/**
* @param {?} override
* @return {?}
*/
function debugOverrideProvider(override) {
providerOverrides.set(override.token, override);
}
/**
* @return {?}
*/
function debugClearProviderOverrides() {
providerOverrides.clear();
}
/**
* @param {?} def
* @return {?}
*/
function applyProviderOverridesToView(def) {
if (providerOverrides.size === 0) {
return def;
}
var /** @type {?} */ elementIndicesWithOverwrittenProviders = findElementIndicesWithOverwrittenProviders(def);
if (elementIndicesWithOverwrittenProviders.length === 0) {
return def;
}
// clone the whole view definition,
// as it maintains references between the nodes that are hard to update.
def = /** @type {?} */ ((def.factory))(function () { return NOOP; });
for (var /** @type {?} */ i = 0; i < elementIndicesWithOverwrittenProviders.length; i++) {
applyProviderOverridesToElement(def, elementIndicesWithOverwrittenProviders[i]);
}
return def;
/**
* @param {?} def
* @return {?}
*/
function findElementIndicesWithOverwrittenProviders(def) {
var /** @type {?} */ elIndicesWithOverwrittenProviders = [];
var /** @type {?} */ lastElementDef = null;
for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) {
var /** @type {?} */ nodeDef = def.nodes[i];
if (nodeDef.flags & 1 /* TypeElement */) {
lastElementDef = nodeDef;
}
if (lastElementDef && nodeDef.flags & 3840 /* CatProviderNoDirective */ &&
providerOverrides.has(/** @type {?} */ ((nodeDef.provider)).token)) {
elIndicesWithOverwrittenProviders.push(/** @type {?} */ ((lastElementDef)).nodeIndex);
lastElementDef = null;
}
}
return elIndicesWithOverwrittenProviders;
}
/**
* @param {?} viewDef
* @param {?} elIndex
* @return {?}
*/
function applyProviderOverridesToElement(viewDef$$1, elIndex) {
for (var /** @type {?} */ i = elIndex + 1; i < viewDef$$1.nodes.length; i++) {
var /** @type {?} */ nodeDef = viewDef$$1.nodes[i];
if (nodeDef.flags & 1 /* TypeElement */) {
// stop at the next element
return;
}
if (nodeDef.flags & 3840 /* CatProviderNoDirective */) {
var /** @type {?} */ provider = /** @type {?} */ ((nodeDef.provider));
var /** @type {?} */ override = providerOverrides.get(provider.token);
if (override) {
nodeDef.flags = (nodeDef.flags & ~3840 /* CatProviderNoDirective */) | override.flags;
provider.deps = splitDepsDsl(override.deps);
provider.value = override.value;
}
}
}
}
}
/**
* @param {?} def
* @return {?}
*/
function applyProviderOverridesToNgModule(def) {
var _a = calcHasOverrides(def), hasOverrides = _a.hasOverrides, hasDeprecatedOverrides = _a.hasDeprecatedOverrides;
if (!hasOverrides) {
return def;
}
// clone the whole view definition,
// as it maintains references between the nodes that are hard to update.
def = /** @type {?} */ ((def.factory))(function () { return NOOP; });
applyProviderOverrides(def);
return def;
/**
* @param {?} def
* @return {?}
*/
function calcHasOverrides(def) {
var /** @type {?} */ hasOverrides = false;
var /** @type {?} */ hasDeprecatedOverrides = false;
if (providerOverrides.size === 0) {
return { hasOverrides: hasOverrides, hasDeprecatedOverrides: hasDeprecatedOverrides };
}
def.providers.forEach(function (node) {
var /** @type {?} */ override = providerOverrides.get(node.token);
if ((node.flags & 3840 /* CatProviderNoDirective */) && override) {
hasOverrides = true;
hasDeprecatedOverrides = hasDeprecatedOverrides || override.deprecatedBehavior;
}
});
return { hasOverrides: hasOverrides, hasDeprecatedOverrides: hasDeprecatedOverrides };
}
/**
* @param {?} def
* @return {?}
*/
function applyProviderOverrides(def) {
for (var /** @type {?} */ i = 0; i < def.providers.length; i++) {
var /** @type {?} */ provider = def.providers[i];
if (hasDeprecatedOverrides) {
// We had a bug where me made
// all providers lazy. Keep this logic behind a flag
// for migrating existing users.
provider.flags |= 4096 /* LazyProvider */;
}
var /** @type {?} */ override = providerOverrides.get(provider.token);
if (override) {
provider.flags = (provider.flags & ~3840 /* CatProviderNoDirective */) | override.flags;
provider.deps = splitDepsDsl(override.deps);
provider.value = override.value;
}
}
}
}
/**
* @param {?} view
* @param {?} checkIndex
* @param {?} argStyle
* @param {?=} v0
* @param {?=} v1
* @param {?=} v2
* @param {?=} v3
* @param {?=} v4
* @param {?=} v5
* @param {?=} v6
* @param {?=} v7
* @param {?=} v8
* @param {?=} v9
* @return {?}
*/
function prodCheckAndUpdateNode(view, checkIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
var /** @type {?} */ nodeDef = view.def.nodes[checkIndex];
checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
return (nodeDef.flags & 224 /* CatPureExpression */) ?
asPureExpressionData(view, checkIndex).value :
undefined;
}
/**
* @param {?} view
* @param {?} checkIndex
* @param {?} argStyle
* @param {?=} v0
* @param {?=} v1
* @param {?=} v2
* @param {?=} v3
* @param {?=} v4
* @param {?=} v5
* @param {?=} v6
* @param {?=} v7
* @param {?=} v8
* @param {?=} v9
* @return {?}
*/
function prodCheckNoChangesNode(view, checkIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
var /** @type {?} */ nodeDef = view.def.nodes[checkIndex];
checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
return (nodeDef.flags & 224 /* CatPureExpression */) ?
asPureExpressionData(view, checkIndex).value :
undefined;
}
/**
* @param {?} view
* @return {?}
*/
function debugCheckAndUpdateView(view) {
return callWithDebugContext(DebugAction.detectChanges, checkAndUpdateView, null, [view]);
}
/**
* @param {?} view
* @return {?}
*/
function debugCheckNoChangesView(view) {
return callWithDebugContext(DebugAction.checkNoChanges, checkNoChangesView, null, [view]);
}
/**
* @param {?} view
* @return {?}
*/
function debugDestroyView(view) {
return callWithDebugContext(DebugAction.destroy, destroyView, null, [view]);
}
/** @enum {number} */
var DebugAction = {
create: 0,
detectChanges: 1,
checkNoChanges: 2,
destroy: 3,
handleEvent: 4,
};
DebugAction[DebugAction.create] = "create";
DebugAction[DebugAction.detectChanges] = "detectChanges";
DebugAction[DebugAction.checkNoChanges] = "checkNoChanges";
DebugAction[DebugAction.destroy] = "destroy";
DebugAction[DebugAction.handleEvent] = "handleEvent";
var _currentAction;
var _currentView;
var _currentNodeIndex;
/**
* @param {?} view
* @param {?} nodeIndex
* @return {?}
*/
function debugSetCurrentNode(view, nodeIndex) {
_currentView = view;
_currentNodeIndex = nodeIndex;
}
/**
* @param {?} view
* @param {?} nodeIndex
* @param {?} eventName
* @param {?} event
* @return {?}
*/
function debugHandleEvent(view, nodeIndex, eventName, event) {
debugSetCurrentNode(view, nodeIndex);
return callWithDebugContext(DebugAction.handleEvent, view.def.handleEvent, null, [view, nodeIndex, eventName, event]);
}
/**
* @param {?} view
* @param {?} checkType
* @return {?}
*/
function debugUpdateDirectives(view, checkType) {
if (view.state & 128 /* Destroyed */) {
throw viewDestroyedError(DebugAction[_currentAction]);
}
debugSetCurrentNode(view, nextDirectiveWithBinding(view, 0));
return view.def.updateDirectives(debugCheckDirectivesFn, view);
/**
* @param {?} view
* @param {?} nodeIndex
* @param {?} argStyle
* @param {...?} values
* @return {?}
*/
function debugCheckDirectivesFn(view, nodeIndex, argStyle) {
var values = [];
for (var _i = 3; _i < arguments.length; _i++) {
values[_i - 3] = arguments[_i];
}
var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex];
if (checkType === 0 /* CheckAndUpdate */) {
debugCheckAndUpdateNode(view, nodeDef, argStyle, values);
}
else {
debugCheckNoChangesNode(view, nodeDef, argStyle, values);
}
if (nodeDef.flags & 16384 /* TypeDirective */) {
debugSetCurrentNode(view, nextDirectiveWithBinding(view, nodeIndex));
}
return (nodeDef.flags & 224 /* CatPureExpression */) ?
asPureExpressionData(view, nodeDef.nodeIndex).value :
undefined;
}
}
/**
* @param {?} view
* @param {?} checkType
* @return {?}
*/
function debugUpdateRenderer(view, checkType) {
if (view.state & 128 /* Destroyed */) {
throw viewDestroyedError(DebugAction[_currentAction]);
}
debugSetCurrentNode(view, nextRenderNodeWithBinding(view, 0));
return view.def.updateRenderer(debugCheckRenderNodeFn, view);
/**
* @param {?} view
* @param {?} nodeIndex
* @param {?} argStyle
* @param {...?} values
* @return {?}
*/
function debugCheckRenderNodeFn(view, nodeIndex, argStyle) {
var values = [];
for (var _i = 3; _i < arguments.length; _i++) {
values[_i - 3] = arguments[_i];
}
var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex];
if (checkType === 0 /* CheckAndUpdate */) {
debugCheckAndUpdateNode(view, nodeDef, argStyle, values);
}
else {
debugCheckNoChangesNode(view, nodeDef, argStyle, values);
}
if (nodeDef.flags & 3 /* CatRenderNode */) {
debugSetCurrentNode(view, nextRenderNodeWithBinding(view, nodeIndex));
}
return (nodeDef.flags & 224 /* CatPureExpression */) ?
asPureExpressionData(view, nodeDef.nodeIndex).value :
undefined;
}
}
/**
* @param {?} view
* @param {?} nodeDef
* @param {?} argStyle
* @param {?} givenValues
* @return {?}
*/
function debugCheckAndUpdateNode(view, nodeDef, argStyle, givenValues) {
var /** @type {?} */ changed = (/** @type {?} */ (checkAndUpdateNode)).apply(void 0, [view, nodeDef, argStyle].concat(givenValues));
if (changed) {
var /** @type {?} */ values = argStyle === 1 /* Dynamic */ ? givenValues[0] : givenValues;
if (nodeDef.flags & 16384 /* TypeDirective */) {
var /** @type {?} */ bindingValues = {};
for (var /** @type {?} */ i = 0; i < nodeDef.bindings.length; i++) {
var /** @type {?} */ binding = nodeDef.bindings[i];
var /** @type {?} */ value = values[i];
if (binding.flags & 8 /* TypeProperty */) {
bindingValues[normalizeDebugBindingName(/** @type {?} */ ((binding.nonMinifiedName)))] =
normalizeDebugBindingValue(value);
}
}
var /** @type {?} */ elDef = /** @type {?} */ ((nodeDef.parent));
var /** @type {?} */ el = asElementData(view, elDef.nodeIndex).renderElement;
if (!/** @type {?} */ ((elDef.element)).name) {
// a comment.
view.renderer.setValue(el, "bindings=" + JSON.stringify(bindingValues, null, 2));
}
else {
// a regular element.
for (var /** @type {?} */ attr in bindingValues) {
var /** @type {?} */ value = bindingValues[attr];
if (value != null) {
view.renderer.setAttribute(el, attr, value);
}
else {
view.renderer.removeAttribute(el, attr);
}
}
}
}
}
}
/**
* @param {?} view
* @param {?} nodeDef
* @param {?} argStyle
* @param {?} values
* @return {?}
*/
function debugCheckNoChangesNode(view, nodeDef, argStyle, values) {
(/** @type {?} */ (checkNoChangesNode)).apply(void 0, [view, nodeDef, argStyle].concat(values));
}
/**
* @param {?} name
* @return {?}
*/
function normalizeDebugBindingName(name) {
// Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
return "ng-reflect-" + name;
}
var CAMEL_CASE_REGEXP = /([A-Z])/g;
/**
* @param {?} input
* @return {?}
*/
function camelCaseToDashCase(input) {
return input.replace(CAMEL_CASE_REGEXP, function () {
var m = [];
for (var _i = 0; _i < arguments.length; _i++) {
m[_i] = arguments[_i];
}
return '-' + m[1].toLowerCase();
});
}
/**
* @param {?} value
* @return {?}
*/
function normalizeDebugBindingValue(value) {
try {
// Limit the size of the value as otherwise the DOM just gets polluted.
return value != null ? value.toString().slice(0, 30) : value;
}
catch (/** @type {?} */ e) {
return '[ERROR] Exception while trying to serialize the value';
}
}
/**
* @param {?} view
* @param {?} nodeIndex
* @return {?}
*/
function nextDirectiveWithBinding(view, nodeIndex) {
for (var /** @type {?} */ i = nodeIndex; i < view.def.nodes.length; i++) {
var /** @type {?} */ nodeDef = view.def.nodes[i];
if (nodeDef.flags & 16384 /* TypeDirective */ && nodeDef.bindings && nodeDef.bindings.length) {
return i;
}
}
return null;
}
/**
* @param {?} view
* @param {?} nodeIndex
* @return {?}
*/
function nextRenderNodeWithBinding(view, nodeIndex) {
for (var /** @type {?} */ i = nodeIndex; i < view.def.nodes.length; i++) {
var /** @type {?} */ nodeDef = view.def.nodes[i];
if ((nodeDef.flags & 3 /* CatRenderNode */) && nodeDef.bindings && nodeDef.bindings.length) {
return i;
}
}
return null;
}
var DebugContext_ = (function () {
function DebugContext_(view, nodeIndex) {
this.view = view;
this.nodeIndex = nodeIndex;
if (nodeIndex == null) {
this.nodeIndex = nodeIndex = 0;
}
this.nodeDef = view.def.nodes[nodeIndex];
var /** @type {?} */ elDef = this.nodeDef;
var /** @type {?} */ elView = view;
while (elDef && (elDef.flags & 1 /* TypeElement */) === 0) {
elDef = /** @type {?} */ ((elDef.parent));
}
if (!elDef) {
while (!elDef && elView) {
elDef = /** @type {?} */ ((viewParentEl(elView)));
elView = /** @type {?} */ ((elView.parent));
}
}
this.elDef = elDef;
this.elView = elView;
}
Object.defineProperty(DebugContext_.prototype, "elOrCompView", {
get: /**
* @return {?}
*/
function () {
// Has to be done lazily as we use the DebugContext also during creation of elements...
return asElementData(this.elView, this.elDef.nodeIndex).componentView || this.view;
},
enumerable: true,
configurable: true
});
Object.defineProperty(DebugContext_.prototype, "injector", {
get: /**
* @return {?}
*/
function () { return createInjector(this.elView, this.elDef); },
enumerable: true,
configurable: true
});
Object.defineProperty(DebugContext_.prototype, "component", {
get: /**
* @return {?}
*/
function () { return this.elOrCompView.component; },
enumerable: true,
configurable: true
});
Object.defineProperty(DebugContext_.prototype, "context", {
get: /**
* @return {?}
*/
function () { return this.elOrCompView.context; },
enumerable: true,
configurable: true
});
Object.defineProperty(DebugContext_.prototype, "providerTokens", {
get: /**
* @return {?}
*/
function () {
var /** @type {?} */ tokens = [];
if (this.elDef) {
for (var /** @type {?} */ i = this.elDef.nodeIndex + 1; i <= this.elDef.nodeIndex + this.elDef.childCount; i++) {
var /** @type {?} */ childDef = this.elView.def.nodes[i];
if (childDef.flags & 20224 /* CatProvider */) {
tokens.push(/** @type {?} */ ((childDef.provider)).token);
}
i += childDef.childCount;
}
}
return tokens;
},
enumerable: true,
configurable: true
});
Object.defineProperty(DebugContext_.prototype, "references", {
get: /**
* @return {?}
*/
function () {
var /** @type {?} */ references = {};
if (this.elDef) {
collectReferences(this.elView, this.elDef, references);
for (var /** @type {?} */ i = this.elDef.nodeIndex + 1; i <= this.elDef.nodeIndex + this.elDef.childCount; i++) {
var /** @type {?} */ childDef = this.elView.def.nodes[i];
if (childDef.flags & 20224 /* CatProvider */) {
collectReferences(this.elView, childDef, references);
}
i += childDef.childCount;
}
}
return references;
},
enumerable: true,
configurable: true
});
Object.defineProperty(DebugContext_.prototype, "componentRenderElement", {
get: /**
* @return {?}
*/
function () {
var /** @type {?} */ elData = findHostElement(this.elOrCompView);
return elData ? elData.renderElement : undefined;
},
enumerable: true,
configurable: true
});
Object.defineProperty(DebugContext_.prototype, "renderNode", {
get: /**
* @return {?}
*/
function () {
return this.nodeDef.flags & 2 /* TypeText */ ? renderNode(this.view, this.nodeDef) :
renderNode(this.elView, this.elDef);
},
enumerable: true,
configurable: true
});
/**
* @param {?} console
* @param {...?} values
* @return {?}
*/
DebugContext_.prototype.logError = /**
* @param {?} console
* @param {...?} values
* @return {?}
*/
function (console) {
var values = [];
for (var _i = 1; _i < arguments.length; _i++) {
values[_i - 1] = arguments[_i];
}
var /** @type {?} */ logViewDef;
var /** @type {?} */ logNodeIndex;
if (this.nodeDef.flags & 2 /* TypeText */) {
logViewDef = this.view.def;
logNodeIndex = this.nodeDef.nodeIndex;
}
else {
logViewDef = this.elView.def;
logNodeIndex = this.elDef.nodeIndex;
}
// Note: we only generate a log function for text and element nodes
// to make the generated code as small as possible.
var /** @type {?} */ renderNodeIndex = getRenderNodeIndex(logViewDef, logNodeIndex);
var /** @type {?} */ currRenderNodeIndex = -1;
var /** @type {?} */ nodeLogger = function () {
currRenderNodeIndex++;
if (currRenderNodeIndex === renderNodeIndex) {
return (_a = console.error).bind.apply(_a, [console].concat(values));
}
else {
return NOOP;
}
var _a;
}; /** @type {?} */
((logViewDef.factory))(nodeLogger);
if (currRenderNodeIndex < renderNodeIndex) {
console.error('Illegal state: the ViewDefinitionFactory did not call the logger!');
console.error.apply(console, values);
}
};
return DebugContext_;
}());
/**
* @param {?} viewDef
* @param {?} nodeIndex
* @return {?}
*/
function getRenderNodeIndex(viewDef$$1, nodeIndex) {
var /** @type {?} */ renderNodeIndex = -1;
for (var /** @type {?} */ i = 0; i <= nodeIndex; i++) {
var /** @type {?} */ nodeDef = viewDef$$1.nodes[i];
if (nodeDef.flags & 3 /* CatRenderNode */) {
renderNodeIndex++;
}
}
return renderNodeIndex;
}
/**
* @param {?} view
* @return {?}
*/
function findHostElement(view) {
while (view && !isComponentView(view)) {
view = /** @type {?} */ ((view.parent));
}
if (view.parent) {
return asElementData(view.parent, /** @type {?} */ ((viewParentEl(view))).nodeIndex);
}
return null;
}
/**
* @param {?} view
* @param {?} nodeDef
* @param {?} references
* @return {?}
*/
function collectReferences(view, nodeDef, references) {
for (var /** @type {?} */ refName in nodeDef.references) {
references[refName] = getQueryValue(view, nodeDef, nodeDef.references[refName]);
}
}
/**
* @param {?} action
* @param {?} fn
* @param {?} self
* @param {?} args
* @return {?}
*/
function callWithDebugContext(action, fn, self, args) {
var /** @type {?} */ oldAction = _currentAction;
var /** @type {?} */ oldView = _currentView;
var /** @type {?} */ oldNodeIndex = _currentNodeIndex;
try {
_currentAction = action;
var /** @type {?} */ result = fn.apply(self, args);
_currentView = oldView;
_currentNodeIndex = oldNodeIndex;
_currentAction = oldAction;
return result;
}
catch (/** @type {?} */ e) {
if (isViewDebugError(e) || !_currentView) {
throw e;
}
throw viewWrappedDebugError(e, /** @type {?} */ ((getCurrentDebugContext())));
}
}
/**
* @return {?}
*/
function getCurrentDebugContext() {
return _currentView ? new DebugContext_(_currentView, _currentNodeIndex) : null;
}
var DebugRendererFactory2 = (function () {
function DebugRendererFactory2(delegate) {
this.delegate = delegate;
}
/**
* @param {?} element
* @param {?} renderData
* @return {?}
*/
DebugRendererFactory2.prototype.createRenderer = /**
* @param {?} element
* @param {?} renderData
* @return {?}
*/
function (element, renderData) {
return new DebugRenderer2(this.delegate.createRenderer(element, renderData));
};
/**
* @return {?}
*/
DebugRendererFactory2.prototype.begin = /**
* @return {?}
*/
function () {
if (this.delegate.begin) {
this.delegate.begin();
}
};
/**
* @return {?}
*/
DebugRendererFactory2.prototype.end = /**
* @return {?}
*/
function () {
if (this.delegate.end) {
this.delegate.end();
}
};
/**
* @return {?}
*/
DebugRendererFactory2.prototype.whenRenderingDone = /**
* @return {?}
*/
function () {
if (this.delegate.whenRenderingDone) {
return this.delegate.whenRenderingDone();
}
return Promise.resolve(null);
};
return DebugRendererFactory2;
}());
var DebugRenderer2 = (function () {
function DebugRenderer2(delegate) {
this.delegate = delegate;
}
Object.defineProperty(DebugRenderer2.prototype, "data", {
get: /**
* @return {?}
*/
function () { return this.delegate.data; },
enumerable: true,
configurable: true
});
/**
* @param {?} node
* @return {?}
*/
DebugRenderer2.prototype.destroyNode = /**
* @param {?} node
* @return {?}
*/
function (node) {
removeDebugNodeFromIndex(/** @type {?} */ ((getDebugNode(node))));
if (this.delegate.destroyNode) {
this.delegate.destroyNode(node);
}
};
/**
* @return {?}
*/
DebugRenderer2.prototype.destroy = /**
* @return {?}
*/
function () { this.delegate.destroy(); };
/**
* @param {?} name
* @param {?=} namespace
* @return {?}
*/
DebugRenderer2.prototype.createElement = /**
* @param {?} name
* @param {?=} namespace
* @return {?}
*/
function (name, namespace) {
var /** @type {?} */ el = this.delegate.createElement(name, namespace);
var /** @type {?} */ debugCtx = getCurrentDebugContext();
if (debugCtx) {
var /** @type {?} */ debugEl = new DebugElement(el, null, debugCtx);
debugEl.name = name;
indexDebugNode(debugEl);
}
return el;
};
/**
* @param {?} value
* @return {?}
*/
DebugRenderer2.prototype.createComment = /**
* @param {?} value
* @return {?}
*/
function (value) {
var /** @type {?} */ comment = this.delegate.createComment(value);
var /** @type {?} */ debugCtx = getCurrentDebugContext();
if (debugCtx) {
indexDebugNode(new DebugNode(comment, null, debugCtx));
}
return comment;
};
/**
* @param {?} value
* @return {?}
*/
DebugRenderer2.prototype.createText = /**
* @param {?} value
* @return {?}
*/
function (value) {
var /** @type {?} */ text = this.delegate.createText(value);
var /** @type {?} */ debugCtx = getCurrentDebugContext();
if (debugCtx) {
indexDebugNode(new DebugNode(text, null, debugCtx));
}
return text;
};
/**
* @param {?} parent
* @param {?} newChild
* @return {?}
*/
DebugRenderer2.prototype.appendChild = /**
* @param {?} parent
* @param {?} newChild
* @return {?}
*/
function (parent, newChild) {
var /** @type {?} */ debugEl = getDebugNode(parent);
var /** @type {?} */ debugChildEl = getDebugNode(newChild);
if (debugEl && debugChildEl && debugEl instanceof DebugElement) {
debugEl.addChild(debugChildEl);
}
this.delegate.appendChild(parent, newChild);
};
/**
* @param {?} parent
* @param {?} newChild
* @param {?} refChild
* @return {?}
*/
DebugRenderer2.prototype.insertBefore = /**
* @param {?} parent
* @param {?} newChild
* @param {?} refChild
* @return {?}
*/
function (parent, newChild, refChild) {
var /** @type {?} */ debugEl = getDebugNode(parent);
var /** @type {?} */ debugChildEl = getDebugNode(newChild);
var /** @type {?} */ debugRefEl = /** @type {?} */ ((getDebugNode(refChild)));
if (debugEl && debugChildEl && debugEl instanceof DebugElement) {
debugEl.insertBefore(debugRefEl, debugChildEl);
}
this.delegate.insertBefore(parent, newChild, refChild);
};
/**
* @param {?} parent
* @param {?} oldChild
* @return {?}
*/
DebugRenderer2.prototype.removeChild = /**
* @param {?} parent
* @param {?} oldChild
* @return {?}
*/
function (parent, oldChild) {
var /** @type {?} */ debugEl = getDebugNode(parent);
var /** @type {?} */ debugChildEl = getDebugNode(oldChild);
if (debugEl && debugChildEl && debugEl instanceof DebugElement) {
debugEl.removeChild(debugChildEl);
}
this.delegate.removeChild(parent, oldChild);
};
/**
* @param {?} selectorOrNode
* @return {?}
*/
DebugRenderer2.prototype.selectRootElement = /**
* @param {?} selectorOrNode
* @return {?}
*/
function (selectorOrNode) {
var /** @type {?} */ el = this.delegate.selectRootElement(selectorOrNode);
var /** @type {?} */ debugCtx = getCurrentDebugContext();
if (debugCtx) {
indexDebugNode(new DebugElement(el, null, debugCtx));
}
return el;
};
/**
* @param {?} el
* @param {?} name
* @param {?} value
* @param {?=} namespace
* @return {?}
*/
DebugRenderer2.prototype.setAttribute = /**
* @param {?} el
* @param {?} name
* @param {?} value
* @param {?=} namespace
* @return {?}
*/
function (el, name, value, namespace) {
var /** @type {?} */ debugEl = getDebugNode(el);
if (debugEl && debugEl instanceof DebugElement) {
var /** @type {?} */ fullName = namespace ? namespace + ':' + name : name;
debugEl.attributes[fullName] = value;
}
this.delegate.setAttribute(el, name, value, namespace);
};
/**
* @param {?} el
* @param {?} name
* @param {?=} namespace
* @return {?}
*/
DebugRenderer2.prototype.removeAttribute = /**
* @param {?} el
* @param {?} name
* @param {?=} namespace
* @return {?}
*/
function (el, name, namespace) {
var /** @type {?} */ debugEl = getDebugNode(el);
if (debugEl && debugEl instanceof DebugElement) {
var /** @type {?} */ fullName = namespace ? namespace + ':' + name : name;
debugEl.attributes[fullName] = null;
}
this.delegate.removeAttribute(el, name, namespace);
};
/**
* @param {?} el
* @param {?} name
* @return {?}
*/
DebugRenderer2.prototype.addClass = /**
* @param {?} el
* @param {?} name
* @return {?}
*/
function (el, name) {
var /** @type {?} */ debugEl = getDebugNode(el);
if (debugEl && debugEl instanceof DebugElement) {
debugEl.classes[name] = true;
}
this.delegate.addClass(el, name);
};
/**
* @param {?} el
* @param {?} name
* @return {?}
*/
DebugRenderer2.prototype.removeClass = /**
* @param {?} el
* @param {?} name
* @return {?}
*/
function (el, name) {
var /** @type {?} */ debugEl = getDebugNode(el);
if (debugEl && debugEl instanceof DebugElement) {
debugEl.classes[name] = false;
}
this.delegate.removeClass(el, name);
};
/**
* @param {?} el
* @param {?} style
* @param {?} value
* @param {?} flags
* @return {?}
*/
DebugRenderer2.prototype.setStyle = /**
* @param {?} el
* @param {?} style
* @param {?} value
* @param {?} flags
* @return {?}
*/
function (el, style, value, flags) {
var /** @type {?} */ debugEl = getDebugNode(el);
if (debugEl && debugEl instanceof DebugElement) {
debugEl.styles[style] = value;
}
this.delegate.setStyle(el, style, value, flags);
};
/**
* @param {?} el
* @param {?} style
* @param {?} flags
* @return {?}
*/
DebugRenderer2.prototype.removeStyle = /**
* @param {?} el
* @param {?} style
* @param {?} flags
* @return {?}
*/
function (el, style, flags) {
var /** @type {?} */ debugEl = getDebugNode(el);
if (debugEl && debugEl instanceof DebugElement) {
debugEl.styles[style] = null;
}
this.delegate.removeStyle(el, style, flags);
};
/**
* @param {?} el
* @param {?} name
* @param {?} value
* @return {?}
*/
DebugRenderer2.prototype.setProperty = /**
* @param {?} el
* @param {?} name
* @param {?} value
* @return {?}
*/
function (el, name, value) {
var /** @type {?} */ debugEl = getDebugNode(el);
if (debugEl && debugEl instanceof DebugElement) {
debugEl.properties[name] = value;
}
this.delegate.setProperty(el, name, value);
};
/**
* @param {?} target
* @param {?} eventName
* @param {?} callback
* @return {?}
*/
DebugRenderer2.prototype.listen = /**
* @param {?} target
* @param {?} eventName
* @param {?} callback
* @return {?}
*/
function (target, eventName, callback) {
if (typeof target !== 'string') {
var /** @type {?} */ debugEl = getDebugNode(target);
if (debugEl) {
debugEl.listeners.push(new EventListener(eventName, callback));
}
}
return this.delegate.listen(target, eventName, callback);
};
/**
* @param {?} node
* @return {?}
*/
DebugRenderer2.prototype.parentNode = /**
* @param {?} node
* @return {?}
*/
function (node) { return this.delegate.parentNode(node); };
/**
* @param {?} node
* @return {?}
*/
DebugRenderer2.prototype.nextSibling = /**
* @param {?} node
* @return {?}
*/
function (node) { return this.delegate.nextSibling(node); };
/**
* @param {?} node
* @param {?} value
* @return {?}
*/
DebugRenderer2.prototype.setValue = /**
* @param {?} node
* @param {?} value
* @return {?}
*/
function (node, value) { return this.delegate.setValue(node, value); };
return DebugRenderer2;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @param {?} override
* @return {?}
*/
function overrideProvider(override) {
initServicesIfNeeded();
return Services.overrideProvider(override);
}
/**
* @return {?}
*/
function clearProviderOverrides() {
initServicesIfNeeded();
return Services.clearProviderOverrides();
}
/**
* @param {?} ngModuleType
* @param {?} bootstrapComponents
* @param {?} defFactory
* @return {?}
*/
function createNgModuleFactory(ngModuleType, bootstrapComponents, defFactory) {
return new NgModuleFactory_(ngModuleType, bootstrapComponents, defFactory);
}
var NgModuleFactory_ = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(NgModuleFactory_, _super);
function NgModuleFactory_(moduleType, _bootstrapComponents, _ngModuleDefFactory) {
var _this =
// Attention: this ctor is called as top level function.
// Putting any logic in here will destroy closure tree shaking!
_super.call(this) || this;
_this.moduleType = moduleType;
_this._bootstrapComponents = _bootstrapComponents;
_this._ngModuleDefFactory = _ngModuleDefFactory;
return _this;
}
/**
* @param {?} parentInjector
* @return {?}
*/
NgModuleFactory_.prototype.create = /**
* @param {?} parentInjector
* @return {?}
*/
function (parentInjector) {
initServicesIfNeeded();
var /** @type {?} */ def = resolveDefinition(this._ngModuleDefFactory);
return Services.createNgModuleRef(this.moduleType, parentInjector || Injector.NULL, this._bootstrapComponents, def);
};
return NgModuleFactory_;
}(NgModuleFactory));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
* @record
*/
/**
* \@experimental Animation support is experimental.
*/
/**
* \@experimental Animation support is experimental.
* @record
*/
/**
* Metadata representing the entry of animations. Instances of this interface are provided via the
* animation DSL when the {\@link trigger trigger animation function} is called.
*
* \@experimental Animation support is experimental.
* @record
*/
/**
* Metadata representing the entry of animations. Instances of this interface are provided via the
* animation DSL when the {\@link state state animation function} is called.
*
* \@experimental Animation support is experimental.
* @record
*/
/**
* Metadata representing the entry of animations. Instances of this interface are provided via the
* animation DSL when the {\@link transition transition animation function} is called.
*
* \@experimental Animation support is experimental.
* @record
*/
/**
* \@experimental Animation support is experimental.
* @record
*/
/**
* \@experimental Animation support is experimental.
* @record
*/
/**
* Metadata representing the entry of animations. Instances of this interface are provided via the
* animation DSL when the {\@link keyframes keyframes animation function} is called.
*
* \@experimental Animation support is experimental.
* @record
*/
/**
* Metadata representing the entry of animations. Instances of this interface are provided via the
* animation DSL when the {\@link style style animation function} is called.
*
* \@experimental Animation support is experimental.
* @record
*/
/**
* Metadata representing the entry of animations. Instances of this interface are provided via the
* animation DSL when the {\@link animate animate animation function} is called.
*
* \@experimental Animation support is experimental.
* @record
*/
/**
* Metadata representing the entry of animations. Instances of this interface are provided via the
* animation DSL when the {\@link animateChild animateChild animation function} is called.
*
* \@experimental Animation support is experimental.
* @record
*/
/**
* Metadata representing the entry of animations. Instances of this interface are provided via the
* animation DSL when the {\@link useAnimation useAnimation animation function} is called.
*
* \@experimental Animation support is experimental.
* @record
*/
/**
* Metadata representing the entry of animations. Instances of this interface are provided via the
* animation DSL when the {\@link sequence sequence animation function} is called.
*
* \@experimental Animation support is experimental.
* @record
*/
/**
* Metadata representing the entry of animations. Instances of this interface are provided via the
* animation DSL when the {\@link group group animation function} is called.
*
* \@experimental Animation support is experimental.
* @record
*/
/**
* Metadata representing the entry of animations. Instances of this interface are provided via the
* animation DSL when the {\@link stagger stagger animation function} is called.
*
* \@experimental Animation support is experimental.
* @record
*/
/**
* `trigger` is an animation-specific function that is designed to be used inside of Angular's
* animation DSL language. If this information is new, please navigate to the
* {\@link Component#animations component animations metadata page} to gain a better
* understanding of how animations in Angular are used.
*
* `trigger` Creates an animation trigger which will a list of {\@link state state} and
* {\@link transition transition} entries that will be evaluated when the expression
* bound to the trigger changes.
*
* Triggers are registered within the component annotation data under the
* {\@link Component#animations animations section}. An animation trigger can be placed on an element
* within a template by referencing the name of the trigger followed by the expression value that
* the
* trigger is bound to (in the form of `[\@triggerName]="expression"`.
*
* Animation trigger bindings strigify values and then match the previous and current values against
* any linked transitions. If a boolean value is provided into the trigger binding then it will both
* be represented as `1` or `true` and `0` or `false` for a true and false boolean values
* respectively.
*
* ### Usage
*
* `trigger` will create an animation trigger reference based on the provided `name` value. The
* provided `animation` value is expected to be an array consisting of {\@link state state} and
* {\@link transition transition} declarations.
*
* ```typescript
* \@Component({
* selector: 'my-component',
* templateUrl: 'my-component-tpl.html',
* animations: [
* trigger("myAnimationTrigger", [
* state(...),
* state(...),
* transition(...),
* transition(...)
* ])
* ]
* })
* class MyComponent {
* myStatusExp = "something";
* }
* ```
*
* The template associated with this component will make use of the `myAnimationTrigger` animation
* trigger by binding to an element within its template code.
*
* ```html
* <!-- somewhere inside of my-component-tpl.html -->
* <div [\@myAnimationTrigger]="myStatusExp">...</div>
* ```
*
* ## Disable Animations
* A special animation control binding called `\@.disabled` can be placed on an element which will
* then disable animations for any inner animation triggers situated within the element as well as
* any animations on the element itself.
*
* When true, the `\@.disabled` binding will prevent all animations from rendering. The example
* below shows how to use this feature:
*
* ```ts
* \@Component({
* selector: 'my-component',
* template: `
* <div [\@.disabled]="isDisabled">
* <div [\@childAnimation]="exp"></div>
* </div>
* `,
* animations: [
* trigger("childAnimation", [
* // ...
* ])
* ]
* })
* class MyComponent {
* isDisabled = true;
* exp = '...';
* }
* ```
*
* The `\@childAnimation` trigger will not animate because `\@.disabled` prevents it from happening
* (when true).
*
* Note that `\@.disbled` will only disable all animations (this means any animations running on
* the same element will also be disabled).
*
* ### Disabling Animations Application-wide
* When an area of the template is set to have animations disabled, **all** inner components will
* also have their animations disabled as well. This means that all animations for an angular
* application can be disabled by placing a host binding set on `\@.disabled` on the topmost Angular
* component.
*
* ```ts
* import {Component, HostBinding} from '\@angular/core';
*
* \@Component({
* selector: 'app-component',
* templateUrl: 'app.component.html',
* })
* class AppComponent {
* \@HostBinding('\@.disabled')
* public animationsDisabled = true;
* }
* ```
*
* ### What about animations that us `query()` and `animateChild()`?
* Despite inner animations being disabled, a parent animation can {\@link query query} for inner
* elements located in disabled areas of the template and still animate them as it sees fit. This is
* also the case for when a sub animation is queried by a parent and then later animated using {\@link
* animateChild animateChild}.
*
* \@experimental Animation support is experimental.
* @param {?} name
* @param {?} definitions
* @return {?}
*/
function trigger$1(name, definitions) {
return { type: 7 /* Trigger */, name: name, definitions: definitions, options: {} };
}
/**
* `animate` is an animation-specific function that is designed to be used inside of Angular's
* animation DSL language. If this information is new, please navigate to the {\@link
* Component#animations component animations metadata page} to gain a better understanding of
* how animations in Angular are used.
*
* `animate` specifies an animation step that will apply the provided `styles` data for a given
* amount of time based on the provided `timing` expression value. Calls to `animate` are expected
* to be used within {\@link sequence an animation sequence}, {\@link group group}, or {\@link
* transition transition}.
*
* ### Usage
*
* The `animate` function accepts two input parameters: `timing` and `styles`:
*
* - `timing` is a string based value that can be a combination of a duration with optional delay
* and easing values. The format for the expression breaks down to `duration delay easing`
* (therefore a value such as `1s 100ms ease-out` will be parse itself into `duration=1000,
* delay=100, easing=ease-out`. If a numeric value is provided then that will be used as the
* `duration` value in millisecond form.
* - `styles` is the style input data which can either be a call to {\@link style style} or {\@link
* keyframes keyframes}. If left empty then the styles from the destination state will be collected
* and used (this is useful when describing an animation step that will complete an animation by
* {\@link transition#the-final-animate-call animating to the final state}).
*
* ```typescript
* // various functions for specifying timing data
* animate(500, style(...))
* animate("1s", style(...))
* animate("100ms 0.5s", style(...))
* animate("5s ease", style(...))
* animate("5s 10ms cubic-bezier(.17,.67,.88,.1)", style(...))
*
* // either style() of keyframes() can be used
* animate(500, style({ background: "red" }))
* animate(500, keyframes([
* style({ background: "blue" })),
* style({ background: "red" }))
* ])
* ```
*
* {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
*
* \@experimental Animation support is experimental.
* @param {?} timings
* @param {?=} styles
* @return {?}
*/
function animate$1(timings, styles) {
if (styles === void 0) { styles = null; }
return { type: 4 /* Animate */, styles: styles, timings: timings };
}
/**
* `group` is an animation-specific function that is designed to be used inside of Angular's
* animation DSL language. If this information is new, please navigate to the {\@link
* Component#animations component animations metadata page} to gain a better understanding of
* how animations in Angular are used.
*
* `group` specifies a list of animation steps that are all run in parallel. Grouped animations are
* useful when a series of styles must be animated/closed off at different starting/ending times.
*
* The `group` function can either be used within a {\@link sequence sequence} or a {\@link transition
* transition} and it will only continue to the next instruction once all of the inner animation
* steps have completed.
*
* ### Usage
*
* The `steps` data that is passed into the `group` animation function can either consist of {\@link
* style style} or {\@link animate animate} function calls. Each call to `style()` or `animate()`
* within a group will be executed instantly (use {\@link keyframes keyframes} or a {\@link
* animate#usage animate() with a delay value} to offset styles to be applied at a later time).
*
* ```typescript
* group([
* animate("1s", { background: "black" }))
* animate("2s", { color: "white" }))
* ])
* ```
*
* {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
*
* \@experimental Animation support is experimental.
* @param {?} steps
* @param {?=} options
* @return {?}
*/
function group$1(steps, options) {
if (options === void 0) { options = null; }
return { type: 3 /* Group */, steps: steps, options: options };
}
/**
* `sequence` is an animation-specific function that is designed to be used inside of Angular's
* animation DSL language. If this information is new, please navigate to the {\@link
* Component#animations component animations metadata page} to gain a better understanding of
* how animations in Angular are used.
*
* `sequence` Specifies a list of animation steps that are run one by one. (`sequence` is used by
* default when an array is passed as animation data into {\@link transition transition}.)
*
* The `sequence` function can either be used within a {\@link group group} or a {\@link transition
* transition} and it will only continue to the next instruction once each of the inner animation
* steps have completed.
*
* To perform animation styling in parallel with other animation steps then have a look at the
* {\@link group group} animation function.
*
* ### Usage
*
* The `steps` data that is passed into the `sequence` animation function can either consist of
* {\@link style style} or {\@link animate animate} function calls. A call to `style()` will apply the
* provided styling data immediately while a call to `animate()` will apply its styling data over a
* given time depending on its timing data.
*
* ```typescript
* sequence([
* style({ opacity: 0 })),
* animate("1s", { opacity: 1 }))
* ])
* ```
*
* {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
*
* \@experimental Animation support is experimental.
* @param {?} steps
* @param {?=} options
* @return {?}
*/
function sequence$1(steps, options) {
if (options === void 0) { options = null; }
return { type: 2 /* Sequence */, steps: steps, options: options };
}
/**
* `style` is an animation-specific function that is designed to be used inside of Angular's
* animation DSL language. If this information is new, please navigate to the {\@link
* Component#animations component animations metadata page} to gain a better understanding of
* how animations in Angular are used.
*
* `style` declares a key/value object containing CSS properties/styles that can then be used for
* {\@link state animation states}, within an {\@link sequence animation sequence}, or as styling data
* for both {\@link animate animate} and {\@link keyframes keyframes}.
*
* ### Usage
*
* `style` takes in a key/value string map as data and expects one or more CSS property/value pairs
* to be defined.
*
* ```typescript
* // string values are used for css properties
* style({ background: "red", color: "blue" })
*
* // numerical (pixel) values are also supported
* style({ width: 100, height: 0 })
* ```
*
* #### Auto-styles (using `*`)
*
* When an asterix (`*`) character is used as a value then it will be detected from the element
* being animated and applied as animation data when the animation starts.
*
* This feature proves useful for a state depending on layout and/or environment factors; in such
* cases the styles are calculated just before the animation starts.
*
* ```typescript
* // the steps below will animate from 0 to the
* // actual height of the element
* style({ height: 0 }),
* animate("1s", style({ height: "*" }))
* ```
*
* {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
*
* \@experimental Animation support is experimental.
* @param {?} tokens
* @return {?}
*/
function style$1(tokens) {
return { type: 6 /* Style */, styles: tokens, offset: null };
}
/**
* `state` is an animation-specific function that is designed to be used inside of Angular's
* animation DSL language. If this information is new, please navigate to the {\@link
* Component#animations component animations metadata page} to gain a better understanding of
* how animations in Angular are used.
*
* `state` declares an animation state within the given trigger. When a state is active within a
* component then its associated styles will persist on the element that the trigger is attached to
* (even when the animation ends).
*
* To animate between states, have a look at the animation {\@link transition transition} DSL
* function. To register states to an animation trigger please have a look at the {\@link trigger
* trigger} function.
*
* #### The `void` state
*
* The `void` state value is a reserved word that angular uses to determine when the element is not
* apart of the application anymore (e.g. when an `ngIf` evaluates to false then the state of the
* associated element is void).
*
* #### The `*` (default) state
*
* The `*` state (when styled) is a fallback state that will be used if the state that is being
* animated is not declared within the trigger.
*
* ### Usage
*
* `state` will declare an animation state with its associated styles
* within the given trigger.
*
* - `stateNameExpr` can be one or more state names separated by commas.
* - `styles` refers to the {\@link style styling data} that will be persisted on the element once
* the state has been reached.
*
* ```typescript
* // "void" is a reserved name for a state and is used to represent
* // the state in which an element is detached from from the application.
* state("void", style({ height: 0 }))
*
* // user-defined states
* state("closed", style({ height: 0 }))
* state("open, visible", style({ height: "*" }))
* ```
*
* {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
*
* \@experimental Animation support is experimental.
* @param {?} name
* @param {?} styles
* @param {?=} options
* @return {?}
*/
function state$1(name, styles, options) {
return { type: 0 /* State */, name: name, styles: styles, options: options };
}
/**
* `keyframes` is an animation-specific function that is designed to be used inside of Angular's
* animation DSL language. If this information is new, please navigate to the {\@link
* Component#animations component animations metadata page} to gain a better understanding of
* how animations in Angular are used.
*
* `keyframes` specifies a collection of {\@link style style} entries each optionally characterized
* by an `offset` value.
*
* ### Usage
*
* The `keyframes` animation function is designed to be used alongside the {\@link animate animate}
* animation function. Instead of applying animations from where they are currently to their
* destination, keyframes can describe how each style entry is applied and at what point within the
* animation arc (much like CSS Keyframe Animations do).
*
* For each `style()` entry an `offset` value can be set. Doing so allows to specifiy at what
* percentage of the animate time the styles will be applied.
*
* ```typescript
* // the provided offset values describe when each backgroundColor value is applied.
* animate("5s", keyframes([
* style({ backgroundColor: "red", offset: 0 }),
* style({ backgroundColor: "blue", offset: 0.2 }),
* style({ backgroundColor: "orange", offset: 0.3 }),
* style({ backgroundColor: "black", offset: 1 })
* ]))
* ```
*
* Alternatively, if there are no `offset` values used within the style entries then the offsets
* will be calculated automatically.
*
* ```typescript
* animate("5s", keyframes([
* style({ backgroundColor: "red" }) // offset = 0
* style({ backgroundColor: "blue" }) // offset = 0.33
* style({ backgroundColor: "orange" }) // offset = 0.66
* style({ backgroundColor: "black" }) // offset = 1
* ]))
* ```
*
* {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
*
* \@experimental Animation support is experimental.
* @param {?} steps
* @return {?}
*/
function keyframes$1(steps) {
return { type: 5 /* Keyframes */, steps: steps };
}
/**
* `transition` is an animation-specific function that is designed to be used inside of Angular's
* animation DSL language. If this information is new, please navigate to the {\@link
* Component#animations component animations metadata page} to gain a better understanding of
* how animations in Angular are used.
*
* `transition` declares the {\@link sequence sequence of animation steps} that will be run when the
* provided `stateChangeExpr` value is satisfied. The `stateChangeExpr` consists of a `state1 =>
* state2` which consists of two known states (use an asterix (`*`) to refer to a dynamic starting
* and/or ending state).
*
* A function can also be provided as the `stateChangeExpr` argument for a transition and this
* function will be executed each time a state change occurs. If the value returned within the
* function is true then the associated animation will be run.
*
* Animation transitions are placed within an {\@link trigger animation trigger}. For an transition
* to animate to a state value and persist its styles then one or more {\@link state animation
* states} is expected to be defined.
*
* ### Usage
*
* An animation transition is kicked off the `stateChangeExpr` predicate evaluates to true based on
* what the previous state is and what the current state has become. In other words, if a transition
* is defined that matches the old/current state criteria then the associated animation will be
* triggered.
*
* ```typescript
* // all transition/state changes are defined within an animation trigger
* trigger("myAnimationTrigger", [
* // if a state is defined then its styles will be persisted when the
* // animation has fully completed itself
* state("on", style({ background: "green" })),
* state("off", style({ background: "grey" })),
*
* // a transition animation that will be kicked off when the state value
* // bound to "myAnimationTrigger" changes from "on" to "off"
* transition("on => off", animate(500)),
*
* // it is also possible to do run the same animation for both directions
* transition("on <=> off", animate(500)),
*
* // or to define multiple states pairs separated by commas
* transition("on => off, off => void", animate(500)),
*
* // this is a catch-all state change for when an element is inserted into
* // the page and the destination state is unknown
* transition("void => *", [
* style({ opacity: 0 }),
* animate(500)
* ]),
*
* // this will capture a state change between any states
* transition("* => *", animate("1s 0s")),
*
* // you can also go full out and include a function
* transition((fromState, toState) => {
* // when `true` then it will allow the animation below to be invoked
* return fromState == "off" && toState == "on";
* }, animate("1s 0s"))
* ])
* ```
*
* The template associated with this component will make use of the `myAnimationTrigger` animation
* trigger by binding to an element within its template code.
*
* ```html
* <!-- somewhere inside of my-component-tpl.html -->
* <div [\@myAnimationTrigger]="myStatusExp">...</div>
* ```
*
* #### The final `animate` call
*
* If the final step within the transition steps is a call to `animate()` that **only** uses a
* timing value with **no style data** then it will be automatically used as the final animation arc
* for the element to animate itself to the final state. This involves an automatic mix of
* adding/removing CSS styles so that the element will be in the exact state it should be for the
* applied state to be presented correctly.
*
* ```
* // start off by hiding the element, but make sure that it animates properly to whatever state
* // is currently active for "myAnimationTrigger"
* transition("void => *", [
* style({ opacity: 0 }),
* animate(500)
* ])
* ```
*
* ### Using :enter and :leave
*
* Given that enter (insertion) and leave (removal) animations are so common, the `transition`
* function accepts both `:enter` and `:leave` values which are aliases for the `void => *` and `*
* => void` state changes.
*
* ```
* transition(":enter", [
* style({ opacity: 0 }),
* animate(500, style({ opacity: 1 }))
* ]),
* transition(":leave", [
* animate(500, style({ opacity: 0 }))
* ])
* ```
*
* ### Boolean values
* if a trigger binding value is a boolean value then it can be matched using a transition
* expression that compares `true` and `false` or `1` and `0`.
*
* ```
* // in the template
* <div [\@openClose]="open ? true : false">...</div>
*
* // in the component metadata
* trigger('openClose', [
* state('true', style({ height: '*' })),
* state('false', style({ height: '0px' })),
* transition('false <=> true', animate(500))
* ])
* ```
*
* ### Using :increment and :decrement
* In addition to the :enter and :leave transition aliases, the :increment and :decrement aliases
* can be used to kick off a transition when a numeric value has increased or decreased in value.
*
* ```
* import {group, animate, query, transition, style, trigger} from '\@angular/animations';
* import {Component} from '\@angular/core';
*
* \@Component({
* selector: 'banner-carousel-component',
* styles: [`
* .banner-container {
* position:relative;
* height:500px;
* overflow:hidden;
* }
* .banner-container > .banner {
* position:absolute;
* left:0;
* top:0;
* font-size:200px;
* line-height:500px;
* font-weight:bold;
* text-align:center;
* width:100%;
* }
* `],
* template: `
* <button (click)="previous()">Previous</button>
* <button (click)="next()">Next</button>
* <hr>
* <div [\@bannerAnimation]="selectedIndex" class="banner-container">
* <div class="banner"> {{ banner }} </div>
* </div>
* `
* animations: [
* trigger('bannerAnimation', [
* transition(":increment", group([
* query(':enter', [
* style({ left: '100%' }),
* animate('0.5s ease-out', style('*'))
* ]),
* query(':leave', [
* animate('0.5s ease-out', style({ left: '-100%' }))
* ])
* ])),
* transition(":decrement", group([
* query(':enter', [
* style({ left: '-100%' }),
* animate('0.5s ease-out', style('*'))
* ]),
* query(':leave', [
* animate('0.5s ease-out', style({ left: '100%' }))
* ])
* ])),
* ])
* ]
* })
* class BannerCarouselComponent {
* allBanners: string[] = ['1', '2', '3', '4'];
* selectedIndex: number = 0;
*
* get banners() {
* return [this.allBanners[this.selectedIndex]];
* }
*
* previous() {
* this.selectedIndex = Math.max(this.selectedIndex - 1, 0);
* }
*
* next() {
* this.selectedIndex = Math.min(this.selectedIndex + 1, this.allBanners.length - 1);
* }
* }
* ```
*
* {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
*
* \@experimental Animation support is experimental.
* @param {?} stateChangeExpr
* @param {?} steps
* @param {?=} options
* @return {?}
*/
function transition$1(stateChangeExpr, steps, options) {
if (options === void 0) { options = null; }
return { type: 1 /* Transition */, expr: stateChangeExpr, animation: steps, options: options };
}
/**
* `animation` is an animation-specific function that is designed to be used inside of Angular's
* animation DSL language.
*
* `var myAnimation = animation(...)` is designed to produce a reusable animation that can be later
* invoked in another animation or sequence. Reusable animations are designed to make use of
* animation parameters and the produced animation can be used via the `useAnimation` method.
*
* ```
* var fadeAnimation = animation([
* style({ opacity: '{{ start }}' }),
* animate('{{ time }}',
* style({ opacity: '{{ end }}'}))
* ], { params: { time: '1000ms', start: 0, end: 1 }});
* ```
*
* If parameters are attached to an animation then they act as **default parameter values**. When an
* animation is invoked via `useAnimation` then parameter values are allowed to be passed in
* directly. If any of the passed in parameter values are missing then the default values will be
* used.
*
* ```
* useAnimation(fadeAnimation, {
* params: {
* time: '2s',
* start: 1,
* end: 0
* }
* })
* ```
*
* If one or more parameter values are missing before animated then an error will be thrown.
*
* \@experimental Animation support is experimental.
* @param {?} steps
* @param {?=} options
* @return {?}
*/
/**
* `animateChild` is an animation-specific function that is designed to be used inside of Angular's
* animation DSL language. It works by allowing a queried element to execute its own
* animation within the animation sequence.
*
* Each time an animation is triggered in angular, the parent animation
* will always get priority and any child animations will be blocked. In order
* for a child animation to run, the parent animation must query each of the elements
* containing child animations and then allow the animations to run using `animateChild`.
*
* The example HTML code below shows both parent and child elements that have animation
* triggers that will execute at the same time.
*
* ```html
* <!-- parent-child.component.html -->
* <button (click)="exp =! exp">Toggle</button>
* <hr>
*
* <div [\@parentAnimation]="exp">
* <header>Hello</header>
* <div [\@childAnimation]="exp">
* one
* </div>
* <div [\@childAnimation]="exp">
* two
* </div>
* <div [\@childAnimation]="exp">
* three
* </div>
* </div>
* ```
*
* Now when the `exp` value changes to true, only the `parentAnimation` animation will animate
* because it has priority. However, using `query` and `animateChild` each of the inner animations
* can also fire:
*
* ```ts
* // parent-child.component.ts
* import {trigger, transition, animate, style, query, animateChild} from '\@angular/animations';
* \@Component({
* selector: 'parent-child-component',
* animations: [
* trigger('parentAnimation', [
* transition('false => true', [
* query('header', [
* style({ opacity: 0 }),
* animate(500, style({ opacity: 1 }))
* ]),
* query('\@childAnimation', [
* animateChild()
* ])
* ])
* ]),
* trigger('childAnimation', [
* transition('false => true', [
* style({ opacity: 0 }),
* animate(500, style({ opacity: 1 }))
* ])
* ])
* ]
* })
* class ParentChildCmp {
* exp: boolean = false;
* }
* ```
*
* In the animation code above, when the `parentAnimation` transition kicks off it first queries to
* find the header element and fades it in. It then finds each of the sub elements that contain the
* `\@childAnimation` trigger and then allows for their animations to fire.
*
* This example can be further extended by using stagger:
*
* ```ts
* query('\@childAnimation', stagger(100, [
* animateChild()
* ]))
* ```
*
* Now each of the sub animations start off with respect to the `100ms` staggering step.
*
* ## The first frame of child animations
* When sub animations are executed using `animateChild` the animation engine will always apply the
* first frame of every sub animation immediately at the start of the animation sequence. This way
* the parent animation does not need to set any initial styling data on the sub elements before the
* sub animations kick off.
*
* In the example above the first frame of the `childAnimation`'s `false => true` transition
* consists of a style of `opacity: 0`. This is applied immediately when the `parentAnimation`
* animation transition sequence starts. Only then when the `\@childAnimation` is queried and called
* with `animateChild` will it then animate to its destination of `opacity: 1`.
*
* Note that this feature designed to be used alongside {\@link query query()} and it will only work
* with animations that are assigned using the Angular animation DSL (this means that CSS keyframes
* and transitions are not handled by this API).
*
* \@experimental Animation support is experimental.
* @param {?=} options
* @return {?}
*/
/**
* `useAnimation` is an animation-specific function that is designed to be used inside of Angular's
* animation DSL language. It is used to kick off a reusable animation that is created using {\@link
* animation animation()}.
*
* \@experimental Animation support is experimental.
* @param {?} animation
* @param {?=} options
* @return {?}
*/
/**
* `query` is an animation-specific function that is designed to be used inside of Angular's
* animation DSL language.
*
* query() is used to find one or more inner elements within the current element that is
* being animated within the sequence. The provided animation steps are applied
* to the queried element (by default, an array is provided, then this will be
* treated as an animation sequence).
*
* ### Usage
*
* query() is designed to collect mutiple elements and works internally by using
* `element.querySelectorAll`. An additional options object can be provided which
* can be used to limit the total amount of items to be collected.
*
* ```js
* query('div', [
* animate(...),
* animate(...)
* ], { limit: 1 })
* ```
*
* query(), by default, will throw an error when zero items are found. If a query
* has the `optional` flag set to true then this error will be ignored.
*
* ```js
* query('.some-element-that-may-not-be-there', [
* animate(...),
* animate(...)
* ], { optional: true })
* ```
*
* ### Special Selector Values
*
* The selector value within a query can collect elements that contain angular-specific
* characteristics
* using special pseudo-selectors tokens.
*
* These include:
*
* - Querying for newly inserted/removed elements using `query(":enter")`/`query(":leave")`
* - Querying all currently animating elements using `query(":animating")`
* - Querying elements that contain an animation trigger using `query("\@triggerName")`
* - Querying all elements that contain an animation triggers using `query("\@*")`
* - Including the current element into the animation sequence using `query(":self")`
*
*
* Each of these pseudo-selector tokens can be merged together into a combined query selector
* string:
*
* ```
* query(':self, .record:enter, .record:leave, \@subTrigger', [...])
* ```
*
* ### Demo
*
* ```
* \@Component({
* selector: 'inner',
* template: `
* <div [\@queryAnimation]="exp">
* <h1>Title</h1>
* <div class="content">
* Blah blah blah
* </div>
* </div>
* `,
* animations: [
* trigger('queryAnimation', [
* transition('* => goAnimate', [
* // hide the inner elements
* query('h1', style({ opacity: 0 })),
* query('.content', style({ opacity: 0 })),
*
* // animate the inner elements in, one by one
* query('h1', animate(1000, style({ opacity: 1 })),
* query('.content', animate(1000, style({ opacity: 1 })),
* ])
* ])
* ]
* })
* class Cmp {
* exp = '';
*
* goAnimate() {
* this.exp = 'goAnimate';
* }
* }
* ```
*
* \@experimental Animation support is experimental.
* @param {?} selector
* @param {?} animation
* @param {?=} options
* @return {?}
*/
/**
* `stagger` is an animation-specific function that is designed to be used inside of Angular's
* animation DSL language. It is designed to be used inside of an animation {\@link query query()}
* and works by issuing a timing gap between after each queried item is animated.
*
* ### Usage
*
* In the example below there is a container element that wraps a list of items stamped out
* by an ngFor. The container element contains an animation trigger that will later be set
* to query for each of the inner items.
*
* ```html
* <!-- list.component.html -->
* <button (click)="toggle()">Show / Hide Items</button>
* <hr />
* <div [\@listAnimation]="items.length">
* <div *ngFor="let item of items">
* {{ item }}
* </div>
* </div>
* ```
*
* The component code for this looks as such:
*
* ```ts
* import {trigger, transition, style, animate, query, stagger} from '\@angular/animations';
* \@Component({
* templateUrl: 'list.component.html',
* animations: [
* trigger('listAnimation', [
* //...
* ])
* ]
* })
* class ListComponent {
* items = [];
*
* showItems() {
* this.items = [0,1,2,3,4];
* }
*
* hideItems() {
* this.items = [];
* }
*
* toggle() {
* this.items.length ? this.hideItems() : this.showItems();
* }
* }
* ```
*
* And now for the animation trigger code:
*
* ```ts
* trigger('listAnimation', [
* transition('* => *', [ // each time the binding value changes
* query(':leave', [
* stagger(100, [
* animate('0.5s', style({ opacity: 0 }))
* ])
* ]),
* query(':enter', [
* style({ opacity: 0 }),
* stagger(100, [
* animate('0.5s', style({ opacity: 1 }))
* ])
* ])
* ])
* ])
* ```
*
* Now each time the items are added/removed then either the opacity
* fade-in animation will run or each removed item will be faded out.
* When either of these animations occur then a stagger effect will be
* applied after each item's animation is started.
*
* \@experimental Animation support is experimental.
* @param {?} timings
* @param {?} animation
* @return {?}
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
*/
var AUTO_STYLE = '*';
/**
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
* @record
*/
/**
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
* @record
*/
/**
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
* @record
*/
/**
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
* @record
*/
/**
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
* @record
*/
/**
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
* @record
*/
/**
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
* @record
*/
/**
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
* @record
*/
/**
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
* @record
*/
/**
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
* @param {?} name
* @param {?} definitions
* @return {?}
*/
function trigger$$1(name, definitions) {
return trigger$1(name, definitions);
}
/**
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
* @param {?} timings
* @param {?=} styles
* @return {?}
*/
function animate$$1(timings, styles) {
return animate$1(timings, styles);
}
/**
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
* @param {?} steps
* @return {?}
*/
function group$$1(steps) {
return group$1(steps);
}
/**
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
* @param {?} steps
* @return {?}
*/
function sequence$$1(steps) {
return sequence$1(steps);
}
/**
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
* @param {?} tokens
* @return {?}
*/
function style$$1(tokens) {
return style$1(tokens);
}
/**
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
* @param {?} name
* @param {?} styles
* @return {?}
*/
function state$$1(name, styles) {
return state$1(name, styles);
}
/**
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
* @param {?} steps
* @return {?}
*/
function keyframes$$1(steps) {
return keyframes$1(steps);
}
/**
* @deprecated This symbol has moved. Please Import from \@angular/animations instead!
* @param {?} stateChangeExpr
* @param {?} steps
* @return {?}
*/
function transition$$1(stateChangeExpr, steps) {
return transition$1(stateChangeExpr, steps);
}
/**
* @deprecated This has been renamed to `AnimationEvent`. Please import it from \@angular/animations.
* @record
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @module
* @description
* Entry point from which you should import all public core APIs.
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @module
* @description
* Entry point for all public APIs of this package.
*/
// This file only reexports content of the `src` folder. Keep it that way.
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Generated bundle index. Do not edit.
*/
//# sourceMappingURL=core.js.map
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(68)))
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(module) {var require;//! moment.js
;(function (global, factory) {
true ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
global.moment = factory()
}(this, (function () { 'use strict';
var hookCallback;
function hooks () {
return hookCallback.apply(null, arguments);
}
// This is done to register the method called with moment()
// without creating circular dependencies.
function setHookCallback (callback) {
hookCallback = callback;
}
function isArray(input) {
return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]';
}
function isObject(input) {
// IE8 will treat undefined and null as object if it wasn't for
// input != null
return input != null && Object.prototype.toString.call(input) === '[object Object]';
}
function isObjectEmpty(obj) {
if (Object.getOwnPropertyNames) {
return (Object.getOwnPropertyNames(obj).length === 0);
} else {
var k;
for (k in obj) {
if (obj.hasOwnProperty(k)) {
return false;
}
}
return true;
}
}
function isUndefined(input) {
return input === void 0;
}
function isNumber(input) {
return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]';
}
function isDate(input) {
return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
}
function map(arr, fn) {
var res = [], i;
for (i = 0; i < arr.length; ++i) {
res.push(fn(arr[i], i));
}
return res;
}
function hasOwnProp(a, b) {
return Object.prototype.hasOwnProperty.call(a, b);
}
function extend(a, b) {
for (var i in b) {
if (hasOwnProp(b, i)) {
a[i] = b[i];
}
}
if (hasOwnProp(b, 'toString')) {
a.toString = b.toString;
}
if (hasOwnProp(b, 'valueOf')) {
a.valueOf = b.valueOf;
}
return a;
}
function createUTC (input, format, locale, strict) {
return createLocalOrUTC(input, format, locale, strict, true).utc();
}
function defaultParsingFlags() {
// We need to deep clone this object.
return {
empty : false,
unusedTokens : [],
unusedInput : [],
overflow : -2,
charsLeftOver : 0,
nullInput : false,
invalidMonth : null,
invalidFormat : false,
userInvalidated : false,
iso : false,
parsedDateParts : [],
meridiem : null,
rfc2822 : false,
weekdayMismatch : false
};
}
function getParsingFlags(m) {
if (m._pf == null) {
m._pf = defaultParsingFlags();
}
return m._pf;
}
var some;
if (Array.prototype.some) {
some = Array.prototype.some;
} else {
some = function (fun) {
var t = Object(this);
var len = t.length >>> 0;
for (var i = 0; i < len; i++) {
if (i in t && fun.call(this, t[i], i, t)) {
return true;
}
}
return false;
};
}
function isValid(m) {
if (m._isValid == null) {
var flags = getParsingFlags(m);
var parsedParts = some.call(flags.parsedDateParts, function (i) {
return i != null;
});
var isNowValid = !isNaN(m._d.getTime()) &&
flags.overflow < 0 &&
!flags.empty &&
!flags.invalidMonth &&
!flags.invalidWeekday &&
!flags.weekdayMismatch &&
!flags.nullInput &&
!flags.invalidFormat &&
!flags.userInvalidated &&
(!flags.meridiem || (flags.meridiem && parsedParts));
if (m._strict) {
isNowValid = isNowValid &&
flags.charsLeftOver === 0 &&
flags.unusedTokens.length === 0 &&
flags.bigHour === undefined;
}
if (Object.isFrozen == null || !Object.isFrozen(m)) {
m._isValid = isNowValid;
}
else {
return isNowValid;
}
}
return m._isValid;
}
function createInvalid (flags) {
var m = createUTC(NaN);
if (flags != null) {
extend(getParsingFlags(m), flags);
}
else {
getParsingFlags(m).userInvalidated = true;
}
return m;
}
// Plugins that add properties should also add the key here (null value),
// so we can properly clone ourselves.
var momentProperties = hooks.momentProperties = [];
function copyConfig(to, from) {
var i, prop, val;
if (!isUndefined(from._isAMomentObject)) {
to._isAMomentObject = from._isAMomentObject;
}
if (!isUndefined(from._i)) {
to._i = from._i;
}
if (!isUndefined(from._f)) {
to._f = from._f;
}
if (!isUndefined(from._l)) {
to._l = from._l;
}
if (!isUndefined(from._strict)) {
to._strict = from._strict;
}
if (!isUndefined(from._tzm)) {
to._tzm = from._tzm;
}
if (!isUndefined(from._isUTC)) {
to._isUTC = from._isUTC;
}
if (!isUndefined(from._offset)) {
to._offset = from._offset;
}
if (!isUndefined(from._pf)) {
to._pf = getParsingFlags(from);
}
if (!isUndefined(from._locale)) {
to._locale = from._locale;
}
if (momentProperties.length > 0) {
for (i = 0; i < momentProperties.length; i++) {
prop = momentProperties[i];
val = from[prop];
if (!isUndefined(val)) {
to[prop] = val;
}
}
}
return to;
}
var updateInProgress = false;
// Moment prototype object
function Moment(config) {
copyConfig(this, config);
this._d = new Date(config._d != null ? config._d.getTime() : NaN);
if (!this.isValid()) {
this._d = new Date(NaN);
}
// Prevent infinite loop in case updateOffset creates new moment
// objects.
if (updateInProgress === false) {
updateInProgress = true;
hooks.updateOffset(this);
updateInProgress = false;
}
}
function isMoment (obj) {
return obj instanceof Moment || (obj != null && obj._isAMomentObject != null);
}
function absFloor (number) {
if (number < 0) {
// -0 -> 0
return Math.ceil(number) || 0;
} else {
return Math.floor(number);
}
}
function toInt(argumentForCoercion) {
var coercedNumber = +argumentForCoercion,
value = 0;
if (coercedNumber !== 0 && isFinite(coercedNumber)) {
value = absFloor(coercedNumber);
}
return value;
}
// compare two arrays, return the number of differences
function compareArrays(array1, array2, dontConvert) {
var len = Math.min(array1.length, array2.length),
lengthDiff = Math.abs(array1.length - array2.length),
diffs = 0,
i;
for (i = 0; i < len; i++) {
if ((dontConvert && array1[i] !== array2[i]) ||
(!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
diffs++;
}
}
return diffs + lengthDiff;
}
function warn(msg) {
if (hooks.suppressDeprecationWarnings === false &&
(typeof console !== 'undefined') && console.warn) {
console.warn('Deprecation warning: ' + msg);
}
}
function deprecate(msg, fn) {
var firstTime = true;
return extend(function () {
if (hooks.deprecationHandler != null) {
hooks.deprecationHandler(null, msg);
}
if (firstTime) {
var args = [];
var arg;
for (var i = 0; i < arguments.length; i++) {
arg = '';
if (typeof arguments[i] === 'object') {
arg += '\n[' + i + '] ';
for (var key in arguments[0]) {
arg += key + ': ' + arguments[0][key] + ', ';
}
arg = arg.slice(0, -2); // Remove trailing comma and space
} else {
arg = arguments[i];
}
args.push(arg);
}
warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack);
firstTime = false;
}
return fn.apply(this, arguments);
}, fn);
}
var deprecations = {};
function deprecateSimple(name, msg) {
if (hooks.deprecationHandler != null) {
hooks.deprecationHandler(name, msg);
}
if (!deprecations[name]) {
warn(msg);
deprecations[name] = true;
}
}
hooks.suppressDeprecationWarnings = false;
hooks.deprecationHandler = null;
function isFunction(input) {
return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]';
}
function set (config) {
var prop, i;
for (i in config) {
prop = config[i];
if (isFunction(prop)) {
this[i] = prop;
} else {
this['_' + i] = prop;
}
}
this._config = config;
// Lenient ordinal parsing accepts just a number in addition to
// number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
// TODO: Remove "ordinalParse" fallback in next major release.
this._dayOfMonthOrdinalParseLenient = new RegExp(
(this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +
'|' + (/\d{1,2}/).source);
}
function mergeConfigs(parentConfig, childConfig) {
var res = extend({}, parentConfig), prop;
for (prop in childConfig) {
if (hasOwnProp(childConfig, prop)) {
if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
res[prop] = {};
extend(res[prop], parentConfig[prop]);
extend(res[prop], childConfig[prop]);
} else if (childConfig[prop] != null) {
res[prop] = childConfig[prop];
} else {
delete res[prop];
}
}
}
for (prop in parentConfig) {
if (hasOwnProp(parentConfig, prop) &&
!hasOwnProp(childConfig, prop) &&
isObject(parentConfig[prop])) {
// make sure changes to properties don't modify parent config
res[prop] = extend({}, res[prop]);
}
}
return res;
}
function Locale(config) {
if (config != null) {
this.set(config);
}
}
var keys;
if (Object.keys) {
keys = Object.keys;
} else {
keys = function (obj) {
var i, res = [];
for (i in obj) {
if (hasOwnProp(obj, i)) {
res.push(i);
}
}
return res;
};
}
var defaultCalendar = {
sameDay : '[Today at] LT',
nextDay : '[Tomorrow at] LT',
nextWeek : 'dddd [at] LT',
lastDay : '[Yesterday at] LT',
lastWeek : '[Last] dddd [at] LT',
sameElse : 'L'
};
function calendar (key, mom, now) {
var output = this._calendar[key] || this._calendar['sameElse'];
return isFunction(output) ? output.call(mom, now) : output;
}
var defaultLongDateFormat = {
LTS : 'h:mm:ss A',
LT : 'h:mm A',
L : 'MM/DD/YYYY',
LL : 'MMMM D, YYYY',
LLL : 'MMMM D, YYYY h:mm A',
LLLL : 'dddd, MMMM D, YYYY h:mm A'
};
function longDateFormat (key) {
var format = this._longDateFormat[key],
formatUpper = this._longDateFormat[key.toUpperCase()];
if (format || !formatUpper) {
return format;
}
this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) {
return val.slice(1);
});
return this._longDateFormat[key];
}
var defaultInvalidDate = 'Invalid date';
function invalidDate () {
return this._invalidDate;
}
var defaultOrdinal = '%d';
var defaultDayOfMonthOrdinalParse = /\d{1,2}/;
function ordinal (number) {
return this._ordinal.replace('%d', number);
}
var defaultRelativeTime = {
future : 'in %s',
past : '%s ago',
s : 'a few seconds',
ss : '%d seconds',
m : 'a minute',
mm : '%d minutes',
h : 'an hour',
hh : '%d hours',
d : 'a day',
dd : '%d days',
M : 'a month',
MM : '%d months',
y : 'a year',
yy : '%d years'
};
function relativeTime (number, withoutSuffix, string, isFuture) {
var output = this._relativeTime[string];
return (isFunction(output)) ?
output(number, withoutSuffix, string, isFuture) :
output.replace(/%d/i, number);
}
function pastFuture (diff, output) {
var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
return isFunction(format) ? format(output) : format.replace(/%s/i, output);
}
var aliases = {};
function addUnitAlias (unit, shorthand) {
var lowerCase = unit.toLowerCase();
aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
}
function normalizeUnits(units) {
return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;
}
function normalizeObjectUnits(inputObject) {
var normalizedInput = {},
normalizedProp,
prop;
for (prop in inputObject) {
if (hasOwnProp(inputObject, prop)) {
normalizedProp = normalizeUnits(prop);
if (normalizedProp) {
normalizedInput[normalizedProp] = inputObject[prop];
}
}
}
return normalizedInput;
}
var priorities = {};
function addUnitPriority(unit, priority) {
priorities[unit] = priority;
}
function getPrioritizedUnits(unitsObj) {
var units = [];
for (var u in unitsObj) {
units.push({unit: u, priority: priorities[u]});
}
units.sort(function (a, b) {
return a.priority - b.priority;
});
return units;
}
function zeroFill(number, targetLength, forceSign) {
var absNumber = '' + Math.abs(number),
zerosToFill = targetLength - absNumber.length,
sign = number >= 0;
return (sign ? (forceSign ? '+' : '') : '-') +
Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
}
var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;
var formatFunctions = {};
var formatTokenFunctions = {};
// token: 'M'
// padded: ['MM', 2]
// ordinal: 'Mo'
// callback: function () { this.month() + 1 }
function addFormatToken (token, padded, ordinal, callback) {
var func = callback;
if (typeof callback === 'string') {
func = function () {
return this[callback]();
};
}
if (token) {
formatTokenFunctions[token] = func;
}
if (padded) {
formatTokenFunctions[padded[0]] = function () {
return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
};
}
if (ordinal) {
formatTokenFunctions[ordinal] = function () {
return this.localeData().ordinal(func.apply(this, arguments), token);
};
}
}
function removeFormattingTokens(input) {
if (input.match(/\[[\s\S]/)) {
return input.replace(/^\[|\]$/g, '');
}
return input.replace(/\\/g, '');
}
function makeFormatFunction(format) {
var array = format.match(formattingTokens), i, length;
for (i = 0, length = array.length; i < length; i++) {
if (formatTokenFunctions[array[i]]) {
array[i] = formatTokenFunctions[array[i]];
} else {
array[i] = removeFormattingTokens(array[i]);
}
}
return function (mom) {
var output = '', i;
for (i = 0; i < length; i++) {
output += isFunction(array[i]) ? array[i].call(mom, format) : array[i];
}
return output;
};
}
// format date using native date object
function formatMoment(m, format) {
if (!m.isValid()) {
return m.localeData().invalidDate();
}
format = expandFormat(format, m.localeData());
formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
return formatFunctions[format](m);
}
function expandFormat(format, locale) {
var i = 5;
function replaceLongDateFormatTokens(input) {
return locale.longDateFormat(input) || input;
}
localFormattingTokens.lastIndex = 0;
while (i >= 0 && localFormattingTokens.test(format)) {
format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
localFormattingTokens.lastIndex = 0;
i -= 1;
}
return format;
}
var match1 = /\d/; // 0 - 9
var match2 = /\d\d/; // 00 - 99
var match3 = /\d{3}/; // 000 - 999
var match4 = /\d{4}/; // 0000 - 9999
var match6 = /[+-]?\d{6}/; // -999999 - 999999
var match1to2 = /\d\d?/; // 0 - 99
var match3to4 = /\d\d\d\d?/; // 999 - 9999
var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999
var match1to3 = /\d{1,3}/; // 0 - 999
var match1to4 = /\d{1,4}/; // 0 - 9999
var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999
var matchUnsigned = /\d+/; // 0 - inf
var matchSigned = /[+-]?\d+/; // -inf - inf
var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z
var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
// any word (or two) characters or numbers including two/three word month in arabic.
// includes scottish gaelic two word and hyphenated months
var matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i;
var regexes = {};
function addRegexToken (token, regex, strictRegex) {
regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) {
return (isStrict && strictRegex) ? strictRegex : regex;
};
}
function getParseRegexForToken (token, config) {
if (!hasOwnProp(regexes, token)) {
return new RegExp(unescapeFormat(token));
}
return regexes[token](config._strict, config._locale);
}
// Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
function unescapeFormat(s) {
return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
return p1 || p2 || p3 || p4;
}));
}
function regexEscape(s) {
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
}
var tokens = {};
function addParseToken (token, callback) {
var i, func = callback;
if (typeof token === 'string') {
token = [token];
}
if (isNumber(callback)) {
func = function (input, array) {
array[callback] = toInt(input);
};
}
for (i = 0; i < token.length; i++) {
tokens[token[i]] = func;
}
}
function addWeekParseToken (token, callback) {
addParseToken(token, function (input, array, config, token) {
config._w = config._w || {};
callback(input, config._w, config, token);
});
}
function addTimeToArrayFromToken(token, input, config) {
if (input != null && hasOwnProp(tokens, token)) {
tokens[token](input, config._a, config, token);
}
}
var YEAR = 0;
var MONTH = 1;
var DATE = 2;
var HOUR = 3;
var MINUTE = 4;
var SECOND = 5;
var MILLISECOND = 6;
var WEEK = 7;
var WEEKDAY = 8;
// FORMATTING
addFormatToken('Y', 0, 0, function () {
var y = this.year();
return y <= 9999 ? '' + y : '+' + y;
});
addFormatToken(0, ['YY', 2], 0, function () {
return this.year() % 100;
});
addFormatToken(0, ['YYYY', 4], 0, 'year');
addFormatToken(0, ['YYYYY', 5], 0, 'year');
addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
// ALIASES
addUnitAlias('year', 'y');
// PRIORITIES
addUnitPriority('year', 1);
// PARSING
addRegexToken('Y', matchSigned);
addRegexToken('YY', match1to2, match2);
addRegexToken('YYYY', match1to4, match4);
addRegexToken('YYYYY', match1to6, match6);
addRegexToken('YYYYYY', match1to6, match6);
addParseToken(['YYYYY', 'YYYYYY'], YEAR);
addParseToken('YYYY', function (input, array) {
array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
});
addParseToken('YY', function (input, array) {
array[YEAR] = hooks.parseTwoDigitYear(input);
});
addParseToken('Y', function (input, array) {
array[YEAR] = parseInt(input, 10);
});
// HELPERS
function daysInYear(year) {
return isLeapYear(year) ? 366 : 365;
}
function isLeapYear(year) {
return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
}
// HOOKS
hooks.parseTwoDigitYear = function (input) {
return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
};
// MOMENTS
var getSetYear = makeGetSet('FullYear', true);
function getIsLeapYear () {
return isLeapYear(this.year());
}
function makeGetSet (unit, keepTime) {
return function (value) {
if (value != null) {
set$1(this, unit, value);
hooks.updateOffset(this, keepTime);
return this;
} else {
return get(this, unit);
}
};
}
function get (mom, unit) {
return mom.isValid() ?
mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN;
}
function set$1 (mom, unit, value) {
if (mom.isValid() && !isNaN(value)) {
if (unit === 'FullYear' && isLeapYear(mom.year()) && mom.month() === 1 && mom.date() === 29) {
mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value, mom.month(), daysInMonth(value, mom.month()));
}
else {
mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
}
}
}
// MOMENTS
function stringGet (units) {
units = normalizeUnits(units);
if (isFunction(this[units])) {
return this[units]();
}
return this;
}
function stringSet (units, value) {
if (typeof units === 'object') {
units = normalizeObjectUnits(units);
var prioritized = getPrioritizedUnits(units);
for (var i = 0; i < prioritized.length; i++) {
this[prioritized[i].unit](units[prioritized[i].unit]);
}
} else {
units = normalizeUnits(units);
if (isFunction(this[units])) {
return this[units](value);
}
}
return this;
}
function mod(n, x) {
return ((n % x) + x) % x;
}
var indexOf;
if (Array.prototype.indexOf) {
indexOf = Array.prototype.indexOf;
} else {
indexOf = function (o) {
// I know
var i;
for (i = 0; i < this.length; ++i) {
if (this[i] === o) {
return i;
}
}
return -1;
};
}
function daysInMonth(year, month) {
if (isNaN(year) || isNaN(month)) {
return NaN;
}
var modMonth = mod(month, 12);
year += (month - modMonth) / 12;
return modMonth === 1 ? (isLeapYear(year) ? 29 : 28) : (31 - modMonth % 7 % 2);
}
// FORMATTING
addFormatToken('M', ['MM', 2], 'Mo', function () {
return this.month() + 1;
});
addFormatToken('MMM', 0, 0, function (format) {
return this.localeData().monthsShort(this, format);
});
addFormatToken('MMMM', 0, 0, function (format) {
return this.localeData().months(this, format);
});
// ALIASES
addUnitAlias('month', 'M');
// PRIORITY
addUnitPriority('month', 8);
// PARSING
addRegexToken('M', match1to2);
addRegexToken('MM', match1to2, match2);
addRegexToken('MMM', function (isStrict, locale) {
return locale.monthsShortRegex(isStrict);
});
addRegexToken('MMMM', function (isStrict, locale) {
return locale.monthsRegex(isStrict);
});
addParseToken(['M', 'MM'], function (input, array) {
array[MONTH] = toInt(input) - 1;
});
addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
var month = config._locale.monthsParse(input, token, config._strict);
// if we didn't find a month name, mark the date as invalid.
if (month != null) {
array[MONTH] = month;
} else {
getParsingFlags(config).invalidMonth = input;
}
});
// LOCALES
var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/;
var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
function localeMonths (m, format) {
if (!m) {
return isArray(this._months) ? this._months :
this._months['standalone'];
}
return isArray(this._months) ? this._months[m.month()] :
this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()];
}
var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
function localeMonthsShort (m, format) {
if (!m) {
return isArray(this._monthsShort) ? this._monthsShort :
this._monthsShort['standalone'];
}
return isArray(this._monthsShort) ? this._monthsShort[m.month()] :
this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()];
}
function handleStrictParse(monthName, format, strict) {
var i, ii, mom, llc = monthName.toLocaleLowerCase();
if (!this._monthsParse) {
// this is not used
this._monthsParse = [];
this._longMonthsParse = [];
this._shortMonthsParse = [];
for (i = 0; i < 12; ++i) {
mom = createUTC([2000, i]);
this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase();
this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
}
}
if (strict) {
if (format === 'MMM') {
ii = indexOf.call(this._shortMonthsParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf.call(this._longMonthsParse, llc);
return ii !== -1 ? ii : null;
}
} else {
if (format === 'MMM') {
ii = indexOf.call(this._shortMonthsParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._longMonthsParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf.call(this._longMonthsParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._shortMonthsParse, llc);
return ii !== -1 ? ii : null;
}
}
}
function localeMonthsParse (monthName, format, strict) {
var i, mom, regex;
if (this._monthsParseExact) {
return handleStrictParse.call(this, monthName, format, strict);
}
if (!this._monthsParse) {
this._monthsParse = [];
this._longMonthsParse = [];
this._shortMonthsParse = [];
}
// TODO: add sorting
// Sorting makes sure if one month (or abbr) is a prefix of another
// see sorting in computeMonthsParse
for (i = 0; i < 12; i++) {
// make the regex if we don't have it already
mom = createUTC([2000, i]);
if (strict && !this._longMonthsParse[i]) {
this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
}
if (!strict && !this._monthsParse[i]) {
regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
}
// test the regex
if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
return i;
} else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
return i;
} else if (!strict && this._monthsParse[i].test(monthName)) {
return i;
}
}
}
// MOMENTS
function setMonth (mom, value) {
var dayOfMonth;
if (!mom.isValid()) {
// No op
return mom;
}
if (typeof value === 'string') {
if (/^\d+$/.test(value)) {
value = toInt(value);
} else {
value = mom.localeData().monthsParse(value);
// TODO: Another silent failure?
if (!isNumber(value)) {
return mom;
}
}
}
dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
return mom;
}
function getSetMonth (value) {
if (value != null) {
setMonth(this, value);
hooks.updateOffset(this, true);
return this;
} else {
return get(this, 'Month');
}
}
function getDaysInMonth () {
return daysInMonth(this.year(), this.month());
}
var defaultMonthsShortRegex = matchWord;
function monthsShortRegex (isStrict) {
if (this._monthsParseExact) {
if (!hasOwnProp(this, '_monthsRegex')) {
computeMonthsParse.call(this);
}
if (isStrict) {
return this._monthsShortStrictRegex;
} else {
return this._monthsShortRegex;
}
} else {
if (!hasOwnProp(this, '_monthsShortRegex')) {
this._monthsShortRegex = defaultMonthsShortRegex;
}
return this._monthsShortStrictRegex && isStrict ?
this._monthsShortStrictRegex : this._monthsShortRegex;
}
}
var defaultMonthsRegex = matchWord;
function monthsRegex (isStrict) {
if (this._monthsParseExact) {
if (!hasOwnProp(this, '_monthsRegex')) {
computeMonthsParse.call(this);
}
if (isStrict) {
return this._monthsStrictRegex;
} else {
return this._monthsRegex;
}
} else {
if (!hasOwnProp(this, '_monthsRegex')) {
this._monthsRegex = defaultMonthsRegex;
}
return this._monthsStrictRegex && isStrict ?
this._monthsStrictRegex : this._monthsRegex;
}
}
function computeMonthsParse () {
function cmpLenRev(a, b) {
return b.length - a.length;
}
var shortPieces = [], longPieces = [], mixedPieces = [],
i, mom;
for (i = 0; i < 12; i++) {
// make the regex if we don't have it already
mom = createUTC([2000, i]);
shortPieces.push(this.monthsShort(mom, ''));
longPieces.push(this.months(mom, ''));
mixedPieces.push(this.months(mom, ''));
mixedPieces.push(this.monthsShort(mom, ''));
}
// Sorting makes sure if one month (or abbr) is a prefix of another it
// will match the longer piece.
shortPieces.sort(cmpLenRev);
longPieces.sort(cmpLenRev);
mixedPieces.sort(cmpLenRev);
for (i = 0; i < 12; i++) {
shortPieces[i] = regexEscape(shortPieces[i]);
longPieces[i] = regexEscape(longPieces[i]);
}
for (i = 0; i < 24; i++) {
mixedPieces[i] = regexEscape(mixedPieces[i]);
}
this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
this._monthsShortRegex = this._monthsRegex;
this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
}
function createDate (y, m, d, h, M, s, ms) {
// can't just apply() to create a date:
// https://stackoverflow.com/q/181348
var date = new Date(y, m, d, h, M, s, ms);
// the date constructor remaps years 0-99 to 1900-1999
if (y < 100 && y >= 0 && isFinite(date.getFullYear())) {
date.setFullYear(y);
}
return date;
}
function createUTCDate (y) {
var date = new Date(Date.UTC.apply(null, arguments));
// the Date.UTC function remaps years 0-99 to 1900-1999
if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) {
date.setUTCFullYear(y);
}
return date;
}
// start-of-first-week - start-of-year
function firstWeekOffset(year, dow, doy) {
var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
fwd = 7 + dow - doy,
// first-week day local weekday -- which local weekday is fwd
fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
return -fwdlw + fwd - 1;
}
// https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
var localWeekday = (7 + weekday - dow) % 7,
weekOffset = firstWeekOffset(year, dow, doy),
dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
resYear, resDayOfYear;
if (dayOfYear <= 0) {
resYear = year - 1;
resDayOfYear = daysInYear(resYear) + dayOfYear;
} else if (dayOfYear > daysInYear(year)) {
resYear = year + 1;
resDayOfYear = dayOfYear - daysInYear(year);
} else {
resYear = year;
resDayOfYear = dayOfYear;
}
return {
year: resYear,
dayOfYear: resDayOfYear
};
}
function weekOfYear(mom, dow, doy) {
var weekOffset = firstWeekOffset(mom.year(), dow, doy),
week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
resWeek, resYear;
if (week < 1) {
resYear = mom.year() - 1;
resWeek = week + weeksInYear(resYear, dow, doy);
} else if (week > weeksInYear(mom.year(), dow, doy)) {
resWeek = week - weeksInYear(mom.year(), dow, doy);
resYear = mom.year() + 1;
} else {
resYear = mom.year();
resWeek = week;
}
return {
week: resWeek,
year: resYear
};
}
function weeksInYear(year, dow, doy) {
var weekOffset = firstWeekOffset(year, dow, doy),
weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
}
// FORMATTING
addFormatToken('w', ['ww', 2], 'wo', 'week');
addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
// ALIASES
addUnitAlias('week', 'w');
addUnitAlias('isoWeek', 'W');
// PRIORITIES
addUnitPriority('week', 5);
addUnitPriority('isoWeek', 5);
// PARSING
addRegexToken('w', match1to2);
addRegexToken('ww', match1to2, match2);
addRegexToken('W', match1to2);
addRegexToken('WW', match1to2, match2);
addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
week[token.substr(0, 1)] = toInt(input);
});
// HELPERS
// LOCALES
function localeWeek (mom) {
return weekOfYear(mom, this._week.dow, this._week.doy).week;
}
var defaultLocaleWeek = {
dow : 0, // Sunday is the first day of the week.
doy : 6 // The week that contains Jan 1st is the first week of the year.
};
function localeFirstDayOfWeek () {
return this._week.dow;
}
function localeFirstDayOfYear () {
return this._week.doy;
}
// MOMENTS
function getSetWeek (input) {
var week = this.localeData().week(this);
return input == null ? week : this.add((input - week) * 7, 'd');
}
function getSetISOWeek (input) {
var week = weekOfYear(this, 1, 4).week;
return input == null ? week : this.add((input - week) * 7, 'd');
}
// FORMATTING
addFormatToken('d', 0, 'do', 'day');
addFormatToken('dd', 0, 0, function (format) {
return this.localeData().weekdaysMin(this, format);
});
addFormatToken('ddd', 0, 0, function (format) {
return this.localeData().weekdaysShort(this, format);
});
addFormatToken('dddd', 0, 0, function (format) {
return this.localeData().weekdays(this, format);
});
addFormatToken('e', 0, 0, 'weekday');
addFormatToken('E', 0, 0, 'isoWeekday');
// ALIASES
addUnitAlias('day', 'd');
addUnitAlias('weekday', 'e');
addUnitAlias('isoWeekday', 'E');
// PRIORITY
addUnitPriority('day', 11);
addUnitPriority('weekday', 11);
addUnitPriority('isoWeekday', 11);
// PARSING
addRegexToken('d', match1to2);
addRegexToken('e', match1to2);
addRegexToken('E', match1to2);
addRegexToken('dd', function (isStrict, locale) {
return locale.weekdaysMinRegex(isStrict);
});
addRegexToken('ddd', function (isStrict, locale) {
return locale.weekdaysShortRegex(isStrict);
});
addRegexToken('dddd', function (isStrict, locale) {
return locale.weekdaysRegex(isStrict);
});
addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
var weekday = config._locale.weekdaysParse(input, token, config._strict);
// if we didn't get a weekday name, mark the date as invalid
if (weekday != null) {
week.d = weekday;
} else {
getParsingFlags(config).invalidWeekday = input;
}
});
addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
week[token] = toInt(input);
});
// HELPERS
function parseWeekday(input, locale) {
if (typeof input !== 'string') {
return input;
}
if (!isNaN(input)) {
return parseInt(input, 10);
}
input = locale.weekdaysParse(input);
if (typeof input === 'number') {
return input;
}
return null;
}
function parseIsoWeekday(input, locale) {
if (typeof input === 'string') {
return locale.weekdaysParse(input) % 7 || 7;
}
return isNaN(input) ? null : input;
}
// LOCALES
var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
function localeWeekdays (m, format) {
if (!m) {
return isArray(this._weekdays) ? this._weekdays :
this._weekdays['standalone'];
}
return isArray(this._weekdays) ? this._weekdays[m.day()] :
this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()];
}
var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
function localeWeekdaysShort (m) {
return (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort;
}
var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
function localeWeekdaysMin (m) {
return (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin;
}
function handleStrictParse$1(weekdayName, format, strict) {
var i, ii, mom, llc = weekdayName.toLocaleLowerCase();
if (!this._weekdaysParse) {
this._weekdaysParse = [];
this._shortWeekdaysParse = [];
this._minWeekdaysParse = [];
for (i = 0; i < 7; ++i) {
mom = createUTC([2000, 1]).day(i);
this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase();
this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase();
this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
}
}
if (strict) {
if (format === 'dddd') {
ii = indexOf.call(this._weekdaysParse, llc);
return ii !== -1 ? ii : null;
} else if (format === 'ddd') {
ii = indexOf.call(this._shortWeekdaysParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf.call(this._minWeekdaysParse, llc);
return ii !== -1 ? ii : null;
}
} else {
if (format === 'dddd') {
ii = indexOf.call(this._weekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._shortWeekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._minWeekdaysParse, llc);
return ii !== -1 ? ii : null;
} else if (format === 'ddd') {
ii = indexOf.call(this._shortWeekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._weekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._minWeekdaysParse, llc);
return ii !== -1 ? ii : null;
} else {
ii = indexOf.call(this._minWeekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._weekdaysParse, llc);
if (ii !== -1) {
return ii;
}
ii = indexOf.call(this._shortWeekdaysParse, llc);
return ii !== -1 ? ii : null;
}
}
}
function localeWeekdaysParse (weekdayName, format, strict) {
var i, mom, regex;
if (this._weekdaysParseExact) {
return handleStrictParse$1.call(this, weekdayName, format, strict);
}
if (!this._weekdaysParse) {
this._weekdaysParse = [];
this._minWeekdaysParse = [];
this._shortWeekdaysParse = [];
this._fullWeekdaysParse = [];
}
for (i = 0; i < 7; i++) {
// make the regex if we don't have it already
mom = createUTC([2000, 1]).day(i);
if (strict && !this._fullWeekdaysParse[i]) {
this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i');
this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i');
this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i');
}
if (!this._weekdaysParse[i]) {
regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
}
// test the regex
if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) {
return i;
} else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) {
return i;
} else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) {
return i;
} else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
return i;
}
}
}
// MOMENTS
function getSetDayOfWeek (input) {
if (!this.isValid()) {
return input != null ? this : NaN;
}
var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
if (input != null) {
input = parseWeekday(input, this.localeData());
return this.add(input - day, 'd');
} else {
return day;
}
}
function getSetLocaleDayOfWeek (input) {
if (!this.isValid()) {
return input != null ? this : NaN;
}
var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
return input == null ? weekday : this.add(input - weekday, 'd');
}
function getSetISODayOfWeek (input) {
if (!this.isValid()) {
return input != null ? this : NaN;
}
// behaves the same as moment#day except
// as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
// as a setter, sunday should belong to the previous week.
if (input != null) {
var weekday = parseIsoWeekday(input, this.localeData());
return this.day(this.day() % 7 ? weekday : weekday - 7);
} else {
return this.day() || 7;
}
}
var defaultWeekdaysRegex = matchWord;
function weekdaysRegex (isStrict) {
if (this._weekdaysParseExact) {
if (!hasOwnProp(this, '_weekdaysRegex')) {
computeWeekdaysParse.call(this);
}
if (isStrict) {
return this._weekdaysStrictRegex;
} else {
return this._weekdaysRegex;
}
} else {
if (!hasOwnProp(this, '_weekdaysRegex')) {
this._weekdaysRegex = defaultWeekdaysRegex;
}
return this._weekdaysStrictRegex && isStrict ?
this._weekdaysStrictRegex : this._weekdaysRegex;
}
}
var defaultWeekdaysShortRegex = matchWord;
function weekdaysShortRegex (isStrict) {
if (this._weekdaysParseExact) {
if (!hasOwnProp(this, '_weekdaysRegex')) {
computeWeekdaysParse.call(this);
}
if (isStrict) {
return this._weekdaysShortStrictRegex;
} else {
return this._weekdaysShortRegex;
}
} else {
if (!hasOwnProp(this, '_weekdaysShortRegex')) {
this._weekdaysShortRegex = defaultWeekdaysShortRegex;
}
return this._weekdaysShortStrictRegex && isStrict ?
this._weekdaysShortStrictRegex : this._weekdaysShortRegex;
}
}
var defaultWeekdaysMinRegex = matchWord;
function weekdaysMinRegex (isStrict) {
if (this._weekdaysParseExact) {
if (!hasOwnProp(this, '_weekdaysRegex')) {
computeWeekdaysParse.call(this);
}
if (isStrict) {
return this._weekdaysMinStrictRegex;
} else {
return this._weekdaysMinRegex;
}
} else {
if (!hasOwnProp(this, '_weekdaysMinRegex')) {
this._weekdaysMinRegex = defaultWeekdaysMinRegex;
}
return this._weekdaysMinStrictRegex && isStrict ?
this._weekdaysMinStrictRegex : this._weekdaysMinRegex;
}
}
function computeWeekdaysParse () {
function cmpLenRev(a, b) {
return b.length - a.length;
}
var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [],
i, mom, minp, shortp, longp;
for (i = 0; i < 7; i++) {
// make the regex if we don't have it already
mom = createUTC([2000, 1]).day(i);
minp = this.weekdaysMin(mom, '');
shortp = this.weekdaysShort(mom, '');
longp = this.weekdays(mom, '');
minPieces.push(minp);
shortPieces.push(shortp);
longPieces.push(longp);
mixedPieces.push(minp);
mixedPieces.push(shortp);
mixedPieces.push(longp);
}
// Sorting makes sure if one weekday (or abbr) is a prefix of another it
// will match the longer piece.
minPieces.sort(cmpLenRev);
shortPieces.sort(cmpLenRev);
longPieces.sort(cmpLenRev);
mixedPieces.sort(cmpLenRev);
for (i = 0; i < 7; i++) {
shortPieces[i] = regexEscape(shortPieces[i]);
longPieces[i] = regexEscape(longPieces[i]);
mixedPieces[i] = regexEscape(mixedPieces[i]);
}
this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
this._weekdaysShortRegex = this._weekdaysRegex;
this._weekdaysMinRegex = this._weekdaysRegex;
this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i');
this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i');
this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i');
}
// FORMATTING
function hFormat() {
return this.hours() % 12 || 12;
}
function kFormat() {
return this.hours() || 24;
}
addFormatToken('H', ['HH', 2], 0, 'hour');
addFormatToken('h', ['hh', 2], 0, hFormat);
addFormatToken('k', ['kk', 2], 0, kFormat);
addFormatToken('hmm', 0, 0, function () {
return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
});
addFormatToken('hmmss', 0, 0, function () {
return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) +
zeroFill(this.seconds(), 2);
});
addFormatToken('Hmm', 0, 0, function () {
return '' + this.hours() + zeroFill(this.minutes(), 2);
});
addFormatToken('Hmmss', 0, 0, function () {
return '' + this.hours() + zeroFill(this.minutes(), 2) +
zeroFill(this.seconds(), 2);
});
function meridiem (token, lowercase) {
addFormatToken(token, 0, 0, function () {
return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
});
}
meridiem('a', true);
meridiem('A', false);
// ALIASES
addUnitAlias('hour', 'h');
// PRIORITY
addUnitPriority('hour', 13);
// PARSING
function matchMeridiem (isStrict, locale) {
return locale._meridiemParse;
}
addRegexToken('a', matchMeridiem);
addRegexToken('A', matchMeridiem);
addRegexToken('H', match1to2);
addRegexToken('h', match1to2);
addRegexToken('k', match1to2);
addRegexToken('HH', match1to2, match2);
addRegexToken('hh', match1to2, match2);
addRegexToken('kk', match1to2, match2);
addRegexToken('hmm', match3to4);
addRegexToken('hmmss', match5to6);
addRegexToken('Hmm', match3to4);
addRegexToken('Hmmss', match5to6);
addParseToken(['H', 'HH'], HOUR);
addParseToken(['k', 'kk'], function (input, array, config) {
var kInput = toInt(input);
array[HOUR] = kInput === 24 ? 0 : kInput;
});
addParseToken(['a', 'A'], function (input, array, config) {
config._isPm = config._locale.isPM(input);
config._meridiem = input;
});
addParseToken(['h', 'hh'], function (input, array, config) {
array[HOUR] = toInt(input);
getParsingFlags(config).bigHour = true;
});
addParseToken('hmm', function (input, array, config) {
var pos = input.length - 2;
array[HOUR] = toInt(input.substr(0, pos));
array[MINUTE] = toInt(input.substr(pos));
getParsingFlags(config).bigHour = true;
});
addParseToken('hmmss', function (input, array, config) {
var pos1 = input.length - 4;
var pos2 = input.length - 2;
array[HOUR] = toInt(input.substr(0, pos1));
array[MINUTE] = toInt(input.substr(pos1, 2));
array[SECOND] = toInt(input.substr(pos2));
getParsingFlags(config).bigHour = true;
});
addParseToken('Hmm', function (input, array, config) {
var pos = input.length - 2;
array[HOUR] = toInt(input.substr(0, pos));
array[MINUTE] = toInt(input.substr(pos));
});
addParseToken('Hmmss', function (input, array, config) {
var pos1 = input.length - 4;
var pos2 = input.length - 2;
array[HOUR] = toInt(input.substr(0, pos1));
array[MINUTE] = toInt(input.substr(pos1, 2));
array[SECOND] = toInt(input.substr(pos2));
});
// LOCALES
function localeIsPM (input) {
// IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
// Using charAt should be more compatible.
return ((input + '').toLowerCase().charAt(0) === 'p');
}
var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
function localeMeridiem (hours, minutes, isLower) {
if (hours > 11) {
return isLower ? 'pm' : 'PM';
} else {
return isLower ? 'am' : 'AM';
}
}
// MOMENTS
// Setting the hour should keep the time, because the user explicitly
// specified which hour they want. So trying to maintain the same hour (in
// a new timezone) makes sense. Adding/subtracting hours does not follow
// this rule.
var getSetHour = makeGetSet('Hours', true);
var baseConfig = {
calendar: defaultCalendar,
longDateFormat: defaultLongDateFormat,
invalidDate: defaultInvalidDate,
ordinal: defaultOrdinal,
dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
relativeTime: defaultRelativeTime,
months: defaultLocaleMonths,
monthsShort: defaultLocaleMonthsShort,
week: defaultLocaleWeek,
weekdays: defaultLocaleWeekdays,
weekdaysMin: defaultLocaleWeekdaysMin,
weekdaysShort: defaultLocaleWeekdaysShort,
meridiemParse: defaultLocaleMeridiemParse
};
// internal storage for locale config files
var locales = {};
var localeFamilies = {};
var globalLocale;
function normalizeLocale(key) {
return key ? key.toLowerCase().replace('_', '-') : key;
}
// pick the locale from the array
// try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
// substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
function chooseLocale(names) {
var i = 0, j, next, locale, split;
while (i < names.length) {
split = normalizeLocale(names[i]).split('-');
j = split.length;
next = normalizeLocale(names[i + 1]);
next = next ? next.split('-') : null;
while (j > 0) {
locale = loadLocale(split.slice(0, j).join('-'));
if (locale) {
return locale;
}
if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
//the next array item is better than a shallower substring of this one
break;
}
j--;
}
i++;
}
return globalLocale;
}
function loadLocale(name) {
var oldLocale = null;
// TODO: Find a better way to register and load all the locales in Node
if (!locales[name] && (typeof module !== 'undefined') &&
module && module.exports) {
try {
oldLocale = globalLocale._abbr;
var aliasedRequire = require;
__webpack_require__(447)("./" + name);
getSetGlobalLocale(oldLocale);
} catch (e) {}
}
return locales[name];
}
// This function will load locale and then set the global locale. If
// no arguments are passed in, it will simply return the current global
// locale key.
function getSetGlobalLocale (key, values) {
var data;
if (key) {
if (isUndefined(values)) {
data = getLocale(key);
}
else {
data = defineLocale(key, values);
}
if (data) {
// moment.duration._locale = moment._locale = data;
globalLocale = data;
}
else {
if ((typeof console !== 'undefined') && console.warn) {
//warn user if arguments are passed but the locale could not be set
console.warn('Locale ' + key + ' not found. Did you forget to load it?');
}
}
}
return globalLocale._abbr;
}
function defineLocale (name, config) {
if (config !== null) {
var locale, parentConfig = baseConfig;
config.abbr = name;
if (locales[name] != null) {
deprecateSimple('defineLocaleOverride',
'use moment.updateLocale(localeName, config) to change ' +
'an existing locale. moment.defineLocale(localeName, ' +
'config) should only be used for creating a new locale ' +
'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.');
parentConfig = locales[name]._config;
} else if (config.parentLocale != null) {
if (locales[config.parentLocale] != null) {
parentConfig = locales[config.parentLocale]._config;
} else {
locale = loadLocale(config.parentLocale);
if (locale != null) {
parentConfig = locale._config;
} else {
if (!localeFamilies[config.parentLocale]) {
localeFamilies[config.parentLocale] = [];
}
localeFamilies[config.parentLocale].push({
name: name,
config: config
});
return null;
}
}
}
locales[name] = new Locale(mergeConfigs(parentConfig, config));
if (localeFamilies[name]) {
localeFamilies[name].forEach(function (x) {
defineLocale(x.name, x.config);
});
}
// backwards compat for now: also set the locale
// make sure we set the locale AFTER all child locales have been
// created, so we won't end up with the child locale set.
getSetGlobalLocale(name);
return locales[name];
} else {
// useful for testing
delete locales[name];
return null;
}
}
function updateLocale(name, config) {
if (config != null) {
var locale, tmpLocale, parentConfig = baseConfig;
// MERGE
tmpLocale = loadLocale(name);
if (tmpLocale != null) {
parentConfig = tmpLocale._config;
}
config = mergeConfigs(parentConfig, config);
locale = new Locale(config);
locale.parentLocale = locales[name];
locales[name] = locale;
// backwards compat for now: also set the locale
getSetGlobalLocale(name);
} else {
// pass null for config to unupdate, useful for tests
if (locales[name] != null) {
if (locales[name].parentLocale != null) {
locales[name] = locales[name].parentLocale;
} else if (locales[name] != null) {
delete locales[name];
}
}
}
return locales[name];
}
// returns locale data
function getLocale (key) {
var locale;
if (key && key._locale && key._locale._abbr) {
key = key._locale._abbr;
}
if (!key) {
return globalLocale;
}
if (!isArray(key)) {
//short-circuit everything else
locale = loadLocale(key);
if (locale) {
return locale;
}
key = [key];
}
return chooseLocale(key);
}
function listLocales() {
return keys(locales);
}
function checkOverflow (m) {
var overflow;
var a = m._a;
if (a && getParsingFlags(m).overflow === -2) {
overflow =
a[MONTH] < 0 || a[MONTH] > 11 ? MONTH :
a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR :
a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE :
a[SECOND] < 0 || a[SECOND] > 59 ? SECOND :
a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND :
-1;
if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
overflow = DATE;
}
if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
overflow = WEEK;
}
if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
overflow = WEEKDAY;
}
getParsingFlags(m).overflow = overflow;
}
return m;
}
// Pick the first defined of two or three arguments.
function defaults(a, b, c) {
if (a != null) {
return a;
}
if (b != null) {
return b;
}
return c;
}
function currentDateArray(config) {
// hooks is actually the exported moment object
var nowValue = new Date(hooks.now());
if (config._useUTC) {
return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()];
}
return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
}
// convert an array to a date.
// the array should mirror the parameters below
// note: all values past the year are optional and will default to the lowest possible value.
// [year, month, day , hour, minute, second, millisecond]
function configFromArray (config) {
var i, date, input = [], currentDate, expectedWeekday, yearToUse;
if (config._d) {
return;
}
currentDate = currentDateArray(config);
//compute day of the year from weeks and weekdays
if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
dayOfYearFromWeekInfo(config);
}
//if the day of the year is set, figure out what it is
if (config._dayOfYear != null) {
yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) {
getParsingFlags(config)._overflowDayOfYear = true;
}
date = createUTCDate(yearToUse, 0, config._dayOfYear);
config._a[MONTH] = date.getUTCMonth();
config._a[DATE] = date.getUTCDate();
}
// Default to current date.
// * if no year, month, day of month are given, default to today
// * if day of month is given, default month and year
// * if month is given, default only year
// * if year is given, don't default anything
for (i = 0; i < 3 && config._a[i] == null; ++i) {
config._a[i] = input[i] = currentDate[i];
}
// Zero out whatever was not defaulted, including time
for (; i < 7; i++) {
config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
}
// Check for 24:00:00.000
if (config._a[HOUR] === 24 &&
config._a[MINUTE] === 0 &&
config._a[SECOND] === 0 &&
config._a[MILLISECOND] === 0) {
config._nextDay = true;
config._a[HOUR] = 0;
}
config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay();
// Apply timezone offset from input. The actual utcOffset can be changed
// with parseZone.
if (config._tzm != null) {
config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
}
if (config._nextDay) {
config._a[HOUR] = 24;
}
// check for mismatching day of week
if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) {
getParsingFlags(config).weekdayMismatch = true;
}
}
function dayOfYearFromWeekInfo(config) {
var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
w = config._w;
if (w.GG != null || w.W != null || w.E != null) {
dow = 1;
doy = 4;
// TODO: We need to take the current isoWeekYear, but that depends on
// how we interpret now (local, utc, fixed offset). So create
// a now version of current config (take local/utc/offset flags, and
// create now).
weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year);
week = defaults(w.W, 1);
weekday = defaults(w.E, 1);
if (weekday < 1 || weekday > 7) {
weekdayOverflow = true;
}
} else {
dow = config._locale._week.dow;
doy = config._locale._week.doy;
var curWeek = weekOfYear(createLocal(), dow, doy);
weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
// Default to current week.
week = defaults(w.w, curWeek.week);
if (w.d != null) {
// weekday -- low day numbers are considered next week
weekday = w.d;
if (weekday < 0 || weekday > 6) {
weekdayOverflow = true;
}
} else if (w.e != null) {
// local weekday -- counting starts from begining of week
weekday = w.e + dow;
if (w.e < 0 || w.e > 6) {
weekdayOverflow = true;
}
} else {
// default to begining of week
weekday = dow;
}
}
if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
getParsingFlags(config)._overflowWeeks = true;
} else if (weekdayOverflow != null) {
getParsingFlags(config)._overflowWeekday = true;
} else {
temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
config._a[YEAR] = temp.year;
config._dayOfYear = temp.dayOfYear;
}
}
// iso 8601 regex
// 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/;
var isoDates = [
['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
['GGGG-[W]WW', /\d{4}-W\d\d/, false],
['YYYY-DDD', /\d{4}-\d{3}/],
['YYYY-MM', /\d{4}-\d\d/, false],
['YYYYYYMMDD', /[+-]\d{10}/],
['YYYYMMDD', /\d{8}/],
// YYYYMM is NOT allowed by the standard
['GGGG[W]WWE', /\d{4}W\d{3}/],
['GGGG[W]WW', /\d{4}W\d{2}/, false],
['YYYYDDD', /\d{7}/]
];
// iso time formats and regexes
var isoTimes = [
['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
['HH:mm:ss', /\d\d:\d\d:\d\d/],
['HH:mm', /\d\d:\d\d/],
['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
['HHmmss', /\d\d\d\d\d\d/],
['HHmm', /\d\d\d\d/],
['HH', /\d\d/]
];
var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
// date from iso format
function configFromISO(config) {
var i, l,
string = config._i,
match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
allowTime, dateFormat, timeFormat, tzFormat;
if (match) {
getParsingFlags(config).iso = true;
for (i = 0, l = isoDates.length; i < l; i++) {
if (isoDates[i][1].exec(match[1])) {
dateFormat = isoDates[i][0];
allowTime = isoDates[i][2] !== false;
break;
}
}
if (dateFormat == null) {
config._isValid = false;
return;
}
if (match[3]) {
for (i = 0, l = isoTimes.length; i < l; i++) {
if (isoTimes[i][1].exec(match[3])) {
// match[2] should be 'T' or space
timeFormat = (match[2] || ' ') + isoTimes[i][0];
break;
}
}
if (timeFormat == null) {
config._isValid = false;
return;
}
}
if (!allowTime && timeFormat != null) {
config._isValid = false;
return;
}
if (match[4]) {
if (tzRegex.exec(match[4])) {
tzFormat = 'Z';
} else {
config._isValid = false;
return;
}
}
config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
configFromStringAndFormat(config);
} else {
config._isValid = false;
}
}
// RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/;
function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
var result = [
untruncateYear(yearStr),
defaultLocaleMonthsShort.indexOf(monthStr),
parseInt(dayStr, 10),
parseInt(hourStr, 10),
parseInt(minuteStr, 10)
];
if (secondStr) {
result.push(parseInt(secondStr, 10));
}
return result;
}
function untruncateYear(yearStr) {
var year = parseInt(yearStr, 10);
if (year <= 49) {
return 2000 + year;
} else if (year <= 999) {
return 1900 + year;
}
return year;
}
function preprocessRFC2822(s) {
// Remove comments and folding whitespace and replace multiple-spaces with a single space
return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').trim();
}
function checkWeekday(weekdayStr, parsedInput, config) {
if (weekdayStr) {
// TODO: Replace the vanilla JS Date object with an indepentent day-of-week check.
var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),
weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay();
if (weekdayProvided !== weekdayActual) {
getParsingFlags(config).weekdayMismatch = true;
config._isValid = false;
return false;
}
}
return true;
}
var obsOffsets = {
UT: 0,
GMT: 0,
EDT: -4 * 60,
EST: -5 * 60,
CDT: -5 * 60,
CST: -6 * 60,
MDT: -6 * 60,
MST: -7 * 60,
PDT: -7 * 60,
PST: -8 * 60
};
function calculateOffset(obsOffset, militaryOffset, numOffset) {
if (obsOffset) {
return obsOffsets[obsOffset];
} else if (militaryOffset) {
// the only allowed military tz is Z
return 0;
} else {
var hm = parseInt(numOffset, 10);
var m = hm % 100, h = (hm - m) / 100;
return h * 60 + m;
}
}
// date and time from ref 2822 format
function configFromRFC2822(config) {
var match = rfc2822.exec(preprocessRFC2822(config._i));
if (match) {
var parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]);
if (!checkWeekday(match[1], parsedArray, config)) {
return;
}
config._a = parsedArray;
config._tzm = calculateOffset(match[8], match[9], match[10]);
config._d = createUTCDate.apply(null, config._a);
config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
getParsingFlags(config).rfc2822 = true;
} else {
config._isValid = false;
}
}
// date from iso format or fallback
function configFromString(config) {
var matched = aspNetJsonRegex.exec(config._i);
if (matched !== null) {
config._d = new Date(+matched[1]);
return;
}
configFromISO(config);
if (config._isValid === false) {
delete config._isValid;
} else {
return;
}
configFromRFC2822(config);
if (config._isValid === false) {
delete config._isValid;
} else {
return;
}
// Final attempt, use Input Fallback
hooks.createFromInputFallback(config);
}
hooks.createFromInputFallback = deprecate(
'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +
'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +
'discouraged and will be removed in an upcoming major release. Please refer to ' +
'http://momentjs.com/guides/#/warnings/js-date/ for more info.',
function (config) {
config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
}
);
// constant that refers to the ISO standard
hooks.ISO_8601 = function () {};
// constant that refers to the RFC 2822 form
hooks.RFC_2822 = function () {};
// date from string and format string
function configFromStringAndFormat(config) {
// TODO: Move this to another part of the creation flow to prevent circular deps
if (config._f === hooks.ISO_8601) {
configFromISO(config);
return;
}
if (config._f === hooks.RFC_2822) {
configFromRFC2822(config);
return;
}
config._a = [];
getParsingFlags(config).empty = true;
// This array is used to make a Date, either with `new Date` or `Date.UTC`
var string = '' + config._i,
i, parsedInput, tokens, token, skipped,
stringLength = string.length,
totalParsedInputLength = 0;
tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
for (i = 0; i < tokens.length; i++) {
token = tokens[i];
parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
// console.log('token', token, 'parsedInput', parsedInput,
// 'regex', getParseRegexForToken(token, config));
if (parsedInput) {
skipped = string.substr(0, string.indexOf(parsedInput));
if (skipped.length > 0) {
getParsingFlags(config).unusedInput.push(skipped);
}
string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
totalParsedInputLength += parsedInput.length;
}
// don't parse if it's not a known token
if (formatTokenFunctions[token]) {
if (parsedInput) {
getParsingFlags(config).empty = false;
}
else {
getParsingFlags(config).unusedTokens.push(token);
}
addTimeToArrayFromToken(token, parsedInput, config);
}
else if (config._strict && !parsedInput) {
getParsingFlags(config).unusedTokens.push(token);
}
}
// add remaining unparsed input length to the string
getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
if (string.length > 0) {
getParsingFlags(config).unusedInput.push(string);
}
// clear _12h flag if hour is <= 12
if (config._a[HOUR] <= 12 &&
getParsingFlags(config).bigHour === true &&
config._a[HOUR] > 0) {
getParsingFlags(config).bigHour = undefined;
}
getParsingFlags(config).parsedDateParts = config._a.slice(0);
getParsingFlags(config).meridiem = config._meridiem;
// handle meridiem
config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);
configFromArray(config);
checkOverflow(config);
}
function meridiemFixWrap (locale, hour, meridiem) {
var isPm;
if (meridiem == null) {
// nothing to do
return hour;
}
if (locale.meridiemHour != null) {
return locale.meridiemHour(hour, meridiem);
} else if (locale.isPM != null) {
// Fallback
isPm = locale.isPM(meridiem);
if (isPm && hour < 12) {
hour += 12;
}
if (!isPm && hour === 12) {
hour = 0;
}
return hour;
} else {
// this is not supposed to happen
return hour;
}
}
// date from string and array of format strings
function configFromStringAndArray(config) {
var tempConfig,
bestMoment,
scoreToBeat,
i,
currentScore;
if (config._f.length === 0) {
getParsingFlags(config).invalidFormat = true;
config._d = new Date(NaN);
return;
}
for (i = 0; i < config._f.length; i++) {
currentScore = 0;
tempConfig = copyConfig({}, config);
if (config._useUTC != null) {
tempConfig._useUTC = config._useUTC;
}
tempConfig._f = config._f[i];
configFromStringAndFormat(tempConfig);
if (!isValid(tempConfig)) {
continue;
}
// if there is any input that was not parsed add a penalty for that format
currentScore += getParsingFlags(tempConfig).charsLeftOver;
//or tokens
currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
getParsingFlags(tempConfig).score = currentScore;
if (scoreToBeat == null || currentScore < scoreToBeat) {
scoreToBeat = currentScore;
bestMoment = tempConfig;
}
}
extend(config, bestMoment || tempConfig);
}
function configFromObject(config) {
if (config._d) {
return;
}
var i = normalizeObjectUnits(config._i);
config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) {
return obj && parseInt(obj, 10);
});
configFromArray(config);
}
function createFromConfig (config) {
var res = new Moment(checkOverflow(prepareConfig(config)));
if (res._nextDay) {
// Adding is smart enough around DST
res.add(1, 'd');
res._nextDay = undefined;
}
return res;
}
function prepareConfig (config) {
var input = config._i,
format = config._f;
config._locale = config._locale || getLocale(config._l);
if (input === null || (format === undefined && input === '')) {
return createInvalid({nullInput: true});
}
if (typeof input === 'string') {
config._i = input = config._locale.preparse(input);
}
if (isMoment(input)) {
return new Moment(checkOverflow(input));
} else if (isDate(input)) {
config._d = input;
} else if (isArray(format)) {
configFromStringAndArray(config);
} else if (format) {
configFromStringAndFormat(config);
} else {
configFromInput(config);
}
if (!isValid(config)) {
config._d = null;
}
return config;
}
function configFromInput(config) {
var input = config._i;
if (isUndefined(input)) {
config._d = new Date(hooks.now());
} else if (isDate(input)) {
config._d = new Date(input.valueOf());
} else if (typeof input === 'string') {
configFromString(config);
} else if (isArray(input)) {
config._a = map(input.slice(0), function (obj) {
return parseInt(obj, 10);
});
configFromArray(config);
} else if (isObject(input)) {
configFromObject(config);
} else if (isNumber(input)) {
// from milliseconds
config._d = new Date(input);
} else {
hooks.createFromInputFallback(config);
}
}
function createLocalOrUTC (input, format, locale, strict, isUTC) {
var c = {};
if (locale === true || locale === false) {
strict = locale;
locale = undefined;
}
if ((isObject(input) && isObjectEmpty(input)) ||
(isArray(input) && input.length === 0)) {
input = undefined;
}
// object construction must be done this way.
// https://github.com/moment/moment/issues/1423
c._isAMomentObject = true;
c._useUTC = c._isUTC = isUTC;
c._l = locale;
c._i = input;
c._f = format;
c._strict = strict;
return createFromConfig(c);
}
function createLocal (input, format, locale, strict) {
return createLocalOrUTC(input, format, locale, strict, false);
}
var prototypeMin = deprecate(
'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
function () {
var other = createLocal.apply(null, arguments);
if (this.isValid() && other.isValid()) {
return other < this ? this : other;
} else {
return createInvalid();
}
}
);
var prototypeMax = deprecate(
'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
function () {
var other = createLocal.apply(null, arguments);
if (this.isValid() && other.isValid()) {
return other > this ? this : other;
} else {
return createInvalid();
}
}
);
// Pick a moment m from moments so that m[fn](other) is true for all
// other. This relies on the function fn to be transitive.
//
// moments should either be an array of moment objects or an array, whose
// first element is an array of moment objects.
function pickBy(fn, moments) {
var res, i;
if (moments.length === 1 && isArray(moments[0])) {
moments = moments[0];
}
if (!moments.length) {
return createLocal();
}
res = moments[0];
for (i = 1; i < moments.length; ++i) {
if (!moments[i].isValid() || moments[i][fn](res)) {
res = moments[i];
}
}
return res;
}
// TODO: Use [].sort instead?
function min () {
var args = [].slice.call(arguments, 0);
return pickBy('isBefore', args);
}
function max () {
var args = [].slice.call(arguments, 0);
return pickBy('isAfter', args);
}
var now = function () {
return Date.now ? Date.now() : +(new Date());
};
var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond'];
function isDurationValid(m) {
for (var key in m) {
if (!(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) {
return false;
}
}
var unitHasDecimal = false;
for (var i = 0; i < ordering.length; ++i) {
if (m[ordering[i]]) {
if (unitHasDecimal) {
return false; // only allow non-integers for smallest unit
}
if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
unitHasDecimal = true;
}
}
}
return true;
}
function isValid$1() {
return this._isValid;
}
function createInvalid$1() {
return createDuration(NaN);
}
function Duration (duration) {
var normalizedInput = normalizeObjectUnits(duration),
years = normalizedInput.year || 0,
quarters = normalizedInput.quarter || 0,
months = normalizedInput.month || 0,
weeks = normalizedInput.week || 0,
days = normalizedInput.day || 0,
hours = normalizedInput.hour || 0,
minutes = normalizedInput.minute || 0,
seconds = normalizedInput.second || 0,
milliseconds = normalizedInput.millisecond || 0;
this._isValid = isDurationValid(normalizedInput);
// representation for dateAddRemove
this._milliseconds = +milliseconds +
seconds * 1e3 + // 1000
minutes * 6e4 + // 1000 * 60
hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
// Because of dateAddRemove treats 24 hours as different from a
// day when working around DST, we need to store them separately
this._days = +days +
weeks * 7;
// It is impossible to translate months into days without knowing
// which months you are are talking about, so we have to store
// it separately.
this._months = +months +
quarters * 3 +
years * 12;
this._data = {};
this._locale = getLocale();
this._bubble();
}
function isDuration (obj) {
return obj instanceof Duration;
}
function absRound (number) {
if (number < 0) {
return Math.round(-1 * number) * -1;
} else {
return Math.round(number);
}
}
// FORMATTING
function offset (token, separator) {
addFormatToken(token, 0, 0, function () {
var offset = this.utcOffset();
var sign = '+';
if (offset < 0) {
offset = -offset;
sign = '-';
}
return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2);
});
}
offset('Z', ':');
offset('ZZ', '');
// PARSING
addRegexToken('Z', matchShortOffset);
addRegexToken('ZZ', matchShortOffset);
addParseToken(['Z', 'ZZ'], function (input, array, config) {
config._useUTC = true;
config._tzm = offsetFromString(matchShortOffset, input);
});
// HELPERS
// timezone chunker
// '+10:00' > ['10', '00']
// '-1530' > ['-15', '30']
var chunkOffset = /([\+\-]|\d\d)/gi;
function offsetFromString(matcher, string) {
var matches = (string || '').match(matcher);
if (matches === null) {
return null;
}
var chunk = matches[matches.length - 1] || [];
var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
var minutes = +(parts[1] * 60) + toInt(parts[2]);
return minutes === 0 ?
0 :
parts[0] === '+' ? minutes : -minutes;
}
// Return a moment from input, that is local/utc/zone equivalent to model.
function cloneWithOffset(input, model) {
var res, diff;
if (model._isUTC) {
res = model.clone();
diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf();
// Use low-level api, because this fn is low-level api.
res._d.setTime(res._d.valueOf() + diff);
hooks.updateOffset(res, false);
return res;
} else {
return createLocal(input).local();
}
}
function getDateOffset (m) {
// On Firefox.24 Date#getTimezoneOffset returns a floating point.
// https://github.com/moment/moment/pull/1871
return -Math.round(m._d.getTimezoneOffset() / 15) * 15;
}
// HOOKS
// This function will be called whenever a moment is mutated.
// It is intended to keep the offset in sync with the timezone.
hooks.updateOffset = function () {};
// MOMENTS
// keepLocalTime = true means only change the timezone, without
// affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
// 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
// +0200, so we adjust the time as needed, to be valid.
//
// Keeping the time actually adds/subtracts (one hour)
// from the actual represented time. That is why we call updateOffset
// a second time. In case it wants us to change the offset again
// _changeInProgress == true case, then we have to adjust, because
// there is no such time in the given timezone.
function getSetOffset (input, keepLocalTime, keepMinutes) {
var offset = this._offset || 0,
localAdjust;
if (!this.isValid()) {
return input != null ? this : NaN;
}
if (input != null) {
if (typeof input === 'string') {
input = offsetFromString(matchShortOffset, input);
if (input === null) {
return this;
}
} else if (Math.abs(input) < 16 && !keepMinutes) {
input = input * 60;
}
if (!this._isUTC && keepLocalTime) {
localAdjust = getDateOffset(this);
}
this._offset = input;
this._isUTC = true;
if (localAdjust != null) {
this.add(localAdjust, 'm');
}
if (offset !== input) {
if (!keepLocalTime || this._changeInProgress) {
addSubtract(this, createDuration(input - offset, 'm'), 1, false);
} else if (!this._changeInProgress) {
this._changeInProgress = true;
hooks.updateOffset(this, true);
this._changeInProgress = null;
}
}
return this;
} else {
return this._isUTC ? offset : getDateOffset(this);
}
}
function getSetZone (input, keepLocalTime) {
if (input != null) {
if (typeof input !== 'string') {
input = -input;
}
this.utcOffset(input, keepLocalTime);
return this;
} else {
return -this.utcOffset();
}
}
function setOffsetToUTC (keepLocalTime) {
return this.utcOffset(0, keepLocalTime);
}
function setOffsetToLocal (keepLocalTime) {
if (this._isUTC) {
this.utcOffset(0, keepLocalTime);
this._isUTC = false;
if (keepLocalTime) {
this.subtract(getDateOffset(this), 'm');
}
}
return this;
}
function setOffsetToParsedOffset () {
if (this._tzm != null) {
this.utcOffset(this._tzm, false, true);
} else if (typeof this._i === 'string') {
var tZone = offsetFromString(matchOffset, this._i);
if (tZone != null) {
this.utcOffset(tZone);
}
else {
this.utcOffset(0, true);
}
}
return this;
}
function hasAlignedHourOffset (input) {
if (!this.isValid()) {
return false;
}
input = input ? createLocal(input).utcOffset() : 0;
return (this.utcOffset() - input) % 60 === 0;
}
function isDaylightSavingTime () {
return (
this.utcOffset() > this.clone().month(0).utcOffset() ||
this.utcOffset() > this.clone().month(5).utcOffset()
);
}
function isDaylightSavingTimeShifted () {
if (!isUndefined(this._isDSTShifted)) {
return this._isDSTShifted;
}
var c = {};
copyConfig(c, this);
c = prepareConfig(c);
if (c._a) {
var other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
this._isDSTShifted = this.isValid() &&
compareArrays(c._a, other.toArray()) > 0;
} else {
this._isDSTShifted = false;
}
return this._isDSTShifted;
}
function isLocal () {
return this.isValid() ? !this._isUTC : false;
}
function isUtcOffset () {
return this.isValid() ? this._isUTC : false;
}
function isUtc () {
return this.isValid() ? this._isUTC && this._offset === 0 : false;
}
// ASP.NET json date format regex
var aspNetRegex = /^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/;
// from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
// somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
// and further modified to allow for strings containing both week and day
var isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
function createDuration (input, key) {
var duration = input,
// matching against regexp is expensive, do it on demand
match = null,
sign,
ret,
diffRes;
if (isDuration(input)) {
duration = {
ms : input._milliseconds,
d : input._days,
M : input._months
};
} else if (isNumber(input)) {
duration = {};
if (key) {
duration[key] = input;
} else {
duration.milliseconds = input;
}
} else if (!!(match = aspNetRegex.exec(input))) {
sign = (match[1] === '-') ? -1 : 1;
duration = {
y : 0,
d : toInt(match[DATE]) * sign,
h : toInt(match[HOUR]) * sign,
m : toInt(match[MINUTE]) * sign,
s : toInt(match[SECOND]) * sign,
ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match
};
} else if (!!(match = isoRegex.exec(input))) {
sign = (match[1] === '-') ? -1 : (match[1] === '+') ? 1 : 1;
duration = {
y : parseIso(match[2], sign),
M : parseIso(match[3], sign),
w : parseIso(match[4], sign),
d : parseIso(match[5], sign),
h : parseIso(match[6], sign),
m : parseIso(match[7], sign),
s : parseIso(match[8], sign)
};
} else if (duration == null) {// checks for null or undefined
duration = {};
} else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) {
diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to));
duration = {};
duration.ms = diffRes.milliseconds;
duration.M = diffRes.months;
}
ret = new Duration(duration);
if (isDuration(input) && hasOwnProp(input, '_locale')) {
ret._locale = input._locale;
}
return ret;
}
createDuration.fn = Duration.prototype;
createDuration.invalid = createInvalid$1;
function parseIso (inp, sign) {
// We'd normally use ~~inp for this, but unfortunately it also
// converts floats to ints.
// inp may be undefined, so careful calling replace on it.
var res = inp && parseFloat(inp.replace(',', '.'));
// apply sign while we're at it
return (isNaN(res) ? 0 : res) * sign;
}
function positiveMomentsDifference(base, other) {
var res = {milliseconds: 0, months: 0};
res.months = other.month() - base.month() +
(other.year() - base.year()) * 12;
if (base.clone().add(res.months, 'M').isAfter(other)) {
--res.months;
}
res.milliseconds = +other - +(base.clone().add(res.months, 'M'));
return res;
}
function momentsDifference(base, other) {
var res;
if (!(base.isValid() && other.isValid())) {
return {milliseconds: 0, months: 0};
}
other = cloneWithOffset(other, base);
if (base.isBefore(other)) {
res = positiveMomentsDifference(base, other);
} else {
res = positiveMomentsDifference(other, base);
res.milliseconds = -res.milliseconds;
res.months = -res.months;
}
return res;
}
// TODO: remove 'name' arg after deprecation is removed
function createAdder(direction, name) {
return function (val, period) {
var dur, tmp;
//invert the arguments, but complain about it
if (period !== null && !isNaN(+period)) {
deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' +
'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.');
tmp = val; val = period; period = tmp;
}
val = typeof val === 'string' ? +val : val;
dur = createDuration(val, period);
addSubtract(this, dur, direction);
return this;
};
}
function addSubtract (mom, duration, isAdding, updateOffset) {
var milliseconds = duration._milliseconds,
days = absRound(duration._days),
months = absRound(duration._months);
if (!mom.isValid()) {
// No op
return;
}
updateOffset = updateOffset == null ? true : updateOffset;
if (months) {
setMonth(mom, get(mom, 'Month') + months * isAdding);
}
if (days) {
set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
}
if (milliseconds) {
mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
}
if (updateOffset) {
hooks.updateOffset(mom, days || months);
}
}
var add = createAdder(1, 'add');
var subtract = createAdder(-1, 'subtract');
function getCalendarFormat(myMoment, now) {
var diff = myMoment.diff(now, 'days', true);
return diff < -6 ? 'sameElse' :
diff < -1 ? 'lastWeek' :
diff < 0 ? 'lastDay' :
diff < 1 ? 'sameDay' :
diff < 2 ? 'nextDay' :
diff < 7 ? 'nextWeek' : 'sameElse';
}
function calendar$1 (time, formats) {
// We want to compare the start of today, vs this.
// Getting start-of-today depends on whether we're local/utc/offset or not.
var now = time || createLocal(),
sod = cloneWithOffset(now, this).startOf('day'),
format = hooks.calendarFormat(this, sod) || 'sameElse';
var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]);
return this.format(output || this.localeData().calendar(format, this, createLocal(now)));
}
function clone () {
return new Moment(this);
}
function isAfter (input, units) {
var localInput = isMoment(input) ? input : createLocal(input);
if (!(this.isValid() && localInput.isValid())) {
return false;
}
units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
if (units === 'millisecond') {
return this.valueOf() > localInput.valueOf();
} else {
return localInput.valueOf() < this.clone().startOf(units).valueOf();
}
}
function isBefore (input, units) {
var localInput = isMoment(input) ? input : createLocal(input);
if (!(this.isValid() && localInput.isValid())) {
return false;
}
units = normalizeUnits(!isUndefined(units) ? units : 'millisecond');
if (units === 'millisecond') {
return this.valueOf() < localInput.valueOf();
} else {
return this.clone().endOf(units).valueOf() < localInput.valueOf();
}
}
function isBetween (from, to, units, inclusivity) {
inclusivity = inclusivity || '()';
return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) &&
(inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units));
}
function isSame (input, units) {
var localInput = isMoment(input) ? input : createLocal(input),
inputMs;
if (!(this.isValid() && localInput.isValid())) {
return false;
}
units = normalizeUnits(units || 'millisecond');
if (units === 'millisecond') {
return this.valueOf() === localInput.valueOf();
} else {
inputMs = localInput.valueOf();
return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf();
}
}
function isSameOrAfter (input, units) {
return this.isSame(input, units) || this.isAfter(input,units);
}
function isSameOrBefore (input, units) {
return this.isSame(input, units) || this.isBefore(input,units);
}
function diff (input, units, asFloat) {
var that,
zoneDelta,
output;
if (!this.isValid()) {
return NaN;
}
that = cloneWithOffset(input, this);
if (!that.isValid()) {
return NaN;
}
zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
units = normalizeUnits(units);
switch (units) {
case 'year': output = monthDiff(this, that) / 12; break;
case 'month': output = monthDiff(this, that); break;
case 'quarter': output = monthDiff(this, that) / 3; break;
case 'second': output = (this - that) / 1e3; break; // 1000
case 'minute': output = (this - that) / 6e4; break; // 1000 * 60
case 'hour': output = (this - that) / 36e5; break; // 1000 * 60 * 60
case 'day': output = (this - that - zoneDelta) / 864e5; break; // 1000 * 60 * 60 * 24, negate dst
case 'week': output = (this - that - zoneDelta) / 6048e5; break; // 1000 * 60 * 60 * 24 * 7, negate dst
default: output = this - that;
}
return asFloat ? output : absFloor(output);
}
function monthDiff (a, b) {
// difference in months
var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()),
// b is in (anchor - 1 month, anchor + 1 month)
anchor = a.clone().add(wholeMonthDiff, 'months'),
anchor2, adjust;
if (b - anchor < 0) {
anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
// linear across the month
adjust = (b - anchor) / (anchor - anchor2);
} else {
anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
// linear across the month
adjust = (b - anchor) / (anchor2 - anchor);
}
//check for negative zero, return zero if negative zero
return -(wholeMonthDiff + adjust) || 0;
}
hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
function toString () {
return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
}
function toISOString(keepOffset) {
if (!this.isValid()) {
return null;
}
var utc = keepOffset !== true;
var m = utc ? this.clone().utc() : this;
if (m.year() < 0 || m.year() > 9999) {
return formatMoment(m, utc ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ');
}
if (isFunction(Date.prototype.toISOString)) {
// native implementation is ~50x faster, use it when we can
if (utc) {
return this.toDate().toISOString();
} else {
return new Date(this.valueOf() + this.utcOffset() * 60 * 1000).toISOString().replace('Z', formatMoment(m, 'Z'));
}
}
return formatMoment(m, utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ');
}
/**
* Return a human readable representation of a moment that can
* also be evaluated to get a new moment which is the same
*
* @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
*/
function inspect () {
if (!this.isValid()) {
return 'moment.invalid(/* ' + this._i + ' */)';
}
var func = 'moment';
var zone = '';
if (!this.isLocal()) {
func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
zone = 'Z';
}
var prefix = '[' + func + '("]';
var year = (0 <= this.year() && this.year() <= 9999) ? 'YYYY' : 'YYYYYY';
var datetime = '-MM-DD[T]HH:mm:ss.SSS';
var suffix = zone + '[")]';
return this.format(prefix + year + datetime + suffix);
}
function format (inputString) {
if (!inputString) {
inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat;
}
var output = formatMoment(this, inputString);
return this.localeData().postformat(output);
}
function from (time, withoutSuffix) {
if (this.isValid() &&
((isMoment(time) && time.isValid()) ||
createLocal(time).isValid())) {
return createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
} else {
return this.localeData().invalidDate();
}
}
function fromNow (withoutSuffix) {
return this.from(createLocal(), withoutSuffix);
}
function to (time, withoutSuffix) {
if (this.isValid() &&
((isMoment(time) && time.isValid()) ||
createLocal(time).isValid())) {
return createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
} else {
return this.localeData().invalidDate();
}
}
function toNow (withoutSuffix) {
return this.to(createLocal(), withoutSuffix);
}
// If passed a locale key, it will set the locale for this
// instance. Otherwise, it will return the locale configuration
// variables for this instance.
function locale (key) {
var newLocaleData;
if (key === undefined) {
return this._locale._abbr;
} else {
newLocaleData = getLocale(key);
if (newLocaleData != null) {
this._locale = newLocaleData;
}
return this;
}
}
var lang = deprecate(
'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
function (key) {
if (key === undefined) {
return this.localeData();
} else {
return this.locale(key);
}
}
);
function localeData () {
return this._locale;
}
function startOf (units) {
units = normalizeUnits(units);
// the following switch intentionally omits break keywords
// to utilize falling through the cases.
switch (units) {
case 'year':
this.month(0);
/* falls through */
case 'quarter':
case 'month':
this.date(1);
/* falls through */
case 'week':
case 'isoWeek':
case 'day':
case 'date':
this.hours(0);
/* falls through */
case 'hour':
this.minutes(0);
/* falls through */
case 'minute':
this.seconds(0);
/* falls through */
case 'second':
this.milliseconds(0);
}
// weeks are a special case
if (units === 'week') {
this.weekday(0);
}
if (units === 'isoWeek') {
this.isoWeekday(1);
}
// quarters are also special
if (units === 'quarter') {
this.month(Math.floor(this.month() / 3) * 3);
}
return this;
}
function endOf (units) {
units = normalizeUnits(units);
if (units === undefined || units === 'millisecond') {
return this;
}
// 'date' is an alias for 'day', so it should be considered as such.
if (units === 'date') {
units = 'day';
}
return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
}
function valueOf () {
return this._d.valueOf() - ((this._offset || 0) * 60000);
}
function unix () {
return Math.floor(this.valueOf() / 1000);
}
function toDate () {
return new Date(this.valueOf());
}
function toArray () {
var m = this;
return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
}
function toObject () {
var m = this;
return {
years: m.year(),
months: m.month(),
date: m.date(),
hours: m.hours(),
minutes: m.minutes(),
seconds: m.seconds(),
milliseconds: m.milliseconds()
};
}
function toJSON () {
// new Date(NaN).toJSON() === null
return this.isValid() ? this.toISOString() : null;
}
function isValid$2 () {
return isValid(this);
}
function parsingFlags () {
return extend({}, getParsingFlags(this));
}
function invalidAt () {
return getParsingFlags(this).overflow;
}
function creationData() {
return {
input: this._i,
format: this._f,
locale: this._locale,
isUTC: this._isUTC,
strict: this._strict
};
}
// FORMATTING
addFormatToken(0, ['gg', 2], 0, function () {
return this.weekYear() % 100;
});
addFormatToken(0, ['GG', 2], 0, function () {
return this.isoWeekYear() % 100;
});
function addWeekYearFormatToken (token, getter) {
addFormatToken(0, [token, token.length], 0, getter);
}
addWeekYearFormatToken('gggg', 'weekYear');
addWeekYearFormatToken('ggggg', 'weekYear');
addWeekYearFormatToken('GGGG', 'isoWeekYear');
addWeekYearFormatToken('GGGGG', 'isoWeekYear');
// ALIASES
addUnitAlias('weekYear', 'gg');
addUnitAlias('isoWeekYear', 'GG');
// PRIORITY
addUnitPriority('weekYear', 1);
addUnitPriority('isoWeekYear', 1);
// PARSING
addRegexToken('G', matchSigned);
addRegexToken('g', matchSigned);
addRegexToken('GG', match1to2, match2);
addRegexToken('gg', match1to2, match2);
addRegexToken('GGGG', match1to4, match4);
addRegexToken('gggg', match1to4, match4);
addRegexToken('GGGGG', match1to6, match6);
addRegexToken('ggggg', match1to6, match6);
addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
week[token.substr(0, 2)] = toInt(input);
});
addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
week[token] = hooks.parseTwoDigitYear(input);
});
// MOMENTS
function getSetWeekYear (input) {
return getSetWeekYearHelper.call(this,
input,
this.week(),
this.weekday(),
this.localeData()._week.dow,
this.localeData()._week.doy);
}
function getSetISOWeekYear (input) {
return getSetWeekYearHelper.call(this,
input, this.isoWeek(), this.isoWeekday(), 1, 4);
}
function getISOWeeksInYear () {
return weeksInYear(this.year(), 1, 4);
}
function getWeeksInYear () {
var weekInfo = this.localeData()._week;
return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
}
function getSetWeekYearHelper(input, week, weekday, dow, doy) {
var weeksTarget;
if (input == null) {
return weekOfYear(this, dow, doy).year;
} else {
weeksTarget = weeksInYear(input, dow, doy);
if (week > weeksTarget) {
week = weeksTarget;
}
return setWeekAll.call(this, input, week, weekday, dow, doy);
}
}
function setWeekAll(weekYear, week, weekday, dow, doy) {
var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
this.year(date.getUTCFullYear());
this.month(date.getUTCMonth());
this.date(date.getUTCDate());
return this;
}
// FORMATTING
addFormatToken('Q', 0, 'Qo', 'quarter');
// ALIASES
addUnitAlias('quarter', 'Q');
// PRIORITY
addUnitPriority('quarter', 7);
// PARSING
addRegexToken('Q', match1);
addParseToken('Q', function (input, array) {
array[MONTH] = (toInt(input) - 1) * 3;
});
// MOMENTS
function getSetQuarter (input) {
return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
}
// FORMATTING
addFormatToken('D', ['DD', 2], 'Do', 'date');
// ALIASES
addUnitAlias('date', 'D');
// PRIORITY
addUnitPriority('date', 9);
// PARSING
addRegexToken('D', match1to2);
addRegexToken('DD', match1to2, match2);
addRegexToken('Do', function (isStrict, locale) {
// TODO: Remove "ordinalParse" fallback in next major release.
return isStrict ?
(locale._dayOfMonthOrdinalParse || locale._ordinalParse) :
locale._dayOfMonthOrdinalParseLenient;
});
addParseToken(['D', 'DD'], DATE);
addParseToken('Do', function (input, array) {
array[DATE] = toInt(input.match(match1to2)[0]);
});
// MOMENTS
var getSetDayOfMonth = makeGetSet('Date', true);
// FORMATTING
addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
// ALIASES
addUnitAlias('dayOfYear', 'DDD');
// PRIORITY
addUnitPriority('dayOfYear', 4);
// PARSING
addRegexToken('DDD', match1to3);
addRegexToken('DDDD', match3);
addParseToken(['DDD', 'DDDD'], function (input, array, config) {
config._dayOfYear = toInt(input);
});
// HELPERS
// MOMENTS
function getSetDayOfYear (input) {
var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
}
// FORMATTING
addFormatToken('m', ['mm', 2], 0, 'minute');
// ALIASES
addUnitAlias('minute', 'm');
// PRIORITY
addUnitPriority('minute', 14);
// PARSING
addRegexToken('m', match1to2);
addRegexToken('mm', match1to2, match2);
addParseToken(['m', 'mm'], MINUTE);
// MOMENTS
var getSetMinute = makeGetSet('Minutes', false);
// FORMATTING
addFormatToken('s', ['ss', 2], 0, 'second');
// ALIASES
addUnitAlias('second', 's');
// PRIORITY
addUnitPriority('second', 15);
// PARSING
addRegexToken('s', match1to2);
addRegexToken('ss', match1to2, match2);
addParseToken(['s', 'ss'], SECOND);
// MOMENTS
var getSetSecond = makeGetSet('Seconds', false);
// FORMATTING
addFormatToken('S', 0, 0, function () {
return ~~(this.millisecond() / 100);
});
addFormatToken(0, ['SS', 2], 0, function () {
return ~~(this.millisecond() / 10);
});
addFormatToken(0, ['SSS', 3], 0, 'millisecond');
addFormatToken(0, ['SSSS', 4], 0, function () {
return this.millisecond() * 10;
});
addFormatToken(0, ['SSSSS', 5], 0, function () {
return this.millisecond() * 100;
});
addFormatToken(0, ['SSSSSS', 6], 0, function () {
return this.millisecond() * 1000;
});
addFormatToken(0, ['SSSSSSS', 7], 0, function () {
return this.millisecond() * 10000;
});
addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
return this.millisecond() * 100000;
});
addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
return this.millisecond() * 1000000;
});
// ALIASES
addUnitAlias('millisecond', 'ms');
// PRIORITY
addUnitPriority('millisecond', 16);
// PARSING
addRegexToken('S', match1to3, match1);
addRegexToken('SS', match1to3, match2);
addRegexToken('SSS', match1to3, match3);
var token;
for (token = 'SSSS'; token.length <= 9; token += 'S') {
addRegexToken(token, matchUnsigned);
}
function parseMs(input, array) {
array[MILLISECOND] = toInt(('0.' + input) * 1000);
}
for (token = 'S'; token.length <= 9; token += 'S') {
addParseToken(token, parseMs);
}
// MOMENTS
var getSetMillisecond = makeGetSet('Milliseconds', false);
// FORMATTING
addFormatToken('z', 0, 0, 'zoneAbbr');
addFormatToken('zz', 0, 0, 'zoneName');
// MOMENTS
function getZoneAbbr () {
return this._isUTC ? 'UTC' : '';
}
function getZoneName () {
return this._isUTC ? 'Coordinated Universal Time' : '';
}
var proto = Moment.prototype;
proto.add = add;
proto.calendar = calendar$1;
proto.clone = clone;
proto.diff = diff;
proto.endOf = endOf;
proto.format = format;
proto.from = from;
proto.fromNow = fromNow;
proto.to = to;
proto.toNow = toNow;
proto.get = stringGet;
proto.invalidAt = invalidAt;
proto.isAfter = isAfter;
proto.isBefore = isBefore;
proto.isBetween = isBetween;
proto.isSame = isSame;
proto.isSameOrAfter = isSameOrAfter;
proto.isSameOrBefore = isSameOrBefore;
proto.isValid = isValid$2;
proto.lang = lang;
proto.locale = locale;
proto.localeData = localeData;
proto.max = prototypeMax;
proto.min = prototypeMin;
proto.parsingFlags = parsingFlags;
proto.set = stringSet;
proto.startOf = startOf;
proto.subtract = subtract;
proto.toArray = toArray;
proto.toObject = toObject;
proto.toDate = toDate;
proto.toISOString = toISOString;
proto.inspect = inspect;
proto.toJSON = toJSON;
proto.toString = toString;
proto.unix = unix;
proto.valueOf = valueOf;
proto.creationData = creationData;
proto.year = getSetYear;
proto.isLeapYear = getIsLeapYear;
proto.weekYear = getSetWeekYear;
proto.isoWeekYear = getSetISOWeekYear;
proto.quarter = proto.quarters = getSetQuarter;
proto.month = getSetMonth;
proto.daysInMonth = getDaysInMonth;
proto.week = proto.weeks = getSetWeek;
proto.isoWeek = proto.isoWeeks = getSetISOWeek;
proto.weeksInYear = getWeeksInYear;
proto.isoWeeksInYear = getISOWeeksInYear;
proto.date = getSetDayOfMonth;
proto.day = proto.days = getSetDayOfWeek;
proto.weekday = getSetLocaleDayOfWeek;
proto.isoWeekday = getSetISODayOfWeek;
proto.dayOfYear = getSetDayOfYear;
proto.hour = proto.hours = getSetHour;
proto.minute = proto.minutes = getSetMinute;
proto.second = proto.seconds = getSetSecond;
proto.millisecond = proto.milliseconds = getSetMillisecond;
proto.utcOffset = getSetOffset;
proto.utc = setOffsetToUTC;
proto.local = setOffsetToLocal;
proto.parseZone = setOffsetToParsedOffset;
proto.hasAlignedHourOffset = hasAlignedHourOffset;
proto.isDST = isDaylightSavingTime;
proto.isLocal = isLocal;
proto.isUtcOffset = isUtcOffset;
proto.isUtc = isUtc;
proto.isUTC = isUtc;
proto.zoneAbbr = getZoneAbbr;
proto.zoneName = getZoneName;
proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);
proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone);
proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted);
function createUnix (input) {
return createLocal(input * 1000);
}
function createInZone () {
return createLocal.apply(null, arguments).parseZone();
}
function preParsePostFormat (string) {
return string;
}
var proto$1 = Locale.prototype;
proto$1.calendar = calendar;
proto$1.longDateFormat = longDateFormat;
proto$1.invalidDate = invalidDate;
proto$1.ordinal = ordinal;
proto$1.preparse = preParsePostFormat;
proto$1.postformat = preParsePostFormat;
proto$1.relativeTime = relativeTime;
proto$1.pastFuture = pastFuture;
proto$1.set = set;
proto$1.months = localeMonths;
proto$1.monthsShort = localeMonthsShort;
proto$1.monthsParse = localeMonthsParse;
proto$1.monthsRegex = monthsRegex;
proto$1.monthsShortRegex = monthsShortRegex;
proto$1.week = localeWeek;
proto$1.firstDayOfYear = localeFirstDayOfYear;
proto$1.firstDayOfWeek = localeFirstDayOfWeek;
proto$1.weekdays = localeWeekdays;
proto$1.weekdaysMin = localeWeekdaysMin;
proto$1.weekdaysShort = localeWeekdaysShort;
proto$1.weekdaysParse = localeWeekdaysParse;
proto$1.weekdaysRegex = weekdaysRegex;
proto$1.weekdaysShortRegex = weekdaysShortRegex;
proto$1.weekdaysMinRegex = weekdaysMinRegex;
proto$1.isPM = localeIsPM;
proto$1.meridiem = localeMeridiem;
function get$1 (format, index, field, setter) {
var locale = getLocale();
var utc = createUTC().set(setter, index);
return locale[field](utc, format);
}
function listMonthsImpl (format, index, field) {
if (isNumber(format)) {
index = format;
format = undefined;
}
format = format || '';
if (index != null) {
return get$1(format, index, field, 'month');
}
var i;
var out = [];
for (i = 0; i < 12; i++) {
out[i] = get$1(format, i, field, 'month');
}
return out;
}
// ()
// (5)
// (fmt, 5)
// (fmt)
// (true)
// (true, 5)
// (true, fmt, 5)
// (true, fmt)
function listWeekdaysImpl (localeSorted, format, index, field) {
if (typeof localeSorted === 'boolean') {
if (isNumber(format)) {
index = format;
format = undefined;
}
format = format || '';
} else {
format = localeSorted;
index = format;
localeSorted = false;
if (isNumber(format)) {
index = format;
format = undefined;
}
format = format || '';
}
var locale = getLocale(),
shift = localeSorted ? locale._week.dow : 0;
if (index != null) {
return get$1(format, (index + shift) % 7, field, 'day');
}
var i;
var out = [];
for (i = 0; i < 7; i++) {
out[i] = get$1(format, (i + shift) % 7, field, 'day');
}
return out;
}
function listMonths (format, index) {
return listMonthsImpl(format, index, 'months');
}
function listMonthsShort (format, index) {
return listMonthsImpl(format, index, 'monthsShort');
}
function listWeekdays (localeSorted, format, index) {
return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
}
function listWeekdaysShort (localeSorted, format, index) {
return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
}
function listWeekdaysMin (localeSorted, format, index) {
return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
}
getSetGlobalLocale('en', {
dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
ordinal : function (number) {
var b = number % 10,
output = (toInt(number % 100 / 10) === 1) ? 'th' :
(b === 1) ? 'st' :
(b === 2) ? 'nd' :
(b === 3) ? 'rd' : 'th';
return number + output;
}
});
// Side effect imports
hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale);
hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale);
var mathAbs = Math.abs;
function abs () {
var data = this._data;
this._milliseconds = mathAbs(this._milliseconds);
this._days = mathAbs(this._days);
this._months = mathAbs(this._months);
data.milliseconds = mathAbs(data.milliseconds);
data.seconds = mathAbs(data.seconds);
data.minutes = mathAbs(data.minutes);
data.hours = mathAbs(data.hours);
data.months = mathAbs(data.months);
data.years = mathAbs(data.years);
return this;
}
function addSubtract$1 (duration, input, value, direction) {
var other = createDuration(input, value);
duration._milliseconds += direction * other._milliseconds;
duration._days += direction * other._days;
duration._months += direction * other._months;
return duration._bubble();
}
// supports only 2.0-style add(1, 's') or add(duration)
function add$1 (input, value) {
return addSubtract$1(this, input, value, 1);
}
// supports only 2.0-style subtract(1, 's') or subtract(duration)
function subtract$1 (input, value) {
return addSubtract$1(this, input, value, -1);
}
function absCeil (number) {
if (number < 0) {
return Math.floor(number);
} else {
return Math.ceil(number);
}
}
function bubble () {
var milliseconds = this._milliseconds;
var days = this._days;
var months = this._months;
var data = this._data;
var seconds, minutes, hours, years, monthsFromDays;
// if we have a mix of positive and negative values, bubble down first
// check: https://github.com/moment/moment/issues/2166
if (!((milliseconds >= 0 && days >= 0 && months >= 0) ||
(milliseconds <= 0 && days <= 0 && months <= 0))) {
milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
days = 0;
months = 0;
}
// The following code bubbles up values, see the tests for
// examples of what that means.
data.milliseconds = milliseconds % 1000;
seconds = absFloor(milliseconds / 1000);
data.seconds = seconds % 60;
minutes = absFloor(seconds / 60);
data.minutes = minutes % 60;
hours = absFloor(minutes / 60);
data.hours = hours % 24;
days += absFloor(hours / 24);
// convert days to months
monthsFromDays = absFloor(daysToMonths(days));
months += monthsFromDays;
days -= absCeil(monthsToDays(monthsFromDays));
// 12 months -> 1 year
years = absFloor(months / 12);
months %= 12;
data.days = days;
data.months = months;
data.years = years;
return this;
}
function daysToMonths (days) {
// 400 years have 146097 days (taking into account leap year rules)
// 400 years have 12 months === 4800
return days * 4800 / 146097;
}
function monthsToDays (months) {
// the reverse of daysToMonths
return months * 146097 / 4800;
}
function as (units) {
if (!this.isValid()) {
return NaN;
}
var days;
var months;
var milliseconds = this._milliseconds;
units = normalizeUnits(units);
if (units === 'month' || units === 'year') {
days = this._days + milliseconds / 864e5;
months = this._months + daysToMonths(days);
return units === 'month' ? months : months / 12;
} else {
// handle milliseconds separately because of floating point math errors (issue #1867)
days = this._days + Math.round(monthsToDays(this._months));
switch (units) {
case 'week' : return days / 7 + milliseconds / 6048e5;
case 'day' : return days + milliseconds / 864e5;
case 'hour' : return days * 24 + milliseconds / 36e5;
case 'minute' : return days * 1440 + milliseconds / 6e4;
case 'second' : return days * 86400 + milliseconds / 1000;
// Math.floor prevents floating point math errors here
case 'millisecond': return Math.floor(days * 864e5) + milliseconds;
default: throw new Error('Unknown unit ' + units);
}
}
}
// TODO: Use this.as('ms')?
function valueOf$1 () {
if (!this.isValid()) {
return NaN;
}
return (
this._milliseconds +
this._days * 864e5 +
(this._months % 12) * 2592e6 +
toInt(this._months / 12) * 31536e6
);
}
function makeAs (alias) {
return function () {
return this.as(alias);
};
}
var asMilliseconds = makeAs('ms');
var asSeconds = makeAs('s');
var asMinutes = makeAs('m');
var asHours = makeAs('h');
var asDays = makeAs('d');
var asWeeks = makeAs('w');
var asMonths = makeAs('M');
var asYears = makeAs('y');
function clone$1 () {
return createDuration(this);
}
function get$2 (units) {
units = normalizeUnits(units);
return this.isValid() ? this[units + 's']() : NaN;
}
function makeGetter(name) {
return function () {
return this.isValid() ? this._data[name] : NaN;
};
}
var milliseconds = makeGetter('milliseconds');
var seconds = makeGetter('seconds');
var minutes = makeGetter('minutes');
var hours = makeGetter('hours');
var days = makeGetter('days');
var months = makeGetter('months');
var years = makeGetter('years');
function weeks () {
return absFloor(this.days() / 7);
}
var round = Math.round;
var thresholds = {
ss: 44, // a few seconds to seconds
s : 45, // seconds to minute
m : 45, // minutes to hour
h : 22, // hours to day
d : 26, // days to month
M : 11 // months to year
};
// helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
}
function relativeTime$1 (posNegDuration, withoutSuffix, locale) {
var duration = createDuration(posNegDuration).abs();
var seconds = round(duration.as('s'));
var minutes = round(duration.as('m'));
var hours = round(duration.as('h'));
var days = round(duration.as('d'));
var months = round(duration.as('M'));
var years = round(duration.as('y'));
var a = seconds <= thresholds.ss && ['s', seconds] ||
seconds < thresholds.s && ['ss', seconds] ||
minutes <= 1 && ['m'] ||
minutes < thresholds.m && ['mm', minutes] ||
hours <= 1 && ['h'] ||
hours < thresholds.h && ['hh', hours] ||
days <= 1 && ['d'] ||
days < thresholds.d && ['dd', days] ||
months <= 1 && ['M'] ||
months < thresholds.M && ['MM', months] ||
years <= 1 && ['y'] || ['yy', years];
a[2] = withoutSuffix;
a[3] = +posNegDuration > 0;
a[4] = locale;
return substituteTimeAgo.apply(null, a);
}
// This function allows you to set the rounding function for relative time strings
function getSetRelativeTimeRounding (roundingFunction) {
if (roundingFunction === undefined) {
return round;
}
if (typeof(roundingFunction) === 'function') {
round = roundingFunction;
return true;
}
return false;
}
// This function allows you to set a threshold for relative time strings
function getSetRelativeTimeThreshold (threshold, limit) {
if (thresholds[threshold] === undefined) {
return false;
}
if (limit === undefined) {
return thresholds[threshold];
}
thresholds[threshold] = limit;
if (threshold === 's') {
thresholds.ss = limit - 1;
}
return true;
}
function humanize (withSuffix) {
if (!this.isValid()) {
return this.localeData().invalidDate();
}
var locale = this.localeData();
var output = relativeTime$1(this, !withSuffix, locale);
if (withSuffix) {
output = locale.pastFuture(+this, output);
}
return locale.postformat(output);
}
var abs$1 = Math.abs;
function sign(x) {
return ((x > 0) - (x < 0)) || +x;
}
function toISOString$1() {
// for ISO strings we do not use the normal bubbling rules:
// * milliseconds bubble up until they become hours
// * days do not bubble at all
// * months bubble up until they become years
// This is because there is no context-free conversion between hours and days
// (think of clock changes)
// and also not between days and months (28-31 days per month)
if (!this.isValid()) {
return this.localeData().invalidDate();
}
var seconds = abs$1(this._milliseconds) / 1000;
var days = abs$1(this._days);
var months = abs$1(this._months);
var minutes, hours, years;
// 3600 seconds -> 60 minutes -> 1 hour
minutes = absFloor(seconds / 60);
hours = absFloor(minutes / 60);
seconds %= 60;
minutes %= 60;
// 12 months -> 1 year
years = absFloor(months / 12);
months %= 12;
// inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
var Y = years;
var M = months;
var D = days;
var h = hours;
var m = minutes;
var s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
var total = this.asSeconds();
if (!total) {
// this is the same as C#'s (Noda) and python (isodate)...
// but not other JS (goog.date)
return 'P0D';
}
var totalSign = total < 0 ? '-' : '';
var ymSign = sign(this._months) !== sign(total) ? '-' : '';
var daysSign = sign(this._days) !== sign(total) ? '-' : '';
var hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
return totalSign + 'P' +
(Y ? ymSign + Y + 'Y' : '') +
(M ? ymSign + M + 'M' : '') +
(D ? daysSign + D + 'D' : '') +
((h || m || s) ? 'T' : '') +
(h ? hmsSign + h + 'H' : '') +
(m ? hmsSign + m + 'M' : '') +
(s ? hmsSign + s + 'S' : '');
}
var proto$2 = Duration.prototype;
proto$2.isValid = isValid$1;
proto$2.abs = abs;
proto$2.add = add$1;
proto$2.subtract = subtract$1;
proto$2.as = as;
proto$2.asMilliseconds = asMilliseconds;
proto$2.asSeconds = asSeconds;
proto$2.asMinutes = asMinutes;
proto$2.asHours = asHours;
proto$2.asDays = asDays;
proto$2.asWeeks = asWeeks;
proto$2.asMonths = asMonths;
proto$2.asYears = asYears;
proto$2.valueOf = valueOf$1;
proto$2._bubble = bubble;
proto$2.clone = clone$1;
proto$2.get = get$2;
proto$2.milliseconds = milliseconds;
proto$2.seconds = seconds;
proto$2.minutes = minutes;
proto$2.hours = hours;
proto$2.days = days;
proto$2.weeks = weeks;
proto$2.months = months;
proto$2.years = years;
proto$2.humanize = humanize;
proto$2.toISOString = toISOString$1;
proto$2.toString = toISOString$1;
proto$2.toJSON = toISOString$1;
proto$2.locale = locale;
proto$2.localeData = localeData;
proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1);
proto$2.lang = lang;
// Side effect imports
// FORMATTING
addFormatToken('X', 0, 0, 'unix');
addFormatToken('x', 0, 0, 'valueOf');
// PARSING
addRegexToken('x', matchSigned);
addRegexToken('X', matchTimestamp);
addParseToken('X', function (input, array, config) {
config._d = new Date(parseFloat(input, 10) * 1000);
});
addParseToken('x', function (input, array, config) {
config._d = new Date(toInt(input));
});
// Side effect imports
hooks.version = '2.22.1';
setHookCallback(createLocal);
hooks.fn = proto;
hooks.min = min;
hooks.max = max;
hooks.now = now;
hooks.utc = createUTC;
hooks.unix = createUnix;
hooks.months = listMonths;
hooks.isDate = isDate;
hooks.locale = getSetGlobalLocale;
hooks.invalid = createInvalid;
hooks.duration = createDuration;
hooks.isMoment = isMoment;
hooks.weekdays = listWeekdays;
hooks.parseZone = createInZone;
hooks.localeData = getLocale;
hooks.isDuration = isDuration;
hooks.monthsShort = listMonthsShort;
hooks.weekdaysMin = listWeekdaysMin;
hooks.defineLocale = defineLocale;
hooks.updateLocale = updateLocale;
hooks.locales = listLocales;
hooks.weekdaysShort = listWeekdaysShort;
hooks.normalizeUnits = normalizeUnits;
hooks.relativeTimeRounding = getSetRelativeTimeRounding;
hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
hooks.calendarFormat = getCalendarFormat;
hooks.prototype = proto;
// currently HTML5 input type only supports 24-hour formats
hooks.HTML5_FMT = {
DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // <input type="datetime-local" />
DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type="datetime-local" step="1" />
DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type="datetime-local" step="0.001" />
DATE: 'YYYY-MM-DD', // <input type="date" />
TIME: 'HH:mm', // <input type="time" />
TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" />
TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" />
WEEK: 'YYYY-[W]WW', // <input type="week" />
MONTH: 'YYYY-MM' // <input type="month" />
};
return hooks;
})));
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(446)(module)))
/***/ }),
/* 2 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Config; });
/* harmony export (immutable) */ __webpack_exports__["c"] = setupConfig;
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ConfigToken; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_util__ = __webpack_require__(3);
/**
* @name Config
* @demo /docs/demos/src/config/
* @description
* The Config lets you configure your entire app or specific platforms.
* You can set the tab placement, icon mode, animations, and more here.
*
* ```ts
* import { IonicApp, IonicModule } from 'ionic-angular';
*
* @NgModule({
* declarations: [ MyApp ],
* imports: [
* BrowserModule,
* IonicModule.forRoot(MyApp, {
* backButtonText: 'Go Back',
* iconMode: 'ios',
* modalEnter: 'modal-slide-in',
* modalLeave: 'modal-slide-out',
* tabsPlacement: 'bottom',
* pageTransition: 'ios-transition'
* }, {}
* )],
* bootstrap: [IonicApp],
* entryComponents: [ MyApp ],
* providers: []
* })
* ```
*
*
* Config can be overwritten at multiple levels allowing for more granular configuration.
* Below is an example where an app can override any setting we want based on a platform.
*
* ```ts
* import { IonicModule } from 'ionic-angular';
*
* @NgModule({
* ...
* imports: [
* BrowserModule,
* IonicModule.forRoot(MyApp, {
* tabsPlacement: 'bottom',
* platforms: {
* ios: {
* tabsPlacement: 'top',
* }
* }
* }, {}
* )],
* ...
* })
* ```
*
* We could also configure these values at a component level. Take `tabsPlacement`,
* we can configure this as a property on our `ion-tabs`.
*
* ```html
* <ion-tabs tabsPlacement="top">
* <ion-tab tabTitle="Dash" tabIcon="pulse" [root]="tabRoot"></ion-tab>
* </ion-tabs>
* ```
*
* The last way we could configure is through URL query strings. This is useful for testing
* while in the browser. Simply add `?ionic<PROPERTYNAME>=<value>` to the url.
*
* ```bash
* http://localhost:8100/?ionicTabsPlacement=bottom
* ```
*
* Any value can be added to config, and looked up at a later in any component.
*
* ```js
* config.set('ios', 'favoriteColor', 'green');
*
* // from any page in your app:
* config.get('favoriteColor'); // 'green' when iOS
* ```
*
*
* A config value can come from anywhere and be anything, but there are default
* values for each mode. The [theming](../../../theming/platform-specific-styles/)
* documentation has a chart of the default mode configuration. The following
* chart displays each property with a description of what it controls.
*
*
* | Config Property | Type | Details |
* |--------------------------|---------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|
* | `activator` | `string` | Used for buttons, changes the effect of pressing on a button. Available options: `"ripple"`, `"highlight"`. |
* | `actionSheetEnter` | `string` | The name of the transition to use while an action sheet is presented. |
* | `actionSheetLeave` | `string` | The name of the transition to use while an action sheet is dismissed. |
* | `alertEnter` | `string` | The name of the transition to use while an alert is presented. |
* | `alertLeave` | `string` | The name of the transition to use while an alert is dismissed. |
* | `backButtonText` | `string` | The text to display by the back button icon in the navbar. |
* | `backButtonIcon` | `string` | The icon to use as the back button icon. |
* | `iconMode` | `string` | The mode to use for all icons throughout the application. Available options: `"ios"`, `"md"` |
* | `locationStrategy` | `string` | Set to 'path' to remove hashbangs when using Deeplinking. |
* | `loadingEnter` | `string` | The name of the transition to use while a loading indicator is presented. |
* | `loadingLeave` | `string` | The name of the transition to use while a loading indicator is dismissed. |
* | `menuType` | `string` | Type of menu to display. Available options: `"overlay"`, `"reveal"`, `"push"`. |
* | `modalEnter` | `string` | The name of the transition to use while a modal is presented. |
* | `modalLeave` | `string` | The name of the transition to use while a modal is dismiss. |
* | `mode` | `string` | The mode to use throughout the application. |
* | `pageTransition` | `string` | The name of the transition to use while changing pages. Available options: `"ios-transition"`, `"md-transition"`, `"wp-transition"`. |
* | `pickerEnter` | `string` | The name of the transition to use while a picker is presented. |
* | `pickerLeave` | `string` | The name of the transition to use while a picker is dismissed. |
* | `popoverEnter` | `string` | The name of the transition to use while a popover is presented. |
* | `popoverLeave` | `string` | The name of the transition to use while a popover is dismissed.
* | `scrollAssist` | `boolean` | Used to avoid the input to be hidden by the keyboard if it's near the bottom of the page.
* | `scrollPadding` | `boolean` | Used to remove the extra padding on ion-content when keyboard is displayed.
* | `spinner` | `string` | The default spinner to use when a name is not defined. |
* | `statusbarPadding` | `boolean` | Whether to hide extra padding for statusbar. |
* | `swipeBackEnabled` | `boolean` | Whether native iOS swipe to go back functionality is enabled. |
* | `tabsHighlight` | `boolean` | Whether to show a highlight line under the tab when it is selected. |
* | `tabsLayout` | `string` | The layout to use for all tabs. Available options: `"icon-top"`, `"icon-start"`, `"icon-end"`, `"icon-bottom"`, `"icon-hide"`, `"title-hide"`. |
* | `tabsPlacement` | `string` | The position of the tabs relative to the content. Available options: `"top"`, `"bottom"` |
* | `tabsHideOnSubPages` | `boolean` | Whether to hide the tabs on child pages or not. If `true` it will not show the tabs on child pages. |
* | `toastEnter` | `string` | The name of the transition to use while a toast is presented. |
* | `toastLeave` | `string` | The name of the transition to use while a toast is dismissed. |
*
**/
var Config = (function () {
function Config() {
this._c = {};
this._s = {};
this._modes = {};
this._trns = {};
}
/**
* @hidden
*/
Config.prototype.init = function (config, plt) {
this._s = config && Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["k" /* isObject */])(config) && !Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["e" /* isArray */])(config) ? config : {};
this.plt = plt;
};
/**
* @name get
* @description
* Returns a single config value, given a key.
*
* @param {string} [key] - the key for the config value
* @param {any} [fallbackValue] - a fallback value to use when the config
* value was not found, or is config value is `null`. Fallback value
* defaults to `null`.
*/
Config.prototype.get = function (key, fallbackValue) {
if (fallbackValue === void 0) { fallbackValue = null; }
var platform = this.plt;
if (!Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["h" /* isDefined */])(this._c[key])) {
if (!Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["h" /* isDefined */])(key)) {
throw 'config key is not defined';
}
// if the value was already set this will all be skipped
// if there was no user config then it'll check each of
// the user config's platforms, which already contains
// settings from default platform configs
var userPlatformValue = undefined;
var userDefaultValue = this._s[key];
var userPlatformModeValue = undefined;
var userDefaultModeValue = undefined;
var platformValue = undefined;
var platformModeValue = undefined;
var configObj = null;
if (platform) {
var queryStringValue = platform.getQueryParam('ionic' + key);
if (Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["h" /* isDefined */])(queryStringValue)) {
return this._c[key] = (queryStringValue === 'true' ? true : queryStringValue === 'false' ? false : queryStringValue);
}
// check the platform settings object for this value
// loop though each of the active platforms
// array of active platforms, which also knows the hierarchy,
// with the last one the most important
var activePlatformKeys = platform.platforms();
// loop through all of the active platforms we're on
for (var i = 0, ilen = activePlatformKeys.length; i < ilen; i++) {
// get user defined platform values
if (this._s.platforms) {
configObj = this._s.platforms[activePlatformKeys[i]];
if (configObj) {
if (Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["h" /* isDefined */])(configObj[key])) {
userPlatformValue = configObj[key];
}
configObj = this.getModeConfig(configObj.mode);
if (configObj && Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["h" /* isDefined */])(configObj[key])) {
userPlatformModeValue = configObj[key];
}
}
}
// get default platform's setting
configObj = platform.getPlatformConfig(activePlatformKeys[i]);
if (configObj && configObj.settings) {
if (Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["h" /* isDefined */])(configObj.settings[key])) {
// found a setting for this platform
platformValue = configObj.settings[key];
}
configObj = this.getModeConfig(configObj.settings.mode);
if (configObj && Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["h" /* isDefined */])(configObj[key])) {
// found setting for this platform's mode
platformModeValue = configObj[key];
}
}
}
}
configObj = this.getModeConfig(this._s.mode);
if (configObj && Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["h" /* isDefined */])(configObj[key])) {
userDefaultModeValue = configObj[key];
}
// cache the value
this._c[key] = Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["h" /* isDefined */])(userPlatformValue) ? userPlatformValue :
Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["h" /* isDefined */])(userDefaultValue) ? userDefaultValue :
Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["h" /* isDefined */])(userPlatformModeValue) ? userPlatformModeValue :
Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["h" /* isDefined */])(userDefaultModeValue) ? userDefaultModeValue :
Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["h" /* isDefined */])(platformValue) ? platformValue :
Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["h" /* isDefined */])(platformModeValue) ? platformModeValue :
null;
}
// return key's value
// either it came directly from the user config
// or it was from the users platform configs
// or it was from the default platform configs
// in that order
var rtnVal = this._c[key];
if (Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["i" /* isFunction */])(rtnVal)) {
rtnVal = rtnVal(platform);
}
return (rtnVal !== null ? rtnVal : fallbackValue);
};
/**
* @name getBoolean
* @description
* Same as `get()`, however always returns a boolean value. If the
* value from `get()` is `null`, then it'll return the `fallbackValue`
* which defaults to `false`. Otherwise, `getBoolean()` will return
* if the config value is truthy or not. It also returns `true` if
* the config value was the string value `"true"`.
* @param {string} [key] - the key for the config value
* @param {boolean} [fallbackValue] - a fallback value to use when the config
* value was `null`. Fallback value defaults to `false`.
*/
Config.prototype.getBoolean = function (key, fallbackValue) {
if (fallbackValue === void 0) { fallbackValue = false; }
var val = this.get(key);
if (val === null) {
return fallbackValue;
}
if (typeof val === 'string') {
return val === 'true';
}
return !!val;
};
/**
* @name getNumber
* @description
* Same as `get()`, however always returns a number value. Uses `parseFloat()`
* on the value received from `get()`. If the result from the parse is `NaN`,
* then it will return the value passed to `fallbackValue`. If no fallback
* value was provided then it'll default to returning `NaN` when the result
* is not a valid number.
* @param {string} [key] - the key for the config value
* @param {number} [fallbackValue] - a fallback value to use when the config
* value turned out to be `NaN`. Fallback value defaults to `NaN`.
*/
Config.prototype.getNumber = function (key, fallbackValue) {
if (fallbackValue === void 0) { fallbackValue = NaN; }
var val = parseFloat(this.get(key));
return isNaN(val) ? fallbackValue : val;
};
/**
* @name set
* @description
* Sets a single config value.
*
* @param {string} [platform] - The platform (either 'ios' or 'android') that the config value should apply to. Leaving this blank will apply the config value to all platforms.
* @param {string} [key] - The key used to look up the value at a later point in time.
* @param {string} [value] - The config value being stored.
*/
Config.prototype.set = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var arg0 = args[0];
var arg1 = args[1];
switch (args.length) {
case 2:
// set('key', 'value') = set key/value pair
// arg1 = value
this._s[arg0] = arg1;
delete this._c[arg0]; // clear cache
break;
case 3:
// setting('ios', 'key', 'value') = set key/value pair for platform
// arg0 = platform
// arg1 = key
// arg2 = value
this._s.platforms = this._s.platforms || {};
this._s.platforms[arg0] = this._s.platforms[arg0] || {};
this._s.platforms[arg0][arg1] = args[2];
delete this._c[arg1]; // clear cache
break;
}
return this;
};
/**
* @hidden
* @name settings()
* @description
*/
Config.prototype.settings = function (arg0, arg1) {
switch (arguments.length) {
case 0:
return this._s;
case 1:
// settings({...})
this._s = arg0;
this._c = {}; // clear cache
break;
case 2:
// settings('ios', {...})
this._s.platforms = this._s.platforms || {};
this._s.platforms[arg0] = arg1;
this._c = {}; // clear cache
break;
}
return this;
};
/**
* @hidden
*/
Config.prototype.setModeConfig = function (modeName, modeConfig) {
this._modes[modeName] = modeConfig;
};
/**
* @hidden
*/
Config.prototype.getModeConfig = function (modeName) {
return this._modes[modeName] || null;
};
/**
* @hidden
*/
Config.prototype.setTransition = function (trnsName, trnsClass) {
this._trns[trnsName] = trnsClass;
};
/**
* @hidden
*/
Config.prototype.getTransition = function (trnsName) {
return this._trns[trnsName] || null;
};
return Config;
}());
/**
* @hidden
*/
function setupConfig(userConfig, plt) {
var config = new Config();
config.init(userConfig, plt);
// add the config obj to the window
var win = plt.win();
win['Ionic'] = win['Ionic'] || {};
win['Ionic']['config'] = config;
return config;
}
/**
* @hidden
*/
var ConfigToken = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["B" /* InjectionToken */]('USERCONFIG');
//# sourceMappingURL=config.js.map
/***/ }),
/* 3 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (immutable) */ __webpack_exports__["a"] = clamp;
/* harmony export (immutable) */ __webpack_exports__["b"] = deepCopy;
/* harmony export (immutable) */ __webpack_exports__["c"] = deepEqual;
/* unused harmony export debounce */
/* unused harmony export normalizeURL */
/* harmony export (immutable) */ __webpack_exports__["d"] = defaults;
/* unused harmony export isBoolean */
/* harmony export (immutable) */ __webpack_exports__["n"] = isString;
/* harmony export (immutable) */ __webpack_exports__["j"] = isNumber;
/* harmony export (immutable) */ __webpack_exports__["i"] = isFunction;
/* harmony export (immutable) */ __webpack_exports__["h"] = isDefined;
/* harmony export (immutable) */ __webpack_exports__["p"] = isUndefined;
/* harmony export (immutable) */ __webpack_exports__["l"] = isPresent;
/* harmony export (immutable) */ __webpack_exports__["f"] = isBlank;
/* harmony export (immutable) */ __webpack_exports__["k"] = isObject;
/* harmony export (immutable) */ __webpack_exports__["e"] = isArray;
/* unused harmony export isPrimitive */
/* harmony export (immutable) */ __webpack_exports__["o"] = isTrueProperty;
/* harmony export (immutable) */ __webpack_exports__["g"] = isCheckedProperty;
/* harmony export (immutable) */ __webpack_exports__["m"] = isRightSide;
/* harmony export (immutable) */ __webpack_exports__["r"] = reorderArray;
/* harmony export (immutable) */ __webpack_exports__["q"] = removeArrayItem;
/* harmony export (immutable) */ __webpack_exports__["t"] = swipeShouldReset;
/* harmony export (immutable) */ __webpack_exports__["s"] = requestIonicCallback;
/* unused harmony export assert */
/* unused harmony export runInDev */
/**
* @hidden
* Given a min and max, restrict the given number
* to the range.
* @param min the minimum
* @param n the value
* @param max the maximum
*/
function clamp(min, n, max) {
return Math.max(min, Math.min(n, max));
}
/** @hidden */
function deepCopy(obj) {
return JSON.parse(JSON.stringify(obj));
}
/** @hidden */
function deepEqual(a, b) {
if (a === b) {
return true;
}
return JSON.stringify(a) === JSON.stringify(b);
}
/** @hidden */
function debounce(fn, wait, immediate) {
if (immediate === void 0) { immediate = false; }
var timeout, args, context, timestamp, result;
return function () {
context = this;
args = arguments;
timestamp = Date.now();
var later = function () {
var last = Date.now() - timestamp;
if (last < wait) {
timeout = setTimeout(later, wait - last);
}
else {
timeout = null;
if (!immediate)
result = fn.apply(context, args);
}
};
var callNow = immediate && !timeout;
if (!timeout) {
timeout = setTimeout(later, wait);
}
if (callNow)
result = fn.apply(context, args);
return result;
};
}
/**
* @hidden
* Rewrites an absolute URL so it works across file and http based engines
*/
function normalizeURL(url) {
var ionic = window['Ionic'];
if (ionic && ionic.normalizeURL) {
return ionic.normalizeURL(url);
}
return url;
}
/**
* @hidden
* Apply default arguments if they don't exist in
* the first object.
* @param {any} dest the destination to apply defaults to.
*/
function defaults(dest) {
var _args = [];
for (var _i = 1; _i < arguments.length; _i++) {
_args[_i - 1] = arguments[_i];
}
for (var i = arguments.length - 1; i >= 1; i--) {
var source = arguments[i];
if (source) {
for (var key in source) {
if (source.hasOwnProperty(key) && !dest.hasOwnProperty(key)) {
dest[key] = source[key];
}
}
}
}
return dest;
}
/** @hidden */
function isBoolean(val) { return typeof val === 'boolean'; }
/** @hidden */
function isString(val) { return typeof val === 'string'; }
/** @hidden */
function isNumber(val) { return typeof val === 'number'; }
/** @hidden */
function isFunction(val) { return typeof val === 'function'; }
/** @hidden */
function isDefined(val) { return typeof val !== 'undefined'; }
/** @hidden */
function isUndefined(val) { return typeof val === 'undefined'; }
/** @hidden */
function isPresent(val) { return val !== undefined && val !== null; }
/** @hidden */
function isBlank(val) { return val === undefined || val === null; }
/** @hidden */
function isObject(val) { return typeof val === 'object'; }
/** @hidden */
function isArray(val) { return Array.isArray(val); }
/** @hidden */
function isPrimitive(val) {
return isString(val) || isBoolean(val) || (isNumber(val) && !isNaN(val));
}
/** @hidden */
function isTrueProperty(val) {
if (typeof val === 'string') {
val = val.toLowerCase().trim();
return (val === 'true' || val === 'on' || val === '');
}
return !!val;
}
/** @hidden */
function isCheckedProperty(a, b) {
if (a === undefined || a === null || a === '') {
return (b === undefined || b === null || b === '');
}
else if (a === true || a === 'true') {
return (b === true || b === 'true');
}
else if (a === false || a === 'false') {
return (b === false || b === 'false');
}
else if (a === 0 || a === '0') {
return (b === 0 || b === '0');
}
// not using strict comparison on purpose
return (a == b); // tslint:disable-line
}
/**
* @hidden
* Given a side, return if it should be on the right
* based on the value of dir
* @param side the side
* @param isRTL whether the application dir is rtl
* @param defaultRight whether the default side is right
*/
function isRightSide(side, isRTL, defaultRight) {
if (defaultRight === void 0) { defaultRight = false; }
switch (side) {
case 'right': return true;
case 'left': return false;
case 'end': return !isRTL;
case 'start': return isRTL;
default: return defaultRight ? !isRTL : isRTL;
}
}
/** @hidden */
function reorderArray(array, indexes) {
var element = array[indexes.from];
array.splice(indexes.from, 1);
array.splice(indexes.to, 0, element);
return array;
}
/** @hidden */
function removeArrayItem(array, item) {
var index = array.indexOf(item);
return !!~index && !!array.splice(index, 1);
}
/** @hidden */
function swipeShouldReset(isResetDirection, isMovingFast, isOnResetZone) {
// The logic required to know when the sliding item should close (openAmount=0)
// depends on three booleans (isCloseDirection, isMovingFast, isOnCloseZone)
// and it ended up being too complicated to be written manually without errors
// so the truth table is attached below: (0=false, 1=true)
// isCloseDirection | isMovingFast | isOnCloseZone || shouldClose
// 0 | 0 | 0 || 0
// 0 | 0 | 1 || 1
// 0 | 1 | 0 || 0
// 0 | 1 | 1 || 0
// 1 | 0 | 0 || 0
// 1 | 0 | 1 || 1
// 1 | 1 | 0 || 1
// 1 | 1 | 1 || 1
// The resulting expression was generated by resolving the K-map (Karnaugh map):
var shouldClose = (!isMovingFast && isOnResetZone) || (isResetDirection && isMovingFast);
return shouldClose;
}
/** @hidden */
var ASSERT_ENABLED = true;
/** @hidden */
function _runInDev(fn) {
if (ASSERT_ENABLED === true) {
return fn();
}
}
/** @hidden */
function _assert(actual, reason) {
if (!actual && ASSERT_ENABLED === true) {
var message = 'IONIC ASSERT: ' + reason;
console.error(message);
debugger; // tslint:disable-line
throw new Error(message);
}
}
/** @hidden */
function requestIonicCallback(functionToLazy) {
if ('requestIdleCallback' in window) {
return window.requestIdleCallback(functionToLazy);
}
else {
return setTimeout(functionToLazy, 500);
}
}
/** @hidden */
/** @hidden */
//# sourceMappingURL=util.js.map
/***/ }),
/* 4 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Platform; });
/* harmony export (immutable) */ __webpack_exports__["b"] = setupPlatform;
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_dom__ = __webpack_require__(14);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__query_params__ = __webpack_require__(382);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_util__ = __webpack_require__(3);
/**
* @name Platform
* @description
* The Platform service can be used to get information about your current device.
* You can get all of the platforms associated with the device using the [platforms](#platforms)
* method, including whether the app is being viewed from a tablet, if it's
* on a mobile device or browser, and the exact platform (iOS, Android, etc).
* You can also get the orientation of the device, if it uses right-to-left
* language direction, and much much more. With this information you can completely
* customize your app to fit any device.
*
* @usage
* ```ts
* import { Platform } from 'ionic-angular';
*
* @Component({...})
* export MyPage {
* constructor(public platform: Platform) {
*
* }
* }
* ```
* @demo /docs/demos/src/platform/
*/
var Platform = (function () {
function Platform() {
var _this = this;
this._versions = {};
this._qp = new __WEBPACK_IMPORTED_MODULE_2__query_params__["a" /* QueryParams */]();
this._bbActions = [];
this._pW = 0;
this._pH = 0;
this._lW = 0;
this._lH = 0;
this._isPortrait = null;
this._uiEvtOpts = false;
/** @internal */
this._platforms = [];
// Events meant to be triggered by the engine
// **********************************************
/**
* @hidden
*/
this.backButton = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* The pause event emits when the native platform puts the application
* into the background, typically when the user switches to a different
* application. This event would emit when a Cordova app is put into
* the background, however, it would not fire on a standard web browser.
*/
this.pause = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* The resume event emits when the native platform pulls the application
* out from the background. This event would emit when a Cordova app comes
* out from the background, however, it would not fire on a standard web browser.
*/
this.resume = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* The resize event emits when the browser window has changed dimensions. This
* could be from a browser window being physically resized, or from a device
* changing orientation.
*/
this.resize = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
this._readyPromise = new Promise(function (res) { _this._readyResolve = res; });
this.backButton.subscribe(function () {
// the hardware back button event has been fired
(void 0) /* console.debug */;
// decide which backbutton action should run
_this.runBackButtonAction();
});
}
/**
* @hidden
*/
Platform.prototype.setWindow = function (win) {
this._win = win;
};
/**
* @hidden
*/
Platform.prototype.win = function () {
return this._win;
};
/**
* @hidden
*/
Platform.prototype.setDocument = function (doc) {
this._doc = doc;
};
/**
* @hidden
*/
Platform.prototype.doc = function () {
return this._doc;
};
/**
* @hidden
*/
Platform.prototype.setZone = function (zone) {
this.zone = zone;
};
/**
* @hidden
*/
Platform.prototype.setCssProps = function (docElement) {
this.Css = Object(__WEBPACK_IMPORTED_MODULE_1__util_dom__["c" /* getCss */])(docElement);
};
// Methods
// **********************************************
/**
* @returns {boolean} returns true/false based on platform.
* @description
* Depending on the platform the user is on, `is(platformName)` will
* return `true` or `false`. Note that the same app can return `true`
* for more than one platform name. For example, an app running from
* an iPad would return `true` for the platform names: `mobile`,
* `ios`, `ipad`, and `tablet`. Additionally, if the app was running
* from Cordova then `cordova` would be true, and if it was running
* from a web browser on the iPad then `mobileweb` would be `true`.
*
* ```
* import { Platform } from 'ionic-angular';
*
* @Component({...})
* export MyPage {
* constructor(public platform: Platform) {
* if (this.platform.is('ios')) {
* // This will only print when on iOS
* console.log('I am an iOS device!');
* }
* }
* }
* ```
*
* | Platform Name | Description |
* |-----------------|------------------------------------|
* | android | on a device running Android. |
* | cordova | on a device running Cordova. |
* | core | on a desktop device. |
* | ios | on a device running iOS. |
* | ipad | on an iPad device. |
* | iphone | on an iPhone device. |
* | mobile | on a mobile device. |
* | mobileweb | in a browser on a mobile device. |
* | phablet | on a phablet device. |
* | tablet | on a tablet device. |
* | windows | on a device running Windows. |
*
* @param {string} platformName
*/
Platform.prototype.is = function (platformName) {
return (this._platforms.indexOf(platformName) > -1);
};
/**
* @returns {array} the array of platforms
* @description
* Depending on what device you are on, `platforms` can return multiple values.
* Each possible value is a hierarchy of platforms. For example, on an iPhone,
* it would return `mobile`, `ios`, and `iphone`.
*
* ```
* import { Platform } from 'ionic-angular';
*
* @Component({...})
* export MyPage {
* constructor(public platform: Platform) {
* // This will print an array of the current platforms
* console.log(this.platform.platforms());
* }
* }
* ```
*/
Platform.prototype.platforms = function () {
// get the array of active platforms, which also knows the hierarchy,
// with the last one the most important
return this._platforms;
};
/**
* Returns an object containing version information about all of the platforms.
*
* ```
* import { Platform } from 'ionic-angular';
*
* @Component({...})
* export MyPage {
* constructor(public platform: Platform) {
* // This will print an object containing
* // all of the platforms and their versions
* console.log(platform.versions());
* }
* }
* ```
*
* @returns {object} An object containing all of the platforms and their versions.
*/
Platform.prototype.versions = function () {
// get all the platforms that have a valid parsed version
return this._versions;
};
/**
* @hidden
*/
Platform.prototype.version = function () {
for (var platformName in this._versions) {
if (this._versions[platformName]) {
return this._versions[platformName];
}
}
return {};
};
/**
* Returns a promise when the platform is ready and native functionality
* can be called. If the app is running from within a web browser, then
* the promise will resolve when the DOM is ready. When the app is running
* from an application engine such as Cordova, then the promise will
* resolve when Cordova triggers the `deviceready` event.
*
* The resolved value is the `readySource`, which states which platform
* ready was used. For example, when Cordova is ready, the resolved ready
* source is `cordova`. The default ready source value will be `dom`. The
* `readySource` is useful if different logic should run depending on the
* platform the app is running from. For example, only Cordova can execute
* the status bar plugin, so the web should not run status bar plugin logic.
*
* ```
* import { Component } from '@angular/core';
* import { Platform } from 'ionic-angular';
*
* @Component({...})
* export MyApp {
* constructor(public platform: Platform) {
* this.platform.ready().then((readySource) => {
* console.log('Platform ready from', readySource);
* // Platform now ready, execute any required native code
* });
* }
* }
* ```
* @returns {promise}
*/
Platform.prototype.ready = function () {
return this._readyPromise;
};
/**
* @hidden
* This should be triggered by the engine when the platform is
* ready. If there was no custom prepareReady method from the engine,
* such as Cordova or Electron, then it uses the default DOM ready.
*/
Platform.prototype.triggerReady = function (readySource) {
var _this = this;
this.zone.run(function () {
_this._readyResolve(readySource);
});
};
/**
* @hidden
* This is the default prepareReady if it's not replaced by an engine,
* such as Cordova or Electron. If there was no custom prepareReady
* method from an engine then it uses the method below, which triggers
* the platform ready on the DOM ready event, and the default resolved
* value is `dom`.
*/
Platform.prototype.prepareReady = function () {
var self = this;
if (self._doc.readyState === 'complete' || self._doc.readyState === 'interactive') {
self.triggerReady('dom');
}
else {
self._doc.addEventListener('DOMContentLoaded', completed, false);
self._win.addEventListener('load', completed, false);
}
function completed() {
self._doc.removeEventListener('DOMContentLoaded', completed, false);
self._win.removeEventListener('load', completed, false);
self.triggerReady('dom');
}
};
/**
* Set the app's language direction, which will update the `dir` attribute
* on the app's root `<html>` element. We recommend the app's `index.html`
* file already has the correct `dir` attribute value set, such as
* `<html dir="ltr">` or `<html dir="rtl">`. This method is useful if the
* direction needs to be dynamically changed per user/session.
* [W3C: Structural markup and right-to-left text in HTML](http://www.w3.org/International/questions/qa-html-dir)
* @param {DocumentDirection} dir Examples: `rtl`, `ltr`
* @param {boolean} updateDocument
*/
Platform.prototype.setDir = function (dir, updateDocument) {
this._dir = dir;
this.isRTL = (dir === 'rtl');
if (updateDocument !== false) {
this._doc['documentElement'].setAttribute('dir', dir);
}
};
/**
* Returns app's language direction.
* We recommend the app's `index.html` file already has the correct `dir`
* attribute value set, such as `<html dir="ltr">` or `<html dir="rtl">`.
* [W3C: Structural markup and right-to-left text in HTML](http://www.w3.org/International/questions/qa-html-dir)
* @returns {DocumentDirection}
*/
Platform.prototype.dir = function () {
return this._dir;
};
/**
* Set the app's language and optionally the country code, which will update
* the `lang` attribute on the app's root `<html>` element.
* We recommend the app's `index.html` file already has the correct `lang`
* attribute value set, such as `<html lang="en">`. This method is useful if
* the language needs to be dynamically changed per user/session.
* [W3C: Declaring language in HTML](http://www.w3.org/International/questions/qa-html-language-declarations)
* @param {string} language Examples: `en-US`, `en-GB`, `ar`, `de`, `zh`, `es-MX`
* @param {boolean} updateDocument Specifies whether the `lang` attribute of `<html>` should be updated
*/
Platform.prototype.setLang = function (language, updateDocument) {
this._lang = language;
if (updateDocument !== false) {
this._doc['documentElement'].setAttribute('lang', language);
}
};
/**
* Returns app's language and optional country code.
* We recommend the app's `index.html` file already has the correct `lang`
* attribute value set, such as `<html lang="en">`.
* [W3C: Declaring language in HTML](http://www.w3.org/International/questions/qa-html-language-declarations)
* @returns {string}
*/
Platform.prototype.lang = function () {
return this._lang;
};
// Methods meant to be overridden by the engine
// **********************************************
// Provided NOOP methods so they do not error when
// called by engines (the browser)that do not provide them
/**
* @hidden
*/
Platform.prototype.exitApp = function () { };
/**
* The back button event is triggered when the user presses the native
* platform's back button, also referred to as the "hardware" back button.
* This event is only used within Cordova apps running on Android and
* Windows platforms. This event is not fired on iOS since iOS doesn't come
* with a hardware back button in the same sense an Android or Windows device
* does.
*
* Registering a hardware back button action and setting a priority allows
* apps to control which action should be called when the hardware back
* button is pressed. This method decides which of the registered back button
* actions has the highest priority and should be called.
*
* @param {Function} fn Called when the back button is pressed,
* if this registered action has the highest priority.
* @param {number} priority Set the priority for this action. Only the highest priority will execute. Defaults to `0`.
* @returns {Function} A function that, when called, will unregister
* the back button action.
*/
Platform.prototype.registerBackButtonAction = function (fn, priority) {
var _this = this;
if (priority === void 0) { priority = 0; }
var action = { fn: fn, priority: priority };
this._bbActions.push(action);
// return a function to unregister this back button action
return function () {
Object(__WEBPACK_IMPORTED_MODULE_3__util_util__["q" /* removeArrayItem */])(_this._bbActions, action);
};
};
/**
* @hidden
*/
Platform.prototype.runBackButtonAction = function () {
// decide which one back button action should run
var winner = null;
this._bbActions.forEach(function (action) {
if (!winner || action.priority >= winner.priority) {
winner = action;
}
});
// run the winning action if there is one
winner && winner.fn && winner.fn();
};
// Getter/Setter Methods
// **********************************************
/**
* @hidden
*/
Platform.prototype.setUserAgent = function (userAgent) {
this._ua = userAgent;
};
/**
* @hidden
*/
Platform.prototype.setQueryParams = function (url) {
this._qp.parseUrl(url);
};
/**
* Get the query string parameter
*/
Platform.prototype.getQueryParam = function (key) {
return this._qp.get(key);
};
/**
* Get the current url.
*/
Platform.prototype.url = function () {
return this._win['location']['href'];
};
/**
* @hidden
*/
Platform.prototype.userAgent = function () {
return this._ua || '';
};
/**
* @hidden
*/
Platform.prototype.setNavigatorPlatform = function (navigatorPlt) {
this._nPlt = navigatorPlt;
};
/**
* @hidden
*/
Platform.prototype.navigatorPlatform = function () {
return this._nPlt || '';
};
/**
* Gets the width of the platform's viewport using `window.innerWidth`.
* Using this method is preferred since the dimension is a cached value,
* which reduces the chance of multiple and expensive DOM reads.
*/
Platform.prototype.width = function () {
this._calcDim();
return this._isPortrait ? this._pW : this._lW;
};
/**
* Gets the height of the platform's viewport using `window.innerHeight`.
* Using this method is preferred since the dimension is a cached value,
* which reduces the chance of multiple and expensive DOM reads.
*/
Platform.prototype.height = function () {
this._calcDim();
return this._isPortrait ? this._pH : this._lH;
};
/**
* @hidden
*/
Platform.prototype.getElementComputedStyle = function (ele, pseudoEle) {
return this._win['getComputedStyle'](ele, pseudoEle);
};
/**
* @hidden
*/
Platform.prototype.getElementFromPoint = function (x, y) {
return this._doc['elementFromPoint'](x, y);
};
/**
* @hidden
*/
Platform.prototype.getElementBoundingClientRect = function (ele) {
return ele['getBoundingClientRect']();
};
/**
* Returns `true` if the app is in portait mode.
*/
Platform.prototype.isPortrait = function () {
this._calcDim();
return this._isPortrait;
};
/**
* Returns `true` if the app is in landscape mode.
*/
Platform.prototype.isLandscape = function () {
return !this.isPortrait();
};
Platform.prototype._calcDim = function () {
// we're caching window dimensions so that
// we're not forcing many layouts
// if _isPortrait is null then that means
// the dimensions needs to be looked up again
// this also has to cover an edge case that only
// happens on iOS 10 (not other versions of iOS)
// where window.innerWidth is always bigger than
// window.innerHeight when it is first measured,
// even when the device is in portrait but
// the second time it is measured it is correct.
// Hopefully this check will not be needed in the future
if (this._isPortrait === null || this._isPortrait === false && this._win['innerWidth'] < this._win['innerHeight']) {
var win = this._win;
var innerWidth = win['innerWidth'];
var innerHeight = win['innerHeight'];
// we're keeping track of portrait and landscape dimensions
// separately because the virtual keyboard can really mess
// up accurate values when the keyboard is up
if (win.screen.width > 0 && win.screen.height > 0) {
if (innerWidth < innerHeight) {
// the device is in portrait
// we have to do fancier checking here
// because of the virtual keyboard resizing
// the window
if (this._pW <= innerWidth) {
(void 0) /* console.debug */;
this._isPortrait = true;
this._pW = innerWidth;
}
if (this._pH <= innerHeight) {
(void 0) /* console.debug */;
this._isPortrait = true;
this._pH = innerHeight;
}
}
else {
// the device is in landscape
if (this._lW !== innerWidth) {
(void 0) /* console.debug */;
this._isPortrait = false;
this._lW = innerWidth;
}
if (this._lH !== innerHeight) {
(void 0) /* console.debug */;
this._isPortrait = false;
this._lH = innerHeight;
}
}
}
}
};
/**
* @hidden
* This requestAnimationFrame will NOT be wrapped by zone.
*/
Platform.prototype.raf = function (callback) {
var win = this._win;
return win['__zone_symbol__requestAnimationFrame'](callback);
};
/**
* @hidden
*/
Platform.prototype.cancelRaf = function (rafId) {
var win = this._win;
return win['__zone_symbol__cancelAnimationFrame'](rafId);
};
/**
* @hidden
* This setTimeout will NOT be wrapped by zone.
*/
Platform.prototype.timeout = function (callback, timeout) {
var win = this._win;
return win['__zone_symbol__setTimeout'](callback, timeout);
};
/**
* @hidden
* This setTimeout will NOT be wrapped by zone.
*/
Platform.prototype.cancelTimeout = function (timeoutId) {
var win = this._win;
win['__zone_symbol__clearTimeout'](timeoutId);
};
/**
* @hidden
* Built to use modern event listener options, like "passive".
* If options are not supported, then just return a boolean which
* represents "capture". Returns a method to remove the listener.
*/
Platform.prototype.registerListener = function (ele, eventName, callback, opts, unregisterListenersCollection) {
// use event listener options when supported
// otherwise it's just a boolean for the "capture" arg
var listenerOpts = this._uiEvtOpts ? {
'capture': !!opts.capture,
'passive': !!opts.passive,
} : !!opts.capture;
var unReg;
if (!opts.zone && ele['__zone_symbol__addEventListener']) {
// do not wrap this event in zone and we've verified we can use the raw addEventListener
ele['__zone_symbol__addEventListener'](eventName, callback, listenerOpts);
unReg = function unregisterListener() {
ele['__zone_symbol__removeEventListener'](eventName, callback, listenerOpts);
};
}
else {
// use the native addEventListener, which is wrapped with zone
ele['addEventListener'](eventName, callback, listenerOpts);
unReg = function unregisterListener() {
ele['removeEventListener'](eventName, callback, listenerOpts);
};
}
if (unregisterListenersCollection) {
unregisterListenersCollection.push(unReg);
}
return unReg;
};
/**
* @hidden
*/
Platform.prototype.transitionEnd = function (el, callback, zone) {
if (zone === void 0) { zone = true; }
var unRegs = [];
function unregister() {
unRegs.forEach(function (unReg) {
unReg();
});
}
function onTransitionEnd(ev) {
if (el === ev.target) {
unregister();
callback(ev);
}
}
if (el) {
this.registerListener(el, 'webkitTransitionEnd', onTransitionEnd, { zone: zone }, unRegs);
this.registerListener(el, 'transitionend', onTransitionEnd, { zone: zone }, unRegs);
}
return unregister;
};
/**
* @hidden
*/
Platform.prototype.windowLoad = function (callback) {
var win = this._win;
var doc = this._doc;
var unreg;
if (doc.readyState === 'complete') {
callback(win, doc);
}
else {
unreg = this.registerListener(win, 'load', function () {
unreg && unreg();
callback(win, doc);
}, { zone: false });
}
};
/**
* @hidden
*/
Platform.prototype.isActiveElement = function (ele) {
return !!(ele && (this.getActiveElement() === ele));
};
/**
* @hidden
*/
Platform.prototype.getActiveElement = function () {
return this._doc['activeElement'];
};
/**
* @hidden
*/
Platform.prototype.hasFocus = function (ele) {
return !!((ele && (this.getActiveElement() === ele)) && (ele.parentElement.querySelector(':focus') === ele));
};
/**
* @hidden
*/
Platform.prototype.hasFocusedTextInput = function () {
var ele = this.getActiveElement();
if (Object(__WEBPACK_IMPORTED_MODULE_1__util_dom__["e" /* isTextInput */])(ele)) {
return (ele.parentElement.querySelector(':focus') === ele);
}
return false;
};
/**
* @hidden
*/
Platform.prototype.focusOutActiveElement = function () {
var activeElement = this.getActiveElement();
activeElement && activeElement.blur && activeElement.blur();
};
Platform.prototype._initEvents = function () {
var _this = this;
// Test via a getter in the options object to see if the passive property is accessed
try {
var opts = Object.defineProperty({}, 'passive', {
get: function () {
_this._uiEvtOpts = true;
}
});
this._win.addEventListener('optsTest', null, opts);
}
catch (e) { }
// add the window resize event listener XXms after
this.timeout(function () {
var timerId;
_this.registerListener(_this._win, 'resize', function () {
clearTimeout(timerId);
timerId = setTimeout(function () {
// setting _isPortrait to null means the
// dimensions will need to be looked up again
if (_this.hasFocusedTextInput() === false) {
_this._isPortrait = null;
}
_this.zone.run(function () { return _this.resize.emit(); });
}, 200);
}, { passive: true, zone: false });
}, 2000);
};
// Platform Registry
// **********************************************
/**
* @hidden
*/
Platform.prototype.setPlatformConfigs = function (platformConfigs) {
this._registry = platformConfigs || {};
};
/**
* @hidden
*/
Platform.prototype.getPlatformConfig = function (platformName) {
return this._registry[platformName] || {};
};
/**
* @hidden
*/
Platform.prototype.registry = function () {
return this._registry;
};
/**
* @hidden
*/
Platform.prototype.setDefault = function (platformName) {
this._default = platformName;
};
/**
* @hidden
*/
Platform.prototype.testQuery = function (queryValue, queryTestValue) {
var valueSplit = queryValue.toLowerCase().split(';');
return valueSplit.indexOf(queryTestValue) > -1;
};
/**
* @hidden
*/
Platform.prototype.testNavigatorPlatform = function (navigatorPlatformExpression) {
var rgx = new RegExp(navigatorPlatformExpression, 'i');
return rgx.test(this._nPlt);
};
/**
* @hidden
*/
Platform.prototype.matchUserAgentVersion = function (userAgentExpression) {
if (this._ua && userAgentExpression) {
var val = this._ua.match(userAgentExpression);
if (val) {
return {
major: val[1],
minor: val[2]
};
}
}
};
Platform.prototype.testUserAgent = function (expression) {
if (this._ua) {
return this._ua.indexOf(expression) >= 0;
}
return false;
};
/**
* @hidden
*/
Platform.prototype.isPlatformMatch = function (queryStringName, userAgentAtLeastHas, userAgentMustNotHave) {
if (userAgentMustNotHave === void 0) { userAgentMustNotHave = []; }
var queryValue = this._qp.get('ionicplatform');
if (queryValue) {
return this.testQuery(queryValue, queryStringName);
}
userAgentAtLeastHas = userAgentAtLeastHas || [queryStringName];
var userAgent = this._ua.toLowerCase();
for (var i = 0; i < userAgentAtLeastHas.length; i++) {
if (userAgent.indexOf(userAgentAtLeastHas[i]) > -1) {
for (var j = 0; j < userAgentMustNotHave.length; j++) {
if (userAgent.indexOf(userAgentMustNotHave[j]) > -1) {
return false;
}
}
return true;
}
}
return false;
};
/** @hidden */
Platform.prototype.init = function () {
this._initEvents();
var rootPlatformNode;
var enginePlatformNode;
// figure out the most specific platform and active engine
var tmpPlt;
for (var platformName in this._registry) {
tmpPlt = this.matchPlatform(platformName);
if (tmpPlt) {
// we found a platform match!
// check if its more specific than the one we already have
if (tmpPlt.isEngine) {
// because it matched then this should be the active engine
// you cannot have more than one active engine
enginePlatformNode = tmpPlt;
}
else if (!rootPlatformNode || tmpPlt.depth > rootPlatformNode.depth) {
// only find the root node for platforms that are not engines
// set this node as the root since we either don't already
// have one, or this one is more specific that the current one
rootPlatformNode = tmpPlt;
}
}
}
if (!rootPlatformNode) {
rootPlatformNode = new PlatformNode(this._registry, this._default);
}
// build a Platform instance filled with the
// hierarchy of active platforms and settings
if (rootPlatformNode) {
// check if we found an engine node (cordova/node-webkit/etc)
if (enginePlatformNode) {
// add the engine to the first in the platform hierarchy
// the original rootPlatformNode now becomes a child
// of the engineNode, which is not the new root
enginePlatformNode.child = rootPlatformNode;
rootPlatformNode.parent = enginePlatformNode;
rootPlatformNode = enginePlatformNode;
}
var platformNode = rootPlatformNode;
while (platformNode) {
insertSuperset(this._registry, platformNode);
platformNode = platformNode.child;
}
// make sure the root noot is actually the root
// incase a node was inserted before the root
platformNode = rootPlatformNode.parent;
while (platformNode) {
rootPlatformNode = platformNode;
platformNode = platformNode.parent;
}
platformNode = rootPlatformNode;
while (platformNode) {
platformNode.initialize(this);
// extra check for ipad pro issue
// https://forums.developer.apple.com/thread/25948
if (platformNode.name === 'iphone' && this.navigatorPlatform() === 'iPad') {
// this is an ipad pro so push ipad and tablet to platforms
// and then return as we are done
this._platforms.push('tablet');
this._platforms.push('ipad');
return;
}
// set the array of active platforms with
// the last one in the array the most important
this._platforms.push(platformNode.name);
// get the platforms version if a version parser was provided
this._versions[platformNode.name] = platformNode.version(this);
// go to the next platform child
platformNode = platformNode.child;
}
}
if (this._platforms.indexOf('mobile') > -1 && this._platforms.indexOf('cordova') === -1) {
this._platforms.push('mobileweb');
}
};
/**
* @hidden
*/
Platform.prototype.matchPlatform = function (platformName) {
// build a PlatformNode and assign config data to it
// use it's getRoot method to build up its hierarchy
// depending on which platforms match
var platformNode = new PlatformNode(this._registry, platformName);
var rootNode = platformNode.getRoot(this);
if (rootNode) {
rootNode.depth = 0;
var childPlatform = rootNode.child;
while (childPlatform) {
rootNode.depth++;
childPlatform = childPlatform.child;
}
}
return rootNode;
};
return Platform;
}());
function insertSuperset(registry, platformNode) {
var supersetPlaformName = platformNode.superset();
if (supersetPlaformName) {
// add a platform in between two exist platforms
// so we can build the correct hierarchy of active platforms
var supersetPlatform = new PlatformNode(registry, supersetPlaformName);
supersetPlatform.parent = platformNode.parent;
supersetPlatform.child = platformNode;
if (supersetPlatform.parent) {
supersetPlatform.parent.child = supersetPlatform;
}
platformNode.parent = supersetPlatform;
}
}
/**
* @hidden
*/
var PlatformNode = (function () {
function PlatformNode(registry, platformName) {
this.registry = registry;
this.c = registry[platformName];
this.name = platformName;
this.isEngine = this.c.isEngine;
}
PlatformNode.prototype.settings = function () {
return this.c.settings || {};
};
PlatformNode.prototype.superset = function () {
return this.c.superset;
};
PlatformNode.prototype.isMatch = function (p) {
return this.c.isMatch && this.c.isMatch(p) || false;
};
PlatformNode.prototype.initialize = function (plt) {
this.c.initialize && this.c.initialize(plt);
};
PlatformNode.prototype.version = function (plt) {
if (this.c.versionParser) {
var v = this.c.versionParser(plt);
if (v) {
var str = v.major + '.' + v.minor;
return {
str: str,
num: parseFloat(str),
major: parseInt(v.major, 10),
minor: parseInt(v.minor, 10)
};
}
}
};
PlatformNode.prototype.getRoot = function (plt) {
if (this.isMatch(plt)) {
var parents = this.getSubsetParents(this.name);
if (!parents.length) {
return this;
}
var platformNode = null;
var rootPlatformNode = null;
for (var i = 0; i < parents.length; i++) {
platformNode = new PlatformNode(this.registry, parents[i]);
platformNode.child = this;
rootPlatformNode = platformNode.getRoot(plt);
if (rootPlatformNode) {
this.parent = platformNode;
return rootPlatformNode;
}
}
}
return null;
};
PlatformNode.prototype.getSubsetParents = function (subsetPlatformName) {
var parentPlatformNames = [];
var pltConfig = null;
for (var platformName in this.registry) {
pltConfig = this.registry[platformName];
if (pltConfig.subsets && pltConfig.subsets.indexOf(subsetPlatformName) > -1) {
parentPlatformNames.push(platformName);
}
}
return parentPlatformNames;
};
return PlatformNode;
}());
/**
* @hidden
*/
function setupPlatform(doc, platformConfigs, zone) {
var plt = new Platform();
plt.setDefault('core');
plt.setPlatformConfigs(platformConfigs);
plt.setZone(zone);
// set values from "document"
var docElement = doc.documentElement;
plt.setDocument(doc);
var dir = docElement.dir;
plt.setDir(dir === 'rtl' ? 'rtl' : 'ltr', !dir);
plt.setLang(docElement.lang, false);
// set css properties
plt.setCssProps(docElement);
// set values from "window"
var win = doc.defaultView;
plt.setWindow(win);
plt.setNavigatorPlatform(win.navigator.platform);
plt.setUserAgent(win.navigator.userAgent);
// set location values
plt.setQueryParams(win.location.href);
plt.init();
// add the platform obj to the window
win['Ionic'] = win['Ionic'] || {};
win['Ionic']['platform'] = plt;
return plt;
}
//# sourceMappingURL=platform.js.map
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = __webpack_require__(61);
module.exports.easing = __webpack_require__(421);
module.exports.canvas = __webpack_require__(422);
module.exports.options = __webpack_require__(423);
/***/ }),
/* 6 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Ion; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/**
* Base class for all Ionic components. Exposes some common functionality
* that all Ionic components need, such as accessing underlying native elements and
* sending/receiving app-level events.
*/
/** @hidden */
var Ion = (function () {
function Ion(config, elementRef, renderer, componentName) {
this._config = config;
this._elementRef = elementRef;
this._renderer = renderer;
this._componentName = componentName;
if (componentName) {
this._setComponentName();
this._setMode(config.get('mode'));
}
}
Object.defineProperty(Ion.prototype, "color", {
get: function () {
return this._color;
},
/**
* @input {string} The color to use from your Sass `$colors` map.
* Default options are: `"primary"`, `"secondary"`, `"danger"`, `"light"`, and `"dark"`.
* For more information, see [Theming your App](/docs/theming/theming-your-app).
*/
set: function (val) {
this._setColor(val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Ion.prototype, "mode", {
get: function () {
return this._mode;
},
/**
* @input {string} The mode determines which platform styles to use.
* Possible values are: `"ios"`, `"md"`, or `"wp"`.
* For more information, see [Platform Styles](/docs/theming/platform-specific-styles).
*/
set: function (val) {
this._setMode(val);
},
enumerable: true,
configurable: true
});
/** @hidden */
Ion.prototype.setElementClass = function (className, isAdd) {
this._renderer.setElementClass(this._elementRef.nativeElement, className, isAdd);
};
/** @hidden */
Ion.prototype.setElementAttribute = function (attributeName, attributeValue) {
this._renderer.setElementAttribute(this._elementRef.nativeElement, attributeName, attributeValue);
};
/** @hidden */
Ion.prototype.setElementStyle = function (property, value) {
this._renderer.setElementStyle(this._elementRef.nativeElement, property, value);
};
/** @hidden */
Ion.prototype._setColor = function (newColor, componentName) {
if (componentName) {
// This is needed for the item-radio
this._componentName = componentName;
}
if (this._color) {
this.setElementClass(this._componentName + "-" + this._mode + "-" + this._color, false);
}
if (newColor) {
this.setElementClass(this._componentName + "-" + this._mode + "-" + newColor, true);
this._color = newColor;
}
};
/** @hidden */
Ion.prototype._setMode = function (newMode) {
if (this._mode) {
this.setElementClass(this._componentName + "-" + this._mode, false);
}
if (newMode) {
this.setElementClass(this._componentName + "-" + newMode, true);
// Remove the color class associated with the previous mode,
// change the mode, then add the new color class
this._setColor(null);
this._mode = newMode;
this._setColor(this._color);
}
};
/** @hidden */
Ion.prototype._setComponentName = function () {
this.setElementClass(this._componentName, true);
};
/** @hidden */
Ion.prototype.getElementRef = function () {
return this._elementRef;
};
/** @hidden */
Ion.prototype.getNativeElement = function () {
return this._elementRef.nativeElement;
};
Ion.propDecorators = {
'color': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'mode': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
};
return Ion;
}());
//# sourceMappingURL=ion.js.map
/***/ }),
/* 7 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ViewController; });
/* harmony export (immutable) */ __webpack_exports__["b"] = isViewController;
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__nav_util__ = __webpack_require__(26);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__nav_params__ = __webpack_require__(18);
/**
* @name ViewController
* @description
* Access various features and information about the current view.
* @usage
* ```ts
* import { Component } from '@angular/core';
* import { ViewController } from 'ionic-angular';
*
* @Component({...})
* export class MyPage{
*
* constructor(public viewCtrl: ViewController) {}
*
* }
* ```
*/
var ViewController = (function () {
function ViewController(component, data, rootCssClass) {
if (rootCssClass === void 0) { rootCssClass = DEFAULT_CSS_CLASS; }
this.component = component;
this._isHidden = false;
this._state = __WEBPACK_IMPORTED_MODULE_2__nav_util__["h" /* STATE_NEW */];
/**
* Observable to be subscribed to when the current component will become active
* @returns {Observable} Returns an observable
*/
this.willEnter = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* Observable to be subscribed to when the current component has become active
* @returns {Observable} Returns an observable
*/
this.didEnter = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* Observable to be subscribed to when the current component will no longer be active
* @returns {Observable} Returns an observable
*/
this.willLeave = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* Observable to be subscribed to when the current component is no long active
* @returns {Observable} Returns an observable
*/
this.didLeave = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* Observable to be subscribed to when the current component has been destroyed
* @returns {Observable} Returns an observable
*/
this.willUnload = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* @hidden
*/
this.readReady = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* @hidden
*/
this.writeReady = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/** @hidden */
this.isOverlay = false;
/** @hidden */
this._emitter = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
// passed in data could be NavParams, but all we care about is its data object
this.data = (data instanceof __WEBPACK_IMPORTED_MODULE_3__nav_params__["a" /* NavParams */] ? data.data : (Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["l" /* isPresent */])(data) ? data : {}));
this._cssClass = rootCssClass;
this._ts = Date.now();
window.addEventListener('orientationchange', this.handleOrientationChange.bind(this));
}
ViewController.prototype.handleOrientationChange = function () {
if (this.getContent()) {
this.getContent().resize();
}
};
/**
* @hidden
*/
ViewController.prototype.init = function (componentRef) {
(void 0) /* assert */;
this._ts = Date.now();
this._cmp = componentRef;
this.instance = this.instance || componentRef.instance;
this._detached = false;
};
ViewController.prototype._setNav = function (navCtrl) {
this._nav = navCtrl;
};
ViewController.prototype._setInstance = function (instance) {
this.instance = instance;
};
/**
* @hidden
*/
ViewController.prototype.subscribe = function (generatorOrNext) {
return this._emitter.subscribe(generatorOrNext);
};
/**
* @hidden
*/
ViewController.prototype.emit = function (data) {
this._emitter.emit(data);
};
/**
* Called when the current viewController has be successfully dismissed
*/
ViewController.prototype.onDidDismiss = function (callback) {
this._onDidDismiss = callback;
};
/**
* Called when the current viewController will be dismissed
*/
ViewController.prototype.onWillDismiss = function (callback) {
this._onWillDismiss = callback;
};
/**
* Dismiss the current viewController
* @param {any} [data] Data that you want to return when the viewController is dismissed.
* @param {any} [role ]
* @param {NavOptions} navOptions Options for the dismiss navigation.
* @returns {any} data Returns the data passed in, if any.
*/
ViewController.prototype.dismiss = function (data, role, navOptions) {
if (navOptions === void 0) { navOptions = {}; }
if (!this._nav) {
(void 0) /* assert */;
return Promise.resolve(false);
}
if (this.isOverlay && !navOptions.minClickBlockDuration) {
// This is a Modal being dismissed so we need
// to add the minClickBlockDuration option
// for UIWebView
navOptions.minClickBlockDuration = 400;
}
this._dismissData = data;
this._dismissRole = role;
var options = Object.assign({}, this._leavingOpts, navOptions);
return this._nav.removeView(this, options).then(function () { return data; });
};
/**
* @hidden
*/
ViewController.prototype.getNav = function () {
return this._nav;
};
/**
* @hidden
*/
ViewController.prototype.getTransitionName = function (_direction) {
return this._nav && this._nav.config.get('pageTransition');
};
/**
* @hidden
*/
ViewController.prototype.getNavParams = function () {
return new __WEBPACK_IMPORTED_MODULE_3__nav_params__["a" /* NavParams */](this.data);
};
/**
* @hidden
*/
ViewController.prototype.setLeavingOpts = function (opts) {
this._leavingOpts = opts;
};
/**
* Check to see if you can go back in the navigation stack.
* @returns {boolean} Returns if it's possible to go back from this Page.
*/
ViewController.prototype.enableBack = function () {
// update if it's possible to go back from this nav item
if (!this._nav) {
return false;
}
// the previous view may exist, but if it's about to be destroyed
// it shouldn't be able to go back to
var previousItem = this._nav.getPrevious(this);
return !!(previousItem);
};
Object.defineProperty(ViewController.prototype, "name", {
/**
* @hidden
*/
get: function () {
return (this.component ? this.component.name : '');
},
enumerable: true,
configurable: true
});
Object.defineProperty(ViewController.prototype, "index", {
/**
* Get the index of the current component in the current navigation stack.
* @returns {number} Returns the index of this page within its `NavController`.
*/
get: function () {
return (this._nav ? this._nav.indexOf(this) : -1);
},
enumerable: true,
configurable: true
});
/**
* @returns {boolean} Returns if this Page is the first in the stack of pages within its NavController.
*/
ViewController.prototype.isFirst = function () {
return (this._nav ? this._nav.first() === this : false);
};
/**
* @returns {boolean} Returns if this Page is the last in the stack of pages within its NavController.
*/
ViewController.prototype.isLast = function () {
return (this._nav ? this._nav.last() === this : false);
};
/**
* @hidden
* DOM WRITE
*/
ViewController.prototype._domShow = function (shouldShow, renderer) {
// using hidden element attribute to display:none and not render views
// _hidden value of '' means the hidden attribute will be added
// _hidden value of null means the hidden attribute will be removed
// doing checks to make sure we only update the DOM when actually needed
// if it should render, then the hidden attribute should not be on the element
if (this._cmp && shouldShow === this._isHidden) {
this._isHidden = !shouldShow;
var value = (shouldShow ? null : '');
// ******** DOM WRITE ****************
renderer.setElementAttribute(this.pageRef().nativeElement, 'hidden', value);
}
};
/**
* @hidden
*/
ViewController.prototype.getZIndex = function () {
return this._zIndex;
};
/**
* @hidden
* DOM WRITE
*/
ViewController.prototype._setZIndex = function (zIndex, renderer) {
if (zIndex !== this._zIndex) {
this._zIndex = zIndex;
var pageRef = this.pageRef();
if (pageRef) {
// ******** DOM WRITE ****************
renderer.setElementStyle(pageRef.nativeElement, 'z-index', zIndex);
}
}
};
/**
* @returns {ElementRef} Returns the Page's ElementRef.
*/
ViewController.prototype.pageRef = function () {
return this._cmp && this._cmp.location;
};
ViewController.prototype._setContent = function (directive) {
this._cntDir = directive;
};
/**
* @returns {component} Returns the Page's Content component reference.
*/
ViewController.prototype.getContent = function () {
return this._cntDir;
};
ViewController.prototype._setContentRef = function (elementRef) {
this._cntRef = elementRef;
};
/**
* @returns {ElementRef} Returns the Content's ElementRef.
*/
ViewController.prototype.contentRef = function () {
return this._cntRef;
};
ViewController.prototype._setIONContent = function (content) {
this._setContent(content);
this._ionCntDir = content;
};
/**
* @hidden
*/
ViewController.prototype.getIONContent = function () {
return this._ionCntDir;
};
ViewController.prototype._setIONContentRef = function (elementRef) {
this._setContentRef(elementRef);
this._ionCntRef = elementRef;
};
/**
* @hidden
*/
ViewController.prototype.getIONContentRef = function () {
return this._ionCntRef;
};
ViewController.prototype._setHeader = function (directive) {
this._hdrDir = directive;
};
/**
* @hidden
*/
ViewController.prototype.getHeader = function () {
return this._hdrDir;
};
ViewController.prototype._setFooter = function (directive) {
this._ftrDir = directive;
};
/**
* @hidden
*/
ViewController.prototype.getFooter = function () {
return this._ftrDir;
};
ViewController.prototype._setNavbar = function (directive) {
this._nb = directive;
};
/**
* @hidden
*/
ViewController.prototype.getNavbar = function () {
return this._nb;
};
/**
* Find out if the current component has a NavBar or not. Be sure
* to wrap this in an `ionViewWillEnter` method in order to make sure
* the view has rendered fully.
* @returns {boolean} Returns a boolean if this Page has a navbar or not.
*/
ViewController.prototype.hasNavbar = function () {
return !!this._nb;
};
/**
* Change the title of the back-button. Be sure to call this
* after `ionViewWillEnter` to make sure the DOM has been rendered.
* @param {string} val Set the back button text.
*/
ViewController.prototype.setBackButtonText = function (val) {
this._nb && this._nb.setBackButtonText(val);
};
/**
* Set if the back button for the current view is visible or not. Be sure to call this
* after `ionViewWillEnter` to make sure the DOM has been rendered.
* @param {boolean} Set if this Page's back button should show or not.
*/
ViewController.prototype.showBackButton = function (shouldShow) {
if (this._nb) {
this._nb.hideBackButton = !shouldShow;
}
};
ViewController.prototype._preLoad = function () {
(void 0) /* assert */;
this._lifecycle('PreLoad');
};
/**
* @hidden
* The view has loaded. This event only happens once per view will be created.
* This event is fired before the component and his children have been initialized.
*/
ViewController.prototype._willLoad = function () {
(void 0) /* assert */;
this._lifecycle('WillLoad');
};
/**
* @hidden
* The view has loaded. This event only happens once per view being
* created. If a view leaves but is cached, then this will not
* fire again on a subsequent viewing. This method is a good place
* to put your setup code for the view; however, it is not the
* recommended method to use when a view becomes active.
*/
ViewController.prototype._didLoad = function () {
(void 0) /* assert */;
this._lifecycle('DidLoad');
};
/**
* @hidden
* The view is about to enter and become the active view.
*/
ViewController.prototype._willEnter = function () {
this.handleOrientationChange();
(void 0) /* assert */;
if (this._detached && this._cmp) {
// ensure this has been re-attached to the change detector
this._cmp.changeDetectorRef.reattach();
this._detached = false;
}
this.willEnter.emit(null);
this._lifecycle('WillEnter');
};
/**
* @hidden
* The view has fully entered and is now the active view. This
* will fire, whether it was the first load or loaded from the cache.
*/
ViewController.prototype._didEnter = function () {
(void 0) /* assert */;
this._nb && this._nb.didEnter();
this.didEnter.emit(null);
this._lifecycle('DidEnter');
};
/**
* @hidden
* The view is about to leave and no longer be the active view.
*/
ViewController.prototype._willLeave = function (willUnload) {
this.willLeave.emit(null);
this._lifecycle('WillLeave');
if (willUnload && this._onWillDismiss) {
this._onWillDismiss(this._dismissData, this._dismissRole);
this._onWillDismiss = null;
}
};
/**
* @hidden
* The view has finished leaving and is no longer the active view. This
* will fire, whether it is cached or unloaded.
*/
ViewController.prototype._didLeave = function () {
this.didLeave.emit(null);
this._lifecycle('DidLeave');
// when this is not the active page
// we no longer need to detect changes
if (!this._detached && this._cmp) {
this._cmp.changeDetectorRef.detach();
this._detached = true;
}
};
/**
* @hidden
*/
ViewController.prototype._willUnload = function () {
this.willUnload.emit(null);
this._lifecycle('WillUnload');
this._onDidDismiss && this._onDidDismiss(this._dismissData, this._dismissRole);
this._onDidDismiss = null;
this._dismissData = null;
this._dismissRole = null;
};
/**
* @hidden
* DOM WRITE
*/
ViewController.prototype._destroy = function (renderer) {
(void 0) /* assert */;
if (this._cmp) {
if (renderer) {
// ensure the element is cleaned up for when the view pool reuses this element
// ******** DOM WRITE ****************
var cmpEle = this._cmp.location.nativeElement;
renderer.setElementAttribute(cmpEle, 'class', null);
renderer.setElementAttribute(cmpEle, 'style', null);
}
window.removeEventListener('orientationchange', this.handleOrientationChange.bind(this));
// completely destroy this component. boom.
this._cmp.destroy();
}
this._nav = this._cmp = this.instance = this._cntDir = this._cntRef = this._leavingOpts = this._hdrDir = this._ftrDir = this._nb = this._onDidDismiss = this._onWillDismiss = null;
this._state = __WEBPACK_IMPORTED_MODULE_2__nav_util__["f" /* STATE_DESTROYED */];
};
/**
* @hidden
*/
ViewController.prototype._lifecycleTest = function (lifecycle) {
var instance = this.instance;
var methodName = 'ionViewCan' + lifecycle;
if (instance && instance[methodName]) {
try {
var result = instance[methodName]();
if (result instanceof Promise) {
return result;
}
else {
// Any value but explitic false, should be true
return Promise.resolve(result !== false);
}
}
catch (e) {
return Promise.reject(this.name + " " + methodName + " error: " + e.message);
}
}
return Promise.resolve(true);
};
/**
* @hidden
*/
ViewController.prototype._lifecycle = function (lifecycle) {
var instance = this.instance;
var methodName = 'ionView' + lifecycle;
if (instance && instance[methodName]) {
instance[methodName]();
}
};
ViewController.propDecorators = {
'_emitter': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
};
return ViewController;
}());
function isViewController(viewCtrl) {
return !!(viewCtrl && viewCtrl._didLoad && viewCtrl._willUnload);
}
var DEFAULT_CSS_CLASS = 'ion-page';
//# sourceMappingURL=view-controller.js.map
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var helpers = __webpack_require__(5);
module.exports = {
/**
* @private
*/
_set: function(scope, values) {
return helpers.merge(this[scope] || (this[scope] = {}), values);
}
};
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var root_1 = __webpack_require__(32);
var toSubscriber_1 = __webpack_require__(357);
var observable_1 = __webpack_require__(126);
var pipe_1 = __webpack_require__(359);
/**
* A representation of any set of values over any amount of time. This is the most basic building block
* of RxJS.
*
* @class Observable<T>
*/
var Observable = (function () {
/**
* @constructor
* @param {Function} subscribe the function that is called when the Observable is
* initially subscribed to. This function is given a Subscriber, to which new values
* can be `next`ed, or an `error` method can be called to raise an error, or
* `complete` can be called to notify of a successful completion.
*/
function Observable(subscribe) {
this._isScalar = false;
if (subscribe) {
this._subscribe = subscribe;
}
}
/**
* Creates a new Observable, with this Observable as the source, and the passed
* operator defined as the new observable's operator.
* @method lift
* @param {Operator} operator the operator defining the operation to take on the observable
* @return {Observable} a new observable with the Operator applied
*/
Observable.prototype.lift = function (operator) {
var observable = new Observable();
observable.source = this;
observable.operator = operator;
return observable;
};
/**
* Invokes an execution of an Observable and registers Observer handlers for notifications it will emit.
*
* <span class="informal">Use it when you have all these Observables, but still nothing is happening.</span>
*
* `subscribe` is not a regular operator, but a method that calls Observable's internal `subscribe` function. It
* might be for example a function that you passed to a {@link create} static factory, but most of the time it is
* a library implementation, which defines what and when will be emitted by an Observable. This means that calling
* `subscribe` is actually the moment when Observable starts its work, not when it is created, as it is often
* thought.
*
* Apart from starting the execution of an Observable, this method allows you to listen for values
* that an Observable emits, as well as for when it completes or errors. You can achieve this in two
* following ways.
*
* The first way is creating an object that implements {@link Observer} interface. It should have methods
* defined by that interface, but note that it should be just a regular JavaScript object, which you can create
* yourself in any way you want (ES6 class, classic function constructor, object literal etc.). In particular do
* not attempt to use any RxJS implementation details to create Observers - you don't need them. Remember also
* that your object does not have to implement all methods. If you find yourself creating a method that doesn't
* do anything, you can simply omit it. Note however, that if `error` method is not provided, all errors will
* be left uncaught.
*
* The second way is to give up on Observer object altogether and simply provide callback functions in place of its methods.
* This means you can provide three functions as arguments to `subscribe`, where first function is equivalent
* of a `next` method, second of an `error` method and third of a `complete` method. Just as in case of Observer,
* if you do not need to listen for something, you can omit a function, preferably by passing `undefined` or `null`,
* since `subscribe` recognizes these functions by where they were placed in function call. When it comes
* to `error` function, just as before, if not provided, errors emitted by an Observable will be thrown.
*
* Whatever style of calling `subscribe` you use, in both cases it returns a Subscription object.
* This object allows you to call `unsubscribe` on it, which in turn will stop work that an Observable does and will clean
* up all resources that an Observable used. Note that cancelling a subscription will not call `complete` callback
* provided to `subscribe` function, which is reserved for a regular completion signal that comes from an Observable.
*
* Remember that callbacks provided to `subscribe` are not guaranteed to be called asynchronously.
* It is an Observable itself that decides when these functions will be called. For example {@link of}
* by default emits all its values synchronously. Always check documentation for how given Observable
* will behave when subscribed and if its default behavior can be modified with a {@link Scheduler}.
*
* @example <caption>Subscribe with an Observer</caption>
* const sumObserver = {
* sum: 0,
* next(value) {
* console.log('Adding: ' + value);
* this.sum = this.sum + value;
* },
* error() { // We actually could just remove this method,
* }, // since we do not really care about errors right now.
* complete() {
* console.log('Sum equals: ' + this.sum);
* }
* };
*
* Rx.Observable.of(1, 2, 3) // Synchronously emits 1, 2, 3 and then completes.
* .subscribe(sumObserver);
*
* // Logs:
* // "Adding: 1"
* // "Adding: 2"
* // "Adding: 3"
* // "Sum equals: 6"
*
*
* @example <caption>Subscribe with functions</caption>
* let sum = 0;
*
* Rx.Observable.of(1, 2, 3)
* .subscribe(
* function(value) {
* console.log('Adding: ' + value);
* sum = sum + value;
* },
* undefined,
* function() {
* console.log('Sum equals: ' + sum);
* }
* );
*
* // Logs:
* // "Adding: 1"
* // "Adding: 2"
* // "Adding: 3"
* // "Sum equals: 6"
*
*
* @example <caption>Cancel a subscription</caption>
* const subscription = Rx.Observable.interval(1000).subscribe(
* num => console.log(num),
* undefined,
* () => console.log('completed!') // Will not be called, even
* ); // when cancelling subscription
*
*
* setTimeout(() => {
* subscription.unsubscribe();
* console.log('unsubscribed!');
* }, 2500);
*
* // Logs:
* // 0 after 1s
* // 1 after 2s
* // "unsubscribed!" after 2.5s
*
*
* @param {Observer|Function} observerOrNext (optional) Either an observer with methods to be called,
* or the first of three possible handlers, which is the handler for each value emitted from the subscribed
* Observable.
* @param {Function} error (optional) A handler for a terminal event resulting from an error. If no error handler is provided,
* the error will be thrown as unhandled.
* @param {Function} complete (optional) A handler for a terminal event resulting from successful completion.
* @return {ISubscription} a subscription reference to the registered handlers
* @method subscribe
*/
Observable.prototype.subscribe = function (observerOrNext, error, complete) {
var operator = this.operator;
var sink = toSubscriber_1.toSubscriber(observerOrNext, error, complete);
if (operator) {
operator.call(sink, this.source);
}
else {
sink.add(this.source ? this._subscribe(sink) : this._trySubscribe(sink));
}
if (sink.syncErrorThrowable) {
sink.syncErrorThrowable = false;
if (sink.syncErrorThrown) {
throw sink.syncErrorValue;
}
}
return sink;
};
Observable.prototype._trySubscribe = function (sink) {
try {
return this._subscribe(sink);
}
catch (err) {
sink.syncErrorThrown = true;
sink.syncErrorValue = err;
sink.error(err);
}
};
/**
* @method forEach
* @param {Function} next a handler for each value emitted by the observable
* @param {PromiseConstructor} [PromiseCtor] a constructor function used to instantiate the Promise
* @return {Promise} a promise that either resolves on observable completion or
* rejects with the handled error
*/
Observable.prototype.forEach = function (next, PromiseCtor) {
var _this = this;
if (!PromiseCtor) {
if (root_1.root.Rx && root_1.root.Rx.config && root_1.root.Rx.config.Promise) {
PromiseCtor = root_1.root.Rx.config.Promise;
}
else if (root_1.root.Promise) {
PromiseCtor = root_1.root.Promise;
}
}
if (!PromiseCtor) {
throw new Error('no Promise impl found');
}
return new PromiseCtor(function (resolve, reject) {
// Must be declared in a separate statement to avoid a RefernceError when
// accessing subscription below in the closure due to Temporal Dead Zone.
var subscription;
subscription = _this.subscribe(function (value) {
if (subscription) {
// if there is a subscription, then we can surmise
// the next handling is asynchronous. Any errors thrown
// need to be rejected explicitly and unsubscribe must be
// called manually
try {
next(value);
}
catch (err) {
reject(err);
subscription.unsubscribe();
}
}
else {
// if there is NO subscription, then we're getting a nexted
// value synchronously during subscription. We can just call it.
// If it errors, Observable's `subscribe` will ensure the
// unsubscription logic is called, then synchronously rethrow the error.
// After that, Promise will trap the error and send it
// down the rejection path.
next(value);
}
}, reject, resolve);
});
};
Observable.prototype._subscribe = function (subscriber) {
return this.source.subscribe(subscriber);
};
/**
* An interop point defined by the es7-observable spec https://github.com/zenparsing/es-observable
* @method Symbol.observable
* @return {Observable} this instance of the observable
*/
Observable.prototype[observable_1.observable] = function () {
return this;
};
/* tslint:enable:max-line-length */
/**
* Used to stitch together functional operators into a chain.
* @method pipe
* @return {Observable} the Observable result of all of the operators having
* been called in the order they were passed in.
*
* @example
*
* import { map, filter, scan } from 'rxjs/operators';
*
* Rx.Observable.interval(1000)
* .pipe(
* filter(x => x % 2 === 0),
* map(x => x + x),
* scan((acc, x) => acc + x)
* )
* .subscribe(x => console.log(x))
*/
Observable.prototype.pipe = function () {
var operations = [];
for (var _i = 0; _i < arguments.length; _i++) {
operations[_i - 0] = arguments[_i];
}
if (operations.length === 0) {
return this;
}
return pipe_1.pipeFromArray(operations)(this);
};
/* tslint:enable:max-line-length */
Observable.prototype.toPromise = function (PromiseCtor) {
var _this = this;
if (!PromiseCtor) {
if (root_1.root.Rx && root_1.root.Rx.config && root_1.root.Rx.config.Promise) {
PromiseCtor = root_1.root.Rx.config.Promise;
}
else if (root_1.root.Promise) {
PromiseCtor = root_1.root.Promise;
}
}
if (!PromiseCtor) {
throw new Error('no Promise impl found');
}
return new PromiseCtor(function (resolve, reject) {
var value;
_this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); });
});
};
// HACK: Since TypeScript inherits static properties too, we have to
// fight against TypeScript here so Subject can have a different static create signature
/**
* Creates a new cold Observable by calling the Observable constructor
* @static true
* @owner Observable
* @method create
* @param {Function} subscribe? the subscriber function to be passed to the Observable constructor
* @return {Observable} a new cold observable
*/
Observable.create = function (subscribe) {
return new Observable(subscribe);
};
return Observable;
}());
exports.Observable = Observable;
//# sourceMappingURL=Observable.js.map
/***/ }),
/* 10 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return App; });
/* unused harmony export getNavByIdOrName */
/* unused harmony export findTopNavs */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_platform_browser__ = __webpack_require__(33);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__app_constants__ = __webpack_require__(44);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__navigation_nav_util__ = __webpack_require__(26);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__menu_controller__ = __webpack_require__(34);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__platform_platform__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__transitions_transition_ios__ = __webpack_require__(383);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__transitions_transition_md__ = __webpack_require__(384);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__transitions_transition_wp__ = __webpack_require__(385);
/**
* @name App
* @description
* App is a utility class used in Ionic to get information about various aspects of an app
*/
var App = (function () {
function App(_config, _plt, _menuCtrl) {
this._config = _config;
this._plt = _plt;
this._menuCtrl = _menuCtrl;
this._disTime = 0;
this._scrollTime = 0;
this._title = '';
this._titleSrv = new __WEBPACK_IMPORTED_MODULE_1__angular_platform_browser__["f" /* Title */](__WEBPACK_IMPORTED_MODULE_1__angular_platform_browser__["b" /* DOCUMENT */]);
this._rootNavs = new Map();
this._didScroll = false;
/**
* Observable that emits whenever a view loads in the app.
* @returns {Observable} Returns an observable
*/
this.viewDidLoad = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* Observable that emits before any view is entered in the app.
* @returns {Observable} Returns an observable
*/
this.viewWillEnter = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* Observable that emits after any view is entered in the app.
* @returns {Observable} Returns an observable
*/
this.viewDidEnter = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* Observable that emits before any view is exited in the app.
* @returns {Observable} Returns an observable
*/
this.viewWillLeave = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* Observable that emits after any view is exited in the app.
* @returns {Observable} Returns an observable
*/
this.viewDidLeave = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* Observable that emits before any view unloads in the app.
* @returns {Observable} Returns an observable
*/
this.viewWillUnload = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
// listen for hardware back button events
// register this back button action with a default priority
_plt.registerBackButtonAction(this.goBack.bind(this));
this._disableScrollAssist = _config.getBoolean('disableScrollAssist', false);
var blurring = _config.getBoolean('inputBlurring', false);
if (blurring) {
this._enableInputBlurring();
}
(void 0) /* runInDev */;
_config.setTransition('ios-transition', __WEBPACK_IMPORTED_MODULE_7__transitions_transition_ios__["a" /* IOSTransition */]);
_config.setTransition('md-transition', __WEBPACK_IMPORTED_MODULE_8__transitions_transition_md__["a" /* MDTransition */]);
_config.setTransition('wp-transition', __WEBPACK_IMPORTED_MODULE_9__transitions_transition_wp__["a" /* WPTransition */]);
}
/**
* Sets the document title.
* @param {string} val Value to set the document title to.
*/
App.prototype.setTitle = function (val) {
if (val !== this._title) {
this._title = val;
this._titleSrv.setTitle(val);
}
};
/**
* @hidden
*/
App.prototype.setElementClass = function (className, isAdd) {
this._appRoot.setElementClass(className, isAdd);
};
/**
* @hidden
* Sets if the app is currently enabled or not, meaning if it's
* available to accept new user commands. For example, this is set to `false`
* while views transition, a modal slides up, an action-sheet
* slides up, etc. After the transition completes it is set back to `true`.
* @param {boolean} isEnabled `true` for enabled, `false` for disabled
* @param {number} duration When `isEnabled` is set to `false`, this argument
* is used to set the maximum number of milliseconds that app will wait until
* it will automatically enable the app again. It's basically a fallback incase
* something goes wrong during a transition and the app wasn't re-enabled correctly.
*/
App.prototype.setEnabled = function (isEnabled, duration, minDuration) {
if (duration === void 0) { duration = 700; }
if (minDuration === void 0) { minDuration = 0; }
this._disTime = (isEnabled ? 0 : Date.now() + duration);
if (this._clickBlock) {
if (isEnabled) {
// disable the click block if it's enabled, or the duration is tiny
this._clickBlock.activate(false, CLICK_BLOCK_BUFFER_IN_MILLIS, minDuration);
}
else {
// show the click block for duration + some number
this._clickBlock.activate(true, duration + CLICK_BLOCK_BUFFER_IN_MILLIS, minDuration);
}
}
};
/**
* @hidden
* Toggles whether an application can be scrolled
* @param {boolean} disableScroll when set to `false`, the application's
* scrolling is enabled. When set to `true`, scrolling is disabled.
*/
App.prototype._setDisableScroll = function (disableScroll) {
if (this._disableScrollAssist) {
this._appRoot._disableScroll(disableScroll);
}
};
/**
* @hidden
* Boolean if the app is actively enabled or not.
* @return {boolean}
*/
App.prototype.isEnabled = function () {
var disTime = this._disTime;
if (disTime === 0) {
return true;
}
return (disTime < Date.now());
};
/**
* @hidden
*/
App.prototype.setScrolling = function () {
this._scrollTime = Date.now() + ACTIVE_SCROLLING_TIME;
this._didScroll = true;
};
/**
* Boolean if the app is actively scrolling or not.
* @return {boolean} returns true or false
*/
App.prototype.isScrolling = function () {
var scrollTime = this._scrollTime;
if (scrollTime === 0) {
return false;
}
if (scrollTime < Date.now()) {
this._scrollTime = 0;
return false;
}
return true;
};
/**
* @return {NavController} Returns the first Active Nav Controller from the list. This method is deprecated
*/
App.prototype.getActiveNav = function () {
console.warn('(getActiveNav) is deprecated and will be removed in the next major release. Use getActiveNavs instead.');
var navs = this.getActiveNavs();
if (navs && navs.length) {
return navs[0];
}
return null;
};
/**
* @return {NavController[]} Returns the active NavControllers. Using this method is preferred when we need access to the top-level navigation controller while on the outside views and handlers like `registerBackButtonAction()`
*/
App.prototype.getActiveNavs = function (rootNavId) {
var portal = this._appRoot._getPortal(__WEBPACK_IMPORTED_MODULE_2__app_constants__["c" /* PORTAL_MODAL */]);
if (portal.length() > 0) {
return findTopNavs(portal);
}
if (!this._rootNavs || !this._rootNavs.size) {
return [];
}
if (this._rootNavs.size === 1) {
return findTopNavs(this._rootNavs.values().next().value);
}
if (rootNavId) {
return findTopNavs(this._rootNavs.get(rootNavId));
}
// fallback to just using all root names
var activeNavs = [];
this._rootNavs.forEach(function (nav) {
var topNavs = findTopNavs(nav);
activeNavs = activeNavs.concat(topNavs);
});
return activeNavs;
};
App.prototype.getRootNav = function () {
console.warn('(getRootNav) is deprecated and will be removed in the next major release. Use getRootNavById instead.');
var rootNavs = this.getRootNavs();
if (rootNavs.length === 0) {
return null;
}
else if (rootNavs.length > 1) {
console.warn('(getRootNav) there are multiple root navs, use getRootNavs instead');
}
return rootNavs[0];
};
App.prototype.getRootNavs = function () {
var navs = [];
this._rootNavs.forEach(function (nav) { return navs.push(nav); });
return navs;
};
/**
* @return {NavController} Returns the root NavController
*/
App.prototype.getRootNavById = function (navId) {
return this._rootNavs.get(navId);
};
/**
* @hidden
*/
App.prototype.registerRootNav = function (nav) {
this._rootNavs.set(nav.id, nav);
};
/**
* @hidden
*/
App.prototype.unregisterRootNav = function (nav) {
this._rootNavs.delete(nav.id);
};
App.prototype.getActiveNavContainers = function () {
// for each root nav container, get it's active nav
var list = [];
this._rootNavs.forEach(function (container) {
list = list.concat(findTopNavs(container));
});
return list;
};
/**
* @hidden
*/
App.prototype.present = function (enteringView, opts, appPortal) {
(void 0) /* assert */;
var portal = this._appRoot._getPortal(appPortal);
// Set Nav must be set here in order to dimiss() work synchnously.
// TODO: move _setNav() to the earlier stages of NavController. _queueTrns()
enteringView._setNav(portal);
opts.direction = __WEBPACK_IMPORTED_MODULE_4__navigation_nav_util__["b" /* DIRECTION_FORWARD */];
if (!opts.animation) {
opts.animation = enteringView.getTransitionName(__WEBPACK_IMPORTED_MODULE_4__navigation_nav_util__["b" /* DIRECTION_FORWARD */]);
}
enteringView.setLeavingOpts({
keyboardClose: opts.keyboardClose,
direction: __WEBPACK_IMPORTED_MODULE_4__navigation_nav_util__["a" /* DIRECTION_BACK */],
animation: enteringView.getTransitionName(__WEBPACK_IMPORTED_MODULE_4__navigation_nav_util__["a" /* DIRECTION_BACK */]),
ev: opts.ev
});
return portal.insertPages(-1, [enteringView], opts);
};
/**
* @hidden
*/
App.prototype.goBack = function () {
if (this._menuCtrl && this._menuCtrl.isOpen()) {
return this._menuCtrl.close();
}
var navPromise = this.navPop();
if (!navPromise) {
// no views to go back to
// let's exit the app
if (this._config.getBoolean('navExitApp', true)) {
(void 0) /* console.debug */;
this._plt.exitApp();
}
}
return navPromise;
};
/**
* @hidden
*/
App.prototype.navPop = function () {
var _this = this;
if (!this._rootNavs || this._rootNavs.size === 0 || !this.isEnabled()) {
return Promise.resolve();
}
// If there are any alert/actionsheet open, let's do nothing
var portal = this._appRoot._getPortal(__WEBPACK_IMPORTED_MODULE_2__app_constants__["a" /* PORTAL_DEFAULT */]);
if (portal.length() > 0) {
return Promise.resolve();
}
var navToPop = null;
var mostRecentVC = null;
this._rootNavs.forEach(function (navContainer) {
var activeNavs = _this.getActiveNavs(navContainer.id);
var poppableNavs = activeNavs.map(function (activeNav) { return getPoppableNav(activeNav); }).filter(function (nav) { return !!nav; });
poppableNavs.forEach(function (poppable) {
var topViewController = poppable.last();
if (poppable._isPortal || (topViewController && poppable.length() > 1 && (!mostRecentVC || topViewController._ts >= mostRecentVC._ts))) {
mostRecentVC = topViewController;
navToPop = poppable;
}
});
});
if (navToPop) {
return navToPop.pop();
}
};
/**
* @hidden
*/
App.prototype._enableInputBlurring = function () {
(void 0) /* console.debug */;
var focused = true;
var self = this;
var platform = this._plt;
platform.registerListener(platform.doc(), 'focusin', onFocusin, { capture: true, zone: false, passive: true });
platform.registerListener(platform.doc(), 'touchend', onTouchend, { capture: false, zone: false, passive: true });
function onFocusin() {
focused = true;
}
function onTouchend(ev) {
// if app did scroll return early
if (self._didScroll) {
self._didScroll = false;
return;
}
var active = self._plt.getActiveElement();
if (!active) {
return;
}
// only blur if the active element is a text-input or a textarea
if (SKIP_BLURRING.indexOf(active.tagName) === -1) {
return;
}
// if the selected target is the active element, do not blur
var tapped = ev.target;
if (tapped === active) {
return;
}
if (SKIP_BLURRING.indexOf(tapped.tagName) >= 0) {
return;
}
// skip if div is a cover
if (tapped.classList.contains('input-cover')) {
return;
}
focused = false;
// TODO: find a better way, why 50ms?
platform.timeout(function () {
if (!focused) {
active.blur();
}
}, 50);
}
};
App.prototype.getNavByIdOrName = function (id) {
var navs = Array.from(this._rootNavs.values());
for (var _i = 0, navs_1 = navs; _i < navs_1.length; _i++) {
var navContainer = navs_1[_i];
var match = getNavByIdOrName(navContainer, id);
if (match) {
return match;
}
}
return null;
};
App.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
App.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_3__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_6__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_5__menu_controller__["a" /* MenuController */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
]; };
return App;
}());
function getNavByIdOrName(nav, id) {
if (nav.id === id || nav.name === id) {
return nav;
}
for (var _i = 0, _a = nav.getAllChildNavs(); _i < _a.length; _i++) {
var child = _a[_i];
var tmp = getNavByIdOrName(child, id);
if (tmp) {
return tmp;
}
}
return null;
}
function getPoppableNav(nav) {
if (!nav) {
return null;
}
if (Object(__WEBPACK_IMPORTED_MODULE_4__navigation_nav_util__["m" /* isTabs */])(nav)) {
// tabs aren't a nav, so just call this function again immediately on the parent on tabs
return getPoppableNav(nav.parent);
}
var len = nav.length();
if (len > 1 || (nav._isPortal && len > 0)) {
// this nav controller has more than one view
// use this nav!
return nav;
}
// try again using the parent nav (if there is one)
return getPoppableNav(nav.parent);
}
function findTopNavs(nav) {
var containers = [];
var childNavs = nav.getActiveChildNavs();
if (!childNavs || !childNavs.length) {
containers.push(nav);
}
else {
childNavs.forEach(function (childNav) {
var topNavs = findTopNavs(childNav);
containers = containers.concat(topNavs);
});
}
return containers;
}
var SKIP_BLURRING = ['INPUT', 'TEXTAREA', 'ION-INPUT', 'ION-TEXTAREA'];
var ACTIVE_SCROLLING_TIME = 100;
var CLICK_BLOCK_BUFFER_IN_MILLIS = 64;
//# sourceMappingURL=app.js.map
/***/ }),
/* 11 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return GESTURE_GO_BACK_SWIPE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return GESTURE_MENU_SWIPE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return GESTURE_ITEM_SWIPE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return GESTURE_REFRESHER; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return GESTURE_TOGGLE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return GESTURE_PRIORITY_SLIDING_ITEM; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return GESTURE_PRIORITY_REFRESHER; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return GESTURE_PRIORITY_MENU_SWIPE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return GESTURE_PRIORITY_GO_BACK_SWIPE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return GESTURE_PRIORITY_TOGGLE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BLOCK_ALL; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return GestureController; });
/* unused harmony export GestureDelegate */
/* unused harmony export BlockerDelegate */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__components_app_app__ = __webpack_require__(10);
/** @hidden */
var GESTURE_GO_BACK_SWIPE = 'goback-swipe';
/** @hidden */
var GESTURE_MENU_SWIPE = 'menu-swipe';
/** @hidden */
var GESTURE_ITEM_SWIPE = 'item-swipe';
/** @hidden */
var GESTURE_REFRESHER = 'refresher';
/** @hidden */
var GESTURE_TOGGLE = 'toggle';
/** @hidden */
var GESTURE_PRIORITY_SLIDING_ITEM = -10;
/** @hidden */
var GESTURE_PRIORITY_REFRESHER = 0;
/** @hidden */
var GESTURE_PRIORITY_MENU_SWIPE = 10;
/** @hidden */
var GESTURE_PRIORITY_GO_BACK_SWIPE = 20;
/** @hidden */
var GESTURE_PRIORITY_TOGGLE = 30;
/**
* @hidden
*/
var BLOCK_ALL = {
disable: [GESTURE_MENU_SWIPE, GESTURE_GO_BACK_SWIPE],
disableScroll: true
};
/**
* @hidden
*/
var GestureController = (function () {
function GestureController(_app) {
this._app = _app;
this.id = 1;
this.requestedStart = {};
this.disabledGestures = {};
this.disabledScroll = new Set();
this.capturedID = null;
}
GestureController.prototype.createGesture = function (opts) {
if (!opts.name) {
throw new Error('name is undefined');
}
return new GestureDelegate(opts.name, this.newID(), this, opts.priority || 0, !!opts.disableScroll);
};
GestureController.prototype.createBlocker = function (opts) {
if (opts === void 0) { opts = {}; }
return new BlockerDelegate(this.newID(), this, opts.disable, !!opts.disableScroll);
};
GestureController.prototype.newID = function () {
var id = this.id;
this.id++;
return id;
};
GestureController.prototype.start = function (gestureName, id, priority) {
if (!this.canStart(gestureName)) {
delete this.requestedStart[id];
return false;
}
this.requestedStart[id] = priority;
return true;
};
GestureController.prototype.capture = function (gestureName, id, priority) {
if (!this.start(gestureName, id, priority)) {
return false;
}
var requestedStart = this.requestedStart;
var maxPriority = -10000;
for (var gestureID in requestedStart) {
maxPriority = Math.max(maxPriority, requestedStart[gestureID]);
}
if (maxPriority === priority) {
this.capturedID = id;
this.requestedStart = {};
(void 0) /* console.debug */;
return true;
}
delete requestedStart[id];
(void 0) /* console.debug */;
return false;
};
GestureController.prototype.release = function (id) {
delete this.requestedStart[id];
if (this.capturedID && id === this.capturedID) {
this.capturedID = null;
}
};
GestureController.prototype.disableGesture = function (gestureName, id) {
var set = this.disabledGestures[gestureName];
if (!set) {
set = new Set();
this.disabledGestures[gestureName] = set;
}
set.add(id);
};
GestureController.prototype.enableGesture = function (gestureName, id) {
var set = this.disabledGestures[gestureName];
if (set) {
set.delete(id);
}
};
GestureController.prototype.disableScroll = function (id) {
var isEnabled = !this.isScrollDisabled();
this.disabledScroll.add(id);
if (this._app && isEnabled && this.isScrollDisabled()) {
(void 0) /* console.debug */;
this._app._setDisableScroll(true);
}
};
GestureController.prototype.enableScroll = function (id) {
var isDisabled = this.isScrollDisabled();
this.disabledScroll.delete(id);
if (this._app && isDisabled && !this.isScrollDisabled()) {
(void 0) /* console.debug */;
this._app._setDisableScroll(false);
}
};
GestureController.prototype.canStart = function (gestureName) {
if (this.capturedID) {
(void 0) /* console.debug */;
// a gesture already captured
return false;
}
if (this.isDisabled(gestureName)) {
(void 0) /* console.debug */;
return false;
}
return true;
};
GestureController.prototype.isCaptured = function () {
return !!this.capturedID;
};
GestureController.prototype.isScrollDisabled = function () {
return this.disabledScroll.size > 0;
};
GestureController.prototype.isDisabled = function (gestureName) {
var disabled = this.disabledGestures[gestureName];
return !!(disabled && disabled.size > 0);
};
GestureController.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
GestureController.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__components_app_app__["a" /* App */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["z" /* Inject */], args: [Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_14" /* forwardRef */])(function () { return __WEBPACK_IMPORTED_MODULE_1__components_app_app__["a" /* App */]; }),] },] },
]; };
return GestureController;
}());
/**
* @hidden
*/
var GestureDelegate = (function () {
function GestureDelegate(name, id, controller, priority, disableScroll) {
this.name = name;
this.id = id;
this.controller = controller;
this.priority = priority;
this.disableScroll = disableScroll;
}
GestureDelegate.prototype.canStart = function () {
if (!this.controller) {
(void 0) /* assert */;
return false;
}
return this.controller.canStart(this.name);
};
GestureDelegate.prototype.start = function () {
if (!this.controller) {
(void 0) /* assert */;
return false;
}
return this.controller.start(this.name, this.id, this.priority);
};
GestureDelegate.prototype.capture = function () {
if (!this.controller) {
(void 0) /* assert */;
return false;
}
var captured = this.controller.capture(this.name, this.id, this.priority);
if (captured && this.disableScroll) {
this.controller.disableScroll(this.id);
}
return captured;
};
GestureDelegate.prototype.release = function () {
if (!this.controller) {
(void 0) /* assert */;
return;
}
this.controller.release(this.id);
if (this.disableScroll) {
this.controller.enableScroll(this.id);
}
};
GestureDelegate.prototype.destroy = function () {
this.release();
this.controller = null;
};
return GestureDelegate;
}());
/**
* @hidden
*/
var BlockerDelegate = (function () {
function BlockerDelegate(id, controller, disable, disableScroll) {
this.id = id;
this.controller = controller;
this.disable = disable;
this.disableScroll = disableScroll;
this.blocked = false;
}
BlockerDelegate.prototype.block = function () {
var _this = this;
if (!this.controller) {
(void 0) /* assert */;
return;
}
if (this.disable) {
this.disable.forEach(function (gesture) {
_this.controller.disableGesture(gesture, _this.id);
});
}
if (this.disableScroll) {
this.controller.disableScroll(this.id);
}
this.blocked = true;
};
BlockerDelegate.prototype.unblock = function () {
var _this = this;
if (!this.controller) {
(void 0) /* assert */;
return;
}
if (this.disable) {
this.disable.forEach(function (gesture) {
_this.controller.enableGesture(gesture, _this.id);
});
}
if (this.disableScroll) {
this.controller.enableScroll(this.id);
}
this.blocked = false;
};
BlockerDelegate.prototype.destroy = function () {
this.unblock();
this.controller = null;
};
return BlockerDelegate;
}());
//# sourceMappingURL=gesture-controller.js.map
/***/ }),
/* 12 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export DomDebouncer */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DomController; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__platform__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_util__ = __webpack_require__(3);
/**
* Adopted from FastDom
* https://github.com/wilsonpage/fastdom
* MIT License
*/
/**
* @hidden
*/
var DomDebouncer = (function () {
function DomDebouncer(dom) {
this.dom = dom;
this.writeTask = null;
this.readTask = null;
}
DomDebouncer.prototype.read = function (fn) {
var _this = this;
if (this.readTask) {
return;
}
return this.readTask = this.dom.read(function (t) {
_this.readTask = null;
fn(t);
});
};
DomDebouncer.prototype.write = function (fn) {
var _this = this;
if (this.writeTask) {
return;
}
return this.writeTask = this.dom.write(function (t) {
_this.writeTask = null;
fn(t);
});
};
DomDebouncer.prototype.cancel = function () {
var writeTask = this.writeTask;
writeTask && this.dom.cancel(writeTask);
var readTask = this.readTask;
readTask && this.dom.cancel(readTask);
this.readTask = this.writeTask = null;
};
return DomDebouncer;
}());
/**
* @hidden
*/
var DomController = (function () {
function DomController(plt) {
this.plt = plt;
this.r = [];
this.w = [];
}
DomController.prototype.debouncer = function () {
return new DomDebouncer(this);
};
DomController.prototype.read = function (fn, timeout) {
var _this = this;
if (timeout) {
fn.timeoutId = this.plt.timeout(function () {
_this.r.push(fn);
_this._queue();
}, timeout);
}
else {
this.r.push(fn);
this._queue();
}
return fn;
};
DomController.prototype.write = function (fn, timeout) {
var _this = this;
if (timeout) {
fn.timeoutId = this.plt.timeout(function () {
_this.w.push(fn);
_this._queue();
}, timeout);
}
else {
this.w.push(fn);
this._queue();
}
return fn;
};
DomController.prototype.cancel = function (fn) {
if (fn) {
if (fn.timeoutId) {
this.plt.cancelTimeout(fn.timeoutId);
}
Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["q" /* removeArrayItem */])(this.r, fn) || Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["q" /* removeArrayItem */])(this.w, fn);
}
};
DomController.prototype._queue = function () {
var self = this;
if (!self.q) {
self.q = true;
self.plt.raf(function rafCallback(timeStamp) {
self._flush(timeStamp);
});
}
};
DomController.prototype._flush = function (timeStamp) {
var err;
try {
dispatch(timeStamp, this.r, this.w);
}
catch (e) {
err = e;
}
this.q = false;
if (this.r.length || this.w.length) {
this._queue();
}
if (err) {
throw err;
}
};
DomController.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
DomController.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__platform__["a" /* Platform */], },
]; };
return DomController;
}());
function dispatch(timeStamp, r, w) {
var fn;
// ******** DOM READS ****************
while (fn = r.shift()) {
fn(timeStamp);
}
// ******** DOM WRITES ****************
while (fn = w.shift()) {
fn(timeStamp);
}
}
//# sourceMappingURL=dom-controller.js.map
/***/ }),
/* 13 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__components_app_app_root__ = __webpack_require__(75);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_0__components_app_app_root__["b"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__components_app_menu_controller__ = __webpack_require__(34);
/* unused harmony reexport MenuController */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__components_action_sheet_action_sheet__ = __webpack_require__(77);
/* unused harmony reexport ActionSheet */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__components_action_sheet_action_sheet_controller__ = __webpack_require__(138);
/* unused harmony reexport ActionSheetController */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__components_action_sheet_action_sheet_component__ = __webpack_require__(78);
/* unused harmony reexport ActionSheetCmp */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__components_alert_alert__ = __webpack_require__(79);
/* unused harmony reexport Alert */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__components_alert_alert_controller__ = __webpack_require__(139);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_6__components_alert_alert_controller__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__components_alert_alert_component__ = __webpack_require__(80);
/* unused harmony reexport AlertCmp */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__components_app_app__ = __webpack_require__(10);
/* unused harmony reexport App */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__components_avatar_avatar__ = __webpack_require__(140);
/* unused harmony reexport Avatar */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__components_backdrop_backdrop__ = __webpack_require__(81);
/* unused harmony reexport Backdrop */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__components_badge_badge__ = __webpack_require__(141);
/* unused harmony reexport Badge */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__components_button_button__ = __webpack_require__(45);
/* unused harmony reexport Button */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__components_card_card__ = __webpack_require__(142);
/* unused harmony reexport Card */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__components_card_card_content__ = __webpack_require__(143);
/* unused harmony reexport CardContent */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__components_card_card_header__ = __webpack_require__(144);
/* unused harmony reexport CardHeader */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__components_card_card_title__ = __webpack_require__(145);
/* unused harmony reexport CardTitle */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__components_checkbox_checkbox__ = __webpack_require__(146);
/* unused harmony reexport Checkbox */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__components_chip_chip__ = __webpack_require__(150);
/* unused harmony reexport Chip */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__components_content_content__ = __webpack_require__(24);
/* unused harmony reexport Content */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__components_datetime_datetime__ = __webpack_require__(151);
/* unused harmony reexport DateTime */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__components_fab_fab__ = __webpack_require__(56);
/* unused harmony reexport FabButton */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__components_fab_fab_container__ = __webpack_require__(153);
/* unused harmony reexport FabContainer */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__components_fab_fab_list__ = __webpack_require__(88);
/* unused harmony reexport FabList */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__components_grid_col__ = __webpack_require__(154);
/* unused harmony reexport Col */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__components_grid_grid__ = __webpack_require__(155);
/* unused harmony reexport Grid */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__components_grid_row__ = __webpack_require__(156);
/* unused harmony reexport Row */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__components_ion__ = __webpack_require__(6);
/* unused harmony reexport Ion */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__components_icon_icon__ = __webpack_require__(82);
/* unused harmony reexport Icon */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__components_img_img__ = __webpack_require__(157);
/* unused harmony reexport Img */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__components_infinite_scroll_infinite_scroll__ = __webpack_require__(89);
/* unused harmony reexport InfiniteScroll */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__components_infinite_scroll_infinite_scroll_content__ = __webpack_require__(158);
/* unused harmony reexport InfiniteScrollContent */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_32__components_input_input__ = __webpack_require__(159);
/* unused harmony reexport TextInput */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_33__components_item_item__ = __webpack_require__(21);
/* unused harmony reexport Item */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_34__components_item_item_content__ = __webpack_require__(161);
/* unused harmony reexport ItemContent */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_35__components_item_item_divider__ = __webpack_require__(162);
/* unused harmony reexport ItemDivider */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_36__components_item_item_group__ = __webpack_require__(163);
/* unused harmony reexport ItemGroup */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_37__components_item_item_options__ = __webpack_require__(90);
/* unused harmony reexport ItemOptions */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_38__components_item_item_reorder__ = __webpack_require__(84);
/* unused harmony reexport ItemReorder */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_39__components_item_item_sliding__ = __webpack_require__(164);
/* unused harmony reexport ItemSliding */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_40__components_item_reorder__ = __webpack_require__(165);
/* unused harmony reexport Reorder */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_41__components_label_label__ = __webpack_require__(83);
/* unused harmony reexport Label */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_42__components_list_list__ = __webpack_require__(91);
/* unused harmony reexport List */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_43__components_list_list_header__ = __webpack_require__(92);
/* unused harmony reexport ListHeader */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_44__components_loading_loading__ = __webpack_require__(166);
/* unused harmony reexport Loading */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_45__components_loading_loading_controller__ = __webpack_require__(167);
/* unused harmony reexport LoadingController */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_46__components_loading_loading_component__ = __webpack_require__(93);
/* unused harmony reexport LoadingCmp */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_47__components_menu_menu__ = __webpack_require__(168);
/* unused harmony reexport Menu */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_48__components_menu_menu_close__ = __webpack_require__(169);
/* unused harmony reexport MenuClose */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_49__components_menu_menu_toggle__ = __webpack_require__(170);
/* unused harmony reexport MenuToggle */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_50__components_menu_menu_types__ = __webpack_require__(399);
/* unused harmony reexport MenuType */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_51__components_modal_modal__ = __webpack_require__(172);
/* unused harmony reexport Modal */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_52__components_modal_modal_component__ = __webpack_require__(95);
/* unused harmony reexport ModalCmp */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_53__components_modal_modal_controller__ = __webpack_require__(313);
/* unused harmony reexport ModalController */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_54__components_nav_nav__ = __webpack_require__(94);
/* unused harmony reexport Nav */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_55__components_nav_nav_pop__ = __webpack_require__(101);
/* unused harmony reexport NavPop */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_56__components_nav_nav_pop_anchor__ = __webpack_require__(314);
/* unused harmony reexport NavPopAnchor */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_57__components_nav_nav_push__ = __webpack_require__(102);
/* unused harmony reexport NavPush */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_58__components_nav_nav_push_anchor__ = __webpack_require__(315);
/* unused harmony reexport NavPushAnchor */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_59__components_note_note__ = __webpack_require__(316);
/* unused harmony reexport Note */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_60__components_option_option__ = __webpack_require__(103);
/* unused harmony reexport Option */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_61__components_picker_picker__ = __webpack_require__(152);
/* unused harmony reexport Picker */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_62__components_picker_picker_component__ = __webpack_require__(86);
/* unused harmony reexport PickerCmp */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_63__components_picker_picker_column__ = __webpack_require__(87);
/* unused harmony reexport PickerColumnCmp */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_64__components_picker_picker_controller__ = __webpack_require__(85);
/* unused harmony reexport PickerController */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_65__components_popover_popover__ = __webpack_require__(104);
/* unused harmony reexport Popover */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_66__components_popover_popover_component__ = __webpack_require__(105);
/* unused harmony reexport PopoverCmp */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_67__components_popover_popover_controller__ = __webpack_require__(317);
/* unused harmony reexport PopoverController */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_68__components_radio_radio_button__ = __webpack_require__(318);
/* unused harmony reexport RadioButton */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_69__components_radio_radio_group__ = __webpack_require__(106);
/* unused harmony reexport RadioGroup */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_70__components_range_range__ = __webpack_require__(319);
/* unused harmony reexport Range */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_71__components_range_range_knob__ = __webpack_require__(320);
/* unused harmony reexport RangeKnob */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_72__components_refresher_refresher__ = __webpack_require__(107);
/* unused harmony reexport Refresher */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_73__components_refresher_refresher_content__ = __webpack_require__(321);
/* unused harmony reexport RefresherContent */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_74__components_scroll_scroll__ = __webpack_require__(322);
/* unused harmony reexport Scroll */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_75__components_searchbar_searchbar__ = __webpack_require__(323);
/* unused harmony reexport Searchbar */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_76__components_segment_segment__ = __webpack_require__(324);
/* unused harmony reexport Segment */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_77__components_segment_segment_button__ = __webpack_require__(108);
/* unused harmony reexport SegmentButton */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_78__components_select_select__ = __webpack_require__(325);
/* unused harmony reexport Select */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_79__components_select_select_popover_component__ = __webpack_require__(109);
/* unused harmony reexport SelectPopover */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_80__components_show_hide_when_show_when__ = __webpack_require__(326);
/* unused harmony reexport ShowWhen */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_81__components_show_hide_when_display_when__ = __webpack_require__(110);
/* unused harmony reexport DisplayWhen */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_82__components_show_hide_when_hide_when__ = __webpack_require__(327);
/* unused harmony reexport HideWhen */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_83__components_slides_slide__ = __webpack_require__(328);
/* unused harmony reexport Slide */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_84__components_slides_slides__ = __webpack_require__(111);
/* unused harmony reexport Slides */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_85__components_spinner_spinner__ = __webpack_require__(332);
/* unused harmony reexport Spinner */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_86__components_split_pane_split_pane__ = __webpack_require__(48);
/* unused harmony reexport SplitPane */
/* unused harmony reexport RootNode */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_87__components_tabs_tab__ = __webpack_require__(333);
/* unused harmony reexport Tab */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_88__components_tabs_tab_button__ = __webpack_require__(334);
/* unused harmony reexport TabButton */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_89__components_tabs_tab_highlight__ = __webpack_require__(117);
/* unused harmony reexport TabHighlight */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_90__components_tabs_tabs__ = __webpack_require__(116);
/* unused harmony reexport Tabs */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_91__components_toast_toast__ = __webpack_require__(335);
/* unused harmony reexport Toast */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_92__components_toast_toast_component__ = __webpack_require__(118);
/* unused harmony reexport ToastCmp */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_93__components_toast_toast_controller__ = __webpack_require__(336);
/* unused harmony reexport ToastController */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_94__components_toggle_toggle__ = __webpack_require__(337);
/* unused harmony reexport Toggle */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_95__components_toolbar_toolbar_footer__ = __webpack_require__(338);
/* unused harmony reexport Footer */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_96__components_toolbar_toolbar_header__ = __webpack_require__(339);
/* unused harmony reexport Header */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_97__components_toolbar_toolbar__ = __webpack_require__(67);
/* unused harmony reexport Toolbar */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_98__components_toolbar_toolbar_item__ = __webpack_require__(340);
/* unused harmony reexport ToolbarItem */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_99__components_toolbar_toolbar_title__ = __webpack_require__(341);
/* unused harmony reexport ToolbarTitle */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_100__components_toolbar_navbar__ = __webpack_require__(49);
/* unused harmony reexport Navbar */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_101__components_thumbnail_thumbnail__ = __webpack_require__(342);
/* unused harmony reexport Thumbnail */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_102__components_typography_typography__ = __webpack_require__(343);
/* unused harmony reexport Typography */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_103__components_virtual_scroll_virtual_footer__ = __webpack_require__(119);
/* unused harmony reexport VirtualFooter */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_104__components_virtual_scroll_virtual_header__ = __webpack_require__(120);
/* unused harmony reexport VirtualHeader */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_105__components_virtual_scroll_virtual_item__ = __webpack_require__(121);
/* unused harmony reexport VirtualItem */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_106__components_virtual_scroll_virtual_scroll__ = __webpack_require__(344);
/* unused harmony reexport VirtualScroll */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_107__config_config__ = __webpack_require__(2);
/* unused harmony reexport Config */
/* unused harmony reexport setupConfig */
/* unused harmony reexport ConfigToken */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_108__platform_dom_controller__ = __webpack_require__(12);
/* unused harmony reexport DomController */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_109__platform_platform__ = __webpack_require__(4);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return __WEBPACK_IMPORTED_MODULE_109__platform_platform__["a"]; });
/* unused harmony reexport setupPlatform */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_110__tap_click_haptic__ = __webpack_require__(47);
/* unused harmony reexport Haptic */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_111__navigation_deep_linker__ = __webpack_require__(19);
/* unused harmony reexport DeepLinker */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_112__navigation_ionic_page__ = __webpack_require__(485);
/* unused harmony reexport IonicPage */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_113__navigation_nav_controller__ = __webpack_require__(27);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return __WEBPACK_IMPORTED_MODULE_113__navigation_nav_controller__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_114__navigation_nav_controller_base__ = __webpack_require__(53);
/* unused harmony reexport NavControllerBase */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_115__navigation_nav_params__ = __webpack_require__(18);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return __WEBPACK_IMPORTED_MODULE_115__navigation_nav_params__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_116__navigation_nav_util__ = __webpack_require__(26);
/* unused harmony reexport DeepLinkMetadata */
/* unused harmony reexport DeepLinkMetadataFactory */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_117__tap_click_tap_click__ = __webpack_require__(345);
/* unused harmony reexport TapClick */
/* unused harmony reexport setupTapClick */
/* unused harmony reexport isActivatable */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_118__navigation_url_serializer__ = __webpack_require__(52);
/* unused harmony reexport UrlSerializer */
/* unused harmony reexport DeepLinkConfigToken */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_119__navigation_view_controller__ = __webpack_require__(7);
/* unused harmony reexport ViewController */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_120__gestures_pan_gesture__ = __webpack_require__(54);
/* unused harmony reexport PanGesture */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_121__gestures_gesture__ = __webpack_require__(487);
/* unused harmony reexport Gesture */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_122__gestures_slide_edge_gesture__ = __webpack_require__(76);
/* unused harmony reexport SlideEdgeGesture */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_123__gestures_slide_gesture__ = __webpack_require__(136);
/* unused harmony reexport SlideGesture */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_124__gestures_gesture_controller__ = __webpack_require__(11);
/* unused harmony reexport BLOCK_ALL */
/* unused harmony reexport GESTURE_GO_BACK_SWIPE */
/* unused harmony reexport GESTURE_MENU_SWIPE */
/* unused harmony reexport GESTURE_ITEM_SWIPE */
/* unused harmony reexport GESTURE_REFRESHER */
/* unused harmony reexport GESTURE_TOGGLE */
/* unused harmony reexport GestureController */
/* unused harmony reexport GestureDelegate */
/* unused harmony reexport BlockerDelegate */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_125__util_events__ = __webpack_require__(348);
/* unused harmony reexport Events */
/* unused harmony reexport setupEvents */
/* unused harmony reexport setupProvideEvents */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_126__util_ionic_error_handler__ = __webpack_require__(489);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_126__util_ionic_error_handler__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_127__platform_keyboard__ = __webpack_require__(46);
/* unused harmony reexport Keyboard */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_128__util_form__ = __webpack_require__(20);
/* unused harmony reexport Form */
/* unused harmony reexport IonicFormInput */
/* unused harmony reexport IonicTapInput */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_129__util_util__ = __webpack_require__(3);
/* unused harmony reexport reorderArray */
/* unused harmony reexport normalizeURL */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_130__animations_animation__ = __webpack_require__(15);
/* unused harmony reexport Animation */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_131__transitions_page_transition__ = __webpack_require__(40);
/* unused harmony reexport PageTransition */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_132__transitions_transition__ = __webpack_require__(35);
/* unused harmony reexport Transition */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_133__platform_platform_registry__ = __webpack_require__(349);
/* unused harmony reexport PlatformConfigToken */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_134__config_mode_registry__ = __webpack_require__(350);
/* unused harmony reexport registerModeConfigs */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_135__gestures_gesture_config__ = __webpack_require__(351);
/* unused harmony reexport IonicGestureConfig */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_136__module__ = __webpack_require__(490);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_136__module__["a"]; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return __WEBPACK_IMPORTED_MODULE_136__module__["b"]; });
/* unused harmony reexport provideLocationStrategy */
/**
* Global Providers
*/
/**
* Export Utils
*/
//# sourceMappingURL=index.js.map
/***/ }),
/* 14 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (immutable) */ __webpack_exports__["c"] = getCss;
/* harmony export (immutable) */ __webpack_exports__["f"] = pointerCoord;
/* harmony export (immutable) */ __webpack_exports__["d"] = hasPointerMoved;
/* harmony export (immutable) */ __webpack_exports__["e"] = isTextInput;
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NON_TEXT_INPUT_REGEX; });
/* harmony export (immutable) */ __webpack_exports__["b"] = copyInputAttributes;
function getCss(docEle) {
var css = {};
// transform
var i;
var keys = ['webkitTransform', '-webkit-transform', 'webkit-transform', 'transform'];
for (i = 0; i < keys.length; i++) {
if (docEle.style[keys[i]] !== undefined) {
css.transform = keys[i];
break;
}
}
// transition
keys = ['webkitTransition', 'transition'];
for (i = 0; i < keys.length; i++) {
if (docEle.style[keys[i]] !== undefined) {
css.transition = keys[i];
break;
}
}
// The only prefix we care about is webkit for transitions.
var isWebkit = css.transition.indexOf('webkit') > -1;
// transition duration
css.transitionDuration = (isWebkit ? '-webkit-' : '') + 'transition-duration';
// transition timing function
css.transitionTimingFn = (isWebkit ? '-webkit-' : '') + 'transition-timing-function';
// transition delay
css.transitionDelay = (isWebkit ? '-webkit-' : '') + 'transition-delay';
// To be sure transitionend works everywhere, include *both* the webkit and non-webkit events
css.transitionEnd = (isWebkit ? 'webkitTransitionEnd ' : '') + 'transitionend';
// transform origin
css.transformOrigin = (isWebkit ? '-webkit-' : '') + 'transform-origin';
// animation delay
css.animationDelay = (isWebkit ? 'webkitAnimationDelay' : 'animationDelay');
return css;
}
function pointerCoord(ev) {
// get coordinates for either a mouse click
// or a touch depending on the given event
if (ev) {
var changedTouches = ev.changedTouches;
if (changedTouches && changedTouches.length > 0) {
var touch = changedTouches[0];
return { x: touch.clientX, y: touch.clientY };
}
var pageX = ev.pageX;
if (pageX !== undefined) {
return { x: pageX, y: ev.pageY };
}
}
return { x: 0, y: 0 };
}
function hasPointerMoved(threshold, startCoord, endCoord) {
if (startCoord && endCoord) {
var deltaX = (startCoord.x - endCoord.x);
var deltaY = (startCoord.y - endCoord.y);
var distance = deltaX * deltaX + deltaY * deltaY;
return distance > (threshold * threshold);
}
return false;
}
function isTextInput(ele) {
return !!ele &&
(ele.tagName === 'TEXTAREA' ||
ele.contentEditable === 'true' ||
(ele.tagName === 'INPUT' && !(NON_TEXT_INPUT_REGEX.test(ele.type))));
}
var NON_TEXT_INPUT_REGEX = /^(radio|checkbox|range|file|submit|reset|color|image|button)$/i;
var SKIP_INPUT_ATTR = ['value', 'checked', 'disabled', 'readonly', 'placeholder', 'type', 'class', 'style', 'id', 'autofocus', 'autocomplete', 'autocorrect'];
function copyInputAttributes(srcElement, destElement) {
// copy attributes from one element to another
// however, skip over a few of them as they're already
// handled in the angular world
var attrs = srcElement.attributes;
for (var i = 0; i < attrs.length; i++) {
var attr = attrs[i];
if (SKIP_INPUT_ATTR.indexOf(attr.name) === -1) {
destElement.setAttribute(attr.name, attr.value);
}
}
}
//# sourceMappingURL=dom.js.map
/***/ }),
/* 15 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Animation; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_util__ = __webpack_require__(3);
/**
* @hidden
*/
var Animation = (function () {
function Animation(plt, ele, opts) {
this._dur = null;
this._es = null;
this._rvEs = null;
this.hasChildren = false;
this.isPlaying = false;
this.hasCompleted = false;
this.plt = plt;
this.element(ele);
this.opts = opts;
}
Animation.prototype.element = function (ele) {
if (ele) {
if (typeof ele === 'string') {
ele = this.plt.doc().querySelectorAll(ele);
for (var i = 0; i < ele.length; i++) {
this._addEle(ele[i]);
}
}
else if (ele.length) {
for (var i = 0; i < ele.length; i++) {
this._addEle(ele[i]);
}
}
else {
this._addEle(ele);
}
}
return this;
};
/**
* NO DOM
*/
Animation.prototype._addEle = function (ele) {
if (ele.nativeElement) {
ele = ele.nativeElement;
}
if (ele.nodeType === 1) {
this._eL = (this._e = this._e || []).push(ele);
}
};
/**
* Add a child animation to this animation.
*/
Animation.prototype.add = function (childAnimation) {
childAnimation.parent = this;
this.hasChildren = true;
this._cL = (this._c = this._c || []).push(childAnimation);
return this;
};
/**
* Get the duration of this animation. If this animation does
* not have a duration, then it'll get the duration from its parent.
*/
Animation.prototype.getDuration = function (opts) {
if (opts && Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["h" /* isDefined */])(opts.duration)) {
return opts.duration;
}
else if (this._dur !== null) {
return this._dur;
}
else if (this.parent) {
return this.parent.getDuration();
}
return 0;
};
/**
* Returns if the animation is a root one.
*/
Animation.prototype.isRoot = function () {
return !this.parent;
};
/**
* Set the duration for this animation.
*/
Animation.prototype.duration = function (milliseconds) {
this._dur = milliseconds;
return this;
};
/**
* Get the easing of this animation. If this animation does
* not have an easing, then it'll get the easing from its parent.
*/
Animation.prototype.getEasing = function () {
if (this._rv && this._rvEs) {
return this._rvEs;
}
return this._es !== null ? this._es : (this.parent && this.parent.getEasing()) || null;
};
/**
* Set the easing for this animation.
*/
Animation.prototype.easing = function (name) {
this._es = name;
return this;
};
/**
* Set the easing for this reversed animation.
*/
Animation.prototype.easingReverse = function (name) {
this._rvEs = name;
return this;
};
/**
* Add the "from" value for a specific property.
*/
Animation.prototype.from = function (prop, val) {
this._addProp('from', prop, val);
return this;
};
/**
* Add the "to" value for a specific property.
*/
Animation.prototype.to = function (prop, val, clearProperyAfterTransition) {
var fx = this._addProp('to', prop, val);
if (clearProperyAfterTransition) {
// if this effect is a transform then clear the transform effect
// otherwise just clear the actual property
this.afterClearStyles([fx.trans ? this.plt.Css.transform : prop]);
}
return this;
};
/**
* Shortcut to add both the "from" and "to" for the same property.
*/
Animation.prototype.fromTo = function (prop, fromVal, toVal, clearProperyAfterTransition) {
return this.from(prop, fromVal).to(prop, toVal, clearProperyAfterTransition);
};
/**
* @hidden
* NO DOM
*/
Animation.prototype._getProp = function (name) {
if (this._fx) {
return this._fx.find(function (prop) { return prop.name === name; });
}
else {
this._fx = [];
}
return null;
};
Animation.prototype._addProp = function (state, prop, val) {
var fxProp = this._getProp(prop);
if (!fxProp) {
// first time we've see this EffectProperty
var shouldTrans = (ANIMATION_TRANSFORMS[prop] === 1);
fxProp = {
name: prop,
trans: shouldTrans,
// add the will-change property for transforms or opacity
wc: (shouldTrans ? this.plt.Css.transform : prop)
};
this._fx.push(fxProp);
}
// add from/to EffectState to the EffectProperty
var fxState = {
val: val,
num: null,
unit: '',
};
fxProp[state] = fxState;
if (typeof val === 'string' && val.indexOf(' ') < 0) {
var r = val.match(ANIMATION_CSS_VALUE_REGEX);
var num = parseFloat(r[1]);
if (!isNaN(num)) {
fxState.num = num;
}
fxState.unit = (r[0] !== r[2] ? r[2] : '');
}
else if (typeof val === 'number') {
fxState.num = val;
}
return fxProp;
};
/**
* Add CSS class to this animation's elements
* before the animation begins.
*/
Animation.prototype.beforeAddClass = function (className) {
(this._bfAdd = this._bfAdd || []).push(className);
return this;
};
/**
* Remove CSS class from this animation's elements
* before the animation begins.
*/
Animation.prototype.beforeRemoveClass = function (className) {
(this._bfRm = this._bfRm || []).push(className);
return this;
};
/**
* Set CSS inline styles to this animation's elements
* before the animation begins.
*/
Animation.prototype.beforeStyles = function (styles) {
this._bfSty = styles;
return this;
};
/**
* Clear CSS inline styles from this animation's elements
* before the animation begins.
*/
Animation.prototype.beforeClearStyles = function (propertyNames) {
this._bfSty = this._bfSty || {};
for (var i = 0; i < propertyNames.length; i++) {
this._bfSty[propertyNames[i]] = '';
}
return this;
};
/**
* Add a function which contains DOM reads, which will run
* before the animation begins.
*/
Animation.prototype.beforeAddRead = function (domReadFn) {
(this._rdFn = this._rdFn || []).push(domReadFn);
return this;
};
/**
* Add a function which contains DOM writes, which will run
* before the animation begins.
*/
Animation.prototype.beforeAddWrite = function (domWriteFn) {
(this._wrFn = this._wrFn || []).push(domWriteFn);
return this;
};
/**
* Add CSS class to this animation's elements
* after the animation finishes.
*/
Animation.prototype.afterAddClass = function (className) {
(this._afAdd = this._afAdd || []).push(className);
return this;
};
/**
* Remove CSS class from this animation's elements
* after the animation finishes.
*/
Animation.prototype.afterRemoveClass = function (className) {
(this._afRm = this._afRm || []).push(className);
return this;
};
/**
* Set CSS inline styles to this animation's elements
* after the animation finishes.
*/
Animation.prototype.afterStyles = function (styles) {
this._afSty = styles;
return this;
};
/**
* Clear CSS inline styles from this animation's elements
* after the animation finishes.
*/
Animation.prototype.afterClearStyles = function (propertyNames) {
this._afSty = this._afSty || {};
for (var i = 0; i < propertyNames.length; i++) {
this._afSty[propertyNames[i]] = '';
}
return this;
};
/**
* Play the animation.
*/
Animation.prototype.play = function (opts) {
var _this = this;
// If the animation was already invalidated (it did finish), do nothing
if (!this.plt) {
return;
}
// this is the top level animation and is in full control
// of when the async play() should actually kick off
// if there is no duration then it'll set the TO property immediately
// if there is a duration, then it'll stage all animations at the
// FROM property and transition duration, wait a few frames, then
// kick off the animation by setting the TO property for each animation
this._isAsync = this._hasDuration(opts);
// ensure all past transition end events have been cleared
this._clearAsync();
// recursively kicks off the correct progress step for each child animation
// ******** DOM WRITE ****************
this._playInit(opts);
// doubling up RAFs since this animation was probably triggered
// from an input event, and just having one RAF would have this code
// run within the same frame as the triggering input event, and the
// input event probably already did way too much work for one frame
this.plt.raf(function () {
_this.plt.raf(_this._playDomInspect.bind(_this, opts));
});
};
Animation.prototype.syncPlay = function () {
// If the animation was already invalidated (it did finish), do nothing
if (!this.plt) {
return;
}
var opts = { duration: 0 };
this._isAsync = false;
this._clearAsync();
this._playInit(opts);
this._playDomInspect(opts);
};
/**
* @hidden
* DOM WRITE
* RECURSION
*/
Animation.prototype._playInit = function (opts) {
// always default that an animation does not tween
// a tween requires that an Animation class has an element
// and that it has at least one FROM/TO effect
// and that the FROM/TO effect can tween numeric values
this._twn = false;
this.isPlaying = true;
this.hasCompleted = false;
this._hasDur = (this.getDuration(opts) > ANIMATION_DURATION_MIN);
var children = this._c;
for (var i = 0; i < this._cL; i++) {
// ******** DOM WRITE ****************
children[i]._playInit(opts);
}
if (this._hasDur) {
// if there is a duration then we want to start at step 0
// ******** DOM WRITE ****************
this._progress(0);
// add the will-change properties
// ******** DOM WRITE ****************
this._willChg(true);
}
};
/**
* @hidden
* DOM WRITE
* NO RECURSION
* ROOT ANIMATION
*/
Animation.prototype._playDomInspect = function (opts) {
// fire off all the "before" function that have DOM READS in them
// elements will be in the DOM, however visibily hidden
// so we can read their dimensions if need be
// ******** DOM READ ****************
// ******** DOM WRITE ****************
this._beforeAnimation();
// for the root animation only
// set the async TRANSITION END event
// and run onFinishes when the transition ends
var dur = this.getDuration(opts);
if (this._isAsync) {
this._asyncEnd(dur, true);
}
// ******** DOM WRITE ****************
this._playProgress(opts);
if (this._isAsync && this.plt) {
// this animation has a duration so we need another RAF
// for the CSS TRANSITION properties to kick in
this.plt.raf(this._playToStep.bind(this, 1));
}
};
/**
* @hidden
* DOM WRITE
* RECURSION
*/
Animation.prototype._playProgress = function (opts) {
var children = this._c;
for (var i = 0; i < this._cL; i++) {
// ******** DOM WRITE ****************
children[i]._playProgress(opts);
}
if (this._hasDur) {
// set the CSS TRANSITION duration/easing
// ******** DOM WRITE ****************
this._setTrans(this.getDuration(opts), false);
}
else {
// this animation does not have a duration, so it should not animate
// just go straight to the TO properties and call it done
// ******** DOM WRITE ****************
this._progress(1);
// since there was no animation, immediately run the after
// ******** DOM WRITE ****************
this._setAfterStyles();
// this animation has no duration, so it has finished
// other animations could still be running
this._didFinish(true);
}
};
/**
* @hidden
* DOM WRITE
* RECURSION
*/
Animation.prototype._playToStep = function (stepValue) {
var children = this._c;
for (var i = 0; i < this._cL; i++) {
// ******** DOM WRITE ****************
children[i]._playToStep(stepValue);
}
if (this._hasDur) {
// browser had some time to render everything in place
// and the transition duration/easing is set
// now set the TO properties which will trigger the transition to begin
// ******** DOM WRITE ****************
this._progress(stepValue);
}
};
/**
* @hidden
* DOM WRITE
* NO RECURSION
* ROOT ANIMATION
*/
Animation.prototype._asyncEnd = function (dur, shouldComplete) {
(void 0) /* assert */;
(void 0) /* assert */;
(void 0) /* assert */;
var self = this;
function onTransitionEnd() {
// congrats! a successful transition completed!
// ensure transition end events and timeouts have been cleared
self._clearAsync();
// ******** DOM WRITE ****************
self._playEnd();
// transition finished
self._didFinishAll(shouldComplete, true, false);
}
function onTransitionFallback() {
(void 0) /* console.debug */;
// oh noz! the transition end event didn't fire in time!
// instead the fallback timer when first
// if all goes well this fallback should never fire
// clear the other async end events from firing
self._tm = undefined;
self._clearAsync();
// set the after styles
// ******** DOM WRITE ****************
self._playEnd(shouldComplete ? 1 : 0);
// transition finished
self._didFinishAll(shouldComplete, true, false);
}
// set the TRANSITION END event on one of the transition elements
self._unrgTrns = this.plt.transitionEnd(self._transEl(), onTransitionEnd, false);
// set a fallback timeout if the transition end event never fires, or is too slow
// transition end fallback: (animation duration + XXms)
self._tm = self.plt.timeout(onTransitionFallback, (dur + ANIMATION_TRANSITION_END_FALLBACK_PADDING_MS));
};
/**
* @hidden
* DOM WRITE
* RECURSION
*/
Animation.prototype._playEnd = function (stepValue) {
var children = this._c;
for (var i = 0; i < this._cL; i++) {
// ******** DOM WRITE ****************
children[i]._playEnd(stepValue);
}
if (this._hasDur) {
if (Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["h" /* isDefined */])(stepValue)) {
// too late to have a smooth animation, just finish it
// ******** DOM WRITE ****************
this._setTrans(0, true);
// ensure the ending progress step gets rendered
// ******** DOM WRITE ****************
this._progress(stepValue);
}
// set the after styles
// ******** DOM WRITE ****************
this._setAfterStyles();
// remove the will-change properties
// ******** DOM WRITE ****************
this._willChg(false);
}
};
/**
* @hidden
* NO DOM
* RECURSION
*/
Animation.prototype._hasDuration = function (opts) {
if (this.getDuration(opts) > ANIMATION_DURATION_MIN) {
return true;
}
var children = this._c;
for (var i = 0; i < this._cL; i++) {
if (children[i]._hasDuration(opts)) {
return true;
}
}
return false;
};
/**
* @hidden
* NO DOM
* RECURSION
*/
Animation.prototype._hasDomReads = function () {
if (this._rdFn && this._rdFn.length) {
return true;
}
var children = this._c;
for (var i = 0; i < this._cL; i++) {
if (children[i]._hasDomReads()) {
return true;
}
}
return false;
};
/**
* Immediately stop at the end of the animation.
*/
Animation.prototype.stop = function (stepValue) {
if (stepValue === void 0) { stepValue = 1; }
// ensure all past transition end events have been cleared
this._clearAsync();
this._hasDur = true;
this._playEnd(stepValue);
};
/**
* @hidden
* NO DOM
* NO RECURSION
*/
Animation.prototype._clearAsync = function () {
this._unrgTrns && this._unrgTrns();
this._tm && clearTimeout(this._tm);
this._tm = this._unrgTrns = undefined;
};
/**
* @hidden
* DOM WRITE
* NO RECURSION
*/
Animation.prototype._progress = function (stepValue) {
// bread 'n butter
var val;
var effects = this._fx;
var nuElements = this._eL;
if (!effects || !nuElements) {
return;
}
// flip the number if we're going in reverse
if (this._rv) {
stepValue = ((stepValue * -1) + 1);
}
var i, j;
var finalTransform = '';
var elements = this._e;
for (i = 0; i < effects.length; i++) {
var fx = effects[i];
if (fx.from && fx.to) {
var fromNum = fx.from.num;
var toNum = fx.to.num;
var tweenEffect = (fromNum !== toNum);
(void 0) /* assert */;
if (tweenEffect) {
this._twn = true;
}
if (stepValue === 0) {
// FROM
val = fx.from.val;
}
else if (stepValue === 1) {
// TO
val = fx.to.val;
}
else if (tweenEffect) {
// EVERYTHING IN BETWEEN
var valNum = (((toNum - fromNum) * stepValue) + fromNum);
var unit = fx.to.unit;
if (unit === 'px') {
valNum = Math.round(valNum);
}
val = valNum + unit;
}
if (val !== null) {
var prop = fx.name;
if (fx.trans) {
finalTransform += prop + '(' + val + ') ';
}
else {
for (j = 0; j < nuElements; j++) {
// ******** DOM WRITE ****************
elements[j].style[prop] = val;
}
}
}
}
}
// place all transforms on the same property
if (finalTransform.length) {
if (!this._rv && stepValue !== 1 || this._rv && stepValue !== 0) {
finalTransform += 'translateZ(0px)';
}
var cssTransform = this.plt.Css.transform;
for (i = 0; i < elements.length; i++) {
// ******** DOM WRITE ****************
elements[i].style[cssTransform] = finalTransform;
}
}
};
/**
* @hidden
* DOM WRITE
* NO RECURSION
*/
Animation.prototype._setTrans = function (dur, forcedLinearEasing) {
// Transition is not enabled if there are not effects
if (!this._fx) {
return;
}
// set the TRANSITION properties inline on the element
var elements = this._e;
var easing = (forcedLinearEasing ? 'linear' : this.getEasing());
var durString = dur + 'ms';
var Css = this.plt.Css;
var cssTransform = Css.transition;
var cssTransitionDuration = Css.transitionDuration;
var cssTransitionTimingFn = Css.transitionTimingFn;
var eleStyle;
for (var i = 0; i < this._eL; i++) {
eleStyle = elements[i].style;
if (dur > 0) {
// ******** DOM WRITE ****************
eleStyle[cssTransform] = '';
eleStyle[cssTransitionDuration] = durString;
// each animation can have a different easing
if (easing) {
// ******** DOM WRITE ****************
eleStyle[cssTransitionTimingFn] = easing;
}
}
else {
eleStyle[cssTransform] = 'none';
}
}
};
/**
* @hidden
* DOM READ
* DOM WRITE
* RECURSION
*/
Animation.prototype._beforeAnimation = function () {
// fire off all the "before" function that have DOM READS in them
// elements will be in the DOM, however visibily hidden
// so we can read their dimensions if need be
// ******** DOM READ ****************
this._fireBeforeReadFunc();
// ******** DOM READS ABOVE / DOM WRITES BELOW ****************
// fire off all the "before" function that have DOM WRITES in them
// ******** DOM WRITE ****************
this._fireBeforeWriteFunc();
// stage all of the before css classes and inline styles
// ******** DOM WRITE ****************
this._setBeforeStyles();
};
/**
* @hidden
* DOM WRITE
* RECURSION
*/
Animation.prototype._setBeforeStyles = function () {
var i, j;
var children = this._c;
for (i = 0; i < this._cL; i++) {
children[i]._setBeforeStyles();
}
// before the animations have started
// only set before styles if animation is not reversed
if (this._rv) {
return;
}
var addClasses = this._bfAdd;
var removeClasses = this._bfRm;
var ele;
var eleClassList;
var prop;
for (i = 0; i < this._eL; i++) {
ele = this._e[i];
eleClassList = ele.classList;
// css classes to add before the animation
if (addClasses) {
for (j = 0; j < addClasses.length; j++) {
// ******** DOM WRITE ****************
eleClassList.add(addClasses[j]);
}
}
// css classes to remove before the animation
if (removeClasses) {
for (j = 0; j < removeClasses.length; j++) {
// ******** DOM WRITE ****************
eleClassList.remove(removeClasses[j]);
}
}
// inline styles to add before the animation
if (this._bfSty) {
for (prop in this._bfSty) {
// ******** DOM WRITE ****************
ele.style[prop] = this._bfSty[prop];
}
}
}
};
/**
* @hidden
* DOM READ
* RECURSION
*/
Animation.prototype._fireBeforeReadFunc = function () {
var children = this._c;
for (var i = 0; i < this._cL; i++) {
// ******** DOM READ ****************
children[i]._fireBeforeReadFunc();
}
var readFunctions = this._rdFn;
if (readFunctions) {
for (var i = 0; i < readFunctions.length; i++) {
// ******** DOM READ ****************
readFunctions[i]();
}
}
};
/**
* @hidden
* DOM WRITE
* RECURSION
*/
Animation.prototype._fireBeforeWriteFunc = function () {
var children = this._c;
for (var i = 0; i < this._cL; i++) {
// ******** DOM WRITE ****************
children[i]._fireBeforeWriteFunc();
}
var writeFunctions = this._wrFn;
if (this._wrFn) {
for (var i = 0; i < writeFunctions.length; i++) {
// ******** DOM WRITE ****************
writeFunctions[i]();
}
}
};
/**
* @hidden
* DOM WRITE
*/
Animation.prototype._setAfterStyles = function () {
var i, j;
var ele;
var eleClassList;
var elements = this._e;
for (i = 0; i < this._eL; i++) {
ele = elements[i];
eleClassList = ele.classList;
// remove the transition duration/easing
// ******** DOM WRITE ****************
ele.style[this.plt.Css.transitionDuration] = ele.style[this.plt.Css.transitionTimingFn] = '';
if (this._rv) {
// finished in reverse direction
// css classes that were added before the animation should be removed
if (this._bfAdd) {
for (j = 0; j < this._bfAdd.length; j++) {
// ******** DOM WRITE ****************
eleClassList.remove(this._bfAdd[j]);
}
}
// css classes that were removed before the animation should be added
if (this._bfRm) {
for (j = 0; j < this._bfRm.length; j++) {
// ******** DOM WRITE ****************
eleClassList.add(this._bfRm[j]);
}
}
// inline styles that were added before the animation should be removed
if (this._bfSty) {
for (var prop in this._bfSty) {
// ******** DOM WRITE ****************
ele.style[prop] = '';
}
}
}
else {
// finished in forward direction
// css classes to add after the animation
if (this._afAdd) {
for (j = 0; j < this._afAdd.length; j++) {
// ******** DOM WRITE ****************
eleClassList.add(this._afAdd[j]);
}
}
// css classes to remove after the animation
if (this._afRm) {
for (j = 0; j < this._afRm.length; j++) {
// ******** DOM WRITE ****************
eleClassList.remove(this._afRm[j]);
}
}
// inline styles to add after the animation
if (this._afSty) {
for (var prop in this._afSty) {
// ******** DOM WRITE ****************
ele.style[prop] = this._afSty[prop];
}
}
}
}
};
/**
* @hidden
* DOM WRITE
* NO RECURSION
*/
Animation.prototype._willChg = function (addWillChange) {
var wc;
var effects = this._fx;
var willChange;
if (addWillChange && effects) {
wc = [];
for (var i = 0; i < effects.length; i++) {
var propWC = effects[i].wc;
if (propWC === 'webkitTransform') {
wc.push('transform', '-webkit-transform');
}
else {
wc.push(propWC);
}
}
willChange = wc.join(',');
}
else {
willChange = '';
}
for (var i = 0; i < this._eL; i++) {
// ******** DOM WRITE ****************
this._e[i].style.willChange = willChange;
}
};
/**
* Start the animation with a user controlled progress.
*/
Animation.prototype.progressStart = function () {
// ensure all past transition end events have been cleared
this._clearAsync();
// ******** DOM READ/WRITE ****************
this._beforeAnimation();
// ******** DOM WRITE ****************
this._progressStart();
};
/**
* @hidden
* DOM WRITE
* RECURSION
*/
Animation.prototype._progressStart = function () {
var children = this._c;
for (var i = 0; i < this._cL; i++) {
// ******** DOM WRITE ****************
children[i]._progressStart();
}
// force no duration, linear easing
// ******** DOM WRITE ****************
this._setTrans(0, true);
// ******** DOM WRITE ****************
this._willChg(true);
};
/**
* Set the progress step for this animation.
* progressStep() is not debounced, so it should not be called faster than 60FPS.
*/
Animation.prototype.progressStep = function (stepValue) {
// only update if the last update was more than 16ms ago
stepValue = Math.min(1, Math.max(0, stepValue));
var children = this._c;
for (var i = 0; i < this._cL; i++) {
// ******** DOM WRITE ****************
children[i].progressStep(stepValue);
}
if (this._rv) {
// if the animation is going in reverse then
// flip the step value: 0 becomes 1, 1 becomes 0
stepValue = ((stepValue * -1) + 1);
}
// ******** DOM WRITE ****************
this._progress(stepValue);
};
/**
* End the progress animation.
*/
Animation.prototype.progressEnd = function (shouldComplete, currentStepValue, dur) {
if (dur === void 0) { dur = -1; }
(void 0) /* console.debug */;
if (this._rv) {
// if the animation is going in reverse then
// flip the step value: 0 becomes 1, 1 becomes 0
currentStepValue = ((currentStepValue * -1) + 1);
}
var stepValue = shouldComplete ? 1 : 0;
var diff = Math.abs(currentStepValue - stepValue);
if (diff < 0.05) {
dur = 0;
}
else if (dur < 0) {
dur = this._dur;
}
this._isAsync = (dur > 30);
this._progressEnd(shouldComplete, stepValue, dur, this._isAsync);
if (this._isAsync) {
// for the root animation only
// set the async TRANSITION END event
// and run onFinishes when the transition ends
// ******** DOM WRITE ****************
this._asyncEnd(dur, shouldComplete);
// this animation has a duration so we need another RAF
// for the CSS TRANSITION properties to kick in
this.plt && this.plt.raf(this._playToStep.bind(this, stepValue));
}
};
/**
* @hidden
* DOM WRITE
* RECURSION
*/
Animation.prototype._progressEnd = function (shouldComplete, stepValue, dur, isAsync) {
var children = this._c;
for (var i = 0; i < this._cL; i++) {
// ******** DOM WRITE ****************
children[i]._progressEnd(shouldComplete, stepValue, dur, isAsync);
}
if (!isAsync) {
// stop immediately
// set all the animations to their final position
// ******** DOM WRITE ****************
this._progress(stepValue);
this._willChg(false);
this._setAfterStyles();
this._didFinish(shouldComplete);
}
else {
// animate it back to it's ending position
this.isPlaying = true;
this.hasCompleted = false;
this._hasDur = true;
// ******** DOM WRITE ****************
this._willChg(true);
this._setTrans(dur, false);
}
};
/**
* Add a callback to fire when the animation has finished.
*/
Animation.prototype.onFinish = function (callback, onceTimeCallback, clearOnFinishCallacks) {
if (onceTimeCallback === void 0) { onceTimeCallback = false; }
if (clearOnFinishCallacks === void 0) { clearOnFinishCallacks = false; }
if (clearOnFinishCallacks) {
this._fFn = this._fOneFn = undefined;
}
if (onceTimeCallback) {
this._fOneFn = this._fOneFn || [];
this._fOneFn.push(callback);
}
else {
this._fFn = this._fFn || [];
this._fFn.push(callback);
}
return this;
};
/**
* @hidden
* NO DOM
* RECURSION
*/
Animation.prototype._didFinishAll = function (hasCompleted, finishAsyncAnimations, finishNoDurationAnimations) {
var children = this._c;
for (var i = 0; i < this._cL; i++) {
children[i]._didFinishAll(hasCompleted, finishAsyncAnimations, finishNoDurationAnimations);
}
if (finishAsyncAnimations && this._isAsync || finishNoDurationAnimations && !this._isAsync) {
this._didFinish(hasCompleted);
}
};
/**
* @hidden
* NO RECURSION
*/
Animation.prototype._didFinish = function (hasCompleted) {
this.isPlaying = false;
this.hasCompleted = hasCompleted;
if (this._fFn) {
// run all finish callbacks
for (var i = 0; i < this._fFn.length; i++) {
this._fFn[i](this);
}
}
if (this._fOneFn) {
// run all "onetime" finish callbacks
for (var i = 0; i < this._fOneFn.length; i++) {
this._fOneFn[i](this);
}
this._fOneFn.length = 0;
}
};
/**
* Reverse the animation.
*/
Animation.prototype.reverse = function (shouldReverse) {
if (shouldReverse === void 0) { shouldReverse = true; }
var children = this._c;
for (var i = 0; i < this._cL; i++) {
children[i].reverse(shouldReverse);
}
this._rv = shouldReverse;
return this;
};
/**
* Recursively destroy this animation and all child animations.
*/
Animation.prototype.destroy = function () {
var children = this._c;
for (var i = 0; i < this._cL; i++) {
children[i].destroy();
}
this._clearAsync();
this.parent = this.plt = this._e = this._rdFn = this._wrFn = null;
if (this._c) {
this._c.length = this._cL = 0;
}
if (this._fFn) {
this._fFn.length = 0;
}
if (this._fOneFn) {
this._fOneFn.length = 0;
}
};
/**
* @hidden
* NO DOM
*/
Animation.prototype._transEl = function () {
// get the lowest level element that has an Animation
var targetEl;
for (var i = 0; i < this._cL; i++) {
targetEl = this._c[i]._transEl();
if (targetEl) {
return targetEl;
}
}
return (this._twn && this._hasDur && this._eL ? this._e[0] : null);
};
return Animation;
}());
var ANIMATION_TRANSFORMS = {
'translateX': 1,
'translateY': 1,
'translateZ': 1,
'scale': 1,
'scaleX': 1,
'scaleY': 1,
'scaleZ': 1,
'rotate': 1,
'rotateX': 1,
'rotateY': 1,
'rotateZ': 1,
'skewX': 1,
'skewY': 1,
'perspective': 1
};
var ANIMATION_CSS_VALUE_REGEX = /(^-?\d*\.?\d*)(.*)/;
var ANIMATION_DURATION_MIN = 32;
var ANIMATION_TRANSITION_END_FALLBACK_PADDING_MS = 400;
//# sourceMappingURL=animation.js.map
/***/ }),
/* 16 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export AbstractControlDirective */
/* unused harmony export AbstractFormGroupDirective */
/* unused harmony export CheckboxControlValueAccessor */
/* unused harmony export ControlContainer */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return NG_VALUE_ACCESSOR; });
/* unused harmony export COMPOSITION_BUFFER_MODE */
/* unused harmony export DefaultValueAccessor */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return NgControl; });
/* unused harmony export NgControlStatus */
/* unused harmony export NgControlStatusGroup */
/* unused harmony export NgForm */
/* unused harmony export NgModel */
/* unused harmony export NgModelGroup */
/* unused harmony export RadioControlValueAccessor */
/* unused harmony export FormControlDirective */
/* unused harmony export FormControlName */
/* unused harmony export FormGroupDirective */
/* unused harmony export FormArrayName */
/* unused harmony export FormGroupName */
/* unused harmony export NgSelectOption */
/* unused harmony export SelectControlValueAccessor */
/* unused harmony export SelectMultipleControlValueAccessor */
/* unused harmony export CheckboxRequiredValidator */
/* unused harmony export EmailValidator */
/* unused harmony export MaxLengthValidator */
/* unused harmony export MinLengthValidator */
/* unused harmony export PatternValidator */
/* unused harmony export RequiredValidator */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FormBuilder; });
/* unused harmony export AbstractControl */
/* unused harmony export FormArray */
/* unused harmony export FormControl */
/* unused harmony export FormGroup */
/* unused harmony export NG_ASYNC_VALIDATORS */
/* unused harmony export NG_VALIDATORS */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return Validators; });
/* unused harmony export VERSION */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return FormsModule; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return ReactiveFormsModule; });
/* unused harmony export ɵba */
/* unused harmony export ɵz */
/* unused harmony export ɵx */
/* unused harmony export ɵy */
/* unused harmony export ɵa */
/* unused harmony export ɵb */
/* unused harmony export ɵc */
/* unused harmony export ɵd */
/* unused harmony export ɵe */
/* unused harmony export ɵf */
/* unused harmony export ɵg */
/* unused harmony export ɵbf */
/* unused harmony export ɵbb */
/* unused harmony export ɵbc */
/* unused harmony export ɵh */
/* unused harmony export ɵi */
/* unused harmony export ɵbd */
/* unused harmony export ɵbe */
/* unused harmony export ɵj */
/* unused harmony export ɵk */
/* unused harmony export ɵl */
/* unused harmony export ɵn */
/* unused harmony export ɵm */
/* unused harmony export ɵo */
/* unused harmony export ɵq */
/* unused harmony export ɵp */
/* unused harmony export ɵs */
/* unused harmony export ɵt */
/* unused harmony export ɵv */
/* unused harmony export ɵu */
/* unused harmony export ɵw */
/* unused harmony export ɵr */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_tslib__ = __webpack_require__(31);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_observable_forkJoin__ = __webpack_require__(377);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_observable_forkJoin___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_rxjs_observable_forkJoin__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_observable_fromPromise__ = __webpack_require__(379);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_observable_fromPromise___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_rxjs_observable_fromPromise__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_rxjs_operator_map__ = __webpack_require__(134);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_rxjs_operator_map___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_rxjs_operator_map__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__angular_platform_browser__ = __webpack_require__(33);
/**
* @license Angular v5.0.3
* (c) 2010-2017 Google, Inc. https://angular.io/
* License: MIT
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Base class for control directives.
*
* Only used internally in the forms module.
*
* \@stable
* @abstract
*/
var AbstractControlDirective = (function () {
function AbstractControlDirective() {
}
Object.defineProperty(AbstractControlDirective.prototype, "value", {
/** The value of the control. */
get: /**
* The value of the control.
* @return {?}
*/
function () { return this.control ? this.control.value : null; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControlDirective.prototype, "valid", {
/**
* A control is `valid` when its `status === VALID`.
*
* In order to have this status, the control must have passed all its
* validation checks.
*/
get: /**
* A control is `valid` when its `status === VALID`.
*
* In order to have this status, the control must have passed all its
* validation checks.
* @return {?}
*/
function () { return this.control ? this.control.valid : null; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControlDirective.prototype, "invalid", {
/**
* A control is `invalid` when its `status === INVALID`.
*
* In order to have this status, the control must have failed
* at least one of its validation checks.
*/
get: /**
* A control is `invalid` when its `status === INVALID`.
*
* In order to have this status, the control must have failed
* at least one of its validation checks.
* @return {?}
*/
function () { return this.control ? this.control.invalid : null; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControlDirective.prototype, "pending", {
/**
* A control is `pending` when its `status === PENDING`.
*
* In order to have this status, the control must be in the
* middle of conducting a validation check.
*/
get: /**
* A control is `pending` when its `status === PENDING`.
*
* In order to have this status, the control must be in the
* middle of conducting a validation check.
* @return {?}
*/
function () { return this.control ? this.control.pending : null; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControlDirective.prototype, "disabled", {
/**
* A control is `disabled` when its `status === DISABLED`.
*
* Disabled controls are exempt from validation checks and
* are not included in the aggregate value of their ancestor
* controls.
*/
get: /**
* A control is `disabled` when its `status === DISABLED`.
*
* Disabled controls are exempt from validation checks and
* are not included in the aggregate value of their ancestor
* controls.
* @return {?}
*/
function () { return this.control ? this.control.disabled : null; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControlDirective.prototype, "enabled", {
/**
* A control is `enabled` as long as its `status !== DISABLED`.
*
* In other words, it has a status of `VALID`, `INVALID`, or
* `PENDING`.
*/
get: /**
* A control is `enabled` as long as its `status !== DISABLED`.
*
* In other words, it has a status of `VALID`, `INVALID`, or
* `PENDING`.
* @return {?}
*/
function () { return this.control ? this.control.enabled : null; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControlDirective.prototype, "errors", {
/**
* Returns any errors generated by failing validation. If there
* are no errors, it will return null.
*/
get: /**
* Returns any errors generated by failing validation. If there
* are no errors, it will return null.
* @return {?}
*/
function () { return this.control ? this.control.errors : null; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControlDirective.prototype, "pristine", {
/**
* A control is `pristine` if the user has not yet changed
* the value in the UI.
*
* Note that programmatic changes to a control's value will
* *not* mark it dirty.
*/
get: /**
* A control is `pristine` if the user has not yet changed
* the value in the UI.
*
* Note that programmatic changes to a control's value will
* *not* mark it dirty.
* @return {?}
*/
function () { return this.control ? this.control.pristine : null; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControlDirective.prototype, "dirty", {
/**
* A control is `dirty` if the user has changed the value
* in the UI.
*
* Note that programmatic changes to a control's value will
* *not* mark it dirty.
*/
get: /**
* A control is `dirty` if the user has changed the value
* in the UI.
*
* Note that programmatic changes to a control's value will
* *not* mark it dirty.
* @return {?}
*/
function () { return this.control ? this.control.dirty : null; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControlDirective.prototype, "touched", {
/**
* A control is marked `touched` once the user has triggered
* a `blur` event on it.
*/
get: /**
* A control is marked `touched` once the user has triggered
* a `blur` event on it.
* @return {?}
*/
function () { return this.control ? this.control.touched : null; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControlDirective.prototype, "status", {
get: /**
* @return {?}
*/
function () { return this.control ? this.control.status : null; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControlDirective.prototype, "untouched", {
/**
* A control is `untouched` if the user has not yet triggered
* a `blur` event on it.
*/
get: /**
* A control is `untouched` if the user has not yet triggered
* a `blur` event on it.
* @return {?}
*/
function () { return this.control ? this.control.untouched : null; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControlDirective.prototype, "statusChanges", {
/**
* Emits an event every time the validation status of the control
* is re-calculated.
*/
get: /**
* Emits an event every time the validation status of the control
* is re-calculated.
* @return {?}
*/
function () {
return this.control ? this.control.statusChanges : null;
},
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControlDirective.prototype, "valueChanges", {
/**
* Emits an event every time the value of the control changes, in
* the UI or programmatically.
*/
get: /**
* Emits an event every time the value of the control changes, in
* the UI or programmatically.
* @return {?}
*/
function () {
return this.control ? this.control.valueChanges : null;
},
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControlDirective.prototype, "path", {
/**
* Returns an array that represents the path from the top-level form
* to this control. Each index is the string name of the control on
* that level.
*/
get: /**
* Returns an array that represents the path from the top-level form
* to this control. Each index is the string name of the control on
* that level.
* @return {?}
*/
function () { return null; },
enumerable: true,
configurable: true
});
/**
* Resets the form control. This means by default:
*
* * it is marked as `pristine`
* * it is marked as `untouched`
* * value is set to null
*
* For more information, see {@link AbstractControl}.
*/
/**
* Resets the form control. This means by default:
*
* * it is marked as `pristine`
* * it is marked as `untouched`
* * value is set to null
*
* For more information, see {\@link AbstractControl}.
* @param {?=} value
* @return {?}
*/
AbstractControlDirective.prototype.reset = /**
* Resets the form control. This means by default:
*
* * it is marked as `pristine`
* * it is marked as `untouched`
* * value is set to null
*
* For more information, see {\@link AbstractControl}.
* @param {?=} value
* @return {?}
*/
function (value) {
if (value === void 0) { value = undefined; }
if (this.control)
this.control.reset(value);
};
/**
* Returns true if the control with the given path has the error specified. Otherwise
* returns false.
*
* If no path is given, it checks for the error on the present control.
*/
/**
* Returns true if the control with the given path has the error specified. Otherwise
* returns false.
*
* If no path is given, it checks for the error on the present control.
* @param {?} errorCode
* @param {?=} path
* @return {?}
*/
AbstractControlDirective.prototype.hasError = /**
* Returns true if the control with the given path has the error specified. Otherwise
* returns false.
*
* If no path is given, it checks for the error on the present control.
* @param {?} errorCode
* @param {?=} path
* @return {?}
*/
function (errorCode, path) {
return this.control ? this.control.hasError(errorCode, path) : false;
};
/**
* Returns error data if the control with the given path has the error specified. Otherwise
* returns null or undefined.
*
* If no path is given, it checks for the error on the present control.
*/
/**
* Returns error data if the control with the given path has the error specified. Otherwise
* returns null or undefined.
*
* If no path is given, it checks for the error on the present control.
* @param {?} errorCode
* @param {?=} path
* @return {?}
*/
AbstractControlDirective.prototype.getError = /**
* Returns error data if the control with the given path has the error specified. Otherwise
* returns null or undefined.
*
* If no path is given, it checks for the error on the present control.
* @param {?} errorCode
* @param {?=} path
* @return {?}
*/
function (errorCode, path) {
return this.control ? this.control.getError(errorCode, path) : null;
};
return AbstractControlDirective;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* A directive that contains multiple {\@link NgControl}s.
*
* Only used by the forms module.
*
* \@stable
* @abstract
*/
var ControlContainer = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ControlContainer, _super);
function ControlContainer() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(ControlContainer.prototype, "formDirective", {
/**
* Get the form to which this container belongs.
*/
get: /**
* Get the form to which this container belongs.
* @return {?}
*/
function () { return null; },
enumerable: true,
configurable: true
});
Object.defineProperty(ControlContainer.prototype, "path", {
/**
* Get the path to this container.
*/
get: /**
* Get the path to this container.
* @return {?}
*/
function () { return null; },
enumerable: true,
configurable: true
});
return ControlContainer;
}(AbstractControlDirective));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @param {?} value
* @return {?}
*/
function isEmptyInputValue(value) {
// we don't check for string here so it also works with arrays
return value == null || value.length === 0;
}
/**
* Providers for validators to be used for {\@link FormControl}s in a form.
*
* Provide this using `multi: true` to add validators.
*
* \@stable
*/
var NG_VALIDATORS = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["B" /* InjectionToken */]('NgValidators');
/**
* Providers for asynchronous validators to be used for {\@link FormControl}s
* in a form.
*
* Provide this using `multi: true` to add validators.
*
* See {\@link NG_VALIDATORS} for more details.
*
* \@stable
*/
var NG_ASYNC_VALIDATORS = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["B" /* InjectionToken */]('NgAsyncValidators');
var EMAIL_REGEXP = /^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/;
/**
* Provides a set of validators used by form controls.
*
* A validator is a function that processes a {\@link FormControl} or collection of
* controls and returns a map of errors. A null map means that validation has passed.
*
* ### Example
*
* ```typescript
* var loginControl = new FormControl("", Validators.required)
* ```
*
* \@stable
*/
var Validators = (function () {
function Validators() {
}
/**
* Validator that requires controls to have a value greater than a number.
*/
/**
* Validator that requires controls to have a value greater than a number.
* @param {?} min
* @return {?}
*/
Validators.min = /**
* Validator that requires controls to have a value greater than a number.
* @param {?} min
* @return {?}
*/
function (min) {
return function (control) {
if (isEmptyInputValue(control.value) || isEmptyInputValue(min)) {
return null; // don't validate empty values to allow optional controls
}
var /** @type {?} */ value = parseFloat(control.value);
// Controls with NaN values after parsing should be treated as not having a
// minimum, per the HTML forms spec: https://www.w3.org/TR/html5/forms.html#attr-input-min
return !isNaN(value) && value < min ? { 'min': { 'min': min, 'actual': control.value } } : null;
};
};
/**
* Validator that requires controls to have a value less than a number.
*/
/**
* Validator that requires controls to have a value less than a number.
* @param {?} max
* @return {?}
*/
Validators.max = /**
* Validator that requires controls to have a value less than a number.
* @param {?} max
* @return {?}
*/
function (max) {
return function (control) {
if (isEmptyInputValue(control.value) || isEmptyInputValue(max)) {
return null; // don't validate empty values to allow optional controls
}
var /** @type {?} */ value = parseFloat(control.value);
// Controls with NaN values after parsing should be treated as not having a
// maximum, per the HTML forms spec: https://www.w3.org/TR/html5/forms.html#attr-input-max
return !isNaN(value) && value > max ? { 'max': { 'max': max, 'actual': control.value } } : null;
};
};
/**
* Validator that requires controls to have a non-empty value.
*/
/**
* Validator that requires controls to have a non-empty value.
* @param {?} control
* @return {?}
*/
Validators.required = /**
* Validator that requires controls to have a non-empty value.
* @param {?} control
* @return {?}
*/
function (control) {
return isEmptyInputValue(control.value) ? { 'required': true } : null;
};
/**
* Validator that requires control value to be true.
*/
/**
* Validator that requires control value to be true.
* @param {?} control
* @return {?}
*/
Validators.requiredTrue = /**
* Validator that requires control value to be true.
* @param {?} control
* @return {?}
*/
function (control) {
return control.value === true ? null : { 'required': true };
};
/**
* Validator that performs email validation.
*/
/**
* Validator that performs email validation.
* @param {?} control
* @return {?}
*/
Validators.email = /**
* Validator that performs email validation.
* @param {?} control
* @return {?}
*/
function (control) {
return EMAIL_REGEXP.test(control.value) ? null : { 'email': true };
};
/**
* Validator that requires controls to have a value of a minimum length.
*/
/**
* Validator that requires controls to have a value of a minimum length.
* @param {?} minLength
* @return {?}
*/
Validators.minLength = /**
* Validator that requires controls to have a value of a minimum length.
* @param {?} minLength
* @return {?}
*/
function (minLength) {
return function (control) {
if (isEmptyInputValue(control.value)) {
return null; // don't validate empty values to allow optional controls
}
var /** @type {?} */ length = control.value ? control.value.length : 0;
return length < minLength ?
{ 'minlength': { 'requiredLength': minLength, 'actualLength': length } } :
null;
};
};
/**
* Validator that requires controls to have a value of a maximum length.
*/
/**
* Validator that requires controls to have a value of a maximum length.
* @param {?} maxLength
* @return {?}
*/
Validators.maxLength = /**
* Validator that requires controls to have a value of a maximum length.
* @param {?} maxLength
* @return {?}
*/
function (maxLength) {
return function (control) {
var /** @type {?} */ length = control.value ? control.value.length : 0;
return length > maxLength ?
{ 'maxlength': { 'requiredLength': maxLength, 'actualLength': length } } :
null;
};
};
/**
* Validator that requires a control to match a regex to its value.
*/
/**
* Validator that requires a control to match a regex to its value.
* @param {?} pattern
* @return {?}
*/
Validators.pattern = /**
* Validator that requires a control to match a regex to its value.
* @param {?} pattern
* @return {?}
*/
function (pattern) {
if (!pattern)
return Validators.nullValidator;
var /** @type {?} */ regex;
var /** @type {?} */ regexStr;
if (typeof pattern === 'string') {
regexStr = "^" + pattern + "$";
regex = new RegExp(regexStr);
}
else {
regexStr = pattern.toString();
regex = pattern;
}
return function (control) {
if (isEmptyInputValue(control.value)) {
return null; // don't validate empty values to allow optional controls
}
var /** @type {?} */ value = control.value;
return regex.test(value) ? null :
{ 'pattern': { 'requiredPattern': regexStr, 'actualValue': value } };
};
};
/**
* No-op validator.
*/
/**
* No-op validator.
* @param {?} c
* @return {?}
*/
Validators.nullValidator = /**
* No-op validator.
* @param {?} c
* @return {?}
*/
function (c) { return null; };
/**
* @param {?} validators
* @return {?}
*/
Validators.compose = /**
* @param {?} validators
* @return {?}
*/
function (validators) {
if (!validators)
return null;
var /** @type {?} */ presentValidators = /** @type {?} */ (validators.filter(isPresent));
if (presentValidators.length == 0)
return null;
return function (control) {
return _mergeErrors(_executeValidators(control, presentValidators));
};
};
/**
* @param {?} validators
* @return {?}
*/
Validators.composeAsync = /**
* @param {?} validators
* @return {?}
*/
function (validators) {
if (!validators)
return null;
var /** @type {?} */ presentValidators = /** @type {?} */ (validators.filter(isPresent));
if (presentValidators.length == 0)
return null;
return function (control) {
var /** @type {?} */ observables = _executeAsyncValidators(control, presentValidators).map(toObservable);
return __WEBPACK_IMPORTED_MODULE_4_rxjs_operator_map__["map"].call(Object(__WEBPACK_IMPORTED_MODULE_2_rxjs_observable_forkJoin__["forkJoin"])(observables), _mergeErrors);
};
};
return Validators;
}());
/**
* @param {?} o
* @return {?}
*/
function isPresent(o) {
return o != null;
}
/**
* @param {?} r
* @return {?}
*/
function toObservable(r) {
var /** @type {?} */ obs = Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_35" /* ɵisPromise */])(r) ? Object(__WEBPACK_IMPORTED_MODULE_3_rxjs_observable_fromPromise__["fromPromise"])(r) : r;
if (!(Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_34" /* ɵisObservable */])(obs))) {
throw new Error("Expected validator to return Promise or Observable.");
}
return obs;
}
/**
* @param {?} control
* @param {?} validators
* @return {?}
*/
function _executeValidators(control, validators) {
return validators.map(function (v) { return v(control); });
}
/**
* @param {?} control
* @param {?} validators
* @return {?}
*/
function _executeAsyncValidators(control, validators) {
return validators.map(function (v) { return v(control); });
}
/**
* @param {?} arrayOfErrors
* @return {?}
*/
function _mergeErrors(arrayOfErrors) {
var /** @type {?} */ res = arrayOfErrors.reduce(function (res, errors) {
return errors != null ? Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({}, /** @type {?} */ ((res)), errors) : /** @type {?} */ ((res));
}, {});
return Object.keys(res).length === 0 ? null : res;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* A `ControlValueAccessor` acts as a bridge between the Angular forms API and a
* native element in the DOM.
*
* Implement this interface if you want to create a custom form control directive
* that integrates with Angular forms.
*
* \@stable
* @record
*/
/**
* Used to provide a {\@link ControlValueAccessor} for form controls.
*
* See {\@link DefaultValueAccessor} for how to implement one.
* \@stable
*/
var NG_VALUE_ACCESSOR = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["B" /* InjectionToken */]('NgValueAccessor');
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var CHECKBOX_VALUE_ACCESSOR = {
provide: NG_VALUE_ACCESSOR,
useExisting: Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_14" /* forwardRef */])(function () { return CheckboxControlValueAccessor; }),
multi: true,
};
/**
* The accessor for writing a value and listening to changes on a checkbox input element.
*
* ### Example
* ```
* <input type="checkbox" name="rememberLogin" ngModel>
* ```
*
* \@stable
*/
var CheckboxControlValueAccessor = (function () {
function CheckboxControlValueAccessor(_renderer, _elementRef) {
this._renderer = _renderer;
this._elementRef = _elementRef;
this.onChange = function (_) { };
this.onTouched = function () { };
}
/**
* @param {?} value
* @return {?}
*/
CheckboxControlValueAccessor.prototype.writeValue = /**
* @param {?} value
* @return {?}
*/
function (value) {
this._renderer.setProperty(this._elementRef.nativeElement, 'checked', value);
};
/**
* @param {?} fn
* @return {?}
*/
CheckboxControlValueAccessor.prototype.registerOnChange = /**
* @param {?} fn
* @return {?}
*/
function (fn) { this.onChange = fn; };
/**
* @param {?} fn
* @return {?}
*/
CheckboxControlValueAccessor.prototype.registerOnTouched = /**
* @param {?} fn
* @return {?}
*/
function (fn) { this.onTouched = fn; };
/**
* @param {?} isDisabled
* @return {?}
*/
CheckboxControlValueAccessor.prototype.setDisabledState = /**
* @param {?} isDisabled
* @return {?}
*/
function (isDisabled) {
this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
};
CheckboxControlValueAccessor.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* Directive */], args: [{
selector: 'input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]',
host: { '(change)': 'onChange($event.target.checked)', '(blur)': 'onTouched()' },
providers: [CHECKBOX_VALUE_ACCESSOR]
},] },
];
/** @nocollapse */
CheckboxControlValueAccessor.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["W" /* Renderer2 */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["t" /* ElementRef */], },
]; };
return CheckboxControlValueAccessor;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var DEFAULT_VALUE_ACCESSOR = {
provide: NG_VALUE_ACCESSOR,
useExisting: Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_14" /* forwardRef */])(function () { return DefaultValueAccessor; }),
multi: true
};
/**
* We must check whether the agent is Android because composition events
* behave differently between iOS and Android.
* @return {?}
*/
function _isAndroid() {
var /** @type {?} */ userAgent = Object(__WEBPACK_IMPORTED_MODULE_5__angular_platform_browser__["h" /* ɵgetDOM */])() ? Object(__WEBPACK_IMPORTED_MODULE_5__angular_platform_browser__["h" /* ɵgetDOM */])().getUserAgent() : '';
return /android (\d+)/.test(userAgent.toLowerCase());
}
/**
* Turn this mode on if you want form directives to buffer IME input until compositionend
* \@experimental
*/
var COMPOSITION_BUFFER_MODE = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["B" /* InjectionToken */]('CompositionEventMode');
/**
* The default accessor for writing a value and listening to changes that is used by the
* {\@link NgModel}, {\@link FormControlDirective}, and {\@link FormControlName} directives.
*
* ### Example
* ```
* <input type="text" name="searchQuery" ngModel>
* ```
*
* \@stable
*/
var DefaultValueAccessor = (function () {
function DefaultValueAccessor(_renderer, _elementRef, _compositionMode) {
this._renderer = _renderer;
this._elementRef = _elementRef;
this._compositionMode = _compositionMode;
this.onChange = function (_) { };
this.onTouched = function () { };
/**
* Whether the user is creating a composition string (IME events).
*/
this._composing = false;
if (this._compositionMode == null) {
this._compositionMode = !_isAndroid();
}
}
/**
* @param {?} value
* @return {?}
*/
DefaultValueAccessor.prototype.writeValue = /**
* @param {?} value
* @return {?}
*/
function (value) {
var /** @type {?} */ normalizedValue = value == null ? '' : value;
this._renderer.setProperty(this._elementRef.nativeElement, 'value', normalizedValue);
};
/**
* @param {?} fn
* @return {?}
*/
DefaultValueAccessor.prototype.registerOnChange = /**
* @param {?} fn
* @return {?}
*/
function (fn) { this.onChange = fn; };
/**
* @param {?} fn
* @return {?}
*/
DefaultValueAccessor.prototype.registerOnTouched = /**
* @param {?} fn
* @return {?}
*/
function (fn) { this.onTouched = fn; };
/**
* @param {?} isDisabled
* @return {?}
*/
DefaultValueAccessor.prototype.setDisabledState = /**
* @param {?} isDisabled
* @return {?}
*/
function (isDisabled) {
this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
};
/** @internal */
/**
* \@internal
* @param {?} value
* @return {?}
*/
DefaultValueAccessor.prototype._handleInput = /**
* \@internal
* @param {?} value
* @return {?}
*/
function (value) {
if (!this._compositionMode || (this._compositionMode && !this._composing)) {
this.onChange(value);
}
};
/** @internal */
/**
* \@internal
* @return {?}
*/
DefaultValueAccessor.prototype._compositionStart = /**
* \@internal
* @return {?}
*/
function () { this._composing = true; };
/** @internal */
/**
* \@internal
* @param {?} value
* @return {?}
*/
DefaultValueAccessor.prototype._compositionEnd = /**
* \@internal
* @param {?} value
* @return {?}
*/
function (value) {
this._composing = false;
this._compositionMode && this.onChange(value);
};
DefaultValueAccessor.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* Directive */], args: [{
selector: 'input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]',
// TODO: vsavkin replace the above selector with the one below it once
// https://github.com/angular/angular/issues/3011 is implemented
// selector: '[ngModel],[formControl],[formControlName]',
host: {
'(input)': '_handleInput($event.target.value)',
'(blur)': 'onTouched()',
'(compositionstart)': '_compositionStart()',
'(compositionend)': '_compositionEnd($event.target.value)'
},
providers: [DEFAULT_VALUE_ACCESSOR]
},] },
];
/** @nocollapse */
DefaultValueAccessor.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["W" /* Renderer2 */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["t" /* ElementRef */], },
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [COMPOSITION_BUFFER_MODE,] },] },
]; };
return DefaultValueAccessor;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @param {?} validator
* @return {?}
*/
function normalizeValidator(validator) {
if ((/** @type {?} */ (validator)).validate) {
return function (c) { return (/** @type {?} */ (validator)).validate(c); };
}
else {
return /** @type {?} */ (validator);
}
}
/**
* @param {?} validator
* @return {?}
*/
function normalizeAsyncValidator(validator) {
if ((/** @type {?} */ (validator)).validate) {
return function (c) { return (/** @type {?} */ (validator)).validate(c); };
}
else {
return /** @type {?} */ (validator);
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var NUMBER_VALUE_ACCESSOR = {
provide: NG_VALUE_ACCESSOR,
useExisting: Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_14" /* forwardRef */])(function () { return NumberValueAccessor; }),
multi: true
};
/**
* The accessor for writing a number value and listening to changes that is used by the
* {\@link NgModel}, {\@link FormControlDirective}, and {\@link FormControlName} directives.
*
* ### Example
* ```
* <input type="number" [(ngModel)]="age">
* ```
*/
var NumberValueAccessor = (function () {
function NumberValueAccessor(_renderer, _elementRef) {
this._renderer = _renderer;
this._elementRef = _elementRef;
this.onChange = function (_) { };
this.onTouched = function () { };
}
/**
* @param {?} value
* @return {?}
*/
NumberValueAccessor.prototype.writeValue = /**
* @param {?} value
* @return {?}
*/
function (value) {
// The value needs to be normalized for IE9, otherwise it is set to 'null' when null
var /** @type {?} */ normalizedValue = value == null ? '' : value;
this._renderer.setProperty(this._elementRef.nativeElement, 'value', normalizedValue);
};
/**
* @param {?} fn
* @return {?}
*/
NumberValueAccessor.prototype.registerOnChange = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
this.onChange = function (value) { fn(value == '' ? null : parseFloat(value)); };
};
/**
* @param {?} fn
* @return {?}
*/
NumberValueAccessor.prototype.registerOnTouched = /**
* @param {?} fn
* @return {?}
*/
function (fn) { this.onTouched = fn; };
/**
* @param {?} isDisabled
* @return {?}
*/
NumberValueAccessor.prototype.setDisabledState = /**
* @param {?} isDisabled
* @return {?}
*/
function (isDisabled) {
this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
};
NumberValueAccessor.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* Directive */], args: [{
selector: 'input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]',
host: {
'(change)': 'onChange($event.target.value)',
'(input)': 'onChange($event.target.value)',
'(blur)': 'onTouched()'
},
providers: [NUMBER_VALUE_ACCESSOR]
},] },
];
/** @nocollapse */
NumberValueAccessor.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["W" /* Renderer2 */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["t" /* ElementRef */], },
]; };
return NumberValueAccessor;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @return {?}
*/
function unimplemented() {
throw new Error('unimplemented');
}
/**
* A base class that all control directive extend.
* It binds a {\@link FormControl} object to a DOM element.
*
* Used internally by Angular forms.
*
* \@stable
* @abstract
*/
var NgControl = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(NgControl, _super);
function NgControl() {
var _this = _super !== null && _super.apply(this, arguments) || this;
/**
* \@internal
*/
_this._parent = null;
_this.name = null;
_this.valueAccessor = null;
/**
* \@internal
*/
_this._rawValidators = [];
/**
* \@internal
*/
_this._rawAsyncValidators = [];
return _this;
}
Object.defineProperty(NgControl.prototype, "validator", {
get: /**
* @return {?}
*/
function () { return /** @type {?} */ (unimplemented()); },
enumerable: true,
configurable: true
});
Object.defineProperty(NgControl.prototype, "asyncValidator", {
get: /**
* @return {?}
*/
function () { return /** @type {?} */ (unimplemented()); },
enumerable: true,
configurable: true
});
return NgControl;
}(AbstractControlDirective));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var RADIO_VALUE_ACCESSOR = {
provide: NG_VALUE_ACCESSOR,
useExisting: Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_14" /* forwardRef */])(function () { return RadioControlValueAccessor; }),
multi: true
};
/**
* Internal class used by Angular to uncheck radio buttons with the matching name.
*/
var RadioControlRegistry = (function () {
function RadioControlRegistry() {
this._accessors = [];
}
/**
* @param {?} control
* @param {?} accessor
* @return {?}
*/
RadioControlRegistry.prototype.add = /**
* @param {?} control
* @param {?} accessor
* @return {?}
*/
function (control, accessor) {
this._accessors.push([control, accessor]);
};
/**
* @param {?} accessor
* @return {?}
*/
RadioControlRegistry.prototype.remove = /**
* @param {?} accessor
* @return {?}
*/
function (accessor) {
for (var /** @type {?} */ i = this._accessors.length - 1; i >= 0; --i) {
if (this._accessors[i][1] === accessor) {
this._accessors.splice(i, 1);
return;
}
}
};
/**
* @param {?} accessor
* @return {?}
*/
RadioControlRegistry.prototype.select = /**
* @param {?} accessor
* @return {?}
*/
function (accessor) {
var _this = this;
this._accessors.forEach(function (c) {
if (_this._isSameGroup(c, accessor) && c[1] !== accessor) {
c[1].fireUncheck(accessor.value);
}
});
};
/**
* @param {?} controlPair
* @param {?} accessor
* @return {?}
*/
RadioControlRegistry.prototype._isSameGroup = /**
* @param {?} controlPair
* @param {?} accessor
* @return {?}
*/
function (controlPair, accessor) {
if (!controlPair[0].control)
return false;
return controlPair[0]._parent === accessor._control._parent &&
controlPair[1].name === accessor.name;
};
RadioControlRegistry.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
RadioControlRegistry.ctorParameters = function () { return []; };
return RadioControlRegistry;
}());
/**
* \@whatItDoes Writes radio control values and listens to radio control changes.
*
* Used by {\@link NgModel}, {\@link FormControlDirective}, and {\@link FormControlName}
* to keep the view synced with the {\@link FormControl} model.
*
* \@howToUse
*
* If you have imported the {\@link FormsModule} or the {\@link ReactiveFormsModule}, this
* value accessor will be active on any radio control that has a form directive. You do
* **not** need to add a special selector to activate it.
*
* ### How to use radio buttons with form directives
*
* To use radio buttons in a template-driven form, you'll want to ensure that radio buttons
* in the same group have the same `name` attribute. Radio buttons with different `name`
* attributes do not affect each other.
*
* {\@example forms/ts/radioButtons/radio_button_example.ts region='TemplateDriven'}
*
* When using radio buttons in a reactive form, radio buttons in the same group should have the
* same `formControlName`. You can also add a `name` attribute, but it's optional.
*
* {\@example forms/ts/reactiveRadioButtons/reactive_radio_button_example.ts region='Reactive'}
*
* * **npm package**: `\@angular/forms`
*
* \@stable
*/
var RadioControlValueAccessor = (function () {
function RadioControlValueAccessor(_renderer, _elementRef, _registry, _injector) {
this._renderer = _renderer;
this._elementRef = _elementRef;
this._registry = _registry;
this._injector = _injector;
this.onChange = function () { };
this.onTouched = function () { };
}
/**
* @return {?}
*/
RadioControlValueAccessor.prototype.ngOnInit = /**
* @return {?}
*/
function () {
this._control = this._injector.get(NgControl);
this._checkName();
this._registry.add(this._control, this);
};
/**
* @return {?}
*/
RadioControlValueAccessor.prototype.ngOnDestroy = /**
* @return {?}
*/
function () { this._registry.remove(this); };
/**
* @param {?} value
* @return {?}
*/
RadioControlValueAccessor.prototype.writeValue = /**
* @param {?} value
* @return {?}
*/
function (value) {
this._state = value === this.value;
this._renderer.setProperty(this._elementRef.nativeElement, 'checked', this._state);
};
/**
* @param {?} fn
* @return {?}
*/
RadioControlValueAccessor.prototype.registerOnChange = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
var _this = this;
this._fn = fn;
this.onChange = function () {
fn(_this.value);
_this._registry.select(_this);
};
};
/**
* @param {?} value
* @return {?}
*/
RadioControlValueAccessor.prototype.fireUncheck = /**
* @param {?} value
* @return {?}
*/
function (value) { this.writeValue(value); };
/**
* @param {?} fn
* @return {?}
*/
RadioControlValueAccessor.prototype.registerOnTouched = /**
* @param {?} fn
* @return {?}
*/
function (fn) { this.onTouched = fn; };
/**
* @param {?} isDisabled
* @return {?}
*/
RadioControlValueAccessor.prototype.setDisabledState = /**
* @param {?} isDisabled
* @return {?}
*/
function (isDisabled) {
this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
};
/**
* @return {?}
*/
RadioControlValueAccessor.prototype._checkName = /**
* @return {?}
*/
function () {
if (this.name && this.formControlName && this.name !== this.formControlName) {
this._throwNameError();
}
if (!this.name && this.formControlName)
this.name = this.formControlName;
};
/**
* @return {?}
*/
RadioControlValueAccessor.prototype._throwNameError = /**
* @return {?}
*/
function () {
throw new Error("\n If you define both a name and a formControlName attribute on your radio button, their values\n must match. Ex: <input type=\"radio\" formControlName=\"food\" name=\"food\">\n ");
};
RadioControlValueAccessor.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* Directive */], args: [{
selector: 'input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]',
host: { '(change)': 'onChange()', '(blur)': 'onTouched()' },
providers: [RADIO_VALUE_ACCESSOR]
},] },
];
/** @nocollapse */
RadioControlValueAccessor.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["W" /* Renderer2 */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["t" /* ElementRef */], },
{ type: RadioControlRegistry, },
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["C" /* Injector */], },
]; };
RadioControlValueAccessor.propDecorators = {
"name": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */] },],
"formControlName": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */] },],
"value": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */] },],
};
return RadioControlValueAccessor;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var RANGE_VALUE_ACCESSOR = {
provide: NG_VALUE_ACCESSOR,
useExisting: Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_14" /* forwardRef */])(function () { return RangeValueAccessor; }),
multi: true
};
/**
* The accessor for writing a range value and listening to changes that is used by the
* {\@link NgModel}, {\@link FormControlDirective}, and {\@link FormControlName} directives.
*
* ### Example
* ```
* <input type="range" [(ngModel)]="age" >
* ```
*/
var RangeValueAccessor = (function () {
function RangeValueAccessor(_renderer, _elementRef) {
this._renderer = _renderer;
this._elementRef = _elementRef;
this.onChange = function (_) { };
this.onTouched = function () { };
}
/**
* @param {?} value
* @return {?}
*/
RangeValueAccessor.prototype.writeValue = /**
* @param {?} value
* @return {?}
*/
function (value) {
this._renderer.setProperty(this._elementRef.nativeElement, 'value', parseFloat(value));
};
/**
* @param {?} fn
* @return {?}
*/
RangeValueAccessor.prototype.registerOnChange = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
this.onChange = function (value) { fn(value == '' ? null : parseFloat(value)); };
};
/**
* @param {?} fn
* @return {?}
*/
RangeValueAccessor.prototype.registerOnTouched = /**
* @param {?} fn
* @return {?}
*/
function (fn) { this.onTouched = fn; };
/**
* @param {?} isDisabled
* @return {?}
*/
RangeValueAccessor.prototype.setDisabledState = /**
* @param {?} isDisabled
* @return {?}
*/
function (isDisabled) {
this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
};
RangeValueAccessor.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* Directive */], args: [{
selector: 'input[type=range][formControlName],input[type=range][formControl],input[type=range][ngModel]',
host: {
'(change)': 'onChange($event.target.value)',
'(input)': 'onChange($event.target.value)',
'(blur)': 'onTouched()'
},
providers: [RANGE_VALUE_ACCESSOR]
},] },
];
/** @nocollapse */
RangeValueAccessor.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["W" /* Renderer2 */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["t" /* ElementRef */], },
]; };
return RangeValueAccessor;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var SELECT_VALUE_ACCESSOR = {
provide: NG_VALUE_ACCESSOR,
useExisting: Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_14" /* forwardRef */])(function () { return SelectControlValueAccessor; }),
multi: true
};
/**
* @param {?} id
* @param {?} value
* @return {?}
*/
function _buildValueString(id, value) {
if (id == null)
return "" + value;
if (value && typeof value === 'object')
value = 'Object';
return (id + ": " + value).slice(0, 50);
}
/**
* @param {?} valueString
* @return {?}
*/
function _extractId(valueString) {
return valueString.split(':')[0];
}
/**
* \@whatItDoes Writes values and listens to changes on a select element.
*
* Used by {\@link NgModel}, {\@link FormControlDirective}, and {\@link FormControlName}
* to keep the view synced with the {\@link FormControl} model.
*
* \@howToUse
*
* If you have imported the {\@link FormsModule} or the {\@link ReactiveFormsModule}, this
* value accessor will be active on any select control that has a form directive. You do
* **not** need to add a special selector to activate it.
*
* ### How to use select controls with form directives
*
* To use a select in a template-driven form, simply add an `ngModel` and a `name`
* attribute to the main `<select>` tag.
*
* If your option values are simple strings, you can bind to the normal `value` property
* on the option. If your option values happen to be objects (and you'd like to save the
* selection in your form as an object), use `ngValue` instead:
*
* {\@example forms/ts/selectControl/select_control_example.ts region='Component'}
*
* In reactive forms, you'll also want to add your form directive (`formControlName` or
* `formControl`) on the main `<select>` tag. Like in the former example, you have the
* choice of binding to the `value` or `ngValue` property on the select's options.
*
* {\@example forms/ts/reactiveSelectControl/reactive_select_control_example.ts region='Component'}
*
* ### Caveat: Option selection
*
* Angular uses object identity to select option. It's possible for the identities of items
* to change while the data does not. This can happen, for example, if the items are produced
* from an RPC to the server, and that RPC is re-run. Even if the data hasn't changed, the
* second response will produce objects with different identities.
*
* To customize the default option comparison algorithm, `<select>` supports `compareWith` input.
* `compareWith` takes a **function** which has two arguments: `option1` and `option2`.
* If `compareWith` is given, Angular selects option by the return value of the function.
*
* #### Syntax
*
* ```
* <select [compareWith]="compareFn" [(ngModel)]="selectedCountries">
* <option *ngFor="let country of countries" [ngValue]="country">
* {{country.name}}
* </option>
* </select>
*
* compareFn(c1: Country, c2: Country): boolean {
* return c1 && c2 ? c1.id === c2.id : c1 === c2;
* }
* ```
*
* Note: We listen to the 'change' event because 'input' events aren't fired
* for selects in Firefox and IE:
* https://bugzilla.mozilla.org/show_bug.cgi?id=1024350
* https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/4660045/
*
* * **npm package**: `\@angular/forms`
*
* \@stable
*/
var SelectControlValueAccessor = (function () {
function SelectControlValueAccessor(_renderer, _elementRef) {
this._renderer = _renderer;
this._elementRef = _elementRef;
/**
* \@internal
*/
this._optionMap = new Map();
/**
* \@internal
*/
this._idCounter = 0;
this.onChange = function (_) { };
this.onTouched = function () { };
this._compareWith = __WEBPACK_IMPORTED_MODULE_1__angular_core__["_36" /* ɵlooseIdentical */];
}
Object.defineProperty(SelectControlValueAccessor.prototype, "compareWith", {
set: /**
* @param {?} fn
* @return {?}
*/
function (fn) {
if (typeof fn !== 'function') {
throw new Error("compareWith must be a function, but received " + JSON.stringify(fn));
}
this._compareWith = fn;
},
enumerable: true,
configurable: true
});
/**
* @param {?} value
* @return {?}
*/
SelectControlValueAccessor.prototype.writeValue = /**
* @param {?} value
* @return {?}
*/
function (value) {
this.value = value;
var /** @type {?} */ id = this._getOptionId(value);
if (id == null) {
this._renderer.setProperty(this._elementRef.nativeElement, 'selectedIndex', -1);
}
var /** @type {?} */ valueString = _buildValueString(id, value);
this._renderer.setProperty(this._elementRef.nativeElement, 'value', valueString);
};
/**
* @param {?} fn
* @return {?}
*/
SelectControlValueAccessor.prototype.registerOnChange = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
var _this = this;
this.onChange = function (valueString) {
_this.value = _this._getOptionValue(valueString);
fn(_this.value);
};
};
/**
* @param {?} fn
* @return {?}
*/
SelectControlValueAccessor.prototype.registerOnTouched = /**
* @param {?} fn
* @return {?}
*/
function (fn) { this.onTouched = fn; };
/**
* @param {?} isDisabled
* @return {?}
*/
SelectControlValueAccessor.prototype.setDisabledState = /**
* @param {?} isDisabled
* @return {?}
*/
function (isDisabled) {
this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
};
/** @internal */
/**
* \@internal
* @return {?}
*/
SelectControlValueAccessor.prototype._registerOption = /**
* \@internal
* @return {?}
*/
function () { return (this._idCounter++).toString(); };
/** @internal */
/**
* \@internal
* @param {?} value
* @return {?}
*/
SelectControlValueAccessor.prototype._getOptionId = /**
* \@internal
* @param {?} value
* @return {?}
*/
function (value) {
for (var _i = 0, _a = Array.from(this._optionMap.keys()); _i < _a.length; _i++) {
var id = _a[_i];
if (this._compareWith(this._optionMap.get(id), value))
return id;
}
return null;
};
/** @internal */
/**
* \@internal
* @param {?} valueString
* @return {?}
*/
SelectControlValueAccessor.prototype._getOptionValue = /**
* \@internal
* @param {?} valueString
* @return {?}
*/
function (valueString) {
var /** @type {?} */ id = _extractId(valueString);
return this._optionMap.has(id) ? this._optionMap.get(id) : valueString;
};
SelectControlValueAccessor.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* Directive */], args: [{
selector: 'select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]',
host: { '(change)': 'onChange($event.target.value)', '(blur)': 'onTouched()' },
providers: [SELECT_VALUE_ACCESSOR]
},] },
];
/** @nocollapse */
SelectControlValueAccessor.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["W" /* Renderer2 */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["t" /* ElementRef */], },
]; };
SelectControlValueAccessor.propDecorators = {
"compareWith": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */] },],
};
return SelectControlValueAccessor;
}());
/**
* \@whatItDoes Marks `<option>` as dynamic, so Angular can be notified when options change.
*
* \@howToUse
*
* See docs for {\@link SelectControlValueAccessor} for usage examples.
*
* \@stable
*/
var NgSelectOption = (function () {
function NgSelectOption(_element, _renderer, _select) {
this._element = _element;
this._renderer = _renderer;
this._select = _select;
if (this._select)
this.id = this._select._registerOption();
}
Object.defineProperty(NgSelectOption.prototype, "ngValue", {
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
if (this._select == null)
return;
this._select._optionMap.set(this.id, value);
this._setElementValue(_buildValueString(this.id, value));
this._select.writeValue(this._select.value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(NgSelectOption.prototype, "value", {
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
this._setElementValue(value);
if (this._select)
this._select.writeValue(this._select.value);
},
enumerable: true,
configurable: true
});
/** @internal */
/**
* \@internal
* @param {?} value
* @return {?}
*/
NgSelectOption.prototype._setElementValue = /**
* \@internal
* @param {?} value
* @return {?}
*/
function (value) {
this._renderer.setProperty(this._element.nativeElement, 'value', value);
};
/**
* @return {?}
*/
NgSelectOption.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
if (this._select) {
this._select._optionMap.delete(this.id);
this._select.writeValue(this._select.value);
}
};
NgSelectOption.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* Directive */], args: [{ selector: 'option' },] },
];
/** @nocollapse */
NgSelectOption.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["W" /* Renderer2 */], },
{ type: SelectControlValueAccessor, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Host */] },] },
]; };
NgSelectOption.propDecorators = {
"ngValue": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */], args: ['ngValue',] },],
"value": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */], args: ['value',] },],
};
return NgSelectOption;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var SELECT_MULTIPLE_VALUE_ACCESSOR = {
provide: NG_VALUE_ACCESSOR,
useExisting: Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_14" /* forwardRef */])(function () { return SelectMultipleControlValueAccessor; }),
multi: true
};
/**
* @param {?} id
* @param {?} value
* @return {?}
*/
function _buildValueString$1(id, value) {
if (id == null)
return "" + value;
if (typeof value === 'string')
value = "'" + value + "'";
if (value && typeof value === 'object')
value = 'Object';
return (id + ": " + value).slice(0, 50);
}
/**
* @param {?} valueString
* @return {?}
*/
function _extractId$1(valueString) {
return valueString.split(':')[0];
}
/**
* The accessor for writing a value and listening to changes on a select element.
*
* ### Caveat: Options selection
*
* Angular uses object identity to select options. It's possible for the identities of items
* to change while the data does not. This can happen, for example, if the items are produced
* from an RPC to the server, and that RPC is re-run. Even if the data hasn't changed, the
* second response will produce objects with different identities.
*
* To customize the default option comparison algorithm, `<select multiple>` supports `compareWith`
* input. `compareWith` takes a **function** which has two arguments: `option1` and `option2`.
* If `compareWith` is given, Angular selects options by the return value of the function.
*
* #### Syntax
*
* ```
* <select multiple [compareWith]="compareFn" [(ngModel)]="selectedCountries">
* <option *ngFor="let country of countries" [ngValue]="country">
* {{country.name}}
* </option>
* </select>
*
* compareFn(c1: Country, c2: Country): boolean {
* return c1 && c2 ? c1.id === c2.id : c1 === c2;
* }
* ```
*
* \@stable
*/
var SelectMultipleControlValueAccessor = (function () {
function SelectMultipleControlValueAccessor(_renderer, _elementRef) {
this._renderer = _renderer;
this._elementRef = _elementRef;
/**
* \@internal
*/
this._optionMap = new Map();
/**
* \@internal
*/
this._idCounter = 0;
this.onChange = function (_) { };
this.onTouched = function () { };
this._compareWith = __WEBPACK_IMPORTED_MODULE_1__angular_core__["_36" /* ɵlooseIdentical */];
}
Object.defineProperty(SelectMultipleControlValueAccessor.prototype, "compareWith", {
set: /**
* @param {?} fn
* @return {?}
*/
function (fn) {
if (typeof fn !== 'function') {
throw new Error("compareWith must be a function, but received " + JSON.stringify(fn));
}
this._compareWith = fn;
},
enumerable: true,
configurable: true
});
/**
* @param {?} value
* @return {?}
*/
SelectMultipleControlValueAccessor.prototype.writeValue = /**
* @param {?} value
* @return {?}
*/
function (value) {
var _this = this;
this.value = value;
var /** @type {?} */ optionSelectedStateSetter;
if (Array.isArray(value)) {
// convert values to ids
var /** @type {?} */ ids_1 = value.map(function (v) { return _this._getOptionId(v); });
optionSelectedStateSetter = function (opt, o) { opt._setSelected(ids_1.indexOf(o.toString()) > -1); };
}
else {
optionSelectedStateSetter = function (opt, o) { opt._setSelected(false); };
}
this._optionMap.forEach(optionSelectedStateSetter);
};
/**
* @param {?} fn
* @return {?}
*/
SelectMultipleControlValueAccessor.prototype.registerOnChange = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
var _this = this;
this.onChange = function (_) {
var /** @type {?} */ selected = [];
if (_.hasOwnProperty('selectedOptions')) {
var /** @type {?} */ options = _.selectedOptions;
for (var /** @type {?} */ i = 0; i < options.length; i++) {
var /** @type {?} */ opt = options.item(i);
var /** @type {?} */ val = _this._getOptionValue(opt.value);
selected.push(val);
}
}
else {
var /** @type {?} */ options = /** @type {?} */ (_.options);
for (var /** @type {?} */ i = 0; i < options.length; i++) {
var /** @type {?} */ opt = options.item(i);
if (opt.selected) {
var /** @type {?} */ val = _this._getOptionValue(opt.value);
selected.push(val);
}
}
}
_this.value = selected;
fn(selected);
};
};
/**
* @param {?} fn
* @return {?}
*/
SelectMultipleControlValueAccessor.prototype.registerOnTouched = /**
* @param {?} fn
* @return {?}
*/
function (fn) { this.onTouched = fn; };
/**
* @param {?} isDisabled
* @return {?}
*/
SelectMultipleControlValueAccessor.prototype.setDisabledState = /**
* @param {?} isDisabled
* @return {?}
*/
function (isDisabled) {
this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
};
/** @internal */
/**
* \@internal
* @param {?} value
* @return {?}
*/
SelectMultipleControlValueAccessor.prototype._registerOption = /**
* \@internal
* @param {?} value
* @return {?}
*/
function (value) {
var /** @type {?} */ id = (this._idCounter++).toString();
this._optionMap.set(id, value);
return id;
};
/** @internal */
/**
* \@internal
* @param {?} value
* @return {?}
*/
SelectMultipleControlValueAccessor.prototype._getOptionId = /**
* \@internal
* @param {?} value
* @return {?}
*/
function (value) {
for (var _i = 0, _a = Array.from(this._optionMap.keys()); _i < _a.length; _i++) {
var id = _a[_i];
if (this._compareWith(/** @type {?} */ ((this._optionMap.get(id)))._value, value))
return id;
}
return null;
};
/** @internal */
/**
* \@internal
* @param {?} valueString
* @return {?}
*/
SelectMultipleControlValueAccessor.prototype._getOptionValue = /**
* \@internal
* @param {?} valueString
* @return {?}
*/
function (valueString) {
var /** @type {?} */ id = _extractId$1(valueString);
return this._optionMap.has(id) ? /** @type {?} */ ((this._optionMap.get(id)))._value : valueString;
};
SelectMultipleControlValueAccessor.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* Directive */], args: [{
selector: 'select[multiple][formControlName],select[multiple][formControl],select[multiple][ngModel]',
host: { '(change)': 'onChange($event.target)', '(blur)': 'onTouched()' },
providers: [SELECT_MULTIPLE_VALUE_ACCESSOR]
},] },
];
/** @nocollapse */
SelectMultipleControlValueAccessor.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["W" /* Renderer2 */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["t" /* ElementRef */], },
]; };
SelectMultipleControlValueAccessor.propDecorators = {
"compareWith": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */] },],
};
return SelectMultipleControlValueAccessor;
}());
/**
* Marks `<option>` as dynamic, so Angular can be notified when options change.
*
* ### Example
*
* ```
* <select multiple name="city" ngModel>
* <option *ngFor="let c of cities" [value]="c"></option>
* </select>
* ```
*/
var NgSelectMultipleOption = (function () {
function NgSelectMultipleOption(_element, _renderer, _select) {
this._element = _element;
this._renderer = _renderer;
this._select = _select;
if (this._select) {
this.id = this._select._registerOption(this);
}
}
Object.defineProperty(NgSelectMultipleOption.prototype, "ngValue", {
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
if (this._select == null)
return;
this._value = value;
this._setElementValue(_buildValueString$1(this.id, value));
this._select.writeValue(this._select.value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(NgSelectMultipleOption.prototype, "value", {
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
if (this._select) {
this._value = value;
this._setElementValue(_buildValueString$1(this.id, value));
this._select.writeValue(this._select.value);
}
else {
this._setElementValue(value);
}
},
enumerable: true,
configurable: true
});
/** @internal */
/**
* \@internal
* @param {?} value
* @return {?}
*/
NgSelectMultipleOption.prototype._setElementValue = /**
* \@internal
* @param {?} value
* @return {?}
*/
function (value) {
this._renderer.setProperty(this._element.nativeElement, 'value', value);
};
/** @internal */
/**
* \@internal
* @param {?} selected
* @return {?}
*/
NgSelectMultipleOption.prototype._setSelected = /**
* \@internal
* @param {?} selected
* @return {?}
*/
function (selected) {
this._renderer.setProperty(this._element.nativeElement, 'selected', selected);
};
/**
* @return {?}
*/
NgSelectMultipleOption.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
if (this._select) {
this._select._optionMap.delete(this.id);
this._select.writeValue(this._select.value);
}
};
NgSelectMultipleOption.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* Directive */], args: [{ selector: 'option' },] },
];
/** @nocollapse */
NgSelectMultipleOption.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["W" /* Renderer2 */], },
{ type: SelectMultipleControlValueAccessor, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Host */] },] },
]; };
NgSelectMultipleOption.propDecorators = {
"ngValue": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */], args: ['ngValue',] },],
"value": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */], args: ['value',] },],
};
return NgSelectMultipleOption;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @param {?} name
* @param {?} parent
* @return {?}
*/
function controlPath(name, parent) {
return /** @type {?} */ ((parent.path)).concat([name]);
}
/**
* @param {?} control
* @param {?} dir
* @return {?}
*/
function setUpControl(control, dir) {
if (!control)
_throwError(dir, 'Cannot find control with');
if (!dir.valueAccessor)
_throwError(dir, 'No value accessor for form control with');
control.validator = Validators.compose([/** @type {?} */ ((control.validator)), dir.validator]);
control.asyncValidator = Validators.composeAsync([/** @type {?} */ ((control.asyncValidator)), dir.asyncValidator]); /** @type {?} */
((dir.valueAccessor)).writeValue(control.value);
setUpViewChangePipeline(control, dir);
setUpModelChangePipeline(control, dir);
setUpBlurPipeline(control, dir);
if (/** @type {?} */ ((dir.valueAccessor)).setDisabledState) {
control.registerOnDisabledChange(function (isDisabled) { /** @type {?} */ ((/** @type {?} */ ((dir.valueAccessor)).setDisabledState))(isDisabled); });
}
// re-run validation when validator binding changes, e.g. minlength=3 -> minlength=4
dir._rawValidators.forEach(function (validator) {
if ((/** @type {?} */ (validator)).registerOnValidatorChange)
/** @type {?} */ (((/** @type {?} */ (validator)).registerOnValidatorChange))(function () { return control.updateValueAndValidity(); });
});
dir._rawAsyncValidators.forEach(function (validator) {
if ((/** @type {?} */ (validator)).registerOnValidatorChange)
/** @type {?} */ (((/** @type {?} */ (validator)).registerOnValidatorChange))(function () { return control.updateValueAndValidity(); });
});
}
/**
* @param {?} control
* @param {?} dir
* @return {?}
*/
function cleanUpControl(control, dir) {
/** @type {?} */ ((dir.valueAccessor)).registerOnChange(function () { return _noControlError(dir); }); /** @type {?} */
((dir.valueAccessor)).registerOnTouched(function () { return _noControlError(dir); });
dir._rawValidators.forEach(function (validator) {
if (validator.registerOnValidatorChange) {
validator.registerOnValidatorChange(null);
}
});
dir._rawAsyncValidators.forEach(function (validator) {
if (validator.registerOnValidatorChange) {
validator.registerOnValidatorChange(null);
}
});
if (control)
control._clearChangeFns();
}
/**
* @param {?} control
* @param {?} dir
* @return {?}
*/
function setUpViewChangePipeline(control, dir) {
/** @type {?} */ ((dir.valueAccessor)).registerOnChange(function (newValue) {
control._pendingValue = newValue;
control._pendingChange = true;
control._pendingDirty = true;
if (control.updateOn === 'change')
updateControl(control, dir);
});
}
/**
* @param {?} control
* @param {?} dir
* @return {?}
*/
function setUpBlurPipeline(control, dir) {
/** @type {?} */ ((dir.valueAccessor)).registerOnTouched(function () {
control._pendingTouched = true;
if (control.updateOn === 'blur' && control._pendingChange)
updateControl(control, dir);
if (control.updateOn !== 'submit')
control.markAsTouched();
});
}
/**
* @param {?} control
* @param {?} dir
* @return {?}
*/
function updateControl(control, dir) {
dir.viewToModelUpdate(control._pendingValue);
if (control._pendingDirty)
control.markAsDirty();
control.setValue(control._pendingValue, { emitModelToViewChange: false });
control._pendingChange = false;
}
/**
* @param {?} control
* @param {?} dir
* @return {?}
*/
function setUpModelChangePipeline(control, dir) {
control.registerOnChange(function (newValue, emitModelEvent) {
/** @type {?} */ ((
// control -> view
dir.valueAccessor)).writeValue(newValue);
// control -> ngModel
if (emitModelEvent)
dir.viewToModelUpdate(newValue);
});
}
/**
* @param {?} control
* @param {?} dir
* @return {?}
*/
function setUpFormContainer(control, dir) {
if (control == null)
_throwError(dir, 'Cannot find control with');
control.validator = Validators.compose([control.validator, dir.validator]);
control.asyncValidator = Validators.composeAsync([control.asyncValidator, dir.asyncValidator]);
}
/**
* @param {?} dir
* @return {?}
*/
function _noControlError(dir) {
return _throwError(dir, 'There is no FormControl instance attached to form control element with');
}
/**
* @param {?} dir
* @param {?} message
* @return {?}
*/
function _throwError(dir, message) {
var /** @type {?} */ messageEnd;
if (/** @type {?} */ ((dir.path)).length > 1) {
messageEnd = "path: '" + (/** @type {?} */ ((dir.path))).join(' -> ') + "'";
}
else if (/** @type {?} */ ((dir.path))[0]) {
messageEnd = "name: '" + dir.path + "'";
}
else {
messageEnd = 'unspecified name attribute';
}
throw new Error(message + " " + messageEnd);
}
/**
* @param {?} validators
* @return {?}
*/
function composeValidators(validators) {
return validators != null ? Validators.compose(validators.map(normalizeValidator)) : null;
}
/**
* @param {?} validators
* @return {?}
*/
function composeAsyncValidators(validators) {
return validators != null ? Validators.composeAsync(validators.map(normalizeAsyncValidator)) :
null;
}
/**
* @param {?} changes
* @param {?} viewModel
* @return {?}
*/
function isPropertyUpdated(changes, viewModel) {
if (!changes.hasOwnProperty('model'))
return false;
var /** @type {?} */ change = changes['model'];
if (change.isFirstChange())
return true;
return !Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_36" /* ɵlooseIdentical */])(viewModel, change.currentValue);
}
var BUILTIN_ACCESSORS = [
CheckboxControlValueAccessor,
RangeValueAccessor,
NumberValueAccessor,
SelectControlValueAccessor,
SelectMultipleControlValueAccessor,
RadioControlValueAccessor,
];
/**
* @param {?} valueAccessor
* @return {?}
*/
function isBuiltInAccessor(valueAccessor) {
return BUILTIN_ACCESSORS.some(function (a) { return valueAccessor.constructor === a; });
}
/**
* @param {?} form
* @param {?} directives
* @return {?}
*/
function syncPendingControls(form, directives) {
form._syncPendingControls();
directives.forEach(function (dir) {
var /** @type {?} */ control = /** @type {?} */ (dir.control);
if (control.updateOn === 'submit' && control._pendingChange) {
dir.viewToModelUpdate(control._pendingValue);
control._pendingChange = false;
}
});
}
/**
* @param {?} dir
* @param {?} valueAccessors
* @return {?}
*/
function selectValueAccessor(dir, valueAccessors) {
if (!valueAccessors)
return null;
var /** @type {?} */ defaultAccessor = undefined;
var /** @type {?} */ builtinAccessor = undefined;
var /** @type {?} */ customAccessor = undefined;
valueAccessors.forEach(function (v) {
if (v.constructor === DefaultValueAccessor) {
defaultAccessor = v;
}
else if (isBuiltInAccessor(v)) {
if (builtinAccessor)
_throwError(dir, 'More than one built-in value accessor matches form control with');
builtinAccessor = v;
}
else {
if (customAccessor)
_throwError(dir, 'More than one custom value accessor matches form control with');
customAccessor = v;
}
});
if (customAccessor)
return customAccessor;
if (builtinAccessor)
return builtinAccessor;
if (defaultAccessor)
return defaultAccessor;
_throwError(dir, 'No valid value accessor for form control with');
return null;
}
/**
* @template T
* @param {?} list
* @param {?} el
* @return {?}
*/
function removeDir(list, el) {
var /** @type {?} */ index = list.indexOf(el);
if (index > -1)
list.splice(index, 1);
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* This is a base class for code shared between {\@link NgModelGroup} and {\@link FormGroupName}.
*
* \@stable
*/
var AbstractFormGroupDirective = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(AbstractFormGroupDirective, _super);
function AbstractFormGroupDirective() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @return {?}
*/
AbstractFormGroupDirective.prototype.ngOnInit = /**
* @return {?}
*/
function () {
this._checkParentType(); /** @type {?} */
((this.formDirective)).addFormGroup(this);
};
/**
* @return {?}
*/
AbstractFormGroupDirective.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
if (this.formDirective) {
this.formDirective.removeFormGroup(this);
}
};
Object.defineProperty(AbstractFormGroupDirective.prototype, "control", {
/**
* Get the {@link FormGroup} backing this binding.
*/
get: /**
* Get the {\@link FormGroup} backing this binding.
* @return {?}
*/
function () { return /** @type {?} */ ((this.formDirective)).getFormGroup(this); },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractFormGroupDirective.prototype, "path", {
/**
* Get the path to this control group.
*/
get: /**
* Get the path to this control group.
* @return {?}
*/
function () { return controlPath(this.name, this._parent); },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractFormGroupDirective.prototype, "formDirective", {
/**
* Get the {@link Form} to which this group belongs.
*/
get: /**
* Get the {\@link Form} to which this group belongs.
* @return {?}
*/
function () { return this._parent ? this._parent.formDirective : null; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractFormGroupDirective.prototype, "validator", {
get: /**
* @return {?}
*/
function () { return composeValidators(this._validators); },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractFormGroupDirective.prototype, "asyncValidator", {
get: /**
* @return {?}
*/
function () {
return composeAsyncValidators(this._asyncValidators);
},
enumerable: true,
configurable: true
});
/** @internal */
/**
* \@internal
* @return {?}
*/
AbstractFormGroupDirective.prototype._checkParentType = /**
* \@internal
* @return {?}
*/
function () { };
return AbstractFormGroupDirective;
}(ControlContainer));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var AbstractControlStatus = (function () {
function AbstractControlStatus(cd) {
this._cd = cd;
}
Object.defineProperty(AbstractControlStatus.prototype, "ngClassUntouched", {
get: /**
* @return {?}
*/
function () { return this._cd.control ? this._cd.control.untouched : false; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControlStatus.prototype, "ngClassTouched", {
get: /**
* @return {?}
*/
function () { return this._cd.control ? this._cd.control.touched : false; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControlStatus.prototype, "ngClassPristine", {
get: /**
* @return {?}
*/
function () { return this._cd.control ? this._cd.control.pristine : false; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControlStatus.prototype, "ngClassDirty", {
get: /**
* @return {?}
*/
function () { return this._cd.control ? this._cd.control.dirty : false; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControlStatus.prototype, "ngClassValid", {
get: /**
* @return {?}
*/
function () { return this._cd.control ? this._cd.control.valid : false; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControlStatus.prototype, "ngClassInvalid", {
get: /**
* @return {?}
*/
function () { return this._cd.control ? this._cd.control.invalid : false; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControlStatus.prototype, "ngClassPending", {
get: /**
* @return {?}
*/
function () { return this._cd.control ? this._cd.control.pending : false; },
enumerable: true,
configurable: true
});
return AbstractControlStatus;
}());
var ngControlStatusHost = {
'[class.ng-untouched]': 'ngClassUntouched',
'[class.ng-touched]': 'ngClassTouched',
'[class.ng-pristine]': 'ngClassPristine',
'[class.ng-dirty]': 'ngClassDirty',
'[class.ng-valid]': 'ngClassValid',
'[class.ng-invalid]': 'ngClassInvalid',
'[class.ng-pending]': 'ngClassPending',
};
/**
* Directive automatically applied to Angular form controls that sets CSS classes
* based on control status. The following classes are applied as the properties
* become true:
*
* * ng-valid
* * ng-invalid
* * ng-pending
* * ng-pristine
* * ng-dirty
* * ng-untouched
* * ng-touched
*
* \@stable
*/
var NgControlStatus = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(NgControlStatus, _super);
function NgControlStatus(cd) {
return _super.call(this, cd) || this;
}
NgControlStatus.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* Directive */], args: [{ selector: '[formControlName],[ngModel],[formControl]', host: ngControlStatusHost },] },
];
/** @nocollapse */
NgControlStatus.ctorParameters = function () { return [
{ type: NgControl, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_1" /* Self */] },] },
]; };
return NgControlStatus;
}(AbstractControlStatus));
/**
* Directive automatically applied to Angular form groups that sets CSS classes
* based on control status (valid/invalid/dirty/etc).
*
* \@stable
*/
var NgControlStatusGroup = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(NgControlStatusGroup, _super);
function NgControlStatusGroup(cd) {
return _super.call(this, cd) || this;
}
NgControlStatusGroup.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* Directive */], args: [{
selector: '[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]',
host: ngControlStatusHost
},] },
];
/** @nocollapse */
NgControlStatusGroup.ctorParameters = function () { return [
{ type: ControlContainer, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_1" /* Self */] },] },
]; };
return NgControlStatusGroup;
}(AbstractControlStatus));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Indicates that a FormControl is valid, i.e. that no errors exist in the input value.
*/
var VALID = 'VALID';
/**
* Indicates that a FormControl is invalid, i.e. that an error exists in the input value.
*/
var INVALID = 'INVALID';
/**
* Indicates that a FormControl is pending, i.e. that async validation is occurring and
* errors are not yet available for the input value.
*/
var PENDING = 'PENDING';
/**
* Indicates that a FormControl is disabled, i.e. that the control is exempt from ancestor
* calculations of validity or value.
*/
var DISABLED = 'DISABLED';
/**
* @param {?} control
* @param {?} path
* @param {?} delimiter
* @return {?}
*/
function _find(control, path, delimiter) {
if (path == null)
return null;
if (!(path instanceof Array)) {
path = (/** @type {?} */ (path)).split(delimiter);
}
if (path instanceof Array && (path.length === 0))
return null;
return (/** @type {?} */ (path)).reduce(function (v, name) {
if (v instanceof FormGroup) {
return v.controls[name] || null;
}
if (v instanceof FormArray) {
return v.at(/** @type {?} */ (name)) || null;
}
return null;
}, control);
}
/**
* @param {?=} validatorOrOpts
* @return {?}
*/
function coerceToValidator(validatorOrOpts) {
var /** @type {?} */ validator = /** @type {?} */ ((isOptionsObj(validatorOrOpts) ? (/** @type {?} */ (validatorOrOpts)).validators :
validatorOrOpts));
return Array.isArray(validator) ? composeValidators(validator) : validator || null;
}
/**
* @param {?=} asyncValidator
* @param {?=} validatorOrOpts
* @return {?}
*/
function coerceToAsyncValidator(asyncValidator, validatorOrOpts) {
var /** @type {?} */ origAsyncValidator = /** @type {?} */ ((isOptionsObj(validatorOrOpts) ? (/** @type {?} */ (validatorOrOpts)).asyncValidators :
asyncValidator));
return Array.isArray(origAsyncValidator) ? composeAsyncValidators(origAsyncValidator) :
origAsyncValidator || null;
}
/**
* @record
*/
/**
* @param {?=} validatorOrOpts
* @return {?}
*/
function isOptionsObj(validatorOrOpts) {
return validatorOrOpts != null && !Array.isArray(validatorOrOpts) &&
typeof validatorOrOpts === 'object';
}
/**
* \@whatItDoes This is the base class for {\@link FormControl}, {\@link FormGroup}, and
* {\@link FormArray}.
*
* It provides some of the shared behavior that all controls and groups of controls have, like
* running validators, calculating status, and resetting state. It also defines the properties
* that are shared between all sub-classes, like `value`, `valid`, and `dirty`. It shouldn't be
* instantiated directly.
*
* \@stable
* @abstract
*/
var AbstractControl = (function () {
function AbstractControl(validator, asyncValidator) {
this.validator = validator;
this.asyncValidator = asyncValidator;
/**
* \@internal
*/
this._onCollectionChange = function () { };
/**
* A control is `pristine` if the user has not yet changed
* the value in the UI.
*
* Note that programmatic changes to a control's value will
* *not* mark it dirty.
*/
this.pristine = true;
/**
* A control is marked `touched` once the user has triggered
* a `blur` event on it.
*/
this.touched = false;
/**
* \@internal
*/
this._onDisabledChange = [];
}
Object.defineProperty(AbstractControl.prototype, "parent", {
/**
* The parent control.
*/
get: /**
* The parent control.
* @return {?}
*/
function () { return this._parent; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControl.prototype, "valid", {
/**
* A control is `valid` when its `status === VALID`.
*
* In order to have this status, the control must have passed all its
* validation checks.
*/
get: /**
* A control is `valid` when its `status === VALID`.
*
* In order to have this status, the control must have passed all its
* validation checks.
* @return {?}
*/
function () { return this.status === VALID; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControl.prototype, "invalid", {
/**
* A control is `invalid` when its `status === INVALID`.
*
* In order to have this status, the control must have failed
* at least one of its validation checks.
*/
get: /**
* A control is `invalid` when its `status === INVALID`.
*
* In order to have this status, the control must have failed
* at least one of its validation checks.
* @return {?}
*/
function () { return this.status === INVALID; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControl.prototype, "pending", {
/**
* A control is `pending` when its `status === PENDING`.
*
* In order to have this status, the control must be in the
* middle of conducting a validation check.
*/
get: /**
* A control is `pending` when its `status === PENDING`.
*
* In order to have this status, the control must be in the
* middle of conducting a validation check.
* @return {?}
*/
function () { return this.status == PENDING; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControl.prototype, "disabled", {
/**
* A control is `disabled` when its `status === DISABLED`.
*
* Disabled controls are exempt from validation checks and
* are not included in the aggregate value of their ancestor
* controls.
*/
get: /**
* A control is `disabled` when its `status === DISABLED`.
*
* Disabled controls are exempt from validation checks and
* are not included in the aggregate value of their ancestor
* controls.
* @return {?}
*/
function () { return this.status === DISABLED; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControl.prototype, "enabled", {
/**
* A control is `enabled` as long as its `status !== DISABLED`.
*
* In other words, it has a status of `VALID`, `INVALID`, or
* `PENDING`.
*/
get: /**
* A control is `enabled` as long as its `status !== DISABLED`.
*
* In other words, it has a status of `VALID`, `INVALID`, or
* `PENDING`.
* @return {?}
*/
function () { return this.status !== DISABLED; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControl.prototype, "dirty", {
/**
* A control is `dirty` if the user has changed the value
* in the UI.
*
* Note that programmatic changes to a control's value will
* *not* mark it dirty.
*/
get: /**
* A control is `dirty` if the user has changed the value
* in the UI.
*
* Note that programmatic changes to a control's value will
* *not* mark it dirty.
* @return {?}
*/
function () { return !this.pristine; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControl.prototype, "untouched", {
/**
* A control is `untouched` if the user has not yet triggered
* a `blur` event on it.
*/
get: /**
* A control is `untouched` if the user has not yet triggered
* a `blur` event on it.
* @return {?}
*/
function () { return !this.touched; },
enumerable: true,
configurable: true
});
Object.defineProperty(AbstractControl.prototype, "updateOn", {
/**
* Returns the update strategy of the `AbstractControl` (i.e.
* the event on which the control will update itself).
* Possible values: `'change'` (default) | `'blur'` | `'submit'`
*/
get: /**
* Returns the update strategy of the `AbstractControl` (i.e.
* the event on which the control will update itself).
* Possible values: `'change'` (default) | `'blur'` | `'submit'`
* @return {?}
*/
function () {
return this._updateOn ? this._updateOn : (this.parent ? this.parent.updateOn : 'change');
},
enumerable: true,
configurable: true
});
/**
* Sets the synchronous validators that are active on this control. Calling
* this will overwrite any existing sync validators.
*/
/**
* Sets the synchronous validators that are active on this control. Calling
* this will overwrite any existing sync validators.
* @param {?} newValidator
* @return {?}
*/
AbstractControl.prototype.setValidators = /**
* Sets the synchronous validators that are active on this control. Calling
* this will overwrite any existing sync validators.
* @param {?} newValidator
* @return {?}
*/
function (newValidator) {
this.validator = coerceToValidator(newValidator);
};
/**
* Sets the async validators that are active on this control. Calling this
* will overwrite any existing async validators.
*/
/**
* Sets the async validators that are active on this control. Calling this
* will overwrite any existing async validators.
* @param {?} newValidator
* @return {?}
*/
AbstractControl.prototype.setAsyncValidators = /**
* Sets the async validators that are active on this control. Calling this
* will overwrite any existing async validators.
* @param {?} newValidator
* @return {?}
*/
function (newValidator) {
this.asyncValidator = coerceToAsyncValidator(newValidator);
};
/**
* Empties out the sync validator list.
*/
/**
* Empties out the sync validator list.
* @return {?}
*/
AbstractControl.prototype.clearValidators = /**
* Empties out the sync validator list.
* @return {?}
*/
function () { this.validator = null; };
/**
* Empties out the async validator list.
*/
/**
* Empties out the async validator list.
* @return {?}
*/
AbstractControl.prototype.clearAsyncValidators = /**
* Empties out the async validator list.
* @return {?}
*/
function () { this.asyncValidator = null; };
/**
* Marks the control as `touched`.
*
* This will also mark all direct ancestors as `touched` to maintain
* the model.
*/
/**
* Marks the control as `touched`.
*
* This will also mark all direct ancestors as `touched` to maintain
* the model.
* @param {?=} opts
* @return {?}
*/
AbstractControl.prototype.markAsTouched = /**
* Marks the control as `touched`.
*
* This will also mark all direct ancestors as `touched` to maintain
* the model.
* @param {?=} opts
* @return {?}
*/
function (opts) {
if (opts === void 0) { opts = {}; }
(/** @type {?} */ (this)).touched = true;
if (this._parent && !opts.onlySelf) {
this._parent.markAsTouched(opts);
}
};
/**
* Marks the control as `untouched`.
*
* If the control has any children, it will also mark all children as `untouched`
* to maintain the model, and re-calculate the `touched` status of all parent
* controls.
*/
/**
* Marks the control as `untouched`.
*
* If the control has any children, it will also mark all children as `untouched`
* to maintain the model, and re-calculate the `touched` status of all parent
* controls.
* @param {?=} opts
* @return {?}
*/
AbstractControl.prototype.markAsUntouched = /**
* Marks the control as `untouched`.
*
* If the control has any children, it will also mark all children as `untouched`
* to maintain the model, and re-calculate the `touched` status of all parent
* controls.
* @param {?=} opts
* @return {?}
*/
function (opts) {
if (opts === void 0) { opts = {}; }
(/** @type {?} */ (this)).touched = false;
this._pendingTouched = false;
this._forEachChild(function (control) { control.markAsUntouched({ onlySelf: true }); });
if (this._parent && !opts.onlySelf) {
this._parent._updateTouched(opts);
}
};
/**
* Marks the control as `dirty`.
*
* This will also mark all direct ancestors as `dirty` to maintain
* the model.
*/
/**
* Marks the control as `dirty`.
*
* This will also mark all direct ancestors as `dirty` to maintain
* the model.
* @param {?=} opts
* @return {?}
*/
AbstractControl.prototype.markAsDirty = /**
* Marks the control as `dirty`.
*
* This will also mark all direct ancestors as `dirty` to maintain
* the model.
* @param {?=} opts
* @return {?}
*/
function (opts) {
if (opts === void 0) { opts = {}; }
(/** @type {?} */ (this)).pristine = false;
if (this._parent && !opts.onlySelf) {
this._parent.markAsDirty(opts);
}
};
/**
* Marks the control as `pristine`.
*
* If the control has any children, it will also mark all children as `pristine`
* to maintain the model, and re-calculate the `pristine` status of all parent
* controls.
*/
/**
* Marks the control as `pristine`.
*
* If the control has any children, it will also mark all children as `pristine`
* to maintain the model, and re-calculate the `pristine` status of all parent
* controls.
* @param {?=} opts
* @return {?}
*/
AbstractControl.prototype.markAsPristine = /**
* Marks the control as `pristine`.
*
* If the control has any children, it will also mark all children as `pristine`
* to maintain the model, and re-calculate the `pristine` status of all parent
* controls.
* @param {?=} opts
* @return {?}
*/
function (opts) {
if (opts === void 0) { opts = {}; }
(/** @type {?} */ (this)).pristine = true;
this._pendingDirty = false;
this._forEachChild(function (control) { control.markAsPristine({ onlySelf: true }); });
if (this._parent && !opts.onlySelf) {
this._parent._updatePristine(opts);
}
};
/**
* Marks the control as `pending`.
*/
/**
* Marks the control as `pending`.
* @param {?=} opts
* @return {?}
*/
AbstractControl.prototype.markAsPending = /**
* Marks the control as `pending`.
* @param {?=} opts
* @return {?}
*/
function (opts) {
if (opts === void 0) { opts = {}; }
(/** @type {?} */ (this)).status = PENDING;
if (this._parent && !opts.onlySelf) {
this._parent.markAsPending(opts);
}
};
/**
* Disables the control. This means the control will be exempt from validation checks and
* excluded from the aggregate value of any parent. Its status is `DISABLED`.
*
* If the control has children, all children will be disabled to maintain the model.
*/
/**
* Disables the control. This means the control will be exempt from validation checks and
* excluded from the aggregate value of any parent. Its status is `DISABLED`.
*
* If the control has children, all children will be disabled to maintain the model.
* @param {?=} opts
* @return {?}
*/
AbstractControl.prototype.disable = /**
* Disables the control. This means the control will be exempt from validation checks and
* excluded from the aggregate value of any parent. Its status is `DISABLED`.
*
* If the control has children, all children will be disabled to maintain the model.
* @param {?=} opts
* @return {?}
*/
function (opts) {
if (opts === void 0) { opts = {}; }
(/** @type {?} */ (this)).status = DISABLED;
(/** @type {?} */ (this)).errors = null;
this._forEachChild(function (control) { control.disable({ onlySelf: true }); });
this._updateValue();
if (opts.emitEvent !== false) {
(/** @type {?} */ (this.valueChanges)).emit(this.value);
(/** @type {?} */ (this.statusChanges)).emit(this.status);
}
this._updateAncestors(!!opts.onlySelf);
this._onDisabledChange.forEach(function (changeFn) { return changeFn(true); });
};
/**
* Enables the control. This means the control will be included in validation checks and
* the aggregate value of its parent. Its status is re-calculated based on its value and
* its validators.
*
* If the control has children, all children will be enabled.
*/
/**
* Enables the control. This means the control will be included in validation checks and
* the aggregate value of its parent. Its status is re-calculated based on its value and
* its validators.
*
* If the control has children, all children will be enabled.
* @param {?=} opts
* @return {?}
*/
AbstractControl.prototype.enable = /**
* Enables the control. This means the control will be included in validation checks and
* the aggregate value of its parent. Its status is re-calculated based on its value and
* its validators.
*
* If the control has children, all children will be enabled.
* @param {?=} opts
* @return {?}
*/
function (opts) {
if (opts === void 0) { opts = {}; }
(/** @type {?} */ (this)).status = VALID;
this._forEachChild(function (control) { control.enable({ onlySelf: true }); });
this.updateValueAndValidity({ onlySelf: true, emitEvent: opts.emitEvent });
this._updateAncestors(!!opts.onlySelf);
this._onDisabledChange.forEach(function (changeFn) { return changeFn(false); });
};
/**
* @param {?} onlySelf
* @return {?}
*/
AbstractControl.prototype._updateAncestors = /**
* @param {?} onlySelf
* @return {?}
*/
function (onlySelf) {
if (this._parent && !onlySelf) {
this._parent.updateValueAndValidity();
this._parent._updatePristine();
this._parent._updateTouched();
}
};
/**
* @param {?} parent
* @return {?}
*/
AbstractControl.prototype.setParent = /**
* @param {?} parent
* @return {?}
*/
function (parent) { this._parent = parent; };
/**
* Re-calculates the value and validation status of the control.
*
* By default, it will also update the value and validity of its ancestors.
*/
/**
* Re-calculates the value and validation status of the control.
*
* By default, it will also update the value and validity of its ancestors.
* @param {?=} opts
* @return {?}
*/
AbstractControl.prototype.updateValueAndValidity = /**
* Re-calculates the value and validation status of the control.
*
* By default, it will also update the value and validity of its ancestors.
* @param {?=} opts
* @return {?}
*/
function (opts) {
if (opts === void 0) { opts = {}; }
this._setInitialStatus();
this._updateValue();
if (this.enabled) {
this._cancelExistingSubscription();
(/** @type {?} */ (this)).errors = this._runValidator();
(/** @type {?} */ (this)).status = this._calculateStatus();
if (this.status === VALID || this.status === PENDING) {
this._runAsyncValidator(opts.emitEvent);
}
}
if (opts.emitEvent !== false) {
(/** @type {?} */ (this.valueChanges)).emit(this.value);
(/** @type {?} */ (this.statusChanges)).emit(this.status);
}
if (this._parent && !opts.onlySelf) {
this._parent.updateValueAndValidity(opts);
}
};
/** @internal */
/**
* \@internal
* @param {?=} opts
* @return {?}
*/
AbstractControl.prototype._updateTreeValidity = /**
* \@internal
* @param {?=} opts
* @return {?}
*/
function (opts) {
if (opts === void 0) { opts = { emitEvent: true }; }
this._forEachChild(function (ctrl) { return ctrl._updateTreeValidity(opts); });
this.updateValueAndValidity({ onlySelf: true, emitEvent: opts.emitEvent });
};
/**
* @return {?}
*/
AbstractControl.prototype._setInitialStatus = /**
* @return {?}
*/
function () {
(/** @type {?} */ (this)).status = this._allControlsDisabled() ? DISABLED : VALID;
};
/**
* @return {?}
*/
AbstractControl.prototype._runValidator = /**
* @return {?}
*/
function () {
return this.validator ? this.validator(this) : null;
};
/**
* @param {?=} emitEvent
* @return {?}
*/
AbstractControl.prototype._runAsyncValidator = /**
* @param {?=} emitEvent
* @return {?}
*/
function (emitEvent) {
var _this = this;
if (this.asyncValidator) {
(/** @type {?} */ (this)).status = PENDING;
var /** @type {?} */ obs = toObservable(this.asyncValidator(this));
this._asyncValidationSubscription =
obs.subscribe(function (errors) { return _this.setErrors(errors, { emitEvent: emitEvent }); });
}
};
/**
* @return {?}
*/
AbstractControl.prototype._cancelExistingSubscription = /**
* @return {?}
*/
function () {
if (this._asyncValidationSubscription) {
this._asyncValidationSubscription.unsubscribe();
}
};
/**
* Sets errors on a form control.
*
* This is used when validations are run manually by the user, rather than automatically.
*
* Calling `setErrors` will also update the validity of the parent control.
*
* ### Example
*
* ```
* const login = new FormControl("someLogin");
* login.setErrors({
* "notUnique": true
* });
*
* expect(login.valid).toEqual(false);
* expect(login.errors).toEqual({"notUnique": true});
*
* login.setValue("someOtherLogin");
*
* expect(login.valid).toEqual(true);
* ```
*/
/**
* Sets errors on a form control.
*
* This is used when validations are run manually by the user, rather than automatically.
*
* Calling `setErrors` will also update the validity of the parent control.
*
* ### Example
*
* ```
* const login = new FormControl("someLogin");
* login.setErrors({
* "notUnique": true
* });
*
* expect(login.valid).toEqual(false);
* expect(login.errors).toEqual({"notUnique": true});
*
* login.setValue("someOtherLogin");
*
* expect(login.valid).toEqual(true);
* ```
* @param {?} errors
* @param {?=} opts
* @return {?}
*/
AbstractControl.prototype.setErrors = /**
* Sets errors on a form control.
*
* This is used when validations are run manually by the user, rather than automatically.
*
* Calling `setErrors` will also update the validity of the parent control.
*
* ### Example
*
* ```
* const login = new FormControl("someLogin");
* login.setErrors({
* "notUnique": true
* });
*
* expect(login.valid).toEqual(false);
* expect(login.errors).toEqual({"notUnique": true});
*
* login.setValue("someOtherLogin");
*
* expect(login.valid).toEqual(true);
* ```
* @param {?} errors
* @param {?=} opts
* @return {?}
*/
function (errors, opts) {
if (opts === void 0) { opts = {}; }
(/** @type {?} */ (this)).errors = errors;
this._updateControlsErrors(opts.emitEvent !== false);
};
/**
* Retrieves a child control given the control's name or path.
*
* Paths can be passed in as an array or a string delimited by a dot.
*
* To get a control nested within a `person` sub-group:
*
* * `this.form.get('person.name');`
*
* -OR-
*
* * `this.form.get(['person', 'name']);`
*/
/**
* Retrieves a child control given the control's name or path.
*
* Paths can be passed in as an array or a string delimited by a dot.
*
* To get a control nested within a `person` sub-group:
*
* * `this.form.get('person.name');`
*
* -OR-
*
* * `this.form.get(['person', 'name']);`
* @param {?} path
* @return {?}
*/
AbstractControl.prototype.get = /**
* Retrieves a child control given the control's name or path.
*
* Paths can be passed in as an array or a string delimited by a dot.
*
* To get a control nested within a `person` sub-group:
*
* * `this.form.get('person.name');`
*
* -OR-
*
* * `this.form.get(['person', 'name']);`
* @param {?} path
* @return {?}
*/
function (path) { return _find(this, path, '.'); };
/**
* Returns error data if the control with the given path has the error specified. Otherwise
* returns null or undefined.
*
* If no path is given, it checks for the error on the present control.
*/
/**
* Returns error data if the control with the given path has the error specified. Otherwise
* returns null or undefined.
*
* If no path is given, it checks for the error on the present control.
* @param {?} errorCode
* @param {?=} path
* @return {?}
*/
AbstractControl.prototype.getError = /**
* Returns error data if the control with the given path has the error specified. Otherwise
* returns null or undefined.
*
* If no path is given, it checks for the error on the present control.
* @param {?} errorCode
* @param {?=} path
* @return {?}
*/
function (errorCode, path) {
var /** @type {?} */ control = path ? this.get(path) : this;
return control && control.errors ? control.errors[errorCode] : null;
};
/**
* Returns true if the control with the given path has the error specified. Otherwise
* returns false.
*
* If no path is given, it checks for the error on the present control.
*/
/**
* Returns true if the control with the given path has the error specified. Otherwise
* returns false.
*
* If no path is given, it checks for the error on the present control.
* @param {?} errorCode
* @param {?=} path
* @return {?}
*/
AbstractControl.prototype.hasError = /**
* Returns true if the control with the given path has the error specified. Otherwise
* returns false.
*
* If no path is given, it checks for the error on the present control.
* @param {?} errorCode
* @param {?=} path
* @return {?}
*/
function (errorCode, path) { return !!this.getError(errorCode, path); };
Object.defineProperty(AbstractControl.prototype, "root", {
/**
* Retrieves the top-level ancestor of this control.
*/
get: /**
* Retrieves the top-level ancestor of this control.
* @return {?}
*/
function () {
var /** @type {?} */ x = this;
while (x._parent) {
x = x._parent;
}
return x;
},
enumerable: true,
configurable: true
});
/** @internal */
/**
* \@internal
* @param {?} emitEvent
* @return {?}
*/
AbstractControl.prototype._updateControlsErrors = /**
* \@internal
* @param {?} emitEvent
* @return {?}
*/
function (emitEvent) {
(/** @type {?} */ (this)).status = this._calculateStatus();
if (emitEvent) {
(/** @type {?} */ (this.statusChanges)).emit(this.status);
}
if (this._parent) {
this._parent._updateControlsErrors(emitEvent);
}
};
/** @internal */
/**
* \@internal
* @return {?}
*/
AbstractControl.prototype._initObservables = /**
* \@internal
* @return {?}
*/
function () {
(/** @type {?} */ (this)).valueChanges = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["v" /* EventEmitter */]();
(/** @type {?} */ (this)).statusChanges = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["v" /* EventEmitter */]();
};
/**
* @return {?}
*/
AbstractControl.prototype._calculateStatus = /**
* @return {?}
*/
function () {
if (this._allControlsDisabled())
return DISABLED;
if (this.errors)
return INVALID;
if (this._anyControlsHaveStatus(PENDING))
return PENDING;
if (this._anyControlsHaveStatus(INVALID))
return INVALID;
return VALID;
};
/** @internal */
/**
* \@internal
* @param {?} status
* @return {?}
*/
AbstractControl.prototype._anyControlsHaveStatus = /**
* \@internal
* @param {?} status
* @return {?}
*/
function (status) {
return this._anyControls(function (control) { return control.status === status; });
};
/** @internal */
/**
* \@internal
* @return {?}
*/
AbstractControl.prototype._anyControlsDirty = /**
* \@internal
* @return {?}
*/
function () {
return this._anyControls(function (control) { return control.dirty; });
};
/** @internal */
/**
* \@internal
* @return {?}
*/
AbstractControl.prototype._anyControlsTouched = /**
* \@internal
* @return {?}
*/
function () {
return this._anyControls(function (control) { return control.touched; });
};
/** @internal */
/**
* \@internal
* @param {?=} opts
* @return {?}
*/
AbstractControl.prototype._updatePristine = /**
* \@internal
* @param {?=} opts
* @return {?}
*/
function (opts) {
if (opts === void 0) { opts = {}; }
(/** @type {?} */ (this)).pristine = !this._anyControlsDirty();
if (this._parent && !opts.onlySelf) {
this._parent._updatePristine(opts);
}
};
/** @internal */
/**
* \@internal
* @param {?=} opts
* @return {?}
*/
AbstractControl.prototype._updateTouched = /**
* \@internal
* @param {?=} opts
* @return {?}
*/
function (opts) {
if (opts === void 0) { opts = {}; }
(/** @type {?} */ (this)).touched = this._anyControlsTouched();
if (this._parent && !opts.onlySelf) {
this._parent._updateTouched(opts);
}
};
/** @internal */
/**
* \@internal
* @param {?} formState
* @return {?}
*/
AbstractControl.prototype._isBoxedValue = /**
* \@internal
* @param {?} formState
* @return {?}
*/
function (formState) {
return typeof formState === 'object' && formState !== null &&
Object.keys(formState).length === 2 && 'value' in formState && 'disabled' in formState;
};
/** @internal */
/**
* \@internal
* @param {?} fn
* @return {?}
*/
AbstractControl.prototype._registerOnCollectionChange = /**
* \@internal
* @param {?} fn
* @return {?}
*/
function (fn) { this._onCollectionChange = fn; };
/** @internal */
/**
* \@internal
* @param {?=} opts
* @return {?}
*/
AbstractControl.prototype._setUpdateStrategy = /**
* \@internal
* @param {?=} opts
* @return {?}
*/
function (opts) {
if (isOptionsObj(opts) && (/** @type {?} */ (opts)).updateOn != null) {
this._updateOn = /** @type {?} */ (((/** @type {?} */ (opts)).updateOn));
}
};
return AbstractControl;
}());
/**
* \@whatItDoes Tracks the value and validation status of an individual form control.
*
* It is one of the three fundamental building blocks of Angular forms, along with
* {\@link FormGroup} and {\@link FormArray}.
*
* \@howToUse
*
* When instantiating a {\@link FormControl}, you can pass in an initial value as the
* first argument. Example:
*
* ```ts
* const ctrl = new FormControl('some value');
* console.log(ctrl.value); // 'some value'
* ```
*
* You can also initialize the control with a form state object on instantiation,
* which includes both the value and whether or not the control is disabled.
* You can't use the value key without the disabled key; both are required
* to use this way of initialization.
*
* ```ts
* const ctrl = new FormControl({value: 'n/a', disabled: true});
* console.log(ctrl.value); // 'n/a'
* console.log(ctrl.status); // 'DISABLED'
* ```
*
* The second {\@link FormControl} argument can accept one of three things:
* * a sync validator function
* * an array of sync validator functions
* * an options object containing validator and/or async validator functions
*
* Example of a single sync validator function:
*
* ```ts
* const ctrl = new FormControl('', Validators.required);
* console.log(ctrl.value); // ''
* console.log(ctrl.status); // 'INVALID'
* ```
*
* Example using options object:
*
* ```ts
* const ctrl = new FormControl('', {
* validators: Validators.required,
* asyncValidators: myAsyncValidator
* });
* ```
*
* The options object can also be used to define when the control should update.
* By default, the value and validity of a control updates whenever the value
* changes. You can configure it to update on the blur event instead by setting
* the `updateOn` option to `'blur'`.
*
* ```ts
* const c = new FormControl('', { updateOn: 'blur' });
* ```
*
* You can also set `updateOn` to `'submit'`, which will delay value and validity
* updates until the parent form of the control fires a submit event.
*
* See its superclass, {\@link AbstractControl}, for more properties and methods.
*
* * **npm package**: `\@angular/forms`
*
* \@stable
*/
var FormControl = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(FormControl, _super);
function FormControl(formState, validatorOrOpts, asyncValidator) {
if (formState === void 0) { formState = null; }
var _this = _super.call(this, coerceToValidator(validatorOrOpts), coerceToAsyncValidator(asyncValidator, validatorOrOpts)) || this;
/**
* \@internal
*/
_this._onChange = [];
_this._applyFormState(formState);
_this._setUpdateStrategy(validatorOrOpts);
_this.updateValueAndValidity({ onlySelf: true, emitEvent: false });
_this._initObservables();
return _this;
}
/**
* Set the value of the form control to `value`.
*
* If `onlySelf` is `true`, this change will only affect the validation of this `FormControl`
* and not its parent component. This defaults to false.
*
* If `emitEvent` is `true`, this
* change will cause a `valueChanges` event on the `FormControl` to be emitted. This defaults
* to true (as it falls through to `updateValueAndValidity`).
*
* If `emitModelToViewChange` is `true`, the view will be notified about the new value
* via an `onChange` event. This is the default behavior if `emitModelToViewChange` is not
* specified.
*
* If `emitViewToModelChange` is `true`, an ngModelChange event will be fired to update the
* model. This is the default behavior if `emitViewToModelChange` is not specified.
*/
/**
* Set the value of the form control to `value`.
*
* If `onlySelf` is `true`, this change will only affect the validation of this `FormControl`
* and not its parent component. This defaults to false.
*
* If `emitEvent` is `true`, this
* change will cause a `valueChanges` event on the `FormControl` to be emitted. This defaults
* to true (as it falls through to `updateValueAndValidity`).
*
* If `emitModelToViewChange` is `true`, the view will be notified about the new value
* via an `onChange` event. This is the default behavior if `emitModelToViewChange` is not
* specified.
*
* If `emitViewToModelChange` is `true`, an ngModelChange event will be fired to update the
* model. This is the default behavior if `emitViewToModelChange` is not specified.
* @param {?} value
* @param {?=} options
* @return {?}
*/
FormControl.prototype.setValue = /**
* Set the value of the form control to `value`.
*
* If `onlySelf` is `true`, this change will only affect the validation of this `FormControl`
* and not its parent component. This defaults to false.
*
* If `emitEvent` is `true`, this
* change will cause a `valueChanges` event on the `FormControl` to be emitted. This defaults
* to true (as it falls through to `updateValueAndValidity`).
*
* If `emitModelToViewChange` is `true`, the view will be notified about the new value
* via an `onChange` event. This is the default behavior if `emitModelToViewChange` is not
* specified.
*
* If `emitViewToModelChange` is `true`, an ngModelChange event will be fired to update the
* model. This is the default behavior if `emitViewToModelChange` is not specified.
* @param {?} value
* @param {?=} options
* @return {?}
*/
function (value, options) {
var _this = this;
if (options === void 0) { options = {}; }
(/** @type {?} */ (this)).value = this._pendingValue = value;
if (this._onChange.length && options.emitModelToViewChange !== false) {
this._onChange.forEach(function (changeFn) { return changeFn(_this.value, options.emitViewToModelChange !== false); });
}
this.updateValueAndValidity(options);
};
/**
* Patches the value of a control.
*
* This function is functionally the same as {@link FormControl#setValue setValue} at this level.
* It exists for symmetry with {@link FormGroup#patchValue patchValue} on `FormGroups` and
* `FormArrays`, where it does behave differently.
*/
/**
* Patches the value of a control.
*
* This function is functionally the same as {\@link FormControl#setValue setValue} at this level.
* It exists for symmetry with {\@link FormGroup#patchValue patchValue} on `FormGroups` and
* `FormArrays`, where it does behave differently.
* @param {?} value
* @param {?=} options
* @return {?}
*/
FormControl.prototype.patchValue = /**
* Patches the value of a control.
*
* This function is functionally the same as {\@link FormControl#setValue setValue} at this level.
* It exists for symmetry with {\@link FormGroup#patchValue patchValue} on `FormGroups` and
* `FormArrays`, where it does behave differently.
* @param {?} value
* @param {?=} options
* @return {?}
*/
function (value, options) {
if (options === void 0) { options = {}; }
this.setValue(value, options);
};
/**
* Resets the form control. This means by default:
*
* * it is marked as `pristine`
* * it is marked as `untouched`
* * value is set to null
*
* You can also reset to a specific form state by passing through a standalone
* value or a form state object that contains both a value and a disabled state
* (these are the only two properties that cannot be calculated).
*
* Ex:
*
* ```ts
* this.control.reset('Nancy');
*
* console.log(this.control.value); // 'Nancy'
* ```
*
* OR
*
* ```
* this.control.reset({value: 'Nancy', disabled: true});
*
* console.log(this.control.value); // 'Nancy'
* console.log(this.control.status); // 'DISABLED'
* ```
*/
/**
* Resets the form control. This means by default:
*
* * it is marked as `pristine`
* * it is marked as `untouched`
* * value is set to null
*
* You can also reset to a specific form state by passing through a standalone
* value or a form state object that contains both a value and a disabled state
* (these are the only two properties that cannot be calculated).
*
* Ex:
*
* ```ts
* this.control.reset('Nancy');
*
* console.log(this.control.value); // 'Nancy'
* ```
*
* OR
*
* ```
* this.control.reset({value: 'Nancy', disabled: true});
*
* console.log(this.control.value); // 'Nancy'
* console.log(this.control.status); // 'DISABLED'
* ```
* @param {?=} formState
* @param {?=} options
* @return {?}
*/
FormControl.prototype.reset = /**
* Resets the form control. This means by default:
*
* * it is marked as `pristine`
* * it is marked as `untouched`
* * value is set to null
*
* You can also reset to a specific form state by passing through a standalone
* value or a form state object that contains both a value and a disabled state
* (these are the only two properties that cannot be calculated).
*
* Ex:
*
* ```ts
* this.control.reset('Nancy');
*
* console.log(this.control.value); // 'Nancy'
* ```
*
* OR
*
* ```
* this.control.reset({value: 'Nancy', disabled: true});
*
* console.log(this.control.value); // 'Nancy'
* console.log(this.control.status); // 'DISABLED'
* ```
* @param {?=} formState
* @param {?=} options
* @return {?}
*/
function (formState, options) {
if (formState === void 0) { formState = null; }
if (options === void 0) { options = {}; }
this._applyFormState(formState);
this.markAsPristine(options);
this.markAsUntouched(options);
this.setValue(this.value, options);
this._pendingChange = false;
};
/**
* @internal
*/
/**
* \@internal
* @return {?}
*/
FormControl.prototype._updateValue = /**
* \@internal
* @return {?}
*/
function () { };
/**
* @internal
*/
/**
* \@internal
* @param {?} condition
* @return {?}
*/
FormControl.prototype._anyControls = /**
* \@internal
* @param {?} condition
* @return {?}
*/
function (condition) { return false; };
/**
* @internal
*/
/**
* \@internal
* @return {?}
*/
FormControl.prototype._allControlsDisabled = /**
* \@internal
* @return {?}
*/
function () { return this.disabled; };
/**
* Register a listener for change events.
*/
/**
* Register a listener for change events.
* @param {?} fn
* @return {?}
*/
FormControl.prototype.registerOnChange = /**
* Register a listener for change events.
* @param {?} fn
* @return {?}
*/
function (fn) { this._onChange.push(fn); };
/**
* @internal
*/
/**
* \@internal
* @return {?}
*/
FormControl.prototype._clearChangeFns = /**
* \@internal
* @return {?}
*/
function () {
this._onChange = [];
this._onDisabledChange = [];
this._onCollectionChange = function () { };
};
/**
* Register a listener for disabled events.
*/
/**
* Register a listener for disabled events.
* @param {?} fn
* @return {?}
*/
FormControl.prototype.registerOnDisabledChange = /**
* Register a listener for disabled events.
* @param {?} fn
* @return {?}
*/
function (fn) {
this._onDisabledChange.push(fn);
};
/**
* @internal
*/
/**
* \@internal
* @param {?} cb
* @return {?}
*/
FormControl.prototype._forEachChild = /**
* \@internal
* @param {?} cb
* @return {?}
*/
function (cb) { };
/** @internal */
/**
* \@internal
* @return {?}
*/
FormControl.prototype._syncPendingControls = /**
* \@internal
* @return {?}
*/
function () {
if (this.updateOn === 'submit') {
if (this._pendingDirty)
this.markAsDirty();
if (this._pendingTouched)
this.markAsTouched();
if (this._pendingChange) {
this.setValue(this._pendingValue, { onlySelf: true, emitModelToViewChange: false });
return true;
}
}
return false;
};
/**
* @param {?} formState
* @return {?}
*/
FormControl.prototype._applyFormState = /**
* @param {?} formState
* @return {?}
*/
function (formState) {
if (this._isBoxedValue(formState)) {
(/** @type {?} */ (this)).value = this._pendingValue = formState.value;
formState.disabled ? this.disable({ onlySelf: true, emitEvent: false }) :
this.enable({ onlySelf: true, emitEvent: false });
}
else {
(/** @type {?} */ (this)).value = this._pendingValue = formState;
}
};
return FormControl;
}(AbstractControl));
/**
* \@whatItDoes Tracks the value and validity state of a group of {\@link FormControl}
* instances.
*
* A `FormGroup` aggregates the values of each child {\@link FormControl} into one object,
* with each control name as the key. It calculates its status by reducing the statuses
* of its children. For example, if one of the controls in a group is invalid, the entire
* group becomes invalid.
*
* `FormGroup` is one of the three fundamental building blocks used to define forms in Angular,
* along with {\@link FormControl} and {\@link FormArray}.
*
* \@howToUse
*
* When instantiating a {\@link FormGroup}, pass in a collection of child controls as the first
* argument. The key for each child will be the name under which it is registered.
*
* ### Example
*
* ```
* const form = new FormGroup({
* first: new FormControl('Nancy', Validators.minLength(2)),
* last: new FormControl('Drew'),
* });
*
* console.log(form.value); // {first: 'Nancy', last; 'Drew'}
* console.log(form.status); // 'VALID'
* ```
*
* You can also include group-level validators as the second arg, or group-level async
* validators as the third arg. These come in handy when you want to perform validation
* that considers the value of more than one child control.
*
* ### Example
*
* ```
* const form = new FormGroup({
* password: new FormControl('', Validators.minLength(2)),
* passwordConfirm: new FormControl('', Validators.minLength(2)),
* }, passwordMatchValidator);
*
*
* function passwordMatchValidator(g: FormGroup) {
* return g.get('password').value === g.get('passwordConfirm').value
* ? null : {'mismatch': true};
* }
* ```
*
* Like {\@link FormControl} instances, you can alternatively choose to pass in
* validators and async validators as part of an options object.
*
* ```
* const form = new FormGroup({
* password: new FormControl('')
* passwordConfirm: new FormControl('')
* }, {validators: passwordMatchValidator, asyncValidators: otherValidator});
* ```
*
* The options object can also be used to set a default value for each child
* control's `updateOn` property. If you set `updateOn` to `'blur'` at the
* group level, all child controls will default to 'blur', unless the child
* has explicitly specified a different `updateOn` value.
*
* ```ts
* const c = new FormGroup({
* one: new FormControl()
* }, {updateOn: 'blur'});
* ```
*
* * **npm package**: `\@angular/forms`
*
* \@stable
*/
var FormGroup = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(FormGroup, _super);
function FormGroup(controls, validatorOrOpts, asyncValidator) {
var _this = _super.call(this, coerceToValidator(validatorOrOpts), coerceToAsyncValidator(asyncValidator, validatorOrOpts)) || this;
_this.controls = controls;
_this._initObservables();
_this._setUpdateStrategy(validatorOrOpts);
_this._setUpControls();
_this.updateValueAndValidity({ onlySelf: true, emitEvent: false });
return _this;
}
/**
* Registers a control with the group's list of controls.
*
* This method does not update the value or validity of the control, so for most cases you'll want
* to use {@link FormGroup#addControl addControl} instead.
*/
/**
* Registers a control with the group's list of controls.
*
* This method does not update the value or validity of the control, so for most cases you'll want
* to use {\@link FormGroup#addControl addControl} instead.
* @param {?} name
* @param {?} control
* @return {?}
*/
FormGroup.prototype.registerControl = /**
* Registers a control with the group's list of controls.
*
* This method does not update the value or validity of the control, so for most cases you'll want
* to use {\@link FormGroup#addControl addControl} instead.
* @param {?} name
* @param {?} control
* @return {?}
*/
function (name, control) {
if (this.controls[name])
return this.controls[name];
this.controls[name] = control;
control.setParent(this);
control._registerOnCollectionChange(this._onCollectionChange);
return control;
};
/**
* Add a control to this group.
*/
/**
* Add a control to this group.
* @param {?} name
* @param {?} control
* @return {?}
*/
FormGroup.prototype.addControl = /**
* Add a control to this group.
* @param {?} name
* @param {?} control
* @return {?}
*/
function (name, control) {
this.registerControl(name, control);
this.updateValueAndValidity();
this._onCollectionChange();
};
/**
* Remove a control from this group.
*/
/**
* Remove a control from this group.
* @param {?} name
* @return {?}
*/
FormGroup.prototype.removeControl = /**
* Remove a control from this group.
* @param {?} name
* @return {?}
*/
function (name) {
if (this.controls[name])
this.controls[name]._registerOnCollectionChange(function () { });
delete (this.controls[name]);
this.updateValueAndValidity();
this._onCollectionChange();
};
/**
* Replace an existing control.
*/
/**
* Replace an existing control.
* @param {?} name
* @param {?} control
* @return {?}
*/
FormGroup.prototype.setControl = /**
* Replace an existing control.
* @param {?} name
* @param {?} control
* @return {?}
*/
function (name, control) {
if (this.controls[name])
this.controls[name]._registerOnCollectionChange(function () { });
delete (this.controls[name]);
if (control)
this.registerControl(name, control);
this.updateValueAndValidity();
this._onCollectionChange();
};
/**
* Check whether there is an enabled control with the given name in the group.
*
* It will return false for disabled controls. If you'd like to check for existence in the group
* only, use {@link AbstractControl#get get} instead.
*/
/**
* Check whether there is an enabled control with the given name in the group.
*
* It will return false for disabled controls. If you'd like to check for existence in the group
* only, use {\@link AbstractControl#get get} instead.
* @param {?} controlName
* @return {?}
*/
FormGroup.prototype.contains = /**
* Check whether there is an enabled control with the given name in the group.
*
* It will return false for disabled controls. If you'd like to check for existence in the group
* only, use {\@link AbstractControl#get get} instead.
* @param {?} controlName
* @return {?}
*/
function (controlName) {
return this.controls.hasOwnProperty(controlName) && this.controls[controlName].enabled;
};
/**
* Sets the value of the {@link FormGroup}. It accepts an object that matches
* the structure of the group, with control names as keys.
*
* This method performs strict checks, so it will throw an error if you try
* to set the value of a control that doesn't exist or if you exclude the
* value of a control.
*
* ### Example
*
* ```
* const form = new FormGroup({
* first: new FormControl(),
* last: new FormControl()
* });
* console.log(form.value); // {first: null, last: null}
*
* form.setValue({first: 'Nancy', last: 'Drew'});
* console.log(form.value); // {first: 'Nancy', last: 'Drew'}
*
* ```
*/
/**
* Sets the value of the {\@link FormGroup}. It accepts an object that matches
* the structure of the group, with control names as keys.
*
* This method performs strict checks, so it will throw an error if you try
* to set the value of a control that doesn't exist or if you exclude the
* value of a control.
*
* ### Example
*
* ```
* const form = new FormGroup({
* first: new FormControl(),
* last: new FormControl()
* });
* console.log(form.value); // {first: null, last: null}
*
* form.setValue({first: 'Nancy', last: 'Drew'});
* console.log(form.value); // {first: 'Nancy', last: 'Drew'}
*
* ```
* @param {?} value
* @param {?=} options
* @return {?}
*/
FormGroup.prototype.setValue = /**
* Sets the value of the {\@link FormGroup}. It accepts an object that matches
* the structure of the group, with control names as keys.
*
* This method performs strict checks, so it will throw an error if you try
* to set the value of a control that doesn't exist or if you exclude the
* value of a control.
*
* ### Example
*
* ```
* const form = new FormGroup({
* first: new FormControl(),
* last: new FormControl()
* });
* console.log(form.value); // {first: null, last: null}
*
* form.setValue({first: 'Nancy', last: 'Drew'});
* console.log(form.value); // {first: 'Nancy', last: 'Drew'}
*
* ```
* @param {?} value
* @param {?=} options
* @return {?}
*/
function (value, options) {
var _this = this;
if (options === void 0) { options = {}; }
this._checkAllValuesPresent(value);
Object.keys(value).forEach(function (name) {
_this._throwIfControlMissing(name);
_this.controls[name].setValue(value[name], { onlySelf: true, emitEvent: options.emitEvent });
});
this.updateValueAndValidity(options);
};
/**
* Patches the value of the {@link FormGroup}. It accepts an object with control
* names as keys, and will do its best to match the values to the correct controls
* in the group.
*
* It accepts both super-sets and sub-sets of the group without throwing an error.
*
* ### Example
*
* ```
* const form = new FormGroup({
* first: new FormControl(),
* last: new FormControl()
* });
* console.log(form.value); // {first: null, last: null}
*
* form.patchValue({first: 'Nancy'});
* console.log(form.value); // {first: 'Nancy', last: null}
*
* ```
*/
/**
* Patches the value of the {\@link FormGroup}. It accepts an object with control
* names as keys, and will do its best to match the values to the correct controls
* in the group.
*
* It accepts both super-sets and sub-sets of the group without throwing an error.
*
* ### Example
*
* ```
* const form = new FormGroup({
* first: new FormControl(),
* last: new FormControl()
* });
* console.log(form.value); // {first: null, last: null}
*
* form.patchValue({first: 'Nancy'});
* console.log(form.value); // {first: 'Nancy', last: null}
*
* ```
* @param {?} value
* @param {?=} options
* @return {?}
*/
FormGroup.prototype.patchValue = /**
* Patches the value of the {\@link FormGroup}. It accepts an object with control
* names as keys, and will do its best to match the values to the correct controls
* in the group.
*
* It accepts both super-sets and sub-sets of the group without throwing an error.
*
* ### Example
*
* ```
* const form = new FormGroup({
* first: new FormControl(),
* last: new FormControl()
* });
* console.log(form.value); // {first: null, last: null}
*
* form.patchValue({first: 'Nancy'});
* console.log(form.value); // {first: 'Nancy', last: null}
*
* ```
* @param {?} value
* @param {?=} options
* @return {?}
*/
function (value, options) {
var _this = this;
if (options === void 0) { options = {}; }
Object.keys(value).forEach(function (name) {
if (_this.controls[name]) {
_this.controls[name].patchValue(value[name], { onlySelf: true, emitEvent: options.emitEvent });
}
});
this.updateValueAndValidity(options);
};
/**
* Resets the {@link FormGroup}. This means by default:
*
* * The group and all descendants are marked `pristine`
* * The group and all descendants are marked `untouched`
* * The value of all descendants will be null or null maps
*
* You can also reset to a specific form state by passing in a map of states
* that matches the structure of your form, with control names as keys. The state
* can be a standalone value or a form state object with both a value and a disabled
* status.
*
* ### Example
*
* ```ts
* this.form.reset({first: 'name', last: 'last name'});
*
* console.log(this.form.value); // {first: 'name', last: 'last name'}
* ```
*
* - OR -
*
* ```
* this.form.reset({
* first: {value: 'name', disabled: true},
* last: 'last'
* });
*
* console.log(this.form.value); // {first: 'name', last: 'last name'}
* console.log(this.form.get('first').status); // 'DISABLED'
* ```
*/
/**
* Resets the {\@link FormGroup}. This means by default:
*
* * The group and all descendants are marked `pristine`
* * The group and all descendants are marked `untouched`
* * The value of all descendants will be null or null maps
*
* You can also reset to a specific form state by passing in a map of states
* that matches the structure of your form, with control names as keys. The state
* can be a standalone value or a form state object with both a value and a disabled
* status.
*
* ### Example
*
* ```ts
* this.form.reset({first: 'name', last: 'last name'});
*
* console.log(this.form.value); // {first: 'name', last: 'last name'}
* ```
*
* - OR -
*
* ```
* this.form.reset({
* first: {value: 'name', disabled: true},
* last: 'last'
* });
*
* console.log(this.form.value); // {first: 'name', last: 'last name'}
* console.log(this.form.get('first').status); // 'DISABLED'
* ```
* @param {?=} value
* @param {?=} options
* @return {?}
*/
FormGroup.prototype.reset = /**
* Resets the {\@link FormGroup}. This means by default:
*
* * The group and all descendants are marked `pristine`
* * The group and all descendants are marked `untouched`
* * The value of all descendants will be null or null maps
*
* You can also reset to a specific form state by passing in a map of states
* that matches the structure of your form, with control names as keys. The state
* can be a standalone value or a form state object with both a value and a disabled
* status.
*
* ### Example
*
* ```ts
* this.form.reset({first: 'name', last: 'last name'});
*
* console.log(this.form.value); // {first: 'name', last: 'last name'}
* ```
*
* - OR -
*
* ```
* this.form.reset({
* first: {value: 'name', disabled: true},
* last: 'last'
* });
*
* console.log(this.form.value); // {first: 'name', last: 'last name'}
* console.log(this.form.get('first').status); // 'DISABLED'
* ```
* @param {?=} value
* @param {?=} options
* @return {?}
*/
function (value, options) {
if (value === void 0) { value = {}; }
if (options === void 0) { options = {}; }
this._forEachChild(function (control, name) {
control.reset(value[name], { onlySelf: true, emitEvent: options.emitEvent });
});
this.updateValueAndValidity(options);
this._updatePristine(options);
this._updateTouched(options);
};
/**
* The aggregate value of the {@link FormGroup}, including any disabled controls.
*
* If you'd like to include all values regardless of disabled status, use this method.
* Otherwise, the `value` property is the best way to get the value of the group.
*/
/**
* The aggregate value of the {\@link FormGroup}, including any disabled controls.
*
* If you'd like to include all values regardless of disabled status, use this method.
* Otherwise, the `value` property is the best way to get the value of the group.
* @return {?}
*/
FormGroup.prototype.getRawValue = /**
* The aggregate value of the {\@link FormGroup}, including any disabled controls.
*
* If you'd like to include all values regardless of disabled status, use this method.
* Otherwise, the `value` property is the best way to get the value of the group.
* @return {?}
*/
function () {
return this._reduceChildren({}, function (acc, control, name) {
acc[name] = control instanceof FormControl ? control.value : (/** @type {?} */ (control)).getRawValue();
return acc;
});
};
/** @internal */
/**
* \@internal
* @return {?}
*/
FormGroup.prototype._syncPendingControls = /**
* \@internal
* @return {?}
*/
function () {
var /** @type {?} */ subtreeUpdated = this._reduceChildren(false, function (updated, child) {
return child._syncPendingControls() ? true : updated;
});
if (subtreeUpdated)
this.updateValueAndValidity({ onlySelf: true });
return subtreeUpdated;
};
/** @internal */
/**
* \@internal
* @param {?} name
* @return {?}
*/
FormGroup.prototype._throwIfControlMissing = /**
* \@internal
* @param {?} name
* @return {?}
*/
function (name) {
if (!Object.keys(this.controls).length) {
throw new Error("\n There are no form controls registered with this group yet. If you're using ngModel,\n you may want to check next tick (e.g. use setTimeout).\n ");
}
if (!this.controls[name]) {
throw new Error("Cannot find form control with name: " + name + ".");
}
};
/** @internal */
/**
* \@internal
* @param {?} cb
* @return {?}
*/
FormGroup.prototype._forEachChild = /**
* \@internal
* @param {?} cb
* @return {?}
*/
function (cb) {
var _this = this;
Object.keys(this.controls).forEach(function (k) { return cb(_this.controls[k], k); });
};
/** @internal */
/**
* \@internal
* @return {?}
*/
FormGroup.prototype._setUpControls = /**
* \@internal
* @return {?}
*/
function () {
var _this = this;
this._forEachChild(function (control) {
control.setParent(_this);
control._registerOnCollectionChange(_this._onCollectionChange);
});
};
/** @internal */
/**
* \@internal
* @return {?}
*/
FormGroup.prototype._updateValue = /**
* \@internal
* @return {?}
*/
function () { (/** @type {?} */ (this)).value = this._reduceValue(); };
/** @internal */
/**
* \@internal
* @param {?} condition
* @return {?}
*/
FormGroup.prototype._anyControls = /**
* \@internal
* @param {?} condition
* @return {?}
*/
function (condition) {
var _this = this;
var /** @type {?} */ res = false;
this._forEachChild(function (control, name) {
res = res || (_this.contains(name) && condition(control));
});
return res;
};
/** @internal */
/**
* \@internal
* @return {?}
*/
FormGroup.prototype._reduceValue = /**
* \@internal
* @return {?}
*/
function () {
var _this = this;
return this._reduceChildren({}, function (acc, control, name) {
if (control.enabled || _this.disabled) {
acc[name] = control.value;
}
return acc;
});
};
/** @internal */
/**
* \@internal
* @param {?} initValue
* @param {?} fn
* @return {?}
*/
FormGroup.prototype._reduceChildren = /**
* \@internal
* @param {?} initValue
* @param {?} fn
* @return {?}
*/
function (initValue, fn) {
var /** @type {?} */ res = initValue;
this._forEachChild(function (control, name) { res = fn(res, control, name); });
return res;
};
/** @internal */
/**
* \@internal
* @return {?}
*/
FormGroup.prototype._allControlsDisabled = /**
* \@internal
* @return {?}
*/
function () {
for (var _i = 0, _a = Object.keys(this.controls); _i < _a.length; _i++) {
var controlName = _a[_i];
if (this.controls[controlName].enabled) {
return false;
}
}
return Object.keys(this.controls).length > 0 || this.disabled;
};
/** @internal */
/**
* \@internal
* @param {?} value
* @return {?}
*/
FormGroup.prototype._checkAllValuesPresent = /**
* \@internal
* @param {?} value
* @return {?}
*/
function (value) {
this._forEachChild(function (control, name) {
if (value[name] === undefined) {
throw new Error("Must supply a value for form control with name: '" + name + "'.");
}
});
};
return FormGroup;
}(AbstractControl));
/**
* \@whatItDoes Tracks the value and validity state of an array of {\@link FormControl},
* {\@link FormGroup} or {\@link FormArray} instances.
*
* A `FormArray` aggregates the values of each child {\@link FormControl} into an array.
* It calculates its status by reducing the statuses of its children. For example, if one of
* the controls in a `FormArray` is invalid, the entire array becomes invalid.
*
* `FormArray` is one of the three fundamental building blocks used to define forms in Angular,
* along with {\@link FormControl} and {\@link FormGroup}.
*
* \@howToUse
*
* When instantiating a {\@link FormArray}, pass in an array of child controls as the first
* argument.
*
* ### Example
*
* ```
* const arr = new FormArray([
* new FormControl('Nancy', Validators.minLength(2)),
* new FormControl('Drew'),
* ]);
*
* console.log(arr.value); // ['Nancy', 'Drew']
* console.log(arr.status); // 'VALID'
* ```
*
* You can also include array-level validators and async validators. These come in handy
* when you want to perform validation that considers the value of more than one child
* control.
*
* The two types of validators can be passed in separately as the second and third arg
* respectively, or together as part of an options object.
*
* ```
* const arr = new FormArray([
* new FormControl('Nancy'),
* new FormControl('Drew')
* ], {validators: myValidator, asyncValidators: myAsyncValidator});
* ```
*
* The options object can also be used to set a default value for each child
* control's `updateOn` property. If you set `updateOn` to `'blur'` at the
* array level, all child controls will default to 'blur', unless the child
* has explicitly specified a different `updateOn` value.
*
* ```ts
* const c = new FormArray([
* new FormControl()
* ], {updateOn: 'blur'});
* ```
*
* ### Adding or removing controls
*
* To change the controls in the array, use the `push`, `insert`, or `removeAt` methods
* in `FormArray` itself. These methods ensure the controls are properly tracked in the
* form's hierarchy. Do not modify the array of `AbstractControl`s used to instantiate
* the `FormArray` directly, as that will result in strange and unexpected behavior such
* as broken change detection.
*
* * **npm package**: `\@angular/forms`
*
* \@stable
*/
var FormArray = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(FormArray, _super);
function FormArray(controls, validatorOrOpts, asyncValidator) {
var _this = _super.call(this, coerceToValidator(validatorOrOpts), coerceToAsyncValidator(asyncValidator, validatorOrOpts)) || this;
_this.controls = controls;
_this._initObservables();
_this._setUpdateStrategy(validatorOrOpts);
_this._setUpControls();
_this.updateValueAndValidity({ onlySelf: true, emitEvent: false });
return _this;
}
/**
* Get the {@link AbstractControl} at the given `index` in the array.
*/
/**
* Get the {\@link AbstractControl} at the given `index` in the array.
* @param {?} index
* @return {?}
*/
FormArray.prototype.at = /**
* Get the {\@link AbstractControl} at the given `index` in the array.
* @param {?} index
* @return {?}
*/
function (index) { return this.controls[index]; };
/**
* Insert a new {@link AbstractControl} at the end of the array.
*/
/**
* Insert a new {\@link AbstractControl} at the end of the array.
* @param {?} control
* @return {?}
*/
FormArray.prototype.push = /**
* Insert a new {\@link AbstractControl} at the end of the array.
* @param {?} control
* @return {?}
*/
function (control) {
this.controls.push(control);
this._registerControl(control);
this.updateValueAndValidity();
this._onCollectionChange();
};
/**
* Insert a new {@link AbstractControl} at the given `index` in the array.
*/
/**
* Insert a new {\@link AbstractControl} at the given `index` in the array.
* @param {?} index
* @param {?} control
* @return {?}
*/
FormArray.prototype.insert = /**
* Insert a new {\@link AbstractControl} at the given `index` in the array.
* @param {?} index
* @param {?} control
* @return {?}
*/
function (index, control) {
this.controls.splice(index, 0, control);
this._registerControl(control);
this.updateValueAndValidity();
this._onCollectionChange();
};
/**
* Remove the control at the given `index` in the array.
*/
/**
* Remove the control at the given `index` in the array.
* @param {?} index
* @return {?}
*/
FormArray.prototype.removeAt = /**
* Remove the control at the given `index` in the array.
* @param {?} index
* @return {?}
*/
function (index) {
if (this.controls[index])
this.controls[index]._registerOnCollectionChange(function () { });
this.controls.splice(index, 1);
this.updateValueAndValidity();
this._onCollectionChange();
};
/**
* Replace an existing control.
*/
/**
* Replace an existing control.
* @param {?} index
* @param {?} control
* @return {?}
*/
FormArray.prototype.setControl = /**
* Replace an existing control.
* @param {?} index
* @param {?} control
* @return {?}
*/
function (index, control) {
if (this.controls[index])
this.controls[index]._registerOnCollectionChange(function () { });
this.controls.splice(index, 1);
if (control) {
this.controls.splice(index, 0, control);
this._registerControl(control);
}
this.updateValueAndValidity();
this._onCollectionChange();
};
Object.defineProperty(FormArray.prototype, "length", {
/**
* Length of the control array.
*/
get: /**
* Length of the control array.
* @return {?}
*/
function () { return this.controls.length; },
enumerable: true,
configurable: true
});
/**
* Sets the value of the {@link FormArray}. It accepts an array that matches
* the structure of the control.
*
* This method performs strict checks, so it will throw an error if you try
* to set the value of a control that doesn't exist or if you exclude the
* value of a control.
*
* ### Example
*
* ```
* const arr = new FormArray([
* new FormControl(),
* new FormControl()
* ]);
* console.log(arr.value); // [null, null]
*
* arr.setValue(['Nancy', 'Drew']);
* console.log(arr.value); // ['Nancy', 'Drew']
* ```
*/
/**
* Sets the value of the {\@link FormArray}. It accepts an array that matches
* the structure of the control.
*
* This method performs strict checks, so it will throw an error if you try
* to set the value of a control that doesn't exist or if you exclude the
* value of a control.
*
* ### Example
*
* ```
* const arr = new FormArray([
* new FormControl(),
* new FormControl()
* ]);
* console.log(arr.value); // [null, null]
*
* arr.setValue(['Nancy', 'Drew']);
* console.log(arr.value); // ['Nancy', 'Drew']
* ```
* @param {?} value
* @param {?=} options
* @return {?}
*/
FormArray.prototype.setValue = /**
* Sets the value of the {\@link FormArray}. It accepts an array that matches
* the structure of the control.
*
* This method performs strict checks, so it will throw an error if you try
* to set the value of a control that doesn't exist or if you exclude the
* value of a control.
*
* ### Example
*
* ```
* const arr = new FormArray([
* new FormControl(),
* new FormControl()
* ]);
* console.log(arr.value); // [null, null]
*
* arr.setValue(['Nancy', 'Drew']);
* console.log(arr.value); // ['Nancy', 'Drew']
* ```
* @param {?} value
* @param {?=} options
* @return {?}
*/
function (value, options) {
var _this = this;
if (options === void 0) { options = {}; }
this._checkAllValuesPresent(value);
value.forEach(function (newValue, index) {
_this._throwIfControlMissing(index);
_this.at(index).setValue(newValue, { onlySelf: true, emitEvent: options.emitEvent });
});
this.updateValueAndValidity(options);
};
/**
* Patches the value of the {@link FormArray}. It accepts an array that matches the
* structure of the control, and will do its best to match the values to the correct
* controls in the group.
*
* It accepts both super-sets and sub-sets of the array without throwing an error.
*
* ### Example
*
* ```
* const arr = new FormArray([
* new FormControl(),
* new FormControl()
* ]);
* console.log(arr.value); // [null, null]
*
* arr.patchValue(['Nancy']);
* console.log(arr.value); // ['Nancy', null]
* ```
*/
/**
* Patches the value of the {\@link FormArray}. It accepts an array that matches the
* structure of the control, and will do its best to match the values to the correct
* controls in the group.
*
* It accepts both super-sets and sub-sets of the array without throwing an error.
*
* ### Example
*
* ```
* const arr = new FormArray([
* new FormControl(),
* new FormControl()
* ]);
* console.log(arr.value); // [null, null]
*
* arr.patchValue(['Nancy']);
* console.log(arr.value); // ['Nancy', null]
* ```
* @param {?} value
* @param {?=} options
* @return {?}
*/
FormArray.prototype.patchValue = /**
* Patches the value of the {\@link FormArray}. It accepts an array that matches the
* structure of the control, and will do its best to match the values to the correct
* controls in the group.
*
* It accepts both super-sets and sub-sets of the array without throwing an error.
*
* ### Example
*
* ```
* const arr = new FormArray([
* new FormControl(),
* new FormControl()
* ]);
* console.log(arr.value); // [null, null]
*
* arr.patchValue(['Nancy']);
* console.log(arr.value); // ['Nancy', null]
* ```
* @param {?} value
* @param {?=} options
* @return {?}
*/
function (value, options) {
var _this = this;
if (options === void 0) { options = {}; }
value.forEach(function (newValue, index) {
if (_this.at(index)) {
_this.at(index).patchValue(newValue, { onlySelf: true, emitEvent: options.emitEvent });
}
});
this.updateValueAndValidity(options);
};
/**
* Resets the {@link FormArray}. This means by default:
*
* * The array and all descendants are marked `pristine`
* * The array and all descendants are marked `untouched`
* * The value of all descendants will be null or null maps
*
* You can also reset to a specific form state by passing in an array of states
* that matches the structure of the control. The state can be a standalone value
* or a form state object with both a value and a disabled status.
*
* ### Example
*
* ```ts
* this.arr.reset(['name', 'last name']);
*
* console.log(this.arr.value); // ['name', 'last name']
* ```
*
* - OR -
*
* ```
* this.arr.reset([
* {value: 'name', disabled: true},
* 'last'
* ]);
*
* console.log(this.arr.value); // ['name', 'last name']
* console.log(this.arr.get(0).status); // 'DISABLED'
* ```
*/
/**
* Resets the {\@link FormArray}. This means by default:
*
* * The array and all descendants are marked `pristine`
* * The array and all descendants are marked `untouched`
* * The value of all descendants will be null or null maps
*
* You can also reset to a specific form state by passing in an array of states
* that matches the structure of the control. The state can be a standalone value
* or a form state object with both a value and a disabled status.
*
* ### Example
*
* ```ts
* this.arr.reset(['name', 'last name']);
*
* console.log(this.arr.value); // ['name', 'last name']
* ```
*
* - OR -
*
* ```
* this.arr.reset([
* {value: 'name', disabled: true},
* 'last'
* ]);
*
* console.log(this.arr.value); // ['name', 'last name']
* console.log(this.arr.get(0).status); // 'DISABLED'
* ```
* @param {?=} value
* @param {?=} options
* @return {?}
*/
FormArray.prototype.reset = /**
* Resets the {\@link FormArray}. This means by default:
*
* * The array and all descendants are marked `pristine`
* * The array and all descendants are marked `untouched`
* * The value of all descendants will be null or null maps
*
* You can also reset to a specific form state by passing in an array of states
* that matches the structure of the control. The state can be a standalone value
* or a form state object with both a value and a disabled status.
*
* ### Example
*
* ```ts
* this.arr.reset(['name', 'last name']);
*
* console.log(this.arr.value); // ['name', 'last name']
* ```
*
* - OR -
*
* ```
* this.arr.reset([
* {value: 'name', disabled: true},
* 'last'
* ]);
*
* console.log(this.arr.value); // ['name', 'last name']
* console.log(this.arr.get(0).status); // 'DISABLED'
* ```
* @param {?=} value
* @param {?=} options
* @return {?}
*/
function (value, options) {
if (value === void 0) { value = []; }
if (options === void 0) { options = {}; }
this._forEachChild(function (control, index) {
control.reset(value[index], { onlySelf: true, emitEvent: options.emitEvent });
});
this.updateValueAndValidity(options);
this._updatePristine(options);
this._updateTouched(options);
};
/**
* The aggregate value of the array, including any disabled controls.
*
* If you'd like to include all values regardless of disabled status, use this method.
* Otherwise, the `value` property is the best way to get the value of the array.
*/
/**
* The aggregate value of the array, including any disabled controls.
*
* If you'd like to include all values regardless of disabled status, use this method.
* Otherwise, the `value` property is the best way to get the value of the array.
* @return {?}
*/
FormArray.prototype.getRawValue = /**
* The aggregate value of the array, including any disabled controls.
*
* If you'd like to include all values regardless of disabled status, use this method.
* Otherwise, the `value` property is the best way to get the value of the array.
* @return {?}
*/
function () {
return this.controls.map(function (control) {
return control instanceof FormControl ? control.value : (/** @type {?} */ (control)).getRawValue();
});
};
/** @internal */
/**
* \@internal
* @return {?}
*/
FormArray.prototype._syncPendingControls = /**
* \@internal
* @return {?}
*/
function () {
var /** @type {?} */ subtreeUpdated = this.controls.reduce(function (updated, child) {
return child._syncPendingControls() ? true : updated;
}, false);
if (subtreeUpdated)
this.updateValueAndValidity({ onlySelf: true });
return subtreeUpdated;
};
/** @internal */
/**
* \@internal
* @param {?} index
* @return {?}
*/
FormArray.prototype._throwIfControlMissing = /**
* \@internal
* @param {?} index
* @return {?}
*/
function (index) {
if (!this.controls.length) {
throw new Error("\n There are no form controls registered with this array yet. If you're using ngModel,\n you may want to check next tick (e.g. use setTimeout).\n ");
}
if (!this.at(index)) {
throw new Error("Cannot find form control at index " + index);
}
};
/** @internal */
/**
* \@internal
* @param {?} cb
* @return {?}
*/
FormArray.prototype._forEachChild = /**
* \@internal
* @param {?} cb
* @return {?}
*/
function (cb) {
this.controls.forEach(function (control, index) { cb(control, index); });
};
/** @internal */
/**
* \@internal
* @return {?}
*/
FormArray.prototype._updateValue = /**
* \@internal
* @return {?}
*/
function () {
var _this = this;
(/** @type {?} */ (this)).value =
this.controls.filter(function (control) { return control.enabled || _this.disabled; })
.map(function (control) { return control.value; });
};
/** @internal */
/**
* \@internal
* @param {?} condition
* @return {?}
*/
FormArray.prototype._anyControls = /**
* \@internal
* @param {?} condition
* @return {?}
*/
function (condition) {
return this.controls.some(function (control) { return control.enabled && condition(control); });
};
/** @internal */
/**
* \@internal
* @return {?}
*/
FormArray.prototype._setUpControls = /**
* \@internal
* @return {?}
*/
function () {
var _this = this;
this._forEachChild(function (control) { return _this._registerControl(control); });
};
/** @internal */
/**
* \@internal
* @param {?} value
* @return {?}
*/
FormArray.prototype._checkAllValuesPresent = /**
* \@internal
* @param {?} value
* @return {?}
*/
function (value) {
this._forEachChild(function (control, i) {
if (value[i] === undefined) {
throw new Error("Must supply a value for form control at index: " + i + ".");
}
});
};
/** @internal */
/**
* \@internal
* @return {?}
*/
FormArray.prototype._allControlsDisabled = /**
* \@internal
* @return {?}
*/
function () {
for (var _i = 0, _a = this.controls; _i < _a.length; _i++) {
var control = _a[_i];
if (control.enabled)
return false;
}
return this.controls.length > 0 || this.disabled;
};
/**
* @param {?} control
* @return {?}
*/
FormArray.prototype._registerControl = /**
* @param {?} control
* @return {?}
*/
function (control) {
control.setParent(this);
control._registerOnCollectionChange(this._onCollectionChange);
};
return FormArray;
}(AbstractControl));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var formDirectiveProvider = {
provide: ControlContainer,
useExisting: Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_14" /* forwardRef */])(function () { return NgForm; })
};
var resolvedPromise = Promise.resolve(null);
/**
* \@whatItDoes Creates a top-level {\@link FormGroup} instance and binds it to a form
* to track aggregate form value and validation status.
*
* \@howToUse
*
* As soon as you import the `FormsModule`, this directive becomes active by default on
* all `<form>` tags. You don't need to add a special selector.
*
* You can export the directive into a local template variable using `ngForm` as the key
* (ex: `#myForm="ngForm"`). This is optional, but useful. Many properties from the underlying
* {\@link FormGroup} instance are duplicated on the directive itself, so a reference to it
* will give you access to the aggregate value and validity status of the form, as well as
* user interaction properties like `dirty` and `touched`.
*
* To register child controls with the form, you'll want to use {\@link NgModel} with a
* `name` attribute. You can also use {\@link NgModelGroup} if you'd like to create
* sub-groups within the form.
*
* You can listen to the directive's `ngSubmit` event to be notified when the user has
* triggered a form submission. The `ngSubmit` event will be emitted with the original form
* submission event.
*
* In template driven forms, all `<form>` tags are automatically tagged as `NgForm`.
* If you want to import the `FormsModule` but skip its usage in some forms,
* for example, to use native HTML5 validation, you can add `ngNoForm` and the `<form>`
* tags won't create an `NgForm` directive. In reactive forms, using `ngNoForm` is
* unnecessary because the `<form>` tags are inert. In that case, you would
* refrain from using the `formGroup` directive.
*
* {\@example forms/ts/simpleForm/simple_form_example.ts region='Component'}
*
* * **npm package**: `\@angular/forms`
*
* * **NgModule**: `FormsModule`
*
* \@stable
*/
var NgForm = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(NgForm, _super);
function NgForm(validators, asyncValidators) {
var _this = _super.call(this) || this;
_this.submitted = false;
_this._directives = [];
_this.ngSubmit = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["v" /* EventEmitter */]();
_this.form =
new FormGroup({}, composeValidators(validators), composeAsyncValidators(asyncValidators));
return _this;
}
/**
* @return {?}
*/
NgForm.prototype.ngAfterViewInit = /**
* @return {?}
*/
function () { this._setUpdateStrategy(); };
Object.defineProperty(NgForm.prototype, "formDirective", {
get: /**
* @return {?}
*/
function () { return this; },
enumerable: true,
configurable: true
});
Object.defineProperty(NgForm.prototype, "control", {
get: /**
* @return {?}
*/
function () { return this.form; },
enumerable: true,
configurable: true
});
Object.defineProperty(NgForm.prototype, "path", {
get: /**
* @return {?}
*/
function () { return []; },
enumerable: true,
configurable: true
});
Object.defineProperty(NgForm.prototype, "controls", {
get: /**
* @return {?}
*/
function () { return this.form.controls; },
enumerable: true,
configurable: true
});
/**
* @param {?} dir
* @return {?}
*/
NgForm.prototype.addControl = /**
* @param {?} dir
* @return {?}
*/
function (dir) {
var _this = this;
resolvedPromise.then(function () {
var /** @type {?} */ container = _this._findContainer(dir.path);
(/** @type {?} */ (dir)).control = /** @type {?} */ (container.registerControl(dir.name, dir.control));
setUpControl(dir.control, dir);
dir.control.updateValueAndValidity({ emitEvent: false });
_this._directives.push(dir);
});
};
/**
* @param {?} dir
* @return {?}
*/
NgForm.prototype.getControl = /**
* @param {?} dir
* @return {?}
*/
function (dir) { return /** @type {?} */ (this.form.get(dir.path)); };
/**
* @param {?} dir
* @return {?}
*/
NgForm.prototype.removeControl = /**
* @param {?} dir
* @return {?}
*/
function (dir) {
var _this = this;
resolvedPromise.then(function () {
var /** @type {?} */ container = _this._findContainer(dir.path);
if (container) {
container.removeControl(dir.name);
}
removeDir(_this._directives, dir);
});
};
/**
* @param {?} dir
* @return {?}
*/
NgForm.prototype.addFormGroup = /**
* @param {?} dir
* @return {?}
*/
function (dir) {
var _this = this;
resolvedPromise.then(function () {
var /** @type {?} */ container = _this._findContainer(dir.path);
var /** @type {?} */ group = new FormGroup({});
setUpFormContainer(group, dir);
container.registerControl(dir.name, group);
group.updateValueAndValidity({ emitEvent: false });
});
};
/**
* @param {?} dir
* @return {?}
*/
NgForm.prototype.removeFormGroup = /**
* @param {?} dir
* @return {?}
*/
function (dir) {
var _this = this;
resolvedPromise.then(function () {
var /** @type {?} */ container = _this._findContainer(dir.path);
if (container) {
container.removeControl(dir.name);
}
});
};
/**
* @param {?} dir
* @return {?}
*/
NgForm.prototype.getFormGroup = /**
* @param {?} dir
* @return {?}
*/
function (dir) { return /** @type {?} */ (this.form.get(dir.path)); };
/**
* @param {?} dir
* @param {?} value
* @return {?}
*/
NgForm.prototype.updateModel = /**
* @param {?} dir
* @param {?} value
* @return {?}
*/
function (dir, value) {
var _this = this;
resolvedPromise.then(function () {
var /** @type {?} */ ctrl = /** @type {?} */ (_this.form.get(/** @type {?} */ ((dir.path))));
ctrl.setValue(value);
});
};
/**
* @param {?} value
* @return {?}
*/
NgForm.prototype.setValue = /**
* @param {?} value
* @return {?}
*/
function (value) { this.control.setValue(value); };
/**
* @param {?} $event
* @return {?}
*/
NgForm.prototype.onSubmit = /**
* @param {?} $event
* @return {?}
*/
function ($event) {
(/** @type {?} */ (this)).submitted = true;
syncPendingControls(this.form, this._directives);
this.ngSubmit.emit($event);
return false;
};
/**
* @return {?}
*/
NgForm.prototype.onReset = /**
* @return {?}
*/
function () { this.resetForm(); };
/**
* @param {?=} value
* @return {?}
*/
NgForm.prototype.resetForm = /**
* @param {?=} value
* @return {?}
*/
function (value) {
if (value === void 0) { value = undefined; }
this.form.reset(value);
(/** @type {?} */ (this)).submitted = false;
};
/**
* @return {?}
*/
NgForm.prototype._setUpdateStrategy = /**
* @return {?}
*/
function () {
if (this.options && this.options.updateOn != null) {
this.form._updateOn = this.options.updateOn;
}
};
/** @internal */
/**
* \@internal
* @param {?} path
* @return {?}
*/
NgForm.prototype._findContainer = /**
* \@internal
* @param {?} path
* @return {?}
*/
function (path) {
path.pop();
return path.length ? /** @type {?} */ (this.form.get(path)) : this.form;
};
NgForm.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* Directive */], args: [{
selector: 'form:not([ngNoForm]):not([formGroup]),ngForm,[ngForm]',
providers: [formDirectiveProvider],
host: { '(submit)': 'onSubmit($event)', '(reset)': 'onReset()' },
outputs: ['ngSubmit'],
exportAs: 'ngForm'
},] },
];
/** @nocollapse */
NgForm.ctorParameters = function () { return [
{ type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_1" /* Self */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [NG_VALIDATORS,] },] },
{ type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_1" /* Self */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [NG_ASYNC_VALIDATORS,] },] },
]; };
NgForm.propDecorators = {
"options": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */], args: ['ngFormOptions',] },],
};
return NgForm;
}(ControlContainer));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var FormErrorExamples = {
formControlName: "\n <div [formGroup]=\"myGroup\">\n <input formControlName=\"firstName\">\n </div>\n\n In your class:\n\n this.myGroup = new FormGroup({\n firstName: new FormControl()\n });",
formGroupName: "\n <div [formGroup]=\"myGroup\">\n <div formGroupName=\"person\">\n <input formControlName=\"firstName\">\n </div>\n </div>\n\n In your class:\n\n this.myGroup = new FormGroup({\n person: new FormGroup({ firstName: new FormControl() })\n });",
formArrayName: "\n <div [formGroup]=\"myGroup\">\n <div formArrayName=\"cities\">\n <div *ngFor=\"let city of cityArray.controls; index as i\">\n <input [formControlName]=\"i\">\n </div>\n </div>\n </div>\n\n In your class:\n\n this.cityArray = new FormArray([new FormControl('SF')]);\n this.myGroup = new FormGroup({\n cities: this.cityArray\n });",
ngModelGroup: "\n <form>\n <div ngModelGroup=\"person\">\n <input [(ngModel)]=\"person.name\" name=\"firstName\">\n </div>\n </form>",
ngModelWithFormGroup: "\n <div [formGroup]=\"myGroup\">\n <input formControlName=\"firstName\">\n <input [(ngModel)]=\"showMoreControls\" [ngModelOptions]=\"{standalone: true}\">\n </div>\n "
};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var TemplateDrivenErrors = (function () {
function TemplateDrivenErrors() {
}
/**
* @return {?}
*/
TemplateDrivenErrors.modelParentException = /**
* @return {?}
*/
function () {
throw new Error("\n ngModel cannot be used to register form controls with a parent formGroup directive. Try using\n formGroup's partner directive \"formControlName\" instead. Example:\n\n " + FormErrorExamples.formControlName + "\n\n Or, if you'd like to avoid registering this form control, indicate that it's standalone in ngModelOptions:\n\n Example:\n\n " + FormErrorExamples.ngModelWithFormGroup);
};
/**
* @return {?}
*/
TemplateDrivenErrors.formGroupNameException = /**
* @return {?}
*/
function () {
throw new Error("\n ngModel cannot be used to register form controls with a parent formGroupName or formArrayName directive.\n\n Option 1: Use formControlName instead of ngModel (reactive strategy):\n\n " + FormErrorExamples.formGroupName + "\n\n Option 2: Update ngModel's parent be ngModelGroup (template-driven strategy):\n\n " + FormErrorExamples.ngModelGroup);
};
/**
* @return {?}
*/
TemplateDrivenErrors.missingNameException = /**
* @return {?}
*/
function () {
throw new Error("If ngModel is used within a form tag, either the name attribute must be set or the form\n control must be defined as 'standalone' in ngModelOptions.\n\n Example 1: <input [(ngModel)]=\"person.firstName\" name=\"first\">\n Example 2: <input [(ngModel)]=\"person.firstName\" [ngModelOptions]=\"{standalone: true}\">");
};
/**
* @return {?}
*/
TemplateDrivenErrors.modelGroupParentException = /**
* @return {?}
*/
function () {
throw new Error("\n ngModelGroup cannot be used with a parent formGroup directive.\n\n Option 1: Use formGroupName instead of ngModelGroup (reactive strategy):\n\n " + FormErrorExamples.formGroupName + "\n\n Option 2: Use a regular form tag instead of the formGroup directive (template-driven strategy):\n\n " + FormErrorExamples.ngModelGroup);
};
return TemplateDrivenErrors;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var modelGroupProvider = {
provide: ControlContainer,
useExisting: Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_14" /* forwardRef */])(function () { return NgModelGroup; })
};
/**
* \@whatItDoes Creates and binds a {\@link FormGroup} instance to a DOM element.
*
* \@howToUse
*
* This directive can only be used as a child of {\@link NgForm} (or in other words,
* within `<form>` tags).
*
* Use this directive if you'd like to create a sub-group within a form. This can
* come in handy if you want to validate a sub-group of your form separately from
* the rest of your form, or if some values in your domain model make more sense to
* consume together in a nested object.
*
* Pass in the name you'd like this sub-group to have and it will become the key
* for the sub-group in the form's full value. You can also export the directive into
* a local template variable using `ngModelGroup` (ex: `#myGroup="ngModelGroup"`).
*
* {\@example forms/ts/ngModelGroup/ng_model_group_example.ts region='Component'}
*
* * **npm package**: `\@angular/forms`
*
* * **NgModule**: `FormsModule`
*
* \@stable
*/
var NgModelGroup = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(NgModelGroup, _super);
function NgModelGroup(parent, validators, asyncValidators) {
var _this = _super.call(this) || this;
_this._parent = parent;
_this._validators = validators;
_this._asyncValidators = asyncValidators;
return _this;
}
/** @internal */
/**
* \@internal
* @return {?}
*/
NgModelGroup.prototype._checkParentType = /**
* \@internal
* @return {?}
*/
function () {
if (!(this._parent instanceof NgModelGroup) && !(this._parent instanceof NgForm)) {
TemplateDrivenErrors.modelGroupParentException();
}
};
NgModelGroup.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* Directive */], args: [{ selector: '[ngModelGroup]', providers: [modelGroupProvider], exportAs: 'ngModelGroup' },] },
];
/** @nocollapse */
NgModelGroup.ctorParameters = function () { return [
{ type: ControlContainer, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Host */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_2" /* SkipSelf */] },] },
{ type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_1" /* Self */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [NG_VALIDATORS,] },] },
{ type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_1" /* Self */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [NG_ASYNC_VALIDATORS,] },] },
]; };
NgModelGroup.propDecorators = {
"name": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */], args: ['ngModelGroup',] },],
};
return NgModelGroup;
}(AbstractFormGroupDirective));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var formControlBinding = {
provide: NgControl,
useExisting: Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_14" /* forwardRef */])(function () { return NgModel; })
};
/**
* `ngModel` forces an additional change detection run when its inputs change:
* E.g.:
* ```
* <div>{{myModel.valid}}</div>
* <input [(ngModel)]="myValue" #myModel="ngModel">
* ```
* I.e. `ngModel` can export itself on the element and then be used in the template.
* Normally, this would result in expressions before the `input` that use the exported directive
* to have and old value as they have been
* dirty checked before. As this is a very common case for `ngModel`, we added this second change
* detection run.
*
* Notes:
* - this is just one extra run no matter how many `ngModel` have been changed.
* - this is a general problem when using `exportAs` for directives!
*/
var resolvedPromise$1 = Promise.resolve(null);
/**
* \@whatItDoes Creates a {\@link FormControl} instance from a domain model and binds it
* to a form control element.
*
* The {\@link FormControl} instance will track the value, user interaction, and
* validation status of the control and keep the view synced with the model. If used
* within a parent form, the directive will also register itself with the form as a child
* control.
*
* \@howToUse
*
* This directive can be used by itself or as part of a larger form. All you need is the
* `ngModel` selector to activate it.
*
* It accepts a domain model as an optional {\@link Input}. If you have a one-way binding
* to `ngModel` with `[]` syntax, changing the value of the domain model in the component
* class will set the value in the view. If you have a two-way binding with `[()]` syntax
* (also known as 'banana-box syntax'), the value in the UI will always be synced back to
* the domain model in your class as well.
*
* If you wish to inspect the properties of the associated {\@link FormControl} (like
* validity state), you can also export the directive into a local template variable using
* `ngModel` as the key (ex: `#myVar="ngModel"`). You can then access the control using the
* directive's `control` property, but most properties you'll need (like `valid` and `dirty`)
* will fall through to the control anyway, so you can access them directly. You can see a
* full list of properties directly available in {\@link AbstractControlDirective}.
*
* The following is an example of a simple standalone control using `ngModel`:
*
* {\@example forms/ts/simpleNgModel/simple_ng_model_example.ts region='Component'}
*
* When using the `ngModel` within `<form>` tags, you'll also need to supply a `name` attribute
* so that the control can be registered with the parent form under that name.
*
* It's worth noting that in the context of a parent form, you often can skip one-way or
* two-way binding because the parent form will sync the value for you. You can access
* its properties by exporting it into a local template variable using `ngForm` (ex:
* `#f="ngForm"`). Then you can pass it where it needs to go on submit.
*
* If you do need to populate initial values into your form, using a one-way binding for
* `ngModel` tends to be sufficient as long as you use the exported form's value rather
* than the domain model's value on submit.
*
* Take a look at an example of using `ngModel` within a form:
*
* {\@example forms/ts/simpleForm/simple_form_example.ts region='Component'}
*
* To see `ngModel` examples with different form control types, see:
*
* * Radio buttons: {\@link RadioControlValueAccessor}
* * Selects: {\@link SelectControlValueAccessor}
*
* **npm package**: `\@angular/forms`
*
* **NgModule**: `FormsModule`
*
* \@stable
*/
var NgModel = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(NgModel, _super);
function NgModel(parent, validators, asyncValidators, valueAccessors) {
var _this = _super.call(this) || this;
_this.control = new FormControl();
/**
* \@internal
*/
_this._registered = false;
_this.update = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["v" /* EventEmitter */]();
_this._parent = parent;
_this._rawValidators = validators || [];
_this._rawAsyncValidators = asyncValidators || [];
_this.valueAccessor = selectValueAccessor(_this, valueAccessors);
return _this;
}
/**
* @param {?} changes
* @return {?}
*/
NgModel.prototype.ngOnChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
this._checkForErrors();
if (!this._registered)
this._setUpControl();
if ('isDisabled' in changes) {
this._updateDisabled(changes);
}
if (isPropertyUpdated(changes, this.viewModel)) {
this._updateValue(this.model);
this.viewModel = this.model;
}
};
/**
* @return {?}
*/
NgModel.prototype.ngOnDestroy = /**
* @return {?}
*/
function () { this.formDirective && this.formDirective.removeControl(this); };
Object.defineProperty(NgModel.prototype, "path", {
get: /**
* @return {?}
*/
function () {
return this._parent ? controlPath(this.name, this._parent) : [this.name];
},
enumerable: true,
configurable: true
});
Object.defineProperty(NgModel.prototype, "formDirective", {
get: /**
* @return {?}
*/
function () { return this._parent ? this._parent.formDirective : null; },
enumerable: true,
configurable: true
});
Object.defineProperty(NgModel.prototype, "validator", {
get: /**
* @return {?}
*/
function () { return composeValidators(this._rawValidators); },
enumerable: true,
configurable: true
});
Object.defineProperty(NgModel.prototype, "asyncValidator", {
get: /**
* @return {?}
*/
function () {
return composeAsyncValidators(this._rawAsyncValidators);
},
enumerable: true,
configurable: true
});
/**
* @param {?} newValue
* @return {?}
*/
NgModel.prototype.viewToModelUpdate = /**
* @param {?} newValue
* @return {?}
*/
function (newValue) {
this.viewModel = newValue;
this.update.emit(newValue);
};
/**
* @return {?}
*/
NgModel.prototype._setUpControl = /**
* @return {?}
*/
function () {
this._setUpdateStrategy();
this._isStandalone() ? this._setUpStandalone() :
this.formDirective.addControl(this);
this._registered = true;
};
/**
* @return {?}
*/
NgModel.prototype._setUpdateStrategy = /**
* @return {?}
*/
function () {
if (this.options && this.options.updateOn != null) {
this.control._updateOn = this.options.updateOn;
}
};
/**
* @return {?}
*/
NgModel.prototype._isStandalone = /**
* @return {?}
*/
function () {
return !this._parent || !!(this.options && this.options.standalone);
};
/**
* @return {?}
*/
NgModel.prototype._setUpStandalone = /**
* @return {?}
*/
function () {
setUpControl(this.control, this);
this.control.updateValueAndValidity({ emitEvent: false });
};
/**
* @return {?}
*/
NgModel.prototype._checkForErrors = /**
* @return {?}
*/
function () {
if (!this._isStandalone()) {
this._checkParentType();
}
this._checkName();
};
/**
* @return {?}
*/
NgModel.prototype._checkParentType = /**
* @return {?}
*/
function () {
if (!(this._parent instanceof NgModelGroup) &&
this._parent instanceof AbstractFormGroupDirective) {
TemplateDrivenErrors.formGroupNameException();
}
else if (!(this._parent instanceof NgModelGroup) && !(this._parent instanceof NgForm)) {
TemplateDrivenErrors.modelParentException();
}
};
/**
* @return {?}
*/
NgModel.prototype._checkName = /**
* @return {?}
*/
function () {
if (this.options && this.options.name)
this.name = this.options.name;
if (!this._isStandalone() && !this.name) {
TemplateDrivenErrors.missingNameException();
}
};
/**
* @param {?} value
* @return {?}
*/
NgModel.prototype._updateValue = /**
* @param {?} value
* @return {?}
*/
function (value) {
var _this = this;
resolvedPromise$1.then(function () { _this.control.setValue(value, { emitViewToModelChange: false }); });
};
/**
* @param {?} changes
* @return {?}
*/
NgModel.prototype._updateDisabled = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
var _this = this;
var /** @type {?} */ disabledValue = changes['isDisabled'].currentValue;
var /** @type {?} */ isDisabled = disabledValue === '' || (disabledValue && disabledValue !== 'false');
resolvedPromise$1.then(function () {
if (isDisabled && !_this.control.disabled) {
_this.control.disable();
}
else if (!isDisabled && _this.control.disabled) {
_this.control.enable();
}
});
};
NgModel.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* Directive */], args: [{
selector: '[ngModel]:not([formControlName]):not([formControl])',
providers: [formControlBinding],
exportAs: 'ngModel'
},] },
];
/** @nocollapse */
NgModel.ctorParameters = function () { return [
{ type: ControlContainer, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Host */] },] },
{ type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_1" /* Self */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [NG_VALIDATORS,] },] },
{ type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_1" /* Self */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [NG_ASYNC_VALIDATORS,] },] },
{ type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_1" /* Self */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [NG_VALUE_ACCESSOR,] },] },
]; };
NgModel.propDecorators = {
"name": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */] },],
"isDisabled": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */], args: ['disabled',] },],
"model": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */], args: ['ngModel',] },],
"options": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */], args: ['ngModelOptions',] },],
"update": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["O" /* Output */], args: ['ngModelChange',] },],
};
return NgModel;
}(NgControl));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var ReactiveErrors = (function () {
function ReactiveErrors() {
}
/**
* @return {?}
*/
ReactiveErrors.controlParentException = /**
* @return {?}
*/
function () {
throw new Error("formControlName must be used with a parent formGroup directive. You'll want to add a formGroup\n directive and pass it an existing FormGroup instance (you can create one in your class).\n\n Example:\n\n " + FormErrorExamples.formControlName);
};
/**
* @return {?}
*/
ReactiveErrors.ngModelGroupException = /**
* @return {?}
*/
function () {
throw new Error("formControlName cannot be used with an ngModelGroup parent. It is only compatible with parents\n that also have a \"form\" prefix: formGroupName, formArrayName, or formGroup.\n\n Option 1: Update the parent to be formGroupName (reactive form strategy)\n\n " + FormErrorExamples.formGroupName + "\n\n Option 2: Use ngModel instead of formControlName (template-driven strategy)\n\n " + FormErrorExamples.ngModelGroup);
};
/**
* @return {?}
*/
ReactiveErrors.missingFormException = /**
* @return {?}
*/
function () {
throw new Error("formGroup expects a FormGroup instance. Please pass one in.\n\n Example:\n\n " + FormErrorExamples.formControlName);
};
/**
* @return {?}
*/
ReactiveErrors.groupParentException = /**
* @return {?}
*/
function () {
throw new Error("formGroupName must be used with a parent formGroup directive. You'll want to add a formGroup\n directive and pass it an existing FormGroup instance (you can create one in your class).\n\n Example:\n\n " + FormErrorExamples.formGroupName);
};
/**
* @return {?}
*/
ReactiveErrors.arrayParentException = /**
* @return {?}
*/
function () {
throw new Error("formArrayName must be used with a parent formGroup directive. You'll want to add a formGroup\n directive and pass it an existing FormGroup instance (you can create one in your class).\n\n Example:\n\n " + FormErrorExamples.formArrayName);
};
/**
* @return {?}
*/
ReactiveErrors.disabledAttrWarning = /**
* @return {?}
*/
function () {
console.warn("\n It looks like you're using the disabled attribute with a reactive form directive. If you set disabled to true\n when you set up this control in your component class, the disabled attribute will actually be set in the DOM for\n you. We recommend using this approach to avoid 'changed after checked' errors.\n \n Example: \n form = new FormGroup({\n first: new FormControl({value: 'Nancy', disabled: true}, Validators.required),\n last: new FormControl('Drew', Validators.required)\n });\n ");
};
return ReactiveErrors;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var formControlBinding$1 = {
provide: NgControl,
useExisting: Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_14" /* forwardRef */])(function () { return FormControlDirective; })
};
/**
* \@whatItDoes Syncs a standalone {\@link FormControl} instance to a form control element.
*
* In other words, this directive ensures that any values written to the {\@link FormControl}
* instance programmatically will be written to the DOM element (model -> view). Conversely,
* any values written to the DOM element through user input will be reflected in the
* {\@link FormControl} instance (view -> model).
*
* \@howToUse
*
* Use this directive if you'd like to create and manage a {\@link FormControl} instance directly.
* Simply create a {\@link FormControl}, save it to your component class, and pass it into the
* {\@link FormControlDirective}.
*
* This directive is designed to be used as a standalone control. Unlike {\@link FormControlName},
* it does not require that your {\@link FormControl} instance be part of any parent
* {\@link FormGroup}, and it won't be registered to any {\@link FormGroupDirective} that
* exists above it.
*
* **Get the value**: the `value` property is always synced and available on the
* {\@link FormControl} instance. See a full list of available properties in
* {\@link AbstractControl}.
*
* **Set the value**: You can pass in an initial value when instantiating the {\@link FormControl},
* or you can set it programmatically later using {\@link AbstractControl#setValue setValue} or
* {\@link AbstractControl#patchValue patchValue}.
*
* **Listen to value**: If you want to listen to changes in the value of the control, you can
* subscribe to the {\@link AbstractControl#valueChanges valueChanges} event. You can also listen to
* {\@link AbstractControl#statusChanges statusChanges} to be notified when the validation status is
* re-calculated.
*
* ### Example
*
* {\@example forms/ts/simpleFormControl/simple_form_control_example.ts region='Component'}
*
* * **npm package**: `\@angular/forms`
*
* * **NgModule**: `ReactiveFormsModule`
*
* \@stable
*/
var FormControlDirective = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(FormControlDirective, _super);
function FormControlDirective(validators, asyncValidators, valueAccessors) {
var _this = _super.call(this) || this;
_this.update = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["v" /* EventEmitter */]();
_this._rawValidators = validators || [];
_this._rawAsyncValidators = asyncValidators || [];
_this.valueAccessor = selectValueAccessor(_this, valueAccessors);
return _this;
}
Object.defineProperty(FormControlDirective.prototype, "isDisabled", {
set: /**
* @param {?} isDisabled
* @return {?}
*/
function (isDisabled) { ReactiveErrors.disabledAttrWarning(); },
enumerable: true,
configurable: true
});
/**
* @param {?} changes
* @return {?}
*/
FormControlDirective.prototype.ngOnChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
if (this._isControlChanged(changes)) {
setUpControl(this.form, this);
if (this.control.disabled && /** @type {?} */ ((this.valueAccessor)).setDisabledState) {
/** @type {?} */ ((/** @type {?} */ ((this.valueAccessor)).setDisabledState))(true);
}
this.form.updateValueAndValidity({ emitEvent: false });
}
if (isPropertyUpdated(changes, this.viewModel)) {
this.form.setValue(this.model);
this.viewModel = this.model;
}
};
Object.defineProperty(FormControlDirective.prototype, "path", {
get: /**
* @return {?}
*/
function () { return []; },
enumerable: true,
configurable: true
});
Object.defineProperty(FormControlDirective.prototype, "validator", {
get: /**
* @return {?}
*/
function () { return composeValidators(this._rawValidators); },
enumerable: true,
configurable: true
});
Object.defineProperty(FormControlDirective.prototype, "asyncValidator", {
get: /**
* @return {?}
*/
function () {
return composeAsyncValidators(this._rawAsyncValidators);
},
enumerable: true,
configurable: true
});
Object.defineProperty(FormControlDirective.prototype, "control", {
get: /**
* @return {?}
*/
function () { return this.form; },
enumerable: true,
configurable: true
});
/**
* @param {?} newValue
* @return {?}
*/
FormControlDirective.prototype.viewToModelUpdate = /**
* @param {?} newValue
* @return {?}
*/
function (newValue) {
this.viewModel = newValue;
this.update.emit(newValue);
};
/**
* @param {?} changes
* @return {?}
*/
FormControlDirective.prototype._isControlChanged = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
return changes.hasOwnProperty('form');
};
FormControlDirective.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* Directive */], args: [{ selector: '[formControl]', providers: [formControlBinding$1], exportAs: 'ngForm' },] },
];
/** @nocollapse */
FormControlDirective.ctorParameters = function () { return [
{ type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_1" /* Self */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [NG_VALIDATORS,] },] },
{ type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_1" /* Self */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [NG_ASYNC_VALIDATORS,] },] },
{ type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_1" /* Self */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [NG_VALUE_ACCESSOR,] },] },
]; };
FormControlDirective.propDecorators = {
"form": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */], args: ['formControl',] },],
"model": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */], args: ['ngModel',] },],
"update": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["O" /* Output */], args: ['ngModelChange',] },],
"isDisabled": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */], args: ['disabled',] },],
};
return FormControlDirective;
}(NgControl));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var formDirectiveProvider$1 = {
provide: ControlContainer,
useExisting: Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_14" /* forwardRef */])(function () { return FormGroupDirective; })
};
/**
* \@whatItDoes Binds an existing {\@link FormGroup} to a DOM element.
*
* \@howToUse
*
* This directive accepts an existing {\@link FormGroup} instance. It will then use this
* {\@link FormGroup} instance to match any child {\@link FormControl}, {\@link FormGroup},
* and {\@link FormArray} instances to child {\@link FormControlName}, {\@link FormGroupName},
* and {\@link FormArrayName} directives.
*
* **Set value**: You can set the form's initial value when instantiating the
* {\@link FormGroup}, or you can set it programmatically later using the {\@link FormGroup}'s
* {\@link AbstractControl#setValue setValue} or {\@link AbstractControl#patchValue patchValue}
* methods.
*
* **Listen to value**: If you want to listen to changes in the value of the form, you can subscribe
* to the {\@link FormGroup}'s {\@link AbstractControl#valueChanges valueChanges} event. You can also
* listen to its {\@link AbstractControl#statusChanges statusChanges} event to be notified when the
* validation status is re-calculated.
*
* Furthermore, you can listen to the directive's `ngSubmit` event to be notified when the user has
* triggered a form submission. The `ngSubmit` event will be emitted with the original form
* submission event.
*
* ### Example
*
* In this example, we create form controls for first name and last name.
*
* {\@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'}
*
* **npm package**: `\@angular/forms`
*
* **NgModule**: {\@link ReactiveFormsModule}
*
* \@stable
*/
var FormGroupDirective = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(FormGroupDirective, _super);
function FormGroupDirective(_validators, _asyncValidators) {
var _this = _super.call(this) || this;
_this._validators = _validators;
_this._asyncValidators = _asyncValidators;
_this.submitted = false;
_this.directives = [];
_this.form = /** @type {?} */ ((null));
_this.ngSubmit = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["v" /* EventEmitter */]();
return _this;
}
/**
* @param {?} changes
* @return {?}
*/
FormGroupDirective.prototype.ngOnChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
this._checkFormPresent();
if (changes.hasOwnProperty('form')) {
this._updateValidators();
this._updateDomValue();
this._updateRegistrations();
}
};
Object.defineProperty(FormGroupDirective.prototype, "formDirective", {
get: /**
* @return {?}
*/
function () { return this; },
enumerable: true,
configurable: true
});
Object.defineProperty(FormGroupDirective.prototype, "control", {
get: /**
* @return {?}
*/
function () { return this.form; },
enumerable: true,
configurable: true
});
Object.defineProperty(FormGroupDirective.prototype, "path", {
get: /**
* @return {?}
*/
function () { return []; },
enumerable: true,
configurable: true
});
/**
* @param {?} dir
* @return {?}
*/
FormGroupDirective.prototype.addControl = /**
* @param {?} dir
* @return {?}
*/
function (dir) {
var /** @type {?} */ ctrl = this.form.get(dir.path);
setUpControl(ctrl, dir);
ctrl.updateValueAndValidity({ emitEvent: false });
this.directives.push(dir);
return ctrl;
};
/**
* @param {?} dir
* @return {?}
*/
FormGroupDirective.prototype.getControl = /**
* @param {?} dir
* @return {?}
*/
function (dir) { return /** @type {?} */ (this.form.get(dir.path)); };
/**
* @param {?} dir
* @return {?}
*/
FormGroupDirective.prototype.removeControl = /**
* @param {?} dir
* @return {?}
*/
function (dir) { removeDir(this.directives, dir); };
/**
* @param {?} dir
* @return {?}
*/
FormGroupDirective.prototype.addFormGroup = /**
* @param {?} dir
* @return {?}
*/
function (dir) {
var /** @type {?} */ ctrl = this.form.get(dir.path);
setUpFormContainer(ctrl, dir);
ctrl.updateValueAndValidity({ emitEvent: false });
};
/**
* @param {?} dir
* @return {?}
*/
FormGroupDirective.prototype.removeFormGroup = /**
* @param {?} dir
* @return {?}
*/
function (dir) { };
/**
* @param {?} dir
* @return {?}
*/
FormGroupDirective.prototype.getFormGroup = /**
* @param {?} dir
* @return {?}
*/
function (dir) { return /** @type {?} */ (this.form.get(dir.path)); };
/**
* @param {?} dir
* @return {?}
*/
FormGroupDirective.prototype.addFormArray = /**
* @param {?} dir
* @return {?}
*/
function (dir) {
var /** @type {?} */ ctrl = this.form.get(dir.path);
setUpFormContainer(ctrl, dir);
ctrl.updateValueAndValidity({ emitEvent: false });
};
/**
* @param {?} dir
* @return {?}
*/
FormGroupDirective.prototype.removeFormArray = /**
* @param {?} dir
* @return {?}
*/
function (dir) { };
/**
* @param {?} dir
* @return {?}
*/
FormGroupDirective.prototype.getFormArray = /**
* @param {?} dir
* @return {?}
*/
function (dir) { return /** @type {?} */ (this.form.get(dir.path)); };
/**
* @param {?} dir
* @param {?} value
* @return {?}
*/
FormGroupDirective.prototype.updateModel = /**
* @param {?} dir
* @param {?} value
* @return {?}
*/
function (dir, value) {
var /** @type {?} */ ctrl = /** @type {?} */ (this.form.get(dir.path));
ctrl.setValue(value);
};
/**
* @param {?} $event
* @return {?}
*/
FormGroupDirective.prototype.onSubmit = /**
* @param {?} $event
* @return {?}
*/
function ($event) {
(/** @type {?} */ (this)).submitted = true;
syncPendingControls(this.form, this.directives);
this.ngSubmit.emit($event);
return false;
};
/**
* @return {?}
*/
FormGroupDirective.prototype.onReset = /**
* @return {?}
*/
function () { this.resetForm(); };
/**
* @param {?=} value
* @return {?}
*/
FormGroupDirective.prototype.resetForm = /**
* @param {?=} value
* @return {?}
*/
function (value) {
if (value === void 0) { value = undefined; }
this.form.reset(value);
(/** @type {?} */ (this)).submitted = false;
};
/** @internal */
/**
* \@internal
* @return {?}
*/
FormGroupDirective.prototype._updateDomValue = /**
* \@internal
* @return {?}
*/
function () {
var _this = this;
this.directives.forEach(function (dir) {
var /** @type {?} */ newCtrl = _this.form.get(dir.path);
if (dir.control !== newCtrl) {
cleanUpControl(dir.control, dir);
if (newCtrl)
setUpControl(newCtrl, dir);
(/** @type {?} */ (dir)).control = newCtrl;
}
});
this.form._updateTreeValidity({ emitEvent: false });
};
/**
* @return {?}
*/
FormGroupDirective.prototype._updateRegistrations = /**
* @return {?}
*/
function () {
var _this = this;
this.form._registerOnCollectionChange(function () { return _this._updateDomValue(); });
if (this._oldForm)
this._oldForm._registerOnCollectionChange(function () { });
this._oldForm = this.form;
};
/**
* @return {?}
*/
FormGroupDirective.prototype._updateValidators = /**
* @return {?}
*/
function () {
var /** @type {?} */ sync = composeValidators(this._validators);
this.form.validator = Validators.compose([/** @type {?} */ ((this.form.validator)), /** @type {?} */ ((sync))]);
var /** @type {?} */ async = composeAsyncValidators(this._asyncValidators);
this.form.asyncValidator = Validators.composeAsync([/** @type {?} */ ((this.form.asyncValidator)), /** @type {?} */ ((async))]);
};
/**
* @return {?}
*/
FormGroupDirective.prototype._checkFormPresent = /**
* @return {?}
*/
function () {
if (!this.form) {
ReactiveErrors.missingFormException();
}
};
FormGroupDirective.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* Directive */], args: [{
selector: '[formGroup]',
providers: [formDirectiveProvider$1],
host: { '(submit)': 'onSubmit($event)', '(reset)': 'onReset()' },
exportAs: 'ngForm'
},] },
];
/** @nocollapse */
FormGroupDirective.ctorParameters = function () { return [
{ type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_1" /* Self */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [NG_VALIDATORS,] },] },
{ type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_1" /* Self */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [NG_ASYNC_VALIDATORS,] },] },
]; };
FormGroupDirective.propDecorators = {
"form": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */], args: ['formGroup',] },],
"ngSubmit": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["O" /* Output */] },],
};
return FormGroupDirective;
}(ControlContainer));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var formGroupNameProvider = {
provide: ControlContainer,
useExisting: Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_14" /* forwardRef */])(function () { return FormGroupName; })
};
/**
* \@whatItDoes Syncs a nested {\@link FormGroup} to a DOM element.
*
* \@howToUse
*
* This directive can only be used with a parent {\@link FormGroupDirective} (selector:
* `[formGroup]`).
*
* It accepts the string name of the nested {\@link FormGroup} you want to link, and
* will look for a {\@link FormGroup} registered with that name in the parent
* {\@link FormGroup} instance you passed into {\@link FormGroupDirective}.
*
* Nested form groups can come in handy when you want to validate a sub-group of a
* form separately from the rest or when you'd like to group the values of certain
* controls into their own nested object.
*
* **Access the group**: You can access the associated {\@link FormGroup} using the
* {\@link AbstractControl#get get} method. Ex: `this.form.get('name')`.
*
* You can also access individual controls within the group using dot syntax.
* Ex: `this.form.get('name.first')`
*
* **Get the value**: the `value` property is always synced and available on the
* {\@link FormGroup}. See a full list of available properties in {\@link AbstractControl}.
*
* **Set the value**: You can set an initial value for each child control when instantiating
* the {\@link FormGroup}, or you can set it programmatically later using
* {\@link AbstractControl#setValue setValue} or {\@link AbstractControl#patchValue patchValue}.
*
* **Listen to value**: If you want to listen to changes in the value of the group, you can
* subscribe to the {\@link AbstractControl#valueChanges valueChanges} event. You can also listen to
* {\@link AbstractControl#statusChanges statusChanges} to be notified when the validation status is
* re-calculated.
*
* ### Example
*
* {\@example forms/ts/nestedFormGroup/nested_form_group_example.ts region='Component'}
*
* * **npm package**: `\@angular/forms`
*
* * **NgModule**: `ReactiveFormsModule`
*
* \@stable
*/
var FormGroupName = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(FormGroupName, _super);
function FormGroupName(parent, validators, asyncValidators) {
var _this = _super.call(this) || this;
_this._parent = parent;
_this._validators = validators;
_this._asyncValidators = asyncValidators;
return _this;
}
/** @internal */
/**
* \@internal
* @return {?}
*/
FormGroupName.prototype._checkParentType = /**
* \@internal
* @return {?}
*/
function () {
if (_hasInvalidParent(this._parent)) {
ReactiveErrors.groupParentException();
}
};
FormGroupName.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* Directive */], args: [{ selector: '[formGroupName]', providers: [formGroupNameProvider] },] },
];
/** @nocollapse */
FormGroupName.ctorParameters = function () { return [
{ type: ControlContainer, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Host */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_2" /* SkipSelf */] },] },
{ type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_1" /* Self */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [NG_VALIDATORS,] },] },
{ type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_1" /* Self */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [NG_ASYNC_VALIDATORS,] },] },
]; };
FormGroupName.propDecorators = {
"name": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */], args: ['formGroupName',] },],
};
return FormGroupName;
}(AbstractFormGroupDirective));
var formArrayNameProvider = {
provide: ControlContainer,
useExisting: Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_14" /* forwardRef */])(function () { return FormArrayName; })
};
/**
* \@whatItDoes Syncs a nested {\@link FormArray} to a DOM element.
*
* \@howToUse
*
* This directive is designed to be used with a parent {\@link FormGroupDirective} (selector:
* `[formGroup]`).
*
* It accepts the string name of the nested {\@link FormArray} you want to link, and
* will look for a {\@link FormArray} registered with that name in the parent
* {\@link FormGroup} instance you passed into {\@link FormGroupDirective}.
*
* Nested form arrays can come in handy when you have a group of form controls but
* you're not sure how many there will be. Form arrays allow you to create new
* form controls dynamically.
*
* **Access the array**: You can access the associated {\@link FormArray} using the
* {\@link AbstractControl#get get} method on the parent {\@link FormGroup}.
* Ex: `this.form.get('cities')`.
*
* **Get the value**: the `value` property is always synced and available on the
* {\@link FormArray}. See a full list of available properties in {\@link AbstractControl}.
*
* **Set the value**: You can set an initial value for each child control when instantiating
* the {\@link FormArray}, or you can set the value programmatically later using the
* {\@link FormArray}'s {\@link AbstractControl#setValue setValue} or
* {\@link AbstractControl#patchValue patchValue} methods.
*
* **Listen to value**: If you want to listen to changes in the value of the array, you can
* subscribe to the {\@link FormArray}'s {\@link AbstractControl#valueChanges valueChanges} event.
* You can also listen to its {\@link AbstractControl#statusChanges statusChanges} event to be
* notified when the validation status is re-calculated.
*
* **Add new controls**: You can add new controls to the {\@link FormArray} dynamically by calling
* its {\@link FormArray#push push} method.
* Ex: `this.form.get('cities').push(new FormControl());`
*
* ### Example
*
* {\@example forms/ts/nestedFormArray/nested_form_array_example.ts region='Component'}
*
* * **npm package**: `\@angular/forms`
*
* * **NgModule**: `ReactiveFormsModule`
*
* \@stable
*/
var FormArrayName = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(FormArrayName, _super);
function FormArrayName(parent, validators, asyncValidators) {
var _this = _super.call(this) || this;
_this._parent = parent;
_this._validators = validators;
_this._asyncValidators = asyncValidators;
return _this;
}
/**
* @return {?}
*/
FormArrayName.prototype.ngOnInit = /**
* @return {?}
*/
function () {
this._checkParentType(); /** @type {?} */
((this.formDirective)).addFormArray(this);
};
/**
* @return {?}
*/
FormArrayName.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
if (this.formDirective) {
this.formDirective.removeFormArray(this);
}
};
Object.defineProperty(FormArrayName.prototype, "control", {
get: /**
* @return {?}
*/
function () { return /** @type {?} */ ((this.formDirective)).getFormArray(this); },
enumerable: true,
configurable: true
});
Object.defineProperty(FormArrayName.prototype, "formDirective", {
get: /**
* @return {?}
*/
function () {
return this._parent ? /** @type {?} */ (this._parent.formDirective) : null;
},
enumerable: true,
configurable: true
});
Object.defineProperty(FormArrayName.prototype, "path", {
get: /**
* @return {?}
*/
function () { return controlPath(this.name, this._parent); },
enumerable: true,
configurable: true
});
Object.defineProperty(FormArrayName.prototype, "validator", {
get: /**
* @return {?}
*/
function () { return composeValidators(this._validators); },
enumerable: true,
configurable: true
});
Object.defineProperty(FormArrayName.prototype, "asyncValidator", {
get: /**
* @return {?}
*/
function () {
return composeAsyncValidators(this._asyncValidators);
},
enumerable: true,
configurable: true
});
/**
* @return {?}
*/
FormArrayName.prototype._checkParentType = /**
* @return {?}
*/
function () {
if (_hasInvalidParent(this._parent)) {
ReactiveErrors.arrayParentException();
}
};
FormArrayName.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* Directive */], args: [{ selector: '[formArrayName]', providers: [formArrayNameProvider] },] },
];
/** @nocollapse */
FormArrayName.ctorParameters = function () { return [
{ type: ControlContainer, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Host */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_2" /* SkipSelf */] },] },
{ type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_1" /* Self */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [NG_VALIDATORS,] },] },
{ type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_1" /* Self */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [NG_ASYNC_VALIDATORS,] },] },
]; };
FormArrayName.propDecorators = {
"name": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */], args: ['formArrayName',] },],
};
return FormArrayName;
}(ControlContainer));
/**
* @param {?} parent
* @return {?}
*/
function _hasInvalidParent(parent) {
return !(parent instanceof FormGroupName) && !(parent instanceof FormGroupDirective) &&
!(parent instanceof FormArrayName);
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var controlNameBinding = {
provide: NgControl,
useExisting: Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_14" /* forwardRef */])(function () { return FormControlName; })
};
/**
* \@whatItDoes Syncs a {\@link FormControl} in an existing {\@link FormGroup} to a form control
* element by name.
*
* In other words, this directive ensures that any values written to the {\@link FormControl}
* instance programmatically will be written to the DOM element (model -> view). Conversely,
* any values written to the DOM element through user input will be reflected in the
* {\@link FormControl} instance (view -> model).
*
* \@howToUse
*
* This directive is designed to be used with a parent {\@link FormGroupDirective} (selector:
* `[formGroup]`).
*
* It accepts the string name of the {\@link FormControl} instance you want to
* link, and will look for a {\@link FormControl} registered with that name in the
* closest {\@link FormGroup} or {\@link FormArray} above it.
*
* **Access the control**: You can access the {\@link FormControl} associated with
* this directive by using the {\@link AbstractControl#get get} method.
* Ex: `this.form.get('first');`
*
* **Get value**: the `value` property is always synced and available on the {\@link FormControl}.
* See a full list of available properties in {\@link AbstractControl}.
*
* **Set value**: You can set an initial value for the control when instantiating the
* {\@link FormControl}, or you can set it programmatically later using
* {\@link AbstractControl#setValue setValue} or {\@link AbstractControl#patchValue patchValue}.
*
* **Listen to value**: If you want to listen to changes in the value of the control, you can
* subscribe to the {\@link AbstractControl#valueChanges valueChanges} event. You can also listen to
* {\@link AbstractControl#statusChanges statusChanges} to be notified when the validation status is
* re-calculated.
*
* ### Example
*
* In this example, we create form controls for first name and last name.
*
* {\@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'}
*
* To see `formControlName` examples with different form control types, see:
*
* * Radio buttons: {\@link RadioControlValueAccessor}
* * Selects: {\@link SelectControlValueAccessor}
*
* **npm package**: `\@angular/forms`
*
* **NgModule**: {\@link ReactiveFormsModule}
*
* \@stable
*/
var FormControlName = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(FormControlName, _super);
function FormControlName(parent, validators, asyncValidators, valueAccessors) {
var _this = _super.call(this) || this;
_this._added = false;
_this.update = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["v" /* EventEmitter */]();
_this._parent = parent;
_this._rawValidators = validators || [];
_this._rawAsyncValidators = asyncValidators || [];
_this.valueAccessor = selectValueAccessor(_this, valueAccessors);
return _this;
}
Object.defineProperty(FormControlName.prototype, "isDisabled", {
set: /**
* @param {?} isDisabled
* @return {?}
*/
function (isDisabled) { ReactiveErrors.disabledAttrWarning(); },
enumerable: true,
configurable: true
});
/**
* @param {?} changes
* @return {?}
*/
FormControlName.prototype.ngOnChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
if (!this._added)
this._setUpControl();
if (isPropertyUpdated(changes, this.viewModel)) {
this.viewModel = this.model;
this.formDirective.updateModel(this, this.model);
}
};
/**
* @return {?}
*/
FormControlName.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
if (this.formDirective) {
this.formDirective.removeControl(this);
}
};
/**
* @param {?} newValue
* @return {?}
*/
FormControlName.prototype.viewToModelUpdate = /**
* @param {?} newValue
* @return {?}
*/
function (newValue) {
this.viewModel = newValue;
this.update.emit(newValue);
};
Object.defineProperty(FormControlName.prototype, "path", {
get: /**
* @return {?}
*/
function () { return controlPath(this.name, /** @type {?} */ ((this._parent))); },
enumerable: true,
configurable: true
});
Object.defineProperty(FormControlName.prototype, "formDirective", {
get: /**
* @return {?}
*/
function () { return this._parent ? this._parent.formDirective : null; },
enumerable: true,
configurable: true
});
Object.defineProperty(FormControlName.prototype, "validator", {
get: /**
* @return {?}
*/
function () { return composeValidators(this._rawValidators); },
enumerable: true,
configurable: true
});
Object.defineProperty(FormControlName.prototype, "asyncValidator", {
get: /**
* @return {?}
*/
function () {
return /** @type {?} */ ((composeAsyncValidators(this._rawAsyncValidators)));
},
enumerable: true,
configurable: true
});
/**
* @return {?}
*/
FormControlName.prototype._checkParentType = /**
* @return {?}
*/
function () {
if (!(this._parent instanceof FormGroupName) &&
this._parent instanceof AbstractFormGroupDirective) {
ReactiveErrors.ngModelGroupException();
}
else if (!(this._parent instanceof FormGroupName) && !(this._parent instanceof FormGroupDirective) &&
!(this._parent instanceof FormArrayName)) {
ReactiveErrors.controlParentException();
}
};
/**
* @return {?}
*/
FormControlName.prototype._setUpControl = /**
* @return {?}
*/
function () {
this._checkParentType();
(/** @type {?} */ (this)).control = this.formDirective.addControl(this);
if (this.control.disabled && /** @type {?} */ ((this.valueAccessor)).setDisabledState) {
/** @type {?} */ ((/** @type {?} */ ((this.valueAccessor)).setDisabledState))(true);
}
this._added = true;
};
FormControlName.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* Directive */], args: [{ selector: '[formControlName]', providers: [controlNameBinding] },] },
];
/** @nocollapse */
FormControlName.ctorParameters = function () { return [
{ type: ControlContainer, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* Host */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_2" /* SkipSelf */] },] },
{ type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_1" /* Self */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [NG_VALIDATORS,] },] },
{ type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_1" /* Self */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [NG_ASYNC_VALIDATORS,] },] },
{ type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_1" /* Self */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [NG_VALUE_ACCESSOR,] },] },
]; };
FormControlName.propDecorators = {
"name": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */], args: ['formControlName',] },],
"model": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */], args: ['ngModel',] },],
"update": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["O" /* Output */], args: ['ngModelChange',] },],
"isDisabled": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */], args: ['disabled',] },],
};
return FormControlName;
}(NgControl));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* An interface that can be implemented by classes that can act as validators.
*
* ## Usage
*
* ```typescript
* \@Directive({
* selector: '[custom-validator]',
* providers: [{provide: NG_VALIDATORS, useExisting: CustomValidatorDirective, multi: true}]
* })
* class CustomValidatorDirective implements Validator {
* validate(c: Control): {[key: string]: any} {
* return {"custom": true};
* }
* }
* ```
*
* \@stable
* @record
*/
/**
* \@experimental
* @record
*/
var REQUIRED_VALIDATOR = {
provide: NG_VALIDATORS,
useExisting: Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_14" /* forwardRef */])(function () { return RequiredValidator; }),
multi: true
};
var CHECKBOX_REQUIRED_VALIDATOR = {
provide: NG_VALIDATORS,
useExisting: Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_14" /* forwardRef */])(function () { return CheckboxRequiredValidator; }),
multi: true
};
/**
* A Directive that adds the `required` validator to any controls marked with the
* `required` attribute, via the {\@link NG_VALIDATORS} binding.
*
* ### Example
*
* ```
* <input name="fullName" ngModel required>
* ```
*
* \@stable
*/
var RequiredValidator = (function () {
function RequiredValidator() {
}
Object.defineProperty(RequiredValidator.prototype, "required", {
get: /**
* @return {?}
*/
function () { return this._required; },
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
this._required = value != null && value !== false && "" + value !== 'false';
if (this._onChange)
this._onChange();
},
enumerable: true,
configurable: true
});
/**
* @param {?} c
* @return {?}
*/
RequiredValidator.prototype.validate = /**
* @param {?} c
* @return {?}
*/
function (c) {
return this.required ? Validators.required(c) : null;
};
/**
* @param {?} fn
* @return {?}
*/
RequiredValidator.prototype.registerOnValidatorChange = /**
* @param {?} fn
* @return {?}
*/
function (fn) { this._onChange = fn; };
RequiredValidator.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* Directive */], args: [{
selector: ':not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]',
providers: [REQUIRED_VALIDATOR],
host: { '[attr.required]': 'required ? "" : null' }
},] },
];
/** @nocollapse */
RequiredValidator.ctorParameters = function () { return []; };
RequiredValidator.propDecorators = {
"required": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */] },],
};
return RequiredValidator;
}());
/**
* A Directive that adds the `required` validator to checkbox controls marked with the
* `required` attribute, via the {\@link NG_VALIDATORS} binding.
*
* ### Example
*
* ```
* <input type="checkbox" name="active" ngModel required>
* ```
*
* \@experimental
*/
var CheckboxRequiredValidator = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(CheckboxRequiredValidator, _super);
function CheckboxRequiredValidator() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @param {?} c
* @return {?}
*/
CheckboxRequiredValidator.prototype.validate = /**
* @param {?} c
* @return {?}
*/
function (c) {
return this.required ? Validators.requiredTrue(c) : null;
};
CheckboxRequiredValidator.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* Directive */], args: [{
selector: 'input[type=checkbox][required][formControlName],input[type=checkbox][required][formControl],input[type=checkbox][required][ngModel]',
providers: [CHECKBOX_REQUIRED_VALIDATOR],
host: { '[attr.required]': 'required ? "" : null' }
},] },
];
/** @nocollapse */
CheckboxRequiredValidator.ctorParameters = function () { return []; };
return CheckboxRequiredValidator;
}(RequiredValidator));
/**
* Provider which adds {\@link EmailValidator} to {\@link NG_VALIDATORS}.
*/
var EMAIL_VALIDATOR = {
provide: NG_VALIDATORS,
useExisting: Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_14" /* forwardRef */])(function () { return EmailValidator; }),
multi: true
};
/**
* A Directive that adds the `email` validator to controls marked with the
* `email` attribute, via the {\@link NG_VALIDATORS} binding.
*
* ### Example
*
* ```
* <input type="email" name="email" ngModel email>
* <input type="email" name="email" ngModel email="true">
* <input type="email" name="email" ngModel [email]="true">
* ```
*
* \@experimental
*/
var EmailValidator = (function () {
function EmailValidator() {
}
Object.defineProperty(EmailValidator.prototype, "email", {
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
this._enabled = value === '' || value === true || value === 'true';
if (this._onChange)
this._onChange();
},
enumerable: true,
configurable: true
});
/**
* @param {?} c
* @return {?}
*/
EmailValidator.prototype.validate = /**
* @param {?} c
* @return {?}
*/
function (c) {
return this._enabled ? Validators.email(c) : null;
};
/**
* @param {?} fn
* @return {?}
*/
EmailValidator.prototype.registerOnValidatorChange = /**
* @param {?} fn
* @return {?}
*/
function (fn) { this._onChange = fn; };
EmailValidator.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* Directive */], args: [{
selector: '[email][formControlName],[email][formControl],[email][ngModel]',
providers: [EMAIL_VALIDATOR]
},] },
];
/** @nocollapse */
EmailValidator.ctorParameters = function () { return []; };
EmailValidator.propDecorators = {
"email": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */] },],
};
return EmailValidator;
}());
/**
* \@stable
* @record
*/
/**
* \@stable
* @record
*/
/**
* Provider which adds {\@link MinLengthValidator} to {\@link NG_VALIDATORS}.
*
* ## Example:
*
* {\@example common/forms/ts/validators/validators.ts region='min'}
*/
var MIN_LENGTH_VALIDATOR = {
provide: NG_VALIDATORS,
useExisting: Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_14" /* forwardRef */])(function () { return MinLengthValidator; }),
multi: true
};
/**
* A directive which installs the {\@link MinLengthValidator} for any `formControlName`,
* `formControl`, or control with `ngModel` that also has a `minlength` attribute.
*
* \@stable
*/
var MinLengthValidator = (function () {
function MinLengthValidator() {
}
/**
* @param {?} changes
* @return {?}
*/
MinLengthValidator.prototype.ngOnChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
if ('minlength' in changes) {
this._createValidator();
if (this._onChange)
this._onChange();
}
};
/**
* @param {?} c
* @return {?}
*/
MinLengthValidator.prototype.validate = /**
* @param {?} c
* @return {?}
*/
function (c) {
return this.minlength == null ? null : this._validator(c);
};
/**
* @param {?} fn
* @return {?}
*/
MinLengthValidator.prototype.registerOnValidatorChange = /**
* @param {?} fn
* @return {?}
*/
function (fn) { this._onChange = fn; };
/**
* @return {?}
*/
MinLengthValidator.prototype._createValidator = /**
* @return {?}
*/
function () {
this._validator = Validators.minLength(parseInt(this.minlength, 10));
};
MinLengthValidator.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* Directive */], args: [{
selector: '[minlength][formControlName],[minlength][formControl],[minlength][ngModel]',
providers: [MIN_LENGTH_VALIDATOR],
host: { '[attr.minlength]': 'minlength ? minlength : null' }
},] },
];
/** @nocollapse */
MinLengthValidator.ctorParameters = function () { return []; };
MinLengthValidator.propDecorators = {
"minlength": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */] },],
};
return MinLengthValidator;
}());
/**
* Provider which adds {\@link MaxLengthValidator} to {\@link NG_VALIDATORS}.
*
* ## Example:
*
* {\@example common/forms/ts/validators/validators.ts region='max'}
*/
var MAX_LENGTH_VALIDATOR = {
provide: NG_VALIDATORS,
useExisting: Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_14" /* forwardRef */])(function () { return MaxLengthValidator; }),
multi: true
};
/**
* A directive which installs the {\@link MaxLengthValidator} for any `formControlName,
* `formControl`,
* or control with `ngModel` that also has a `maxlength` attribute.
*
* \@stable
*/
var MaxLengthValidator = (function () {
function MaxLengthValidator() {
}
/**
* @param {?} changes
* @return {?}
*/
MaxLengthValidator.prototype.ngOnChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
if ('maxlength' in changes) {
this._createValidator();
if (this._onChange)
this._onChange();
}
};
/**
* @param {?} c
* @return {?}
*/
MaxLengthValidator.prototype.validate = /**
* @param {?} c
* @return {?}
*/
function (c) {
return this.maxlength != null ? this._validator(c) : null;
};
/**
* @param {?} fn
* @return {?}
*/
MaxLengthValidator.prototype.registerOnValidatorChange = /**
* @param {?} fn
* @return {?}
*/
function (fn) { this._onChange = fn; };
/**
* @return {?}
*/
MaxLengthValidator.prototype._createValidator = /**
* @return {?}
*/
function () {
this._validator = Validators.maxLength(parseInt(this.maxlength, 10));
};
MaxLengthValidator.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* Directive */], args: [{
selector: '[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]',
providers: [MAX_LENGTH_VALIDATOR],
host: { '[attr.maxlength]': 'maxlength ? maxlength : null' }
},] },
];
/** @nocollapse */
MaxLengthValidator.ctorParameters = function () { return []; };
MaxLengthValidator.propDecorators = {
"maxlength": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */] },],
};
return MaxLengthValidator;
}());
var PATTERN_VALIDATOR = {
provide: NG_VALIDATORS,
useExisting: Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_14" /* forwardRef */])(function () { return PatternValidator; }),
multi: true
};
/**
* A Directive that adds the `pattern` validator to any controls marked with the
* `pattern` attribute, via the {\@link NG_VALIDATORS} binding. Uses attribute value
* as the regex to validate Control value against. Follows pattern attribute
* semantics; i.e. regex must match entire Control value.
*
* ### Example
*
* ```
* <input [name]="fullName" pattern="[a-zA-Z ]*" ngModel>
* ```
* \@stable
*/
var PatternValidator = (function () {
function PatternValidator() {
}
/**
* @param {?} changes
* @return {?}
*/
PatternValidator.prototype.ngOnChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
if ('pattern' in changes) {
this._createValidator();
if (this._onChange)
this._onChange();
}
};
/**
* @param {?} c
* @return {?}
*/
PatternValidator.prototype.validate = /**
* @param {?} c
* @return {?}
*/
function (c) { return this._validator(c); };
/**
* @param {?} fn
* @return {?}
*/
PatternValidator.prototype.registerOnValidatorChange = /**
* @param {?} fn
* @return {?}
*/
function (fn) { this._onChange = fn; };
/**
* @return {?}
*/
PatternValidator.prototype._createValidator = /**
* @return {?}
*/
function () { this._validator = Validators.pattern(this.pattern); };
PatternValidator.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* Directive */], args: [{
selector: '[pattern][formControlName],[pattern][formControl],[pattern][ngModel]',
providers: [PATTERN_VALIDATOR],
host: { '[attr.pattern]': 'pattern ? pattern : null' }
},] },
];
/** @nocollapse */
PatternValidator.ctorParameters = function () { return []; };
PatternValidator.propDecorators = {
"pattern": [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["D" /* Input */] },],
};
return PatternValidator;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* \@whatItDoes Creates an {\@link AbstractControl} from a user-specified configuration.
*
* It is essentially syntactic sugar that shortens the `new FormGroup()`,
* `new FormControl()`, and `new FormArray()` boilerplate that can build up in larger
* forms.
*
* \@howToUse
*
* To use, inject `FormBuilder` into your component class. You can then call its methods
* directly.
*
* {\@example forms/ts/formBuilder/form_builder_example.ts region='Component'}
*
* * **npm package**: `\@angular/forms`
*
* * **NgModule**: {\@link ReactiveFormsModule}
*
* \@stable
*/
var FormBuilder = (function () {
function FormBuilder() {
}
/**
* Construct a new {@link FormGroup} with the given map of configuration.
* Valid keys for the `extra` parameter map are `validator` and `asyncValidator`.
*
* See the {@link FormGroup} constructor for more details.
*/
/**
* Construct a new {\@link FormGroup} with the given map of configuration.
* Valid keys for the `extra` parameter map are `validator` and `asyncValidator`.
*
* See the {\@link FormGroup} constructor for more details.
* @param {?} controlsConfig
* @param {?=} extra
* @return {?}
*/
FormBuilder.prototype.group = /**
* Construct a new {\@link FormGroup} with the given map of configuration.
* Valid keys for the `extra` parameter map are `validator` and `asyncValidator`.
*
* See the {\@link FormGroup} constructor for more details.
* @param {?} controlsConfig
* @param {?=} extra
* @return {?}
*/
function (controlsConfig, extra) {
if (extra === void 0) { extra = null; }
var /** @type {?} */ controls = this._reduceControls(controlsConfig);
var /** @type {?} */ validator = extra != null ? extra['validator'] : null;
var /** @type {?} */ asyncValidator = extra != null ? extra['asyncValidator'] : null;
return new FormGroup(controls, validator, asyncValidator);
};
/**
* Construct a new {@link FormControl} with the given `formState`,`validator`, and
* `asyncValidator`.
*
* `formState` can either be a standalone value for the form control or an object
* that contains both a value and a disabled status.
*
*/
/**
* Construct a new {\@link FormControl} with the given `formState`,`validator`, and
* `asyncValidator`.
*
* `formState` can either be a standalone value for the form control or an object
* that contains both a value and a disabled status.
*
* @param {?} formState
* @param {?=} validator
* @param {?=} asyncValidator
* @return {?}
*/
FormBuilder.prototype.control = /**
* Construct a new {\@link FormControl} with the given `formState`,`validator`, and
* `asyncValidator`.
*
* `formState` can either be a standalone value for the form control or an object
* that contains both a value and a disabled status.
*
* @param {?} formState
* @param {?=} validator
* @param {?=} asyncValidator
* @return {?}
*/
function (formState, validator, asyncValidator) {
return new FormControl(formState, validator, asyncValidator);
};
/**
* Construct a {@link FormArray} from the given `controlsConfig` array of
* configuration, with the given optional `validator` and `asyncValidator`.
*/
/**
* Construct a {\@link FormArray} from the given `controlsConfig` array of
* configuration, with the given optional `validator` and `asyncValidator`.
* @param {?} controlsConfig
* @param {?=} validator
* @param {?=} asyncValidator
* @return {?}
*/
FormBuilder.prototype.array = /**
* Construct a {\@link FormArray} from the given `controlsConfig` array of
* configuration, with the given optional `validator` and `asyncValidator`.
* @param {?} controlsConfig
* @param {?=} validator
* @param {?=} asyncValidator
* @return {?}
*/
function (controlsConfig, validator, asyncValidator) {
var _this = this;
var /** @type {?} */ controls = controlsConfig.map(function (c) { return _this._createControl(c); });
return new FormArray(controls, validator, asyncValidator);
};
/** @internal */
/**
* \@internal
* @param {?} controlsConfig
* @return {?}
*/
FormBuilder.prototype._reduceControls = /**
* \@internal
* @param {?} controlsConfig
* @return {?}
*/
function (controlsConfig) {
var _this = this;
var /** @type {?} */ controls = {};
Object.keys(controlsConfig).forEach(function (controlName) {
controls[controlName] = _this._createControl(controlsConfig[controlName]);
});
return controls;
};
/** @internal */
/**
* \@internal
* @param {?} controlConfig
* @return {?}
*/
FormBuilder.prototype._createControl = /**
* \@internal
* @param {?} controlConfig
* @return {?}
*/
function (controlConfig) {
if (controlConfig instanceof FormControl || controlConfig instanceof FormGroup ||
controlConfig instanceof FormArray) {
return controlConfig;
}
else if (Array.isArray(controlConfig)) {
var /** @type {?} */ value = controlConfig[0];
var /** @type {?} */ validator = controlConfig.length > 1 ? controlConfig[1] : null;
var /** @type {?} */ asyncValidator = controlConfig.length > 2 ? controlConfig[2] : null;
return this.control(value, validator, asyncValidator);
}
else {
return this.control(controlConfig);
}
};
FormBuilder.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
FormBuilder.ctorParameters = function () { return []; };
return FormBuilder;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @module
* @description
* Entry point for all public APIs of the common package.
*/
/**
* \@stable
*/
var VERSION = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["_7" /* Version */]('5.0.3');
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* \@whatItDoes Adds `novalidate` attribute to all forms by default.
*
* `novalidate` is used to disable browser's native form validation.
*
* If you want to use native validation with Angular forms, just add `ngNativeValidate` attribute:
*
* ```
* <form ngNativeValidate></form>
* ```
*
* \@experimental
*/
var NgNoValidate = (function () {
function NgNoValidate() {
}
NgNoValidate.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* Directive */], args: [{
selector: 'form:not([ngNoForm]):not([ngNativeValidate])',
host: { 'novalidate': '' },
},] },
];
/** @nocollapse */
NgNoValidate.ctorParameters = function () { return []; };
return NgNoValidate;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var SHARED_FORM_DIRECTIVES = [
NgNoValidate,
NgSelectOption,
NgSelectMultipleOption,
DefaultValueAccessor,
NumberValueAccessor,
RangeValueAccessor,
CheckboxControlValueAccessor,
SelectControlValueAccessor,
SelectMultipleControlValueAccessor,
RadioControlValueAccessor,
NgControlStatus,
NgControlStatusGroup,
RequiredValidator,
MinLengthValidator,
MaxLengthValidator,
PatternValidator,
CheckboxRequiredValidator,
EmailValidator,
];
var TEMPLATE_DRIVEN_DIRECTIVES = [NgModel, NgModelGroup, NgForm];
var REACTIVE_DRIVEN_DIRECTIVES = [FormControlDirective, FormGroupDirective, FormControlName, FormGroupName, FormArrayName];
/**
* Internal module used for sharing directives between FormsModule and ReactiveFormsModule
*/
var InternalFormsSharedModule = (function () {
function InternalFormsSharedModule() {
}
InternalFormsSharedModule.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["I" /* NgModule */], args: [{
declarations: SHARED_FORM_DIRECTIVES,
exports: SHARED_FORM_DIRECTIVES,
},] },
];
/** @nocollapse */
InternalFormsSharedModule.ctorParameters = function () { return []; };
return InternalFormsSharedModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* The ng module for forms.
* \@stable
*/
var FormsModule = (function () {
function FormsModule() {
}
FormsModule.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["I" /* NgModule */], args: [{
declarations: TEMPLATE_DRIVEN_DIRECTIVES,
providers: [RadioControlRegistry],
exports: [InternalFormsSharedModule, TEMPLATE_DRIVEN_DIRECTIVES]
},] },
];
/** @nocollapse */
FormsModule.ctorParameters = function () { return []; };
return FormsModule;
}());
/**
* The ng module for reactive forms.
* \@stable
*/
var ReactiveFormsModule = (function () {
function ReactiveFormsModule() {
}
ReactiveFormsModule.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["I" /* NgModule */], args: [{
declarations: [REACTIVE_DRIVEN_DIRECTIVES],
providers: [FormBuilder, RadioControlRegistry],
exports: [InternalFormsSharedModule, REACTIVE_DRIVEN_DIRECTIVES]
},] },
];
/** @nocollapse */
ReactiveFormsModule.ctorParameters = function () { return []; };
return ReactiveFormsModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @module
* @description
* This module is used for handling user input, by defining and building a {@link FormGroup} that
* consists of {@link FormControl} objects, and mapping them onto the DOM. {@link FormControl}
* objects can then be used to read information from the form DOM elements.
*
* Forms providers are not included in default providers; you must import these providers
* explicitly.
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @module
* @description
* Entry point for all public APIs of this package.
*/
// This file only reexports content of the `src` folder. Keep it that way.
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Generated bundle index. Do not edit.
*/
//# sourceMappingURL=forms.js.map
/***/ }),
/* 17 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (immutable) */ __webpack_exports__["m"] = round;
/* harmony export (immutable) */ __webpack_exports__["e"] = inlineStyle;
/* harmony export (immutable) */ __webpack_exports__["b"] = addClass;
/* harmony export (immutable) */ __webpack_exports__["l"] = removeClass;
/* harmony export (immutable) */ __webpack_exports__["d"] = getElementIndex;
/* harmony export (immutable) */ __webpack_exports__["k"] = queryChildren;
/* harmony export (immutable) */ __webpack_exports__["c"] = eachChild;
/* harmony export (immutable) */ __webpack_exports__["n"] = transform;
/* harmony export (immutable) */ __webpack_exports__["o"] = transition;
/* harmony export (immutable) */ __webpack_exports__["p"] = triggerTransitionEnd;
/* harmony export (immutable) */ __webpack_exports__["j"] = offset;
/* harmony export (immutable) */ __webpack_exports__["q"] = updateSlidesOffset;
/* harmony export (immutable) */ __webpack_exports__["g"] = isHorizontal;
/* harmony export (immutable) */ __webpack_exports__["f"] = isFormElement;
/* harmony export (immutable) */ __webpack_exports__["i"] = minTranslate;
/* harmony export (immutable) */ __webpack_exports__["h"] = maxTranslate;
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CLS; });
function round(a) {
return Math.floor(a);
}
function inlineStyle(ele, styles) {
if (ele) {
if (ele.length) {
for (var i = 0; i < ele.length; i++) {
inlineStyle(ele[i], styles);
}
}
else if (ele.nodeType) {
var cssProps = Object.keys(styles);
for (var i_1 = 0; i_1 < cssProps.length; i_1++) {
ele.style[cssProps[i_1]] = styles[cssProps[i_1]];
}
}
}
}
function addClass(ele, className) {
if (ele) {
if (ele.length) {
for (var i = 0; i < ele.length; i++) {
addClass(ele[i], className);
}
}
else if (ele.nodeType) {
if (Array.isArray(className)) {
className.forEach(function (cls) {
ele.classList.add(cls);
});
}
else {
ele.classList.add(className);
}
}
}
}
function removeClass(ele, className) {
if (ele) {
if (ele.length) {
for (var i = 0; i < ele.length; i++) {
removeClass(ele[i], className);
}
}
else if (ele.nodeType) {
if (Array.isArray(className)) {
className.forEach(function (cls) {
ele.classList.remove(cls);
});
}
else {
ele.classList.remove(className);
}
}
}
}
function getElementIndex(ele) {
var i = 0;
if (ele) {
while ((ele = ele.previousSibling) !== null) {
if (ele.nodeType === 1)
i++;
}
}
return i;
}
function queryChildren(parentEle, query) {
if (parentEle) {
return parentEle.querySelectorAll(query);
}
return [];
}
function eachChild(parentEle, query, callback) {
if (parentEle) {
var nodes = parentEle.querySelectorAll(query);
for (var i = 0; i < nodes.length; i++) {
callback(nodes[i]);
}
}
}
function transform(ele, val) {
if (ele) {
var elStyle = ele.style;
elStyle.webkitTransform = elStyle.MsTransform = elStyle.msTransform = elStyle.transform = val;
}
}
function transition(ele, duration) {
if (ele) {
if (typeof duration !== 'string') {
duration = duration + 'ms';
}
var elStyle = ele.style;
elStyle.webkitTransitionDuration = elStyle.MsTransitionDuration = elStyle.msTransitionDuration = elStyle.transitionDuration = duration;
}
}
function triggerTransitionEnd(plt, ele) {
try {
var win = plt.win();
var evt = new win.CustomEvent('transitionend', { bubbles: true, cancelable: true });
ele.dispatchEvent(evt);
}
catch (e) { }
}
function offset(ele, plt) {
if (ele) {
var box = plt.getElementBoundingClientRect(ele);
var body = plt.doc().body;
var win = plt.win();
var clientTop = ele.clientTop || body.clientTop || 0;
var clientLeft = ele.clientLeft || body.clientLeft || 0;
var scrollTop = win.pageYOffset || ele.scrollTop;
var scrollLeft = win.pageXOffset || ele.scrollLeft;
return {
top: box.top + scrollTop - clientTop,
left: box.left + scrollLeft - clientLeft
};
}
return null;
}
function updateSlidesOffset(s) {
for (var i = 0; i < s._slides.length; i++) {
s._slides[i].swiperSlideOffset = isHorizontal(s) ? s._slides[i].offsetLeft : s._slides[i].offsetTop;
}
}
function isHorizontal(s) {
return s.direction === 'horizontal';
}
var formElements = ['INPUT', 'SELECT', 'TEXTAREA', 'BUTTON', 'VIDEO'];
function isFormElement(el) {
return !!el && formElements.indexOf(el.tagName) > -1;
}
/*=========================
Min/Max Translate
===========================*/
function minTranslate(s) {
return (-s._snapGrid[0]);
}
function maxTranslate(s) {
return (-s._snapGrid[s._snapGrid.length - 1]);
}
var CLS = {
// Classnames
noSwiping: 'swiper-no-swiping',
containerModifier: 'swiper-container-',
slide: 'swiper-slide',
slideActive: 'swiper-slide-active',
slideDuplicateActive: 'swiper-slide-duplicate-active',
slideVisible: 'swiper-slide-visible',
slideDuplicate: 'swiper-slide-duplicate',
slideNext: 'swiper-slide-next',
slideDuplicateNext: 'swiper-slide-duplicate-next',
slidePrev: 'swiper-slide-prev',
slideDuplicatePrev: 'swiper-slide-duplicate-prev',
wrapper: 'swiper-wrapper',
bullet: 'swiper-pagination-bullet',
bulletActive: 'swiper-pagination-bullet-active',
buttonDisabled: 'swiper-button-disabled',
paginationCurrent: 'swiper-pagination-current',
paginationTotal: 'swiper-pagination-total',
paginationHidden: 'swiper-pagination-hidden',
paginationProgressbar: 'swiper-pagination-progressbar',
paginationClickable: 'swiper-pagination-clickable',
paginationModifier: 'swiper-pagination-',
lazyLoading: 'swiper-lazy',
lazyStatusLoading: 'swiper-lazy-loading',
lazyStatusLoaded: 'swiper-lazy-loaded',
lazyPreloader: 'swiper-lazy-preloader',
notification: 'swiper-notification',
preloader: 'preloader',
zoomContainer: 'swiper-zoom-container',
};
//# sourceMappingURL=swiper-utils.js.map
/***/ }),
/* 18 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NavParams; });
/**
* @name NavParams
* @description
* NavParams are an object that exists on a page and can contain data for that particular view.
* Similar to how data was pass to a view in V1 with `$stateParams`, NavParams offer a much more flexible
* option with a simple `get` method.
*
* @usage
* ```ts
* import { NavParams } from 'ionic-angular';
*
* export class MyClass{
*
* constructor(navParams: NavParams){
* // userParams is an object we have in our nav-parameters
* navParams.get('userParams');
* }
*
* }
* ```
* @demo /docs/demos/src/nav-params/
* @see {@link /docs/components#navigation Navigation Component Docs}
* @see {@link ../NavController/ NavController API Docs}
* @see {@link /docs/api/components/nav/Nav/ Nav API Docs}
* @see {@link /docs/api/components/nav/NavPush/ NavPush API Docs}
*/
var NavParams = (function () {
/**
* @hidden
* @param {TODO} data TODO
*/
function NavParams(data) {
if (data === void 0) { data = {}; }
this.data = data;
}
/**
* Get the value of a nav-parameter for the current view
*
* ```ts
* import { NavParams } from 'ionic-angular';
*
* export class MyClass{
* constructor(public navParams: NavParams){
* // userParams is an object we have in our nav-parameters
* this.navParams.get('userParams');
* }
* }
* ```
*
*
* @param {string} param Which param you want to look up
*/
NavParams.prototype.get = function (param) {
return this.data[param];
};
return NavParams;
}());
//# sourceMappingURL=nav-params.js.map
/***/ }),
/* 19 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DeepLinker; });
/* harmony export (immutable) */ __webpack_exports__["b"] = setupDeepLinker;
/* unused harmony export normalizeUrl */
/* unused harmony export getNavFromTree */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__nav_util__ = __webpack_require__(26);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__url_serializer__ = __webpack_require__(52);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__view_controller__ = __webpack_require__(7);
/**
* @hidden
*/
var DeepLinker = (function () {
function DeepLinker(_app, _serializer, _location, _moduleLoader, _baseCfr) {
this._app = _app;
this._serializer = _serializer;
this._location = _location;
this._moduleLoader = _moduleLoader;
this._baseCfr = _baseCfr;
/** @internal */
this._history = [];
}
/**
* @internal
*/
DeepLinker.prototype.init = function () {
var _this = this;
// scenario 1: Initial load of all navs from the initial browser URL
var browserUrl = normalizeUrl(this._location.path());
(void 0) /* console.debug */;
// remember this URL in our internal history stack
this._historyPush(browserUrl);
// listen for browser URL changes
this._location.subscribe(function (locationChg) {
_this._urlChange(normalizeUrl(locationChg.url));
});
};
/**
* The browser's location has been updated somehow.
* @internal
*/
DeepLinker.prototype._urlChange = function (browserUrl) {
var _this = this;
// do nothing if this url is the same as the current one
if (!this._isCurrentUrl(browserUrl)) {
var isGoingBack = true;
if (this._isBackUrl(browserUrl)) {
// scenario 2: user clicked the browser back button
// scenario 4: user changed the browser URL to what was the back url was
// scenario 5: user clicked a link href that was the back url
(void 0) /* console.debug */;
this._historyPop();
}
else {
// scenario 3: user click forward button
// scenario 4: user changed browser URL that wasn't the back url
// scenario 5: user clicked a link href that wasn't the back url
isGoingBack = false;
(void 0) /* console.debug */;
this._historyPush(browserUrl);
}
// get the app's root nav container
var activeNavContainers_1 = this._app.getActiveNavContainers();
if (activeNavContainers_1 && activeNavContainers_1.length) {
if (browserUrl === '/') {
// a url change to the index url
if (Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["l" /* isPresent */])(this._indexAliasUrl)) {
// we already know the indexAliasUrl
// update the url to use the know alias
browserUrl = this._indexAliasUrl;
}
else {
// the url change is to the root but we don't
// already know the url used. So let's just
// reset the root nav to its root page
activeNavContainers_1.forEach(function (navContainer) {
navContainer.goToRoot({
updateUrl: false,
isNavRoot: true
});
});
return;
}
}
// normal url
var segments = this.getCurrentSegments(browserUrl);
segments
.map(function (segment) {
// find the matching nav container
for (var _i = 0, activeNavContainers_2 = activeNavContainers_1; _i < activeNavContainers_2.length; _i++) {
var navContainer = activeNavContainers_2[_i];
var nav = getNavFromTree(navContainer, segment.navId);
if (nav) {
return {
segment: segment,
navContainer: nav
};
}
}
})
.filter(function (pair) { return !!pair; })
.forEach(function (pair) {
_this._loadViewForSegment(pair.navContainer, pair.segment, function () { });
});
}
}
};
DeepLinker.prototype.getCurrentSegments = function (browserUrl) {
if (!browserUrl) {
browserUrl = normalizeUrl(this._location.path());
}
return this._serializer.parse(browserUrl);
};
/**
* Update the deep linker using the NavController's current active view.
* @internal
*/
DeepLinker.prototype.navChange = function (direction) {
if (direction) {
var activeNavContainers = this._app.getActiveNavContainers();
// the only time you'll ever get a TABS here is when loading directly from a URL
// this method will be called again when the TAB is loaded
// so just don't worry about the TABS for now
// if you encounter a TABS, just return
for (var _i = 0, activeNavContainers_3 = activeNavContainers; _i < activeNavContainers_3.length; _i++) {
var activeNavContainer = activeNavContainers_3[_i];
if (Object(__WEBPACK_IMPORTED_MODULE_0__nav_util__["m" /* isTabs */])(activeNavContainer) || activeNavContainer.isTransitioning()) {
return;
}
}
// okay, get the root navs and build the segments up
var segments = [];
var navContainers = this._app.getRootNavs();
for (var _a = 0, navContainers_1 = navContainers; _a < navContainers_1.length; _a++) {
var navContainer = navContainers_1[_a];
var segmentsForNav = this.getSegmentsFromNav(navContainer);
segments = segments.concat(segmentsForNav);
}
segments = segments.filter(function (segment) { return !!segment; });
if (segments.length) {
var browserUrl = this._serializer.serialize(segments);
this._updateLocation(browserUrl, direction);
}
}
};
DeepLinker.prototype.getSegmentsFromNav = function (nav) {
var _this = this;
var segments = [];
if (Object(__WEBPACK_IMPORTED_MODULE_0__nav_util__["k" /* isNav */])(nav)) {
segments.push(this.getSegmentFromNav(nav));
}
else if (Object(__WEBPACK_IMPORTED_MODULE_0__nav_util__["l" /* isTab */])(nav)) {
segments.push(this.getSegmentFromTab(nav));
}
nav.getActiveChildNavs().forEach(function (child) {
segments = segments.concat(_this.getSegmentsFromNav(child));
});
return segments;
};
DeepLinker.prototype.getSegmentFromNav = function (nav, component, data) {
if (!component) {
var viewController = nav.getActive(true);
if (viewController) {
component = viewController.component;
data = viewController.data;
}
}
return this._serializer.serializeComponent(nav, component, data);
};
DeepLinker.prototype.getSegmentFromTab = function (navContainer, component, data) {
if (navContainer && navContainer.parent) {
var tabsNavContainer = navContainer.parent;
var activeChildNavs = tabsNavContainer.getActiveChildNavs();
if (activeChildNavs && activeChildNavs.length) {
var activeChildNav = activeChildNavs[0];
var viewController = activeChildNav.getActive(true);
if (viewController) {
component = viewController.component;
data = viewController.data;
}
return this._serializer.serializeComponent(tabsNavContainer, component, data);
}
}
};
/**
* @internal
*/
DeepLinker.prototype._updateLocation = function (browserUrl, direction) {
if (this._indexAliasUrl === browserUrl) {
browserUrl = '/';
}
if (direction === __WEBPACK_IMPORTED_MODULE_0__nav_util__["a" /* DIRECTION_BACK */] && this._isBackUrl(browserUrl)) {
// this URL is exactly the same as the back URL
// it's safe to use the browser's location.back()
(void 0) /* console.debug */;
this._historyPop();
this._location.back();
}
else if (!this._isCurrentUrl(browserUrl)) {
// probably navigating forward
(void 0) /* console.debug */;
this._historyPush(browserUrl);
this._location.go(browserUrl);
}
};
DeepLinker.prototype.getComponentFromName = function (componentName) {
var link = this._serializer.getLinkFromName(componentName);
if (link) {
// cool, we found the right link for this component name
return this.getNavLinkComponent(link);
}
// umm, idk
return Promise.reject("invalid link: " + componentName);
};
DeepLinker.prototype.getNavLinkComponent = function (link) {
if (link.component) {
// sweet, we're already got a component loaded for this link
return Promise.resolve(link.component);
}
if (link.loadChildren) {
// awesome, looks like we'll lazy load this component
// using loadChildren as the URL to request
return this._moduleLoader.load(link.loadChildren).then(function (response) {
link.component = response.component;
return response.component;
});
}
return Promise.reject("invalid link component: " + link.name);
};
/**
* @internal
*/
DeepLinker.prototype.resolveComponent = function (component) {
var cfr = this._moduleLoader.getComponentFactoryResolver(component);
if (!cfr) {
cfr = this._baseCfr;
}
return cfr.resolveComponentFactory(component);
};
/**
* @internal
*/
DeepLinker.prototype.createUrl = function (navContainer, nameOrComponent, _data, prepareExternalUrl) {
if (prepareExternalUrl === void 0) { prepareExternalUrl = true; }
// create a segment out of just the passed in name
var segment = this._serializer.createSegmentFromName(navContainer, nameOrComponent);
var allSegments = this.getCurrentSegments();
if (segment) {
for (var i = 0; i < allSegments.length; i++) {
if (allSegments[i].navId === navContainer.name || allSegments[i].navId === navContainer.id) {
allSegments[i] = segment;
var url = this._serializer.serialize(allSegments);
return prepareExternalUrl ? this._location.prepareExternalUrl(url) : url;
}
}
}
return '';
};
/**
* Each NavController will call this method when it initializes for
* the first time. This allows each NavController to figure out
* where it lives in the path and load up the correct component.
* @internal
*/
DeepLinker.prototype.getSegmentByNavIdOrName = function (navId, name) {
var browserUrl = normalizeUrl(this._location.path());
var segments = this._serializer.parse(browserUrl);
for (var _i = 0, segments_1 = segments; _i < segments_1.length; _i++) {
var segment = segments_1[_i];
if (segment.navId === navId || segment.navId === name) {
return segment;
}
}
return null;
};
/**
* @internal
*/
DeepLinker.prototype.initViews = function (segment) {
var _this = this;
var link = this._serializer.getLinkFromName(segment.name);
return this.getNavLinkComponent(link).then(function (component) {
segment.component = component;
var view = new __WEBPACK_IMPORTED_MODULE_3__view_controller__["a" /* ViewController */](component, segment.data);
view.id = segment.id;
if (Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["e" /* isArray */])(segment.defaultHistory)) {
return Object(__WEBPACK_IMPORTED_MODULE_0__nav_util__["i" /* convertToViews */])(_this, segment.defaultHistory).then(function (views) {
views.push(view);
return views;
});
}
return [view];
});
};
/**
* @internal
*/
DeepLinker.prototype._isBackUrl = function (browserUrl) {
return (browserUrl === this._history[this._history.length - 2]);
};
/**
* @internal
*/
DeepLinker.prototype._isCurrentUrl = function (browserUrl) {
return (browserUrl === this._history[this._history.length - 1]);
};
/**
* @internal
*/
DeepLinker.prototype._historyPush = function (browserUrl) {
if (!this._isCurrentUrl(browserUrl)) {
this._history.push(browserUrl);
if (this._history.length > 30) {
this._history.shift();
}
}
};
/**
* @internal
*/
DeepLinker.prototype._historyPop = function () {
this._history.pop();
if (!this._history.length) {
this._historyPush(this._location.path());
}
};
/**
* @internal
*/
DeepLinker.prototype._getTabSelector = function (tab) {
if (Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["l" /* isPresent */])(tab.tabUrlPath)) {
return tab.tabUrlPath;
}
if (Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["l" /* isPresent */])(tab.tabTitle)) {
return Object(__WEBPACK_IMPORTED_MODULE_2__url_serializer__["c" /* formatUrlPart */])(tab.tabTitle);
}
return "tab-" + tab.index;
};
/**
* Using the known Path of Segments, walk down all descendents
* from the root NavController and load each NavController according
* to each Segment. This is usually called after a browser URL and
* Path changes and needs to update all NavControllers to match
* the new browser URL. Because the URL is already known, it will
* not update the browser's URL when transitions have completed.
*
* @internal
*/
DeepLinker.prototype._loadViewForSegment = function (navContainer, segment, done) {
if (!segment) {
return done(false, false);
}
if (Object(__WEBPACK_IMPORTED_MODULE_0__nav_util__["m" /* isTabs */])(navContainer) || (Object(__WEBPACK_IMPORTED_MODULE_0__nav_util__["l" /* isTab */])(navContainer) && navContainer.parent)) {
var tabs = (Object(__WEBPACK_IMPORTED_MODULE_0__nav_util__["m" /* isTabs */])(navContainer) ? navContainer : navContainer.parent);
var selectedIndex = tabs._getSelectedTabIndex(segment.secondaryId);
var tab = tabs.getByIndex(selectedIndex);
tab._segment = segment;
tabs.select(tab, {
updateUrl: false,
animate: false
}, true);
return done(false, false);
}
var navController = navContainer;
var numViews = navController.length() - 1;
// walk backwards to see if the exact view we want to show here
// is already in the stack that we can just pop back to
for (var i = numViews; i >= 0; i--) {
var viewController = navController.getByIndex(i);
if (viewController && (viewController.id === segment.id || viewController.id === segment.name)) {
// hooray! we've already got a view loaded in the stack
// matching the view they wanted to show
if (i === numViews) {
// this is the last view in the stack and it's the same
// as the segment so there's no change needed
return done(false, false);
}
else {
// it's not the exact view as the end
// let's have this nav go back to this exact view
return navController.popTo(viewController, {
animate: false,
updateUrl: false,
}, done);
}
}
}
// ok, so we don't know about a view that they're navigating to
// so we might as well just call setRoot and make tthe view the first view
// this seems like the least bad option
return navController.setRoot(segment.component || segment.name, segment.data, {
id: segment.id, animate: false, updateUrl: false
}, done);
};
return DeepLinker;
}());
function setupDeepLinker(app, serializer, location, moduleLoader, cfr) {
var deepLinker = new DeepLinker(app, serializer, location, moduleLoader, cfr);
deepLinker.init();
return deepLinker;
}
function normalizeUrl(browserUrl) {
browserUrl = browserUrl.trim();
if (browserUrl.charAt(0) !== '/') {
// ensure first char is a /
browserUrl = '/' + browserUrl;
}
if (browserUrl.length > 1 && browserUrl.charAt(browserUrl.length - 1) === '/') {
// ensure last char is not a /
browserUrl = browserUrl.substr(0, browserUrl.length - 1);
}
return browserUrl;
}
function getNavFromTree(nav, id) {
while (nav) {
if (nav.id === id || nav.name === id) {
return nav;
}
nav = nav.parent;
}
return null;
}
//# sourceMappingURL=deep-linker.js.map
/***/ }),
/* 20 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Form; });
/* unused harmony export IonicTapInput */
/* unused harmony export IonicFormInput */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util__ = __webpack_require__(3);
/**
* @hidden
*/
var Form = (function () {
function Form() {
this._focused = null;
this._ids = -1;
this._inputs = [];
}
Form.prototype.register = function (input) {
this._inputs.push(input);
};
Form.prototype.deregister = function (input) {
Object(__WEBPACK_IMPORTED_MODULE_1__util__["q" /* removeArrayItem */])(this._inputs, input);
this.unsetAsFocused(input);
};
Form.prototype.setAsFocused = function (input) {
this._focused = input;
};
Form.prototype.unsetAsFocused = function (input) {
if (input === this._focused) {
this._focused = null;
}
};
/**
* Focuses the next input element, if it exists.
*/
Form.prototype.tabFocus = function (currentInput) {
var inputs = this._inputs;
var index = inputs.indexOf(currentInput) + 1;
if (index > 0 && index < inputs.length) {
var nextInput = inputs[index];
if (nextInput !== this._focused) {
(void 0) /* console.debug */;
return nextInput.initFocus();
}
}
index = inputs.indexOf(this._focused);
if (index > 0) {
var previousInput = inputs[index - 1];
if (previousInput) {
(void 0) /* console.debug */;
previousInput.initFocus();
}
}
};
Form.prototype.nextId = function () {
return ++this._ids;
};
Form.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
Form.ctorParameters = function () { return []; };
return Form;
}());
/**
* @hidden
*/
var IonicTapInput = (function () {
function IonicTapInput() {
}
return IonicTapInput;
}());
/**
* @hidden
*/
var IonicFormInput = (function () {
function IonicFormInput() {
}
return IonicFormInput;
}());
//# sourceMappingURL=form.js.map
/***/ }),
/* 21 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Item; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__button_button__ = __webpack_require__(45);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_form__ = __webpack_require__(20);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__icon_icon__ = __webpack_require__(82);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__ion__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__label_label__ = __webpack_require__(83);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__item_reorder__ = __webpack_require__(84);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name Item
* @description
* An item can contain text, images, and anything else. Generally it is placed in a list with other
* items. It can easily be swiped, deleted, reordered, edited, and more. An item is only required to
* be in a [List](../../list/List) if manipulating the item via gestures is required. It requires an
* [ItemSliding](../ItemSliding) wrapper element in order to be swiped.
*
*
* ## Common Usage
* There are a few elements that are considered items, but not all of them are styled to look the same.
* The basic item can be written as an `<ion-item>` element or it can be added to any element by adding
* `ion-item` as an attribute. List headers and item dividers, although styled differently, are also items
* and can be written as `<ion-list-header>` and `<ion-item-divider>`, respectively.
*
* ### As an Element
* A basic item should be written as a `<ion-item>` element when it is not clickable.
*
* ```html
* <ion-item>
* Item
* </ion-item>
* ```
*
* A list header should be written as `<ion-list-header>`.
*
* ```html
* <ion-list-header>
* List Header
* </ion-list-header>
* ```
*
* An item divider should be written as `<ion-item-divider>`.
*
* ```html
* <ion-item-divider>
* Item Divider
* </ion-item-divider>
* ```
*
* ### As an Attribute
* The attribute `ion-item` should be added to a `<button>` when the item can be clicked or tapped. It
* should be added to an `<a>` element when the item needs to contain a `href`. It can be added as an
* attribute to any element to take on the item styling.
*
* ```html
* <button ion-item (click)="buttonClick()">
* Button Item
* </button>
*
* <a ion-item href="https://www.ionicframework.com">
* Anchor Item
* </a>
* ```
*
* Note: do not add `ion-item` as an attribute to an `<ion-list-header>` or `<ion-item-divider>` element
* as they are already items and their styling will be changed to look like a basic item.
*
* ## Detail Arrows
* By default, `<button>` and `<a>` elements with the `ion-item` attribute will display a right arrow icon
* on `ios` mode. To hide the right arrow icon on either of these elements, add the `detail-none` attribute
* to the item. To show the right arrow icon on an element that doesn't display it naturally, add the
* `detail-push` attribute to the item.
*
* ```html
* <ion-item detail-push>
* Item with Detail Arrow
* </ion-item>
*
* <button ion-item (click)="buttonClick()">
* Button Item with Detail Arrow
* </button>
*
* <a ion-item detail-none href="https://www.ionicframework.com">
* Anchor Item with no Detail Arrow
* </a>
* ```
*
* This feature is not enabled by default for `md` and `wp` modes, but it can be enabled by setting the
* Sass variables `$item-md-detail-push-show` and `$item-wp-detail-push-show`, respectively, to `true`.
* It can also be disabled for ios by setting `$item-ios-detail-push-show` to `false`. See the
* [theming documentation](http://ionicframework.com/docs/theming/overriding-ionic-variables/) for
* more information on overriding Sass variables.
*
*
* ## Item Placement
* Items rely heavily on content projection to position content. The item grabs content based on the
* element or attribute and positions it that way. This logic makes it possible to write a complex
* item with simple, understandable markup without having to worry about styling and positioning
* the elements.
*
* The below chart details the attributes item looks for and where it will place the element with
* that attribute inside of the item:
*
* | Attribute | Description |
* |----------------|----------------------------------------------------------------------------------------------------- |
* | `item-start` | Placed to the left of all other elements, outside of the inner item. |
* | `item-end` | Placed to the right of all other elements, inside of the inner item, outside of the input wrapper. |
* | `item-content` | Placed to the right of any `ion-label`, inside of the input wrapper. |
*
* ### Checkboxes, Radios and Toggles
* [Checkboxes](../../checkbox/Checkbox) are positioned in the same place as the `item-start` attribute.
* [Radios](../../radio/RadioButton) and [Toggles](../../toggle/Toggle) are positioned in the same place
* as the `item-end` attribute. All of these components can be positioned differently by adding the
* `item-start` or `item-end` attribute.
*
* ### Content and Inputs
* A [Label](../../label/Label) is placed inside of the item to the left of all content and inputs. The
* following components are all placed in the same position as the `item-content` attribute: [Select](../../select/Select),
* [Input](../../input/Input), [TextArea](../../input/TextArea), [DateTime](../../datetime/DateTime), and
* [Range](../../range/Range).
*
* Any element directly placed inside of an `<ion-item>` that does not have one of the previously mentioned
* attributes and isn't one of the above elements will be placed inside of a [Label](../../label/Label).
*
* ### Text Alignment
* By default, Items will align text to the left and add an ellipsis when the text is wider than the item.
* See the [Utility Attributes Documentation](../../../../theming/css-utilities/) for attributes that can
* be added to `ion-item` to transform the text.
*
* @usage
*
* ```html
* <ion-list>
*
* <ion-list-header>
* Header
* </ion-list-header>
*
* <ion-item>
* Item
* </ion-item>
*
* <ion-item detail-push>
* Item with Detail Arrow
* </ion-item>
*
* <button ion-item (click)="buttonClick()">
* Button Item
* </button>
*
* <ion-item-divider>
* Item Divider
* </ion-item-divider>
*
* <button ion-item detail-none (click)="buttonClick()">
* Button Item with no Detail Arrow
* </button>
*
* <a ion-item href="https://www.ionicframework.com">
* Anchor Item
* </a>
*
* <ion-item no-lines>
* Item with no border
* </ion-item>
*
* <ion-item text-wrap>
* Multiline text that should wrap when it is too long
* to fit on one line in the item.
* </ion-item>
*
* </ion-list>
* ```
*
*
* @advanced
*
* ```html
* <ion-list>
*
* <!-- List header with buttons on each side -->
* <ion-list-header>
* <button ion-button item-start (click)="buttonClick()">Button</button>
* List Header
* <button ion-button outline item-end (click)="buttonClick()">Outline</button>
* </ion-list-header>
*
* <!-- Loops through and creates multiple items -->
* <ion-item *ngFor="let item of items">
* Item {% raw %}{{item}}{% endraw %}
* </ion-item>
*
* <!-- Button item with an icon on the left -->
* <button ion-item>
* <ion-icon name="star" item-start></ion-icon>
* Button Item
* </button>
*
* <!-- Item with a label and content -->
* <ion-item>
* <ion-label>
* Item Label
* </ion-label>
* <div item-content>
* Item Content next to the label
* </div>
* </ion-item>
*
* <!-- Item with left and right buttons -->
* <ion-item>
* <button ion-button item-start (click)="buttonClick()">Button</button>
* Item
* <button ion-button outline item-end (click)="buttonClick()">Outline</button>
* </ion-item>
*
* <!-- Item divider with a right button -->
* <ion-item-divider>
* Item Divider
* <button ion-button item-end>Button</button>
* </ion-item-divider>
*
* <!-- Disabled button item with left and right buttons -->
* <button ion-item disabled>
* <button ion-button item-start (click)="buttonClick()">
* <ion-icon name="home"></ion-icon>
* Left Icon
* </button>
* Disabled Button Item
* <button ion-button outline item-end (click)="buttonClick()">
* <ion-icon name="star"></ion-icon>
* Left Icon
* </button>
* </button>
*
* <!-- Item with an avatar on the left and button on the right -->
* <ion-item>
* <ion-avatar item-start>
* <img src="img/my-avatar.png">
* </ion-avatar>
* Avatar Item
* <button ion-button outline item-end>View</button>
* </ion-item>
*
* <!-- Item with a thumbnail on the right -->
* <ion-item>
* <h2>Item</h2>
* <p>Item Paragraph</p>
* <ion-thumbnail item-end>
* <img src="img/my-thumbnail.png">
* </ion-thumbnail>
* </ion-item>
*
* <!-- Sliding item -->
* <ion-item-sliding>
* <ion-item>
* Item
* </ion-item>
* <ion-item-options>
* <button ion-button color="primary" (click)="archive()">Archive</button>
* </ion-item-options>
* </ion-item-sliding>
*
* </ion-list>
* ```
*
*
* @demo /docs/demos/src/item/
* @see {@link /docs/components#lists List Component Docs}
* @see {@link ../../list/List List API Docs}
* @see {@link ../ItemSliding ItemSliding API Docs}
*/
var Item = (function (_super) {
__extends(Item, _super);
function Item(form, config, elementRef, renderer, reorder) {
var _this = _super.call(this, config, elementRef, renderer, 'item') || this;
_this._ids = -1;
_this._inputs = [];
_this._viewLabel = true;
_this._name = 'item';
/**
* @hidden
*/
_this.labelId = null;
_this._setName(elementRef);
_this._hasReorder = !!reorder;
_this.id = form.nextId().toString();
_this.labelId = 'lbl-' + _this.id;
// auto add "tappable" attribute to ion-item components that have a click listener
if (!renderer.orgListen) {
renderer.orgListen = renderer.listen;
renderer.listen = function (renderElement, name, callback) {
if (name === 'click' && renderElement.setAttribute) {
renderElement.setAttribute('tappable', '');
}
return renderer.orgListen(renderElement, name, callback);
};
}
return _this;
}
/**
* @hidden
*/
Item.prototype.registerInput = function (type) {
this._inputs.push(type);
return this.id + '-' + (++this._ids);
};
/**
* @hidden
*/
Item.prototype.ngAfterContentInit = function () {
if (this._viewLabel && this._inputs.length) {
var labelText = this.getLabelText().trim();
this._viewLabel = (labelText.length > 0);
}
if (this._inputs.length > 1) {
this.setElementClass('item-multiple-inputs', true);
}
};
/**
* @hidden
*/
Item.prototype._updateColor = function (newColor, componentName) {
componentName = componentName || 'item'; // item-radio
this._setColor(newColor, componentName);
};
/**
* @hidden
*/
Item.prototype._setName = function (elementRef) {
var nodeName = elementRef.nativeElement.nodeName.replace('ION-', '');
if (nodeName === 'LIST-HEADER' || nodeName === 'ITEM-DIVIDER') {
this._name = nodeName;
}
};
/**
* @hidden
*/
Item.prototype.getLabelText = function () {
return this._label ? this._label.text : '';
};
Object.defineProperty(Item.prototype, "contentLabel", {
/**
* @hidden
*/
set: function (label) {
if (label) {
this._label = label;
label.id = this.labelId;
if (label.type) {
this.setElementClass('item-label-' + label.type, true);
}
this._viewLabel = false;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(Item.prototype, "viewLabel", {
/**
* @hidden
*/
set: function (label) {
if (!this._label) {
this._label = label;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(Item.prototype, "_buttons", {
/**
* @hidden
*/
set: function (buttons) {
buttons.forEach(function (button) {
if (!button._size) {
button.setElementClass('item-button', true);
}
});
},
enumerable: true,
configurable: true
});
Object.defineProperty(Item.prototype, "_icons", {
/**
* @hidden
*/
set: function (icons) {
icons.forEach(function (icon) {
icon.setElementClass('item-icon', true);
});
},
enumerable: true,
configurable: true
});
Item.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-list-header,ion-item,[ion-item],ion-item-divider',
template: '<ng-content select="[item-start],[item-left],ion-checkbox:not([item-end]):not([item-right])"></ng-content>' +
'<div class="item-inner">' +
'<div class="input-wrapper">' +
'<ng-content select="ion-label"></ng-content>' +
'<ion-label *ngIf="_viewLabel">' +
'<ng-content></ng-content>' +
'</ion-label>' +
'<ng-content select="ion-select,ion-input,ion-textarea,ion-datetime,ion-range,[item-content]"></ng-content>' +
'</div>' +
'<ng-content select="[item-end],[item-right],ion-radio,ion-toggle"></ng-content>' +
'<ion-reorder *ngIf="_hasReorder"></ion-reorder>' +
'</div>' +
'<div class="button-effect"></div>',
host: {
'class': 'item'
},
changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* ChangeDetectionStrategy */].OnPush,
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
},] },
];
/** @nocollapse */
Item.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_3__util_form__["a" /* Form */], },
{ type: __WEBPACK_IMPORTED_MODULE_2__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_7__item_reorder__["a" /* ItemReorder */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
]; };
Item.propDecorators = {
'contentLabel': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* ContentChild */], args: [__WEBPACK_IMPORTED_MODULE_6__label_label__["a" /* Label */],] },],
'viewLabel': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_8" /* ViewChild */], args: [__WEBPACK_IMPORTED_MODULE_6__label_label__["a" /* Label */],] },],
'_buttons': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["r" /* ContentChildren */], args: [__WEBPACK_IMPORTED_MODULE_1__button_button__["a" /* Button */],] },],
'_icons': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["r" /* ContentChildren */], args: [__WEBPACK_IMPORTED_MODULE_4__icon_icon__["a" /* Icon */],] },],
};
return Item;
}(__WEBPACK_IMPORTED_MODULE_5__ion__["a" /* Ion */]));
//# sourceMappingURL=item.js.map
/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var color = __webpack_require__(182);
var helpers = __webpack_require__(5);
function interpolate(start, view, model, ease) {
var keys = Object.keys(model);
var i, ilen, key, actual, origin, target, type, c0, c1;
for (i = 0, ilen = keys.length; i < ilen; ++i) {
key = keys[i];
target = model[key];
// if a value is added to the model after pivot() has been called, the view
// doesn't contain it, so let's initialize the view to the target value.
if (!view.hasOwnProperty(key)) {
view[key] = target;
}
actual = view[key];
if (actual === target || key[0] === '_') {
continue;
}
if (!start.hasOwnProperty(key)) {
start[key] = actual;
}
origin = start[key];
type = typeof target;
if (type === typeof origin) {
if (type === 'string') {
c0 = color(origin);
if (c0.valid) {
c1 = color(target);
if (c1.valid) {
view[key] = c1.mix(c0, ease).rgbString();
continue;
}
}
} else if (type === 'number' && isFinite(origin) && isFinite(target)) {
view[key] = origin + (target - origin) * ease;
continue;
}
}
view[key] = target;
}
}
var Element = function(configuration) {
helpers.extend(this, configuration);
this.initialize.apply(this, arguments);
};
helpers.extend(Element.prototype, {
initialize: function() {
this.hidden = false;
},
pivot: function() {
var me = this;
if (!me._view) {
me._view = helpers.clone(me._model);
}
me._start = {};
return me;
},
transition: function(ease) {
var me = this;
var model = me._model;
var start = me._start;
var view = me._view;
// No animation -> No Transition
if (!model || ease === 1) {
me._view = model;
me._start = null;
return me;
}
if (!view) {
view = me._view = {};
}
if (!start) {
start = me._start = {};
}
interpolate(start, view, model, ease);
return me;
},
tooltipPosition: function() {
return {
x: this._model.x,
y: this._model.y
};
},
hasValue: function() {
return helpers.isNumber(this._model.x) && helpers.isNumber(this._model.y);
}
});
Element.extend = helpers.inherits;
module.exports = Element;
/***/ }),
/* 23 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return KEY_LEFT; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return KEY_UP; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return KEY_RIGHT; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return KEY_DOWN; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return KEY_ENTER; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return KEY_ESCAPE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return KEY_SPACE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return KEY_TAB; });
var KEY_LEFT = 37;
var KEY_UP = 38;
var KEY_RIGHT = 39;
var KEY_DOWN = 40;
var KEY_ENTER = 13;
var KEY_ESCAPE = 27;
var KEY_SPACE = 32;
var KEY_TAB = 9;
//# sourceMappingURL=key.js.map
/***/ }),
/* 24 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export EventEmitterProxy */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Content; });
/* unused harmony export updateImgs */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__app_app__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__platform_dom_controller__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__ion__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__navigation_nav_util__ = __webpack_require__(26);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__platform_keyboard__ = __webpack_require__(46);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__navigation_nav_controller__ = __webpack_require__(27);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__platform_platform__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__util_scroll_view__ = __webpack_require__(148);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__navigation_view_controller__ = __webpack_require__(7);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var EventEmitterProxy = (function (_super) {
__extends(EventEmitterProxy, _super);
function EventEmitterProxy() {
return _super !== null && _super.apply(this, arguments) || this;
}
EventEmitterProxy.prototype.subscribe = function (generatorOrNext, error, complete) {
this.onSubscribe();
return _super.prototype.subscribe.call(this, generatorOrNext, error, complete);
};
return EventEmitterProxy;
}(__WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]));
/**
* @name Content
* @description
* The Content component provides an easy to use content area with
* some useful methods to control the scrollable area. There should
* only be one content in a single view component. If additional scrollable
* elements are needed, use [ionScroll](../../scroll/Scroll).
*
*
* The content area can also implement pull-to-refresh with the
* [Refresher](../../refresher/Refresher) component.
*
* @usage
* ```html
* <ion-content>
* Add your content here!
* </ion-content>
* ```
*
* To get a reference to the content component from a Page's logic,
* you can use Angular's `@ViewChild` annotation:
*
* ```ts
* import { Component, ViewChild } from '@angular/core';
* import { Content } from 'ionic-angular';
*
* @Component({...})
* export class MyPage{
* @ViewChild(Content) content: Content;
*
* scrollToTop() {
* this.content.scrollToTop();
* }
* }
* ```
*
* @advanced
*
* ### Scroll Events
*
* Scroll events happen outside of Angular's Zones. This is for performance reasons. So
* if you're trying to bind a value to any scroll event, it will need to be wrapped in
* a `zone.run()`
*
* ```ts
* import { Component, NgZone } from '@angular/core';
* @Component({
* template: `
* <ion-header>
* <ion-navbar>
* <ion-title>{{scrollAmount}}</ion-title>
* </ion-navbar>
* </ion-header>
* <ion-content (ionScroll)="scrollHandler($event)">
* <p> Some realllllllly long content </p>
* </ion-content>
* `})
* class E2EPage {
* public scrollAmount = 0;
* constructor( public zone: NgZone){}
* scrollHandler(event) {
* console.log(`ScrollEvent: ${event}`)
* this.zone.run(()=>{
* // since scrollAmount is data-binded,
* // the update needs to happen in zone
* this.scrollAmount++
* })
* }
* }
* ```
*
* This goes for any scroll event, not just `ionScroll`.
*
* ### Resizing the content
*
* If the height of `ion-header`, `ion-footer` or `ion-tabbar`
* changes dynamically, `content.resize()` has to be called in order to update the
* layout of `Content`.
*
*
* ```ts
* @Component({
* template: `
* <ion-header>
* <ion-navbar>
* <ion-title>Main Navbar</ion-title>
* </ion-navbar>
* <ion-toolbar *ngIf="showToolbar">
* <ion-title>Dynamic Toolbar</ion-title>
* </ion-toolbar>
* </ion-header>
* <ion-content>
* <button ion-button (click)="toggleToolbar()">Toggle Toolbar</button>
* </ion-content>
* `})
*
* class E2EPage {
* @ViewChild(Content) content: Content;
* showToolbar: boolean = false;
*
* toggleToolbar() {
* this.showToolbar = !this.showToolbar;
* this.content.resize();
* }
* }
* ```
*
*
* Scroll to a specific position
*
* ```ts
* import { Component, ViewChild } from '@angular/core';
* import { Content } from 'ionic-angular';
*
* @Component({
* template: `<ion-content>
* <button ion-button (click)="scrollTo()">Down 500px</button>
* </ion-content>`
* )}
* export class MyPage{
* @ViewChild(Content) content: Content;
*
* scrollTo() {
* // set the scrollLeft to 0px, and scrollTop to 500px
* // the scroll duration should take 200ms
* this.content.scrollTo(0, 500, 200);
* }
* }
* ```
*
*/
var Content = (function (_super) {
__extends(Content, _super);
function Content(config, _plt, _dom, elementRef, renderer, _app, _keyboard, _zone, viewCtrl, navCtrl) {
var _this = _super.call(this, config, elementRef, renderer, 'content') || this;
_this._plt = _plt;
_this._dom = _dom;
_this._app = _app;
_this._keyboard = _keyboard;
_this._zone = _zone;
/** @internal */
_this._scrollPadding = 0;
/** @internal */
_this._inputPolling = false;
/** @internal */
_this._hasRefresher = false;
/** @internal */
_this._imgs = [];
/** @internal */
_this._scrollDownOnLoad = false;
/**
* @output {ScrollEvent} Emitted when the scrolling first starts.
*/
_this.ionScrollStart = new EventEmitterProxy();
/**
* @output {ScrollEvent} Emitted on every scroll event.
*/
_this.ionScroll = new EventEmitterProxy();
/**
* @output {ScrollEvent} Emitted when scrolling ends.
*/
_this.ionScrollEnd = new EventEmitterProxy();
var enableScrollListener = function () { return _this._scroll.enableEvents(); };
_this.ionScroll.onSubscribe = enableScrollListener;
_this.ionScrollStart.onSubscribe = enableScrollListener;
_this.ionScrollEnd.onSubscribe = enableScrollListener;
_this.statusbarPadding = config.getBoolean('statusbarPadding', false);
_this._imgReqBfr = config.getNumber('imgRequestBuffer', 1400);
_this._imgRndBfr = config.getNumber('imgRenderBuffer', 400);
_this._imgVelMax = config.getNumber('imgVelocityMax', 3);
_this._scroll = new __WEBPACK_IMPORTED_MODULE_10__util_scroll_view__["a" /* ScrollView */](_app, _plt, _dom);
while (navCtrl) {
if (Object(__WEBPACK_IMPORTED_MODULE_5__navigation_nav_util__["m" /* isTabs */])(navCtrl)) {
_this._tabs = navCtrl;
break;
}
navCtrl = navCtrl.parent;
}
if (viewCtrl) {
_this._viewCtrl = viewCtrl;
// content has a view controller
viewCtrl._setIONContent(_this);
viewCtrl._setIONContentRef(elementRef);
_this._viewCtrlReadSub = viewCtrl.readReady.subscribe(function () {
_this._viewCtrlReadSub.unsubscribe();
_this._readDimensions();
});
_this._viewCtrlWriteSub = viewCtrl.writeReady.subscribe(function () {
_this._viewCtrlWriteSub.unsubscribe();
_this._writeDimensions();
});
}
else {
// content does not have a view controller
_dom.read(_this._readDimensions.bind(_this));
_dom.write(_this._writeDimensions.bind(_this));
}
return _this;
}
Object.defineProperty(Content.prototype, "contentHeight", {
/**
* Content height of the viewable area. This does not include content
* which is outside the overflow area, or content area which is under
* headers and footers. Read-only.
*
* @return {number}
*/
get: function () {
return this._scroll.ev.contentHeight;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Content.prototype, "contentWidth", {
/**
* Content width including content which is not visible on the screen
* due to overflow. Read-only.
*
* @return {number}
*/
get: function () {
return this._scroll.ev.contentWidth;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Content.prototype, "scrollHeight", {
/**
* Content height including content which is not visible on the screen
* due to overflow. Read-only.
*
* @return {number}
*/
get: function () {
return this._scroll.ev.scrollHeight;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Content.prototype, "scrollWidth", {
/**
* Content width including content which is not visible due to
* overflow. Read-only.
*
* @return {number}
*/
get: function () {
return this._scroll.ev.scrollWidth;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Content.prototype, "scrollTop", {
/**
* The distance of the content's top to its topmost visible content.
*
* @return {number}
*/
get: function () {
return this._scroll.ev.scrollTop;
},
/**
* @param {number} top
*/
set: function (top) {
this._scroll.setTop(top);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Content.prototype, "scrollLeft", {
/**
* The distance of the content's left to its leftmost visible content.
*
* @return {number}
*/
get: function () {
return this._scroll.ev.scrollLeft;
},
/**
* @param {number} top
*/
set: function (top) {
this._scroll.setLeft(top);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Content.prototype, "isScrolling", {
/**
* If the content is actively scrolling or not.
*
* @return {boolean}
*/
get: function () {
return this._scroll.isScrolling;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Content.prototype, "directionY", {
/**
* The current, or last known, vertical scroll direction. Possible
* string values include `down` and `up`.
*
* @return {string}
*/
get: function () {
return this._scroll.ev.directionY;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Content.prototype, "directionX", {
/**
* The current, or last known, horizontal scroll direction. Possible
* string values include `right` and `left`.
*
* @return {string}
*/
get: function () {
return this._scroll.ev.directionX;
},
enumerable: true,
configurable: true
});
/**
* @hidden
*/
Content.prototype.ngAfterViewInit = function () {
var _this = this;
(void 0) /* assert */;
(void 0) /* assert */;
var scroll = this._scroll;
scroll.ev.fixedElement = this.getFixedElement();
scroll.ev.scrollElement = this.getScrollElement();
// subscribe to the scroll start
scroll.onScrollStart = function (ev) {
_this.ionScrollStart.emit(ev);
};
// subscribe to every scroll move
scroll.onScroll = function (ev) {
// emit to all of our other friends things be scrolling
_this.ionScroll.emit(ev);
_this.imgsUpdate();
};
// subscribe to the scroll end
scroll.onScrollEnd = function (ev) {
_this.ionScrollEnd.emit(ev);
_this.imgsUpdate();
};
};
/**
* @hidden
*/
Content.prototype.enableJsScroll = function () {
this._scroll.enableJsScroll(this._cTop, this._cBottom);
};
/**
* @hidden
*/
Content.prototype.ngOnDestroy = function () {
this._scLsn && this._scLsn();
this._viewCtrlReadSub && this._viewCtrlReadSub.unsubscribe();
this._viewCtrlWriteSub && this._viewCtrlWriteSub.unsubscribe();
this._viewCtrlReadSub = this._viewCtrlWriteSub = null;
this._scroll && this._scroll.destroy();
this._footerEle = this._scLsn = this._scroll = null;
};
/**
* @hidden
*/
Content.prototype.getScrollElement = function () {
return this._scrollContent.nativeElement;
};
/**
* @private
*/
Content.prototype.getFixedElement = function () {
return this._fixedContent.nativeElement;
};
/**
* @hidden
*/
Content.prototype.onScrollElementTransitionEnd = function (callback) {
this._plt.transitionEnd(this.getScrollElement(), callback);
};
/**
* Scroll to the specified position.
*
* @param {number} x The x-value to scroll to.
* @param {number} y The y-value to scroll to.
* @param {number} [duration] Duration of the scroll animation in milliseconds. Defaults to `300`.
* @returns {Promise} Returns a promise which is resolved when the scroll has completed.
*/
Content.prototype.scrollTo = function (x, y, duration, done) {
if (duration === void 0) { duration = 300; }
(void 0) /* console.debug */;
return this._scroll.scrollTo(x, y, duration, done);
};
/**
* Scroll to the top of the content component.
*
* @param {number} [duration] Duration of the scroll animation in milliseconds. Defaults to `300`.
* @returns {Promise} Returns a promise which is resolved when the scroll has completed.
*/
Content.prototype.scrollToTop = function (duration) {
if (duration === void 0) { duration = 300; }
(void 0) /* console.debug */;
return this._scroll.scrollToTop(duration);
};
/**
* Scroll to the bottom of the content component.
*
* @param {number} [duration] Duration of the scroll animation in milliseconds. Defaults to `300`.
* @returns {Promise} Returns a promise which is resolved when the scroll has completed.
*/
Content.prototype.scrollToBottom = function (duration) {
if (duration === void 0) { duration = 300; }
(void 0) /* console.debug */;
return this._scroll.scrollToBottom(duration);
};
Object.defineProperty(Content.prototype, "fullscreen", {
/**
* @input {boolean} If true, the content will scroll behind the headers
* and footers. This effect can easily be seen by setting the toolbar
* to transparent.
*/
get: function () {
return this._fullscreen;
},
set: function (val) {
this._fullscreen = Object(__WEBPACK_IMPORTED_MODULE_6__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Content.prototype, "scrollDownOnLoad", {
/**
* @input {boolean} If true, the content will scroll down on load.
*/
get: function () {
return this._scrollDownOnLoad;
},
set: function (val) {
this._scrollDownOnLoad = Object(__WEBPACK_IMPORTED_MODULE_6__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
/**
* @private
*/
Content.prototype.addImg = function (img) {
this._imgs.push(img);
};
/**
* @hidden
*/
Content.prototype.removeImg = function (img) {
Object(__WEBPACK_IMPORTED_MODULE_6__util_util__["q" /* removeArrayItem */])(this._imgs, img);
};
/**
* @hidden
* DOM WRITE
*/
Content.prototype.setScrollElementStyle = function (prop, val) {
var scrollEle = this.getScrollElement();
if (scrollEle) {
this._dom.write(function () {
scrollEle.style[prop] = val;
});
}
};
/**
* Returns the content and scroll elements' dimensions.
* @returns {object} dimensions The content and scroll elements' dimensions
* {number} dimensions.contentHeight content offsetHeight
* {number} dimensions.contentTop content offsetTop
* {number} dimensions.contentBottom content offsetTop+offsetHeight
* {number} dimensions.contentWidth content offsetWidth
* {number} dimensions.contentLeft content offsetLeft
* {number} dimensions.contentRight content offsetLeft + offsetWidth
* {number} dimensions.scrollHeight scroll scrollHeight
* {number} dimensions.scrollTop scroll scrollTop
* {number} dimensions.scrollBottom scroll scrollTop + scrollHeight
* {number} dimensions.scrollWidth scroll scrollWidth
* {number} dimensions.scrollLeft scroll scrollLeft
* {number} dimensions.scrollRight scroll scrollLeft + scrollWidth
*/
Content.prototype.getContentDimensions = function () {
var scrollEle = this.getScrollElement();
var parentElement = scrollEle.parentElement;
return {
contentHeight: parentElement.offsetHeight - this._cTop - this._cBottom,
contentTop: this._cTop,
contentBottom: this._cBottom,
contentWidth: parentElement.offsetWidth,
contentLeft: parentElement.offsetLeft,
scrollHeight: scrollEle.scrollHeight,
scrollTop: scrollEle.scrollTop,
scrollWidth: scrollEle.scrollWidth,
scrollLeft: scrollEle.scrollLeft,
};
};
/**
* @hidden
* DOM WRITE
* Adds padding to the bottom of the scroll element when the keyboard is open
* so content below the keyboard can be scrolled into view.
*/
Content.prototype.addScrollPadding = function (newPadding) {
(void 0) /* assert */;
if (newPadding === 0) {
this._inputPolling = false;
this._scrollPadding = -1;
}
if (newPadding > this._scrollPadding) {
(void 0) /* console.debug */;
this._scrollPadding = newPadding;
var scrollEle = this.getScrollElement();
if (scrollEle) {
this._dom.write(function () {
scrollEle.style.paddingBottom = (newPadding > 0) ? newPadding + 'px' : '';
});
}
}
};
/**
* @hidden
* DOM WRITE
*/
Content.prototype.clearScrollPaddingFocusOut = function () {
var _this = this;
if (!this._inputPolling) {
(void 0) /* console.debug */;
this._inputPolling = true;
this._keyboard.onClose(function () {
(void 0) /* console.debug */;
_this.addScrollPadding(0);
}, 200, 3000);
}
};
/**
* Tell the content to recalculate its dimensions. This should be called
* after dynamically adding/removing headers, footers, or tabs.
*/
Content.prototype.resize = function () {
this._dom.read(this._readDimensions.bind(this));
this._dom.write(this._writeDimensions.bind(this));
};
/**
* @hidden
* DOM READ
*/
Content.prototype._readDimensions = function () {
var cachePaddingTop = this._pTop;
var cachePaddingRight = this._pRight;
var cachePaddingBottom = this._pBottom;
var cachePaddingLeft = this._pLeft;
var cacheHeaderHeight = this._hdrHeight;
var cacheFooterHeight = this._ftrHeight;
var cacheTabsPlacement = this._tabsPlacement;
var tabsTop = 0;
var scrollEvent;
this._pTop = 0;
this._pRight = 0;
this._pBottom = 0;
this._pLeft = 0;
this._hdrHeight = 0;
this._ftrHeight = 0;
this._tabsPlacement = null;
this._tTop = 0;
this._fTop = 0;
this._fBottom = 0;
// In certain cases this._scroll is undefined
// if that is the case then we should just return
if (!this._scroll) {
return;
}
scrollEvent = this._scroll.ev;
var ele = this.getNativeElement();
if (!ele) {
(void 0) /* assert */;
return;
}
var computedStyle;
var tagName;
var parentEle = ele.parentElement;
var children = parentEle.children;
for (var i = children.length - 1; i >= 0; i--) {
ele = children[i];
tagName = ele.tagName;
if (tagName === 'ION-CONTENT') {
scrollEvent.contentElement = ele;
if (this._fullscreen) {
// ******** DOM READ ****************
computedStyle = getComputedStyle(ele);
this._pTop = parsePxUnit(computedStyle.paddingTop);
this._pBottom = parsePxUnit(computedStyle.paddingBottom);
this._pRight = parsePxUnit(computedStyle.paddingRight);
this._pLeft = parsePxUnit(computedStyle.paddingLeft);
}
}
else if (tagName === 'ION-HEADER') {
scrollEvent.headerElement = ele;
// ******** DOM READ ****************
this._hdrHeight = ele.clientHeight;
}
else if (tagName === 'ION-FOOTER') {
scrollEvent.footerElement = ele;
// ******** DOM READ ****************
this._ftrHeight = ele.clientHeight;
this._footerEle = ele;
}
}
ele = parentEle;
var tabbarEle;
while (ele && ele.tagName !== 'ION-MODAL' && !ele.classList.contains('tab-subpage')) {
if (ele.tagName === 'ION-TABS') {
tabbarEle = ele.firstElementChild;
// ******** DOM READ ****************
this._tabbarHeight = tabbarEle.clientHeight;
if (this._tabsPlacement === null) {
// this is the first tabbar found, remember it's position
this._tabsPlacement = ele.getAttribute('tabsplacement');
}
}
ele = ele.parentElement;
}
// Tabs top
if (this._tabs && this._tabsPlacement === 'top') {
this._tTop = this._hdrHeight;
tabsTop = this._tabs._top;
}
// Toolbar height
this._cTop = this._hdrHeight;
this._cBottom = this._ftrHeight;
// Tabs height
if (this._tabsPlacement === 'top') {
this._cTop += this._tabbarHeight;
}
else if (this._tabsPlacement === 'bottom') {
this._cBottom += this._tabbarHeight;
}
// Refresher uses a border which should be hidden unless pulled
if (this._hasRefresher) {
this._cTop -= 1;
}
// Fixed content shouldn't include content padding
this._fTop = this._cTop;
this._fBottom = this._cBottom;
// Handle fullscreen viewport (padding vs margin)
if (this._fullscreen) {
this._cTop += this._pTop;
this._cBottom += this._pBottom;
}
// ******** DOM READ ****************
var contentDimensions = this.getContentDimensions();
scrollEvent.scrollHeight = contentDimensions.scrollHeight;
scrollEvent.scrollWidth = contentDimensions.scrollWidth;
scrollEvent.contentHeight = contentDimensions.contentHeight;
scrollEvent.contentWidth = contentDimensions.contentWidth;
scrollEvent.contentTop = contentDimensions.contentTop;
scrollEvent.contentBottom = contentDimensions.contentBottom;
this._dirty = (cachePaddingTop !== this._pTop ||
cachePaddingBottom !== this._pBottom ||
cachePaddingLeft !== this._pLeft ||
cachePaddingRight !== this._pRight ||
cacheHeaderHeight !== this._hdrHeight ||
cacheFooterHeight !== this._ftrHeight ||
cacheTabsPlacement !== this._tabsPlacement ||
tabsTop !== this._tTop ||
this._cTop !== this.contentTop ||
this._cBottom !== this.contentBottom);
this._scroll.init(this.getScrollElement(), this._cTop, this._cBottom);
// initial imgs refresh
this.imgsUpdate();
};
/**
* @hidden
* DOM WRITE
*/
Content.prototype._writeDimensions = function () {
if (!this._dirty) {
(void 0) /* console.debug */;
return;
}
var scrollEle = this.getScrollElement();
if (!scrollEle) {
(void 0) /* assert */;
return;
}
var fixedEle = this.getFixedElement();
if (!fixedEle) {
(void 0) /* assert */;
return;
}
// Tabs height
if (this._tabsPlacement === 'bottom' && this._cBottom > 0 && this._footerEle) {
var footerPos = this._cBottom - this._ftrHeight;
(void 0) /* assert */;
// ******** DOM WRITE ****************
this._footerEle.style.bottom = cssFormat(footerPos);
}
// Handle fullscreen viewport (padding vs margin)
var topProperty = 'marginTop';
var bottomProperty = 'marginBottom';
var fixedTop = this._fTop;
var fixedBottom = this._fBottom;
if (this._fullscreen) {
(void 0) /* assert */;
(void 0) /* assert */;
// adjust the content with padding, allowing content to scroll under headers/footers
// however, on iOS you cannot control the margins of the scrollbar (last tested iOS9.2)
// only add inline padding styles if the computed padding value, which would
// have come from the app's css, is different than the new padding value
topProperty = 'paddingTop';
bottomProperty = 'paddingBottom';
}
// Only update top margin if value changed
if (this._cTop !== this.contentTop) {
(void 0) /* assert */;
(void 0) /* assert */;
// ******** DOM WRITE ****************
scrollEle.style[topProperty] = cssFormat(this._cTop);
// ******** DOM WRITE ****************
fixedEle.style.marginTop = cssFormat(fixedTop);
this.contentTop = this._cTop;
}
// Only update bottom margin if value changed
if (this._cBottom !== this.contentBottom) {
(void 0) /* assert */;
(void 0) /* assert */;
// ******** DOM WRITE ****************
scrollEle.style[bottomProperty] = cssFormat(this._cBottom);
// ******** DOM WRITE ****************
fixedEle.style.marginBottom = cssFormat(fixedBottom);
this.contentBottom = this._cBottom;
}
if (this._tabsPlacement !== null && this._tabs) {
// set the position of the tabbar
if (this._tabsPlacement === 'top') {
// ******** DOM WRITE ****************
this._tabs.setTabbarPosition(this._tTop, -1);
}
else {
(void 0) /* assert */;
// ******** DOM WRITE ****************
this._tabs.setTabbarPosition(-1, 0);
}
}
// Scroll the page all the way down after setting dimensions
if (this._scrollDownOnLoad) {
this.scrollToBottom(0);
this._scrollDownOnLoad = false;
}
};
/**
* @hidden
*/
Content.prototype.imgsUpdate = function () {
if (this._scroll.initialized && this._imgs.length && this.isImgsUpdatable()) {
updateImgs(this._imgs, this.scrollTop, this.contentHeight, this.directionY, this._imgReqBfr, this._imgRndBfr);
}
};
/**
* @hidden
*/
Content.prototype.isImgsUpdatable = function () {
// an image is only "updatable" if the content isn't scrolling too fast
// if scroll speed is above the maximum velocity, then let current
// requests finish, but do not start new requets or render anything
// if scroll speed is below the maximum velocity, then it's ok
// to start new requests and render images
return Math.abs(this._scroll.ev.velocityY) < this._imgVelMax;
};
Content.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-content',
template: '<div class="fixed-content" #fixedContent>' +
'<ng-content select="[ion-fixed],ion-fab"></ng-content>' +
'</div>' +
'<div class="scroll-content" #scrollContent>' +
'<ng-content></ng-content>' +
'</div>' +
'<ng-content select="ion-refresher"></ng-content>',
host: {
'[class.statusbar-padding]': 'statusbarPadding',
'[class.has-refresher]': '_hasRefresher'
},
changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* ChangeDetectionStrategy */].OnPush,
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None
},] },
];
/** @nocollapse */
Content.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_2__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_9__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_3__platform_dom_controller__["a" /* DomController */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__app_app__["a" /* App */], },
{ type: __WEBPACK_IMPORTED_MODULE_7__platform_keyboard__["a" /* Keyboard */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["M" /* NgZone */], },
{ type: __WEBPACK_IMPORTED_MODULE_11__navigation_view_controller__["a" /* ViewController */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_8__navigation_nav_controller__["a" /* NavController */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
]; };
Content.propDecorators = {
'_fixedContent': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_8" /* ViewChild */], args: ['fixedContent', { read: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */] },] },],
'_scrollContent': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_8" /* ViewChild */], args: ['scrollContent', { read: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */] },] },],
'ionScrollStart': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'ionScroll': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'ionScrollEnd': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'fullscreen': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'scrollDownOnLoad': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
};
return Content;
}(__WEBPACK_IMPORTED_MODULE_4__ion__["a" /* Ion */]));
function updateImgs(imgs, viewableTop, contentHeight, scrollDirectionY, requestableBuffer, renderableBuffer) {
// ok, so it's time to see which images, if any, should be requested and rendered
// ultimately, if we're scrolling fast then don't bother requesting or rendering
// when scrolling is done, then it needs to do a check to see which images are
// important to request and render, and which image requests should be aborted.
// Additionally, images which are not near the viewable area should not be
// rendered at all in order to save browser resources.
var viewableBottom = (viewableTop + contentHeight);
var priority1 = [];
var priority2 = [];
var img;
// all images should be paused
for (var i = 0, ilen = imgs.length; i < ilen; i++) {
img = imgs[i];
if (scrollDirectionY === 'up') {
// scrolling up
if (img.top < viewableBottom && img.bottom > viewableTop - renderableBuffer) {
// scrolling up, img is within viewable area
// or about to be viewable area
img.canRequest = img.canRender = true;
priority1.push(img);
continue;
}
if (img.bottom <= viewableTop && img.bottom > viewableTop - requestableBuffer) {
// scrolling up, img is within requestable area
img.canRequest = true;
img.canRender = false;
priority2.push(img);
continue;
}
if (img.top >= viewableBottom && img.top < viewableBottom + renderableBuffer) {
// scrolling up, img below viewable area
// but it's still within renderable area
// don't allow a reset
img.canRequest = img.canRender = false;
continue;
}
}
else {
// scrolling down
if (img.bottom > viewableTop && img.top < viewableBottom + renderableBuffer) {
// scrolling down, img is within viewable area
// or about to be viewable area
img.canRequest = img.canRender = true;
priority1.push(img);
continue;
}
if (img.top >= viewableBottom && img.top < viewableBottom + requestableBuffer) {
// scrolling down, img is within requestable area
img.canRequest = true;
img.canRender = false;
priority2.push(img);
continue;
}
if (img.bottom <= viewableTop && img.bottom > viewableTop - renderableBuffer) {
// scrolling down, img above viewable area
// but it's still within renderable area
// don't allow a reset
img.canRequest = img.canRender = false;
continue;
}
}
img.canRequest = img.canRender = false;
img.reset();
}
// update all imgs which are viewable
priority1.sort(sortTopToBottom).forEach(function (i) { return i.update(); });
if (scrollDirectionY === 'up') {
// scrolling up
priority2.sort(sortTopToBottom).reverse().forEach(function (i) { return i.update(); });
}
else {
// scrolling down
priority2.sort(sortTopToBottom).forEach(function (i) { return i.update(); });
}
}
function sortTopToBottom(a, b) {
if (a.top < b.top) {
return -1;
}
if (a.top > b.top) {
return 1;
}
return 0;
}
function parsePxUnit(val) {
return (val.indexOf('px') > 0) ? parseInt(val, 10) : 0;
}
function cssFormat(val) {
return (val > 0 ? val + 'px' : '');
}
//# sourceMappingURL=content.js.map
/***/ }),
/* 25 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var isFunction_1 = __webpack_require__(69);
var Subscription_1 = __webpack_require__(39);
var Observer_1 = __webpack_require__(125);
var rxSubscriber_1 = __webpack_require__(72);
/**
* Implements the {@link Observer} interface and extends the
* {@link Subscription} class. While the {@link Observer} is the public API for
* consuming the values of an {@link Observable}, all Observers get converted to
* a Subscriber, in order to provide Subscription-like capabilities such as
* `unsubscribe`. Subscriber is a common type in RxJS, and crucial for
* implementing operators, but it is rarely used as a public API.
*
* @class Subscriber<T>
*/
var Subscriber = (function (_super) {
__extends(Subscriber, _super);
/**
* @param {Observer|function(value: T): void} [destinationOrNext] A partially
* defined Observer or a `next` callback function.
* @param {function(e: ?any): void} [error] The `error` callback of an
* Observer.
* @param {function(): void} [complete] The `complete` callback of an
* Observer.
*/
function Subscriber(destinationOrNext, error, complete) {
_super.call(this);
this.syncErrorValue = null;
this.syncErrorThrown = false;
this.syncErrorThrowable = false;
this.isStopped = false;
switch (arguments.length) {
case 0:
this.destination = Observer_1.empty;
break;
case 1:
if (!destinationOrNext) {
this.destination = Observer_1.empty;
break;
}
if (typeof destinationOrNext === 'object') {
if (destinationOrNext instanceof Subscriber) {
this.destination = destinationOrNext;
this.destination.add(this);
}
else {
this.syncErrorThrowable = true;
this.destination = new SafeSubscriber(this, destinationOrNext);
}
break;
}
default:
this.syncErrorThrowable = true;
this.destination = new SafeSubscriber(this, destinationOrNext, error, complete);
break;
}
}
Subscriber.prototype[rxSubscriber_1.rxSubscriber] = function () { return this; };
/**
* A static factory for a Subscriber, given a (potentially partial) definition
* of an Observer.
* @param {function(x: ?T): void} [next] The `next` callback of an Observer.
* @param {function(e: ?any): void} [error] The `error` callback of an
* Observer.
* @param {function(): void} [complete] The `complete` callback of an
* Observer.
* @return {Subscriber<T>} A Subscriber wrapping the (partially defined)
* Observer represented by the given arguments.
*/
Subscriber.create = function (next, error, complete) {
var subscriber = new Subscriber(next, error, complete);
subscriber.syncErrorThrowable = false;
return subscriber;
};
/**
* The {@link Observer} callback to receive notifications of type `next` from
* the Observable, with a value. The Observable may call this method 0 or more
* times.
* @param {T} [value] The `next` value.
* @return {void}
*/
Subscriber.prototype.next = function (value) {
if (!this.isStopped) {
this._next(value);
}
};
/**
* The {@link Observer} callback to receive notifications of type `error` from
* the Observable, with an attached {@link Error}. Notifies the Observer that
* the Observable has experienced an error condition.
* @param {any} [err] The `error` exception.
* @return {void}
*/
Subscriber.prototype.error = function (err) {
if (!this.isStopped) {
this.isStopped = true;
this._error(err);
}
};
/**
* The {@link Observer} callback to receive a valueless notification of type
* `complete` from the Observable. Notifies the Observer that the Observable
* has finished sending push-based notifications.
* @return {void}
*/
Subscriber.prototype.complete = function () {
if (!this.isStopped) {
this.isStopped = true;
this._complete();
}
};
Subscriber.prototype.unsubscribe = function () {
if (this.closed) {
return;
}
this.isStopped = true;
_super.prototype.unsubscribe.call(this);
};
Subscriber.prototype._next = function (value) {
this.destination.next(value);
};
Subscriber.prototype._error = function (err) {
this.destination.error(err);
this.unsubscribe();
};
Subscriber.prototype._complete = function () {
this.destination.complete();
this.unsubscribe();
};
Subscriber.prototype._unsubscribeAndRecycle = function () {
var _a = this, _parent = _a._parent, _parents = _a._parents;
this._parent = null;
this._parents = null;
this.unsubscribe();
this.closed = false;
this.isStopped = false;
this._parent = _parent;
this._parents = _parents;
return this;
};
return Subscriber;
}(Subscription_1.Subscription));
exports.Subscriber = Subscriber;
/**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
var SafeSubscriber = (function (_super) {
__extends(SafeSubscriber, _super);
function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) {
_super.call(this);
this._parentSubscriber = _parentSubscriber;
var next;
var context = this;
if (isFunction_1.isFunction(observerOrNext)) {
next = observerOrNext;
}
else if (observerOrNext) {
next = observerOrNext.next;
error = observerOrNext.error;
complete = observerOrNext.complete;
if (observerOrNext !== Observer_1.empty) {
context = Object.create(observerOrNext);
if (isFunction_1.isFunction(context.unsubscribe)) {
this.add(context.unsubscribe.bind(context));
}
context.unsubscribe = this.unsubscribe.bind(this);
}
}
this._context = context;
this._next = next;
this._error = error;
this._complete = complete;
}
SafeSubscriber.prototype.next = function (value) {
if (!this.isStopped && this._next) {
var _parentSubscriber = this._parentSubscriber;
if (!_parentSubscriber.syncErrorThrowable) {
this.__tryOrUnsub(this._next, value);
}
else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) {
this.unsubscribe();
}
}
};
SafeSubscriber.prototype.error = function (err) {
if (!this.isStopped) {
var _parentSubscriber = this._parentSubscriber;
if (this._error) {
if (!_parentSubscriber.syncErrorThrowable) {
this.__tryOrUnsub(this._error, err);
this.unsubscribe();
}
else {
this.__tryOrSetError(_parentSubscriber, this._error, err);
this.unsubscribe();
}
}
else if (!_parentSubscriber.syncErrorThrowable) {
this.unsubscribe();
throw err;
}
else {
_parentSubscriber.syncErrorValue = err;
_parentSubscriber.syncErrorThrown = true;
this.unsubscribe();
}
}
};
SafeSubscriber.prototype.complete = function () {
var _this = this;
if (!this.isStopped) {
var _parentSubscriber = this._parentSubscriber;
if (this._complete) {
var wrappedComplete = function () { return _this._complete.call(_this._context); };
if (!_parentSubscriber.syncErrorThrowable) {
this.__tryOrUnsub(wrappedComplete);
this.unsubscribe();
}
else {
this.__tryOrSetError(_parentSubscriber, wrappedComplete);
this.unsubscribe();
}
}
else {
this.unsubscribe();
}
}
};
SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) {
try {
fn.call(this._context, value);
}
catch (err) {
this.unsubscribe();
throw err;
}
};
SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) {
try {
fn.call(this._context, value);
}
catch (err) {
parent.syncErrorValue = err;
parent.syncErrorThrown = true;
return true;
}
return false;
};
SafeSubscriber.prototype._unsubscribe = function () {
var _parentSubscriber = this._parentSubscriber;
this._context = null;
this._parentSubscriber = null;
_parentSubscriber.unsubscribe();
};
return SafeSubscriber;
}(Subscriber));
//# sourceMappingURL=Subscriber.js.map
/***/ }),
/* 26 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (immutable) */ __webpack_exports__["j"] = getComponent;
/* unused harmony export convertToView */
/* harmony export (immutable) */ __webpack_exports__["i"] = convertToViews;
/* harmony export (immutable) */ __webpack_exports__["n"] = setZIndex;
/* harmony export (immutable) */ __webpack_exports__["m"] = isTabs;
/* harmony export (immutable) */ __webpack_exports__["l"] = isTab;
/* harmony export (immutable) */ __webpack_exports__["k"] = isNav;
/* unused harmony export linkToSegment */
/* unused harmony export DeepLinkMetadata */
/* unused harmony export DeepLinkMetadataFactory */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return STATE_NEW; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return STATE_INITIALIZED; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return STATE_ATTACHED; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return STATE_DESTROYED; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return INIT_ZINDEX; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DIRECTION_BACK; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return DIRECTION_FORWARD; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return DIRECTION_SWITCH; });
/* unused harmony export NAV */
/* unused harmony export TABS */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__view_controller__ = __webpack_require__(7);
function getComponent(linker, nameOrPageOrView, params) {
if (typeof nameOrPageOrView === 'function') {
return Promise.resolve(new __WEBPACK_IMPORTED_MODULE_1__view_controller__["a" /* ViewController */](nameOrPageOrView, params));
}
if (typeof nameOrPageOrView === 'string') {
return linker.getComponentFromName(nameOrPageOrView).then(function (component) {
var vc = new __WEBPACK_IMPORTED_MODULE_1__view_controller__["a" /* ViewController */](component, params);
vc.id = nameOrPageOrView;
return vc;
});
}
return Promise.resolve(null);
}
function convertToView(linker, nameOrPageOrView, params) {
if (nameOrPageOrView) {
if (Object(__WEBPACK_IMPORTED_MODULE_1__view_controller__["b" /* isViewController */])(nameOrPageOrView)) {
// is already a ViewController
return Promise.resolve(nameOrPageOrView);
}
return getComponent(linker, nameOrPageOrView, params);
}
return Promise.resolve(null);
}
function convertToViews(linker, pages) {
var views = [];
if (Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["e" /* isArray */])(pages)) {
for (var i = 0; i < pages.length; i++) {
var page = pages[i];
if (page) {
if (Object(__WEBPACK_IMPORTED_MODULE_1__view_controller__["b" /* isViewController */])(page)) {
views.push(page);
}
else if (page.page) {
views.push(convertToView(linker, page.page, page.params));
}
else {
views.push(convertToView(linker, page, null));
}
}
}
}
return Promise.all(views);
}
var portalZindex = 9999;
function setZIndex(nav, enteringView, leavingView, direction, renderer) {
if (enteringView) {
if (nav._isPortal) {
if (direction === DIRECTION_FORWARD) {
enteringView._setZIndex(nav._zIndexOffset + portalZindex, renderer);
}
portalZindex++;
return;
}
leavingView = leavingView || nav.getPrevious(enteringView);
if (leavingView && Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["l" /* isPresent */])(leavingView._zIndex)) {
if (direction === DIRECTION_BACK) {
enteringView._setZIndex(leavingView._zIndex - 1, renderer);
}
else {
enteringView._setZIndex(leavingView._zIndex + 1, renderer);
}
}
else {
enteringView._setZIndex(INIT_ZINDEX + nav._zIndexOffset, renderer);
}
}
}
function isTabs(nav) {
// Tabs (ion-tabs)
return !!nav && !!nav.getSelected;
}
function isTab(nav) {
// Tab (ion-tab)
return !!nav && Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["l" /* isPresent */])(nav._tabId);
}
function isNav(nav) {
// Nav (ion-nav), Tab (ion-tab), Portal (ion-portal)
return !!nav && !!nav.push && nav.getType() === 'nav';
}
function linkToSegment(navId, type, secondaryId, link) {
var segment = Object.assign({}, link);
segment.navId = navId;
segment.type = type;
segment.secondaryId = secondaryId;
return segment;
}
/**
* @hidden
*/
var DeepLinkMetadata = (function () {
function DeepLinkMetadata() {
}
return DeepLinkMetadata;
}());
/**
* @hidden
*/
var DeepLinkMetadataFactory;
var STATE_NEW = 1;
var STATE_INITIALIZED = 2;
var STATE_ATTACHED = 3;
var STATE_DESTROYED = 4;
var INIT_ZINDEX = 100;
var DIRECTION_BACK = 'back';
var DIRECTION_FORWARD = 'forward';
var DIRECTION_SWITCH = 'switch';
var NAV = 'nav';
var TABS = 'tabs';
//# sourceMappingURL=nav-util.js.map
/***/ }),
/* 27 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NavController; });
/**
* @name NavController
* @description
*
* NavController is the base class for navigation controller components like
* [`Nav`](../../components/nav/Nav/) and [`Tab`](../../components/tabs/Tab/). You use navigation controllers
* to navigate to [pages](#view-creation) in your app. At a basic level, a
* navigation controller is an array of pages representing a particular history
* (of a Tab for example). This array can be manipulated to navigate throughout
* an app by pushing and popping pages or inserting and removing them at
* arbitrary locations in history.
*
* The current page is the last one in the array, or the top of the stack if we
* think of it that way. [Pushing](#push) a new page onto the top of the
* navigation stack causes the new page to be animated in, while [popping](#pop)
* the current page will navigate to the previous page in the stack.
*
* Unless you are using a directive like [NavPush](../../components/nav/NavPush/), or need a
* specific NavController, most times you will inject and use a reference to the
* nearest NavController to manipulate the navigation stack.
*
* ## Basic usage
* The simplest way to navigate through an app is to create and initialize a new
* nav controller using the `<ion-nav>` component. `ion-nav` extends the `NavController`
* class.
*
* ```typescript
* import { Component } from `@angular/core`;
* import { StartPage } from './start-page';
*
* @Component(
* template: `<ion-nav [root]="rootPage"></ion-nav>`
* })
* class MyApp {
* // set the rootPage to the first page we want displayed
* public rootPage: any = StartPage;
*
* constructor(){
* }
* }
*
* ```
*
* ### Injecting NavController
* Injecting NavController will always get you an instance of the nearest
* NavController, regardless of whether it is a Tab or a Nav.
*
* Behind the scenes, when Ionic instantiates a new NavController, it creates an
* injector with NavController bound to that instance (usually either a Nav or
* Tab) and adds the injector to its own providers. For more information on
* providers and dependency injection, see [Dependency Injection](https://angular.io/docs/ts/latest/guide/dependency-injection.html).
*
* Instead, you can inject NavController and know that it is the correct
* navigation controller for most situations (for more advanced situations, see
* [Menu](../../menu/Menu/) and [Tab](../../tab/Tab/)).
*
* ```ts
* import { NavController } from 'ionic-angular';
*
* class MyComponent {
* constructor(public navCtrl: NavController) {
*
* }
* }
* ```
*
* ### Navigating from the Root component
* What if you want to control navigation from your root app component?
* You can't inject `NavController` because any components that are navigation
* controllers are _children_ of the root component so they aren't available
* to be injected.
*
* By adding a reference variable to the `ion-nav`, you can use `@ViewChild` to
* get an instance of the `Nav` component, which is a navigation controller
* (it extends `NavController`):
*
* ```typescript
*
* import { Component, ViewChild } from '@angular/core';
* import { NavController } from 'ionic-angular';
*
* @Component({
* template: '<ion-nav #myNav [root]="rootPage"></ion-nav>'
* })
* export class MyApp {
* @ViewChild('myNav') nav: NavController
* public rootPage: any = TabsPage;
*
* // Wait for the components in MyApp's template to be initialized
* // In this case, we are waiting for the Nav with reference variable of "#myNav"
* ngOnInit() {
* // Let's navigate from TabsPage to Page1
* this.nav.push(Page1);
* }
* }
* ```
*
* ### Navigating from an Overlay Component
* What if you wanted to navigate from an overlay component (popover, modal, alert, etc)?
* In this example, we've displayed a popover in our app. From the popover, we'll get a
* reference of the root `NavController` in our app, using the `getRootNav()` method.
*
*
* ```typescript
* import { Component } from '@angular/core';
* import { App, ViewController } from 'ionic-angular';
*
* @Component({
* template: `
* <ion-content>
* <h1>My PopoverPage</h1>
* <button ion-button (click)="pushPage()">Call pushPage</button>
* </ion-content>
* `
* })
* class PopoverPage {
* constructor(
* public viewCtrl: ViewController
* public appCtrl: App
* ) {}
*
* pushPage() {
* this.viewCtrl.dismiss();
* this.appCtrl.getRootNav().push(SecondPage);
* }
* }
*```
*
*
* ## View creation
* Views are created when they are added to the navigation stack. For methods
* like [push()](#push), the NavController takes any component class that is
* decorated with `@Component` as its first argument. The NavController then
* compiles that component, adds it to the app and animates it into view.
*
* By default, pages are cached and left in the DOM if they are navigated away
* from but still in the navigation stack (the exiting page on a `push()` for
* example). They are destroyed when removed from the navigation stack (on
* [pop()](#pop) or [setRoot()](#setRoot)).
*
* ## Pushing a View
* To push a new view onto the navigation stack, use the `push` method.
* If the page has an [`<ion-navbar>`](../../navbar/Navbar/),
* a back button will automatically be added to the pushed view.
*
* Data can also be passed to a view by passing an object to the `push` method.
* The pushed view can then receive the data by accessing it via the `NavParams`
* class.
*
* ```typescript
* import { Component } from '@angular/core';
* import { NavController } from 'ionic-angular';
* import { OtherPage } from './other-page';
* @Component({
* template: `
* <ion-header>
* <ion-navbar>
* <ion-title>Login</ion-title>
* </ion-navbar>
* </ion-header>
*
* <ion-content>
* <button ion-button (click)="pushPage()">
* Go to OtherPage
* </button>
* </ion-content>
* `
* })
* export class StartPage {
* constructor(public navCtrl: NavController) {
* }
*
* pushPage(){
* // push another page onto the navigation stack
* // causing the nav controller to transition to the new page
* // optional data can also be passed to the pushed page.
* this.navCtrl.push(OtherPage, {
* id: "123",
* name: "Carl"
* });
* }
* }
*
* import { NavParams } from 'ionic-angular';
*
* @Component({
* template: `
* <ion-header>
* <ion-navbar>
* <ion-title>Other Page</ion-title>
* </ion-navbar>
* </ion-header>
* <ion-content>I'm the other page!</ion-content>`
* })
* class OtherPage {
* constructor(private navParams: NavParams) {
* let id = navParams.get('id');
* let name = navParams.get('name');
* }
* }
* ```
*
* ## Removing a view
* To remove a view from the stack, use the `pop` method.
* Popping a view will transition to the previous view.
*
* ```ts
* import { Component } from '@angular/core';
* import { NavController } from 'ionic-angular';
*
* @Component({
* template: `
* <ion-header>
* <ion-navbar>
* <ion-title>Other Page</ion-title>
* </ion-navbar>
* </ion-header>
* <ion-content>I'm the other page!</ion-content>`
* })
* class OtherPage {
* constructor(public navCtrl: NavController ){
* }
*
* popView(){
* this.navCtrl.pop();
* }
* }
* ```
*
* ## Lifecycle events
* Lifecycle events are fired during various stages of navigation. They can be
* defined in any component type which is pushed/popped from a `NavController`.
*
* ```ts
* import { Component } from '@angular/core';
*
* @Component({
* template: 'Hello World'
* })
* class HelloWorld {
* ionViewDidLoad() {
* console.log("I'm alive!");
* }
* ionViewWillLeave() {
* console.log("Looks like I'm about to leave :(");
* }
* }
* ```
*
* | Page Event | Returns | Description |
* |---------------------|-----------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
* | `ionViewDidLoad` | void | Runs when the page has loaded. This event only happens once per page being created. If a page leaves but is cached, then this event will not fire again on a subsequent viewing. The `ionViewDidLoad` event is good place to put your setup code for the page. |
* | `ionViewWillEnter` | void | Runs when the page is about to enter and become the active page. |
* | `ionViewDidEnter` | void | Runs when the page has fully entered and is now the active page. This event will fire, whether it was the first load or a cached page. |
* | `ionViewWillLeave` | void | Runs when the page is about to leave and no longer be the active page. |
* | `ionViewDidLeave` | void | Runs when the page has finished leaving and is no longer the active page. |
* | `ionViewWillUnload` | void | Runs when the page is about to be destroyed and have its elements removed. |
* | `ionViewCanEnter` | boolean/Promise<void> | Runs before the view can enter. This can be used as a sort of "guard" in authenticated views where you need to check permissions before the view can enter |
* | `ionViewCanLeave` | boolean/Promise<void> | Runs before the view can leave. This can be used as a sort of "guard" in authenticated views where you need to check permissions before the view can leave |
*
*
* ## Nav Guards
*
* In some cases, a developer should be able to control views leaving and entering. To allow for this, NavController has the `ionViewCanEnter` and `ionViewCanLeave` methods.
* Similar to Angular route guards, but are more integrated with NavController. For example, if you wanted to prevent a user from leaving a view:
*
* ```ts
* export class MyClass{
* constructor(
* public navCtrl: NavController
* ){}
*
* pushPage(){
* this.navCtrl.push(DetailPage);
* }
*
* ionViewCanLeave(): boolean{
* // here we can either return true or false
* // depending on if we want to leave this view
* if(isValid(randomValue)){
* return true;
* } else {
* return false;
* }
* }
* }
* ```
*
* We need to make sure that our `navCtrl.push` has a catch in order to catch the and handle the error.
* If you need to prevent a view from entering, you can do the same thing
*
* ```ts
* export class MyClass{
* constructor(
* public navCtrl: NavController
* ){}
*
* pushPage(){
* this.navCtrl.push(DetailPage);
* }
*
* }
*
* export class DetailPage(){
* constructor(
* public navCtrl: NavController
* ){}
* ionViewCanEnter(): boolean{
* // here we can either return true or false
* // depending on if we want to enter this view
* if(isValid(randomValue)){
* return true;
* } else {
* return false;
* }
* }
* }
* ```
*
* Similar to `ionViewCanLeave` we still need a catch on the original `navCtrl.push` in order to handle it properly.
* When handling the back button in the `ion-navbar`, the catch is already taken care of for you by the framework.
*
* ## NavOptions
*
* Some methods on `NavController` allow for customizing the current transition.
* To do this, we can pass an object with the modified properites.
*
*
* | Property | Value | Description |
* |-----------|-----------|------------------------------------------------------------------------------------------------------------|
* | animate | `boolean` | Whether or not the transition should animate. |
* | animation | `string` | What kind of animation should be used. |
* | direction | `string` | The conceptual direction the user is navigating. For example, is the user navigating `forward`, or `back`? |
* | duration | `number` | The length in milliseconds the animation should take. |
* | easing | `string` | The easing for the animation. |
*
* The property 'animation' understands the following values: `md-transition`, `ios-transition` and `wp-transition`.
*
* @see {@link /docs/components#navigation Navigation Component Docs}
*/
var NavController = (function () {
function NavController() {
}
return NavController;
}());
//# sourceMappingURL=nav-controller.js.map
/***/ }),
/* 28 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return UIEventManager; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__pointer_events__ = __webpack_require__(137);
/**
* @hidden
*/
var UIEventManager = (function () {
function UIEventManager(plt) {
this.plt = plt;
this.evts = [];
}
UIEventManager.prototype.pointerEvents = function (config) {
if (!config.element || !config.pointerDown) {
console.error('PointerEvents config is invalid');
return;
}
var eventListnerOpts = {
capture: config.capture,
passive: config.passive,
zone: config.zone
};
var pointerEvents = new __WEBPACK_IMPORTED_MODULE_0__pointer_events__["b" /* PointerEvents */](this.plt, config.element, config.pointerDown, config.pointerMove, config.pointerUp, eventListnerOpts);
var removeFunc = function () { return pointerEvents.destroy(); };
this.evts.push(removeFunc);
return pointerEvents;
};
UIEventManager.prototype.listen = function (ele, eventName, callback, opts) {
if (ele) {
var removeFunc = this.plt.registerListener(ele, eventName, callback, opts);
this.evts.push(removeFunc);
return removeFunc;
}
};
UIEventManager.prototype.unlistenAll = function () {
this.evts.forEach(function (unRegEvent) {
unRegEvent();
});
this.evts.length = 0;
};
UIEventManager.prototype.destroy = function () {
this.unlistenAll();
this.evts = null;
};
return UIEventManager;
}());
//# sourceMappingURL=ui-event-manager.js.map
/***/ }),
/* 29 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BaseInput; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__components_ion__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__debouncer__ = __webpack_require__(147);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var BaseInput = (function (_super) {
__extends(BaseInput, _super);
function BaseInput(config, elementRef, renderer, name, _defaultValue, _form, _item, _ngControl) {
var _this = _super.call(this, config, elementRef, renderer, name) || this;
_this._defaultValue = _defaultValue;
_this._form = _form;
_this._item = _item;
_this._ngControl = _ngControl;
_this._isFocus = false;
_this._disabled = false;
_this._debouncer = new __WEBPACK_IMPORTED_MODULE_3__debouncer__["a" /* TimeoutDebouncer */](0);
_this._init = false;
_this._initModel = false;
/**
* @output {Range} Emitted when the range selector drag starts.
*/
_this.ionFocus = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* @output {Range} Emitted when the range value changes.
*/
_this.ionChange = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* @output {Range} Emitted when the range selector drag ends.
*/
_this.ionBlur = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
_form && _form.register(_this);
_this._value = Object(__WEBPACK_IMPORTED_MODULE_1__util__["b" /* deepCopy */])(_this._defaultValue);
if (_item) {
(void 0) /* assert */;
_this.id = name + '-' + _item.registerInput(name);
_this._labelId = _item.labelId;
_this._item.setElementClass('item-' + name, true);
}
// If the user passed a ngControl we need to set the valueAccessor
if (_ngControl) {
_ngControl.valueAccessor = _this;
}
return _this;
}
Object.defineProperty(BaseInput.prototype, "disabled", {
/**
* @input {boolean} If true, the user cannot interact with this element.
*/
get: function () {
return this._disabled;
},
set: function (val) {
this.setDisabledState(val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(BaseInput.prototype, "value", {
get: function () {
return this._value;
},
set: function (val) {
if (this._writeValue(val)) {
this.onChange();
this._fireIonChange();
}
},
enumerable: true,
configurable: true
});
// 1. Updates the value
// 2. Calls _inputUpdated()
// 3. Dispatch onChange events
BaseInput.prototype.setValue = function (val) {
this.value = val;
};
/**
* @hidden
*/
BaseInput.prototype.setDisabledState = function (isDisabled) {
this._disabled = isDisabled = Object(__WEBPACK_IMPORTED_MODULE_1__util__["o" /* isTrueProperty */])(isDisabled);
this._item && this._item.setElementClass("item-" + this._componentName + "-disabled", isDisabled);
};
/**
* @hidden
*/
BaseInput.prototype.writeValue = function (val) {
if (this._writeValue(val)) {
if (this._initModel) {
this._fireIonChange();
}
else if (this._init) {
// ngModel fires the first time too late, we need to skip the first ngModel update
this._initModel = true;
}
}
};
/**
* @hidden
*/
BaseInput.prototype._writeValue = function (val) {
(void 0) /* assert */;
if (Object(__WEBPACK_IMPORTED_MODULE_1__util__["p" /* isUndefined */])(val)) {
return false;
}
var normalized = (val === null)
? Object(__WEBPACK_IMPORTED_MODULE_1__util__["b" /* deepCopy */])(this._defaultValue)
: this._inputNormalize(val);
var notUpdate = Object(__WEBPACK_IMPORTED_MODULE_1__util__["p" /* isUndefined */])(normalized) || !this._inputShouldChange(normalized);
if (notUpdate) {
return false;
}
(void 0) /* console.debug */;
this._value = normalized;
if (this._init) {
this._inputUpdated();
}
return true;
};
/**
* @hidden
*/
BaseInput.prototype._fireIonChange = function () {
var _this = this;
if (this._init) {
this._debouncer.debounce(function () {
(void 0) /* assert */;
_this.ionChange.emit(_this._inputChangeEvent());
_this._initModel = true;
});
}
};
/**
* @hidden
*/
BaseInput.prototype.registerOnChange = function (fn) {
this._onChanged = fn;
};
/**
* @hidden
*/
BaseInput.prototype.registerOnTouched = function (fn) {
this._onTouched = fn;
};
/**
* @hidden
*/
BaseInput.prototype._initialize = function () {
if (this._init) {
(void 0) /* assert */;
return;
}
this._init = true;
if (Object(__WEBPACK_IMPORTED_MODULE_1__util__["l" /* isPresent */])(this._value)) {
this._inputUpdated();
}
};
/**
* @hidden
*/
BaseInput.prototype._fireFocus = function () {
if (this._isFocus) {
return;
}
(void 0) /* console.debug */;
this._form && this._form.setAsFocused(this);
this._setFocus(true);
this.ionFocus.emit(this);
};
/**
* @hidden
*/
BaseInput.prototype._fireBlur = function () {
if (!this._isFocus) {
return;
}
(void 0) /* console.debug */;
this._form && this._form.unsetAsFocused(this);
this._setFocus(false);
this._fireTouched();
this.ionBlur.emit(this);
};
/**
* @hidden
*/
BaseInput.prototype._fireTouched = function () {
this._onTouched && this._onTouched();
};
/**
* @hidden
*/
BaseInput.prototype._setFocus = function (isFocused) {
(void 0) /* assert */;
(void 0) /* assert */;
(void 0) /* assert */;
this._isFocus = isFocused;
var item = this._item;
if (item) {
item.setElementClass('input-has-focus', isFocused);
item.setElementClass('item-input-has-focus', isFocused);
}
this._inputUpdated();
};
/**
* @hidden
*/
BaseInput.prototype.onChange = function () {
this._onChanged && this._onChanged(this._inputNgModelEvent());
};
/**
* @hidden
*/
BaseInput.prototype.isFocus = function () {
return this._isFocus;
};
/**
* @hidden
*/
BaseInput.prototype.hasValue = function () {
var val = this._value;
if (!Object(__WEBPACK_IMPORTED_MODULE_1__util__["l" /* isPresent */])(val)) {
return false;
}
if (Object(__WEBPACK_IMPORTED_MODULE_1__util__["e" /* isArray */])(val) || Object(__WEBPACK_IMPORTED_MODULE_1__util__["n" /* isString */])(val)) {
return val.length > 0;
}
return true;
};
/**
* @hidden
*/
BaseInput.prototype.focusNext = function () {
this._form && this._form.tabFocus(this);
};
/**
* @hidden
*/
BaseInput.prototype.ngOnDestroy = function () {
(void 0) /* assert */;
var form = this._form;
form && form.deregister(this);
this._init = false;
};
/**
* @hidden
*/
BaseInput.prototype.ngAfterContentInit = function () {
this._initialize();
};
/**
* @hidden
*/
BaseInput.prototype.initFocus = function () {
var ele = this._elementRef.nativeElement.querySelector('button');
ele && ele.focus();
};
/**
* @hidden
*/
BaseInput.prototype._inputNormalize = function (val) {
return val;
};
/**
* @hidden
*/
BaseInput.prototype._inputShouldChange = function (val) {
return this._value !== val;
};
/**
* @hidden
*/
BaseInput.prototype._inputChangeEvent = function () {
return this;
};
/**
* @hidden
*/
BaseInput.prototype._inputNgModelEvent = function () {
return this._value;
};
/**
* @hidden
*/
BaseInput.prototype._inputUpdated = function () {
(void 0) /* assert */;
var item = this._item;
if (item) {
setControlCss(item, this._ngControl);
// TODO remove all uses of input-has-value in v4
var hasValue = this.hasValue();
item.setElementClass('input-has-value', hasValue);
item.setElementClass('item-input-has-value', hasValue);
}
};
BaseInput.propDecorators = {
'ionFocus': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'ionChange': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'ionBlur': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'disabled': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
};
return BaseInput;
}(__WEBPACK_IMPORTED_MODULE_2__components_ion__["a" /* Ion */]));
function setControlCss(element, control) {
if (!control) {
return;
}
element.setElementClass('ng-untouched', control.untouched);
element.setElementClass('ng-touched', control.touched);
element.setElementClass('ng-pristine', control.pristine);
element.setElementClass('ng-dirty', control.dirty);
element.setElementClass('ng-valid', control.valid);
element.setElementClass('ng-invalid', !control.valid);
}
//# sourceMappingURL=base-input.js.map
/***/ }),
/* 30 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = {};
module.exports.Arc = __webpack_require__(428);
module.exports.Line = __webpack_require__(429);
module.exports.Point = __webpack_require__(430);
module.exports.Rectangle = __webpack_require__(431);
/***/ }),
/* 31 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (immutable) */ __webpack_exports__["b"] = __extends;
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __assign; });
/* unused harmony export __rest */
/* unused harmony export __decorate */
/* unused harmony export __param */
/* unused harmony export __metadata */
/* unused harmony export __awaiter */
/* unused harmony export __generator */
/* unused harmony export __exportStar */
/* unused harmony export __values */
/* unused harmony export __read */
/* unused harmony export __spread */
/* unused harmony export __await */
/* unused harmony export __asyncGenerator */
/* unused harmony export __asyncDelegator */
/* unused harmony export __asyncValues */
/* unused harmony export __makeTemplateObject */
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
}
function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
t[p[i]] = s[p[i]];
return t;
}
function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
function __param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
}
function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
function __awaiter(thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [0, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
function __exportStar(m, exports) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
function __values(o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
}
function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
}
function __asyncDelegator(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { if (o[n]) i[n] = function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; }; }
}
function __asyncValues(o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator];
return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator]();
}
function __makeTemplateObject(cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
/***/ }),
/* 32 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {
// CommonJS / Node have global context exposed as "global" variable.
// We don't want to include the whole node.d.ts this this compilation unit so we'll just fake
// the global "global" var for now.
var __window = typeof window !== 'undefined' && window;
var __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&
self instanceof WorkerGlobalScope && self;
var __global = typeof global !== 'undefined' && global;
var _root = __window || __global || __self;
exports.root = _root;
// Workaround Closure Compiler restriction: The body of a goog.module cannot use throw.
// This is needed when used with angular/tsickle which inserts a goog.module statement.
// Wrap in IIFE
(function () {
if (!_root) {
throw new Error('RxJS could not find any global context (window, self, global)');
}
})();
//# sourceMappingURL=root.js.map
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(68)))
/***/ }),
/* 33 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BrowserModule; });
/* unused harmony export platformBrowser */
/* unused harmony export Meta */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return Title; });
/* unused harmony export disableDebugTools */
/* unused harmony export enableDebugTools */
/* unused harmony export BrowserTransferStateModule */
/* unused harmony export TransferState */
/* unused harmony export makeStateKey */
/* unused harmony export By */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return DOCUMENT$1; });
/* unused harmony export EVENT_MANAGER_PLUGINS */
/* unused harmony export EventManager */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return HAMMER_GESTURE_CONFIG; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return HammerGestureConfig; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return DomSanitizer; });
/* unused harmony export VERSION */
/* unused harmony export ɵBROWSER_SANITIZATION_PROVIDERS */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return INTERNAL_BROWSER_PLATFORM_PROVIDERS; });
/* unused harmony export ɵinitDomAdapter */
/* unused harmony export ɵBrowserDomAdapter */
/* unused harmony export ɵBrowserPlatformLocation */
/* unused harmony export ɵTRANSITION_ID */
/* unused harmony export ɵBrowserGetTestability */
/* unused harmony export ɵescapeHtml */
/* unused harmony export ɵELEMENT_PROBE_PROVIDERS */
/* unused harmony export ɵDomAdapter */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return getDOM; });
/* unused harmony export ɵsetRootDomAdapter */
/* unused harmony export ɵDomRendererFactory2 */
/* unused harmony export ɵNAMESPACE_URIS */
/* unused harmony export ɵflattenStyles */
/* unused harmony export ɵshimContentAttribute */
/* unused harmony export ɵshimHostAttribute */
/* unused harmony export ɵDomEventsPlugin */
/* unused harmony export ɵHammerGesturesPlugin */
/* unused harmony export ɵKeyEventsPlugin */
/* unused harmony export ɵDomSharedStylesHost */
/* unused harmony export ɵSharedStylesHost */
/* unused harmony export ɵb */
/* unused harmony export ɵa */
/* unused harmony export ɵi */
/* unused harmony export ɵg */
/* unused harmony export ɵf */
/* unused harmony export ɵc */
/* unused harmony export ɵh */
/* unused harmony export ɵd */
/* unused harmony export ɵe */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_common__ = __webpack_require__(43);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_tslib__ = __webpack_require__(31);
/**
* @license Angular v5.0.3
* (c) 2010-2017 Google, Inc. https://angular.io/
* License: MIT
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var _DOM = /** @type {?} */ ((null));
/**
* @return {?}
*/
function getDOM() {
return _DOM;
}
/**
* @param {?} adapter
* @return {?}
*/
/**
* @param {?} adapter
* @return {?}
*/
function setRootDomAdapter(adapter) {
if (!_DOM) {
_DOM = adapter;
}
}
/**
* Provides DOM operations in an environment-agnostic way.
*
* \@security Tread carefully! Interacting with the DOM directly is dangerous and
* can introduce XSS risks.
* @abstract
*/
var DomAdapter = (function () {
function DomAdapter() {
this.resourceLoaderType = /** @type {?} */ ((null));
}
Object.defineProperty(DomAdapter.prototype, "attrToPropMap", {
/**
* Maps attribute names to their corresponding property names for cases
* where attribute name doesn't match property name.
*/
get: /**
* Maps attribute names to their corresponding property names for cases
* where attribute name doesn't match property name.
* @return {?}
*/
function () { return this._attrToPropMap; },
set: /**
* @param {?} value
* @return {?}
*/
function (value) { this._attrToPropMap = value; },
enumerable: true,
configurable: true
});
return DomAdapter;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Provides DOM operations in any browser environment.
*
* \@security Tread carefully! Interacting with the DOM directly is dangerous and
* can introduce XSS risks.
* @abstract
*/
var GenericBrowserDomAdapter = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(GenericBrowserDomAdapter, _super);
function GenericBrowserDomAdapter() {
var _this = _super.call(this) || this;
_this._animationPrefix = null;
_this._transitionEnd = null;
try {
var /** @type {?} */ element_1 = _this.createElement('div', document);
if (_this.getStyle(element_1, 'animationName') != null) {
_this._animationPrefix = '';
}
else {
var /** @type {?} */ domPrefixes = ['Webkit', 'Moz', 'O', 'ms'];
for (var /** @type {?} */ i = 0; i < domPrefixes.length; i++) {
if (_this.getStyle(element_1, domPrefixes[i] + 'AnimationName') != null) {
_this._animationPrefix = '-' + domPrefixes[i].toLowerCase() + '-';
break;
}
}
}
var /** @type {?} */ transEndEventNames_1 = {
WebkitTransition: 'webkitTransitionEnd',
MozTransition: 'transitionend',
OTransition: 'oTransitionEnd otransitionend',
transition: 'transitionend'
};
Object.keys(transEndEventNames_1).forEach(function (key) {
if (_this.getStyle(element_1, key) != null) {
_this._transitionEnd = transEndEventNames_1[key];
}
});
}
catch (/** @type {?} */ e) {
_this._animationPrefix = null;
_this._transitionEnd = null;
}
return _this;
}
/**
* @param {?} el
* @return {?}
*/
GenericBrowserDomAdapter.prototype.getDistributedNodes = /**
* @param {?} el
* @return {?}
*/
function (el) { return (/** @type {?} */ (el)).getDistributedNodes(); };
/**
* @param {?} el
* @param {?} baseUrl
* @param {?} href
* @return {?}
*/
GenericBrowserDomAdapter.prototype.resolveAndSetHref = /**
* @param {?} el
* @param {?} baseUrl
* @param {?} href
* @return {?}
*/
function (el, baseUrl, href) {
el.href = href == null ? baseUrl : baseUrl + '/../' + href;
};
/**
* @return {?}
*/
GenericBrowserDomAdapter.prototype.supportsDOMEvents = /**
* @return {?}
*/
function () { return true; };
/**
* @return {?}
*/
GenericBrowserDomAdapter.prototype.supportsNativeShadowDOM = /**
* @return {?}
*/
function () {
return typeof (/** @type {?} */ (document.body)).createShadowRoot === 'function';
};
/**
* @return {?}
*/
GenericBrowserDomAdapter.prototype.getAnimationPrefix = /**
* @return {?}
*/
function () { return this._animationPrefix ? this._animationPrefix : ''; };
/**
* @return {?}
*/
GenericBrowserDomAdapter.prototype.getTransitionEnd = /**
* @return {?}
*/
function () { return this._transitionEnd ? this._transitionEnd : ''; };
/**
* @return {?}
*/
GenericBrowserDomAdapter.prototype.supportsAnimation = /**
* @return {?}
*/
function () {
return this._animationPrefix != null && this._transitionEnd != null;
};
return GenericBrowserDomAdapter;
}(DomAdapter));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var _attrToPropMap = {
'class': 'className',
'innerHtml': 'innerHTML',
'readonly': 'readOnly',
'tabindex': 'tabIndex',
};
var DOM_KEY_LOCATION_NUMPAD = 3;
// Map to convert some key or keyIdentifier values to what will be returned by getEventKey
var _keyMap = {
// The following values are here for cross-browser compatibility and to match the W3C standard
// cf http://www.w3.org/TR/DOM-Level-3-Events-key/
'\b': 'Backspace',
'\t': 'Tab',
'\x7F': 'Delete',
'\x1B': 'Escape',
'Del': 'Delete',
'Esc': 'Escape',
'Left': 'ArrowLeft',
'Right': 'ArrowRight',
'Up': 'ArrowUp',
'Down': 'ArrowDown',
'Menu': 'ContextMenu',
'Scroll': 'ScrollLock',
'Win': 'OS'
};
// There is a bug in Chrome for numeric keypad keys:
// https://code.google.com/p/chromium/issues/detail?id=155654
// 1, 2, 3 ... are reported as A, B, C ...
var _chromeNumKeyPadMap = {
'A': '1',
'B': '2',
'C': '3',
'D': '4',
'E': '5',
'F': '6',
'G': '7',
'H': '8',
'I': '9',
'J': '*',
'K': '+',
'M': '-',
'N': '.',
'O': '/',
'\x60': '0',
'\x90': 'NumLock'
};
var nodeContains;
if (__WEBPACK_IMPORTED_MODULE_1__angular_core__["_30" /* ɵglobal */]['Node']) {
nodeContains = __WEBPACK_IMPORTED_MODULE_1__angular_core__["_30" /* ɵglobal */]['Node'].prototype.contains || function (node) {
return !!(this.compareDocumentPosition(node) & 16);
};
}
/**
* A `DomAdapter` powered by full browser DOM APIs.
*
* \@security Tread carefully! Interacting with the DOM directly is dangerous and
* can introduce XSS risks.
*/
var BrowserDomAdapter = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(BrowserDomAdapter, _super);
function BrowserDomAdapter() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @param {?} templateHtml
* @return {?}
*/
BrowserDomAdapter.prototype.parse = /**
* @param {?} templateHtml
* @return {?}
*/
function (templateHtml) { throw new Error('parse not implemented'); };
/**
* @return {?}
*/
BrowserDomAdapter.makeCurrent = /**
* @return {?}
*/
function () { setRootDomAdapter(new BrowserDomAdapter()); };
/**
* @param {?} element
* @param {?} name
* @return {?}
*/
BrowserDomAdapter.prototype.hasProperty = /**
* @param {?} element
* @param {?} name
* @return {?}
*/
function (element, name) { return name in element; };
/**
* @param {?} el
* @param {?} name
* @param {?} value
* @return {?}
*/
BrowserDomAdapter.prototype.setProperty = /**
* @param {?} el
* @param {?} name
* @param {?} value
* @return {?}
*/
function (el, name, value) { (/** @type {?} */ (el))[name] = value; };
/**
* @param {?} el
* @param {?} name
* @return {?}
*/
BrowserDomAdapter.prototype.getProperty = /**
* @param {?} el
* @param {?} name
* @return {?}
*/
function (el, name) { return (/** @type {?} */ (el))[name]; };
/**
* @param {?} el
* @param {?} methodName
* @param {?} args
* @return {?}
*/
BrowserDomAdapter.prototype.invoke = /**
* @param {?} el
* @param {?} methodName
* @param {?} args
* @return {?}
*/
function (el, methodName, args) {
(_a = (/** @type {?} */ (el)))[methodName].apply(_a, args);
var _a;
};
// TODO(tbosch): move this into a separate environment class once we have it
/**
* @param {?} error
* @return {?}
*/
BrowserDomAdapter.prototype.logError = /**
* @param {?} error
* @return {?}
*/
function (error) {
if (window.console) {
if (console.error) {
console.error(error);
}
else {
console.log(error);
}
}
};
/**
* @param {?} error
* @return {?}
*/
BrowserDomAdapter.prototype.log = /**
* @param {?} error
* @return {?}
*/
function (error) {
if (window.console) {
window.console.log && window.console.log(error);
}
};
/**
* @param {?} error
* @return {?}
*/
BrowserDomAdapter.prototype.logGroup = /**
* @param {?} error
* @return {?}
*/
function (error) {
if (window.console) {
window.console.group && window.console.group(error);
}
};
/**
* @return {?}
*/
BrowserDomAdapter.prototype.logGroupEnd = /**
* @return {?}
*/
function () {
if (window.console) {
window.console.groupEnd && window.console.groupEnd();
}
};
Object.defineProperty(BrowserDomAdapter.prototype, "attrToPropMap", {
get: /**
* @return {?}
*/
function () { return _attrToPropMap; },
enumerable: true,
configurable: true
});
/**
* @param {?} nodeA
* @param {?} nodeB
* @return {?}
*/
BrowserDomAdapter.prototype.contains = /**
* @param {?} nodeA
* @param {?} nodeB
* @return {?}
*/
function (nodeA, nodeB) { return nodeContains.call(nodeA, nodeB); };
/**
* @param {?} el
* @param {?} selector
* @return {?}
*/
BrowserDomAdapter.prototype.querySelector = /**
* @param {?} el
* @param {?} selector
* @return {?}
*/
function (el, selector) { return el.querySelector(selector); };
/**
* @param {?} el
* @param {?} selector
* @return {?}
*/
BrowserDomAdapter.prototype.querySelectorAll = /**
* @param {?} el
* @param {?} selector
* @return {?}
*/
function (el, selector) { return el.querySelectorAll(selector); };
/**
* @param {?} el
* @param {?} evt
* @param {?} listener
* @return {?}
*/
BrowserDomAdapter.prototype.on = /**
* @param {?} el
* @param {?} evt
* @param {?} listener
* @return {?}
*/
function (el, evt, listener) { el.addEventListener(evt, listener, false); };
/**
* @param {?} el
* @param {?} evt
* @param {?} listener
* @return {?}
*/
BrowserDomAdapter.prototype.onAndCancel = /**
* @param {?} el
* @param {?} evt
* @param {?} listener
* @return {?}
*/
function (el, evt, listener) {
el.addEventListener(evt, listener, false);
// Needed to follow Dart's subscription semantic, until fix of
// https://code.google.com/p/dart/issues/detail?id=17406
return function () { el.removeEventListener(evt, listener, false); };
};
/**
* @param {?} el
* @param {?} evt
* @return {?}
*/
BrowserDomAdapter.prototype.dispatchEvent = /**
* @param {?} el
* @param {?} evt
* @return {?}
*/
function (el, evt) { el.dispatchEvent(evt); };
/**
* @param {?} eventType
* @return {?}
*/
BrowserDomAdapter.prototype.createMouseEvent = /**
* @param {?} eventType
* @return {?}
*/
function (eventType) {
var /** @type {?} */ evt = this.getDefaultDocument().createEvent('MouseEvent');
evt.initEvent(eventType, true, true);
return evt;
};
/**
* @param {?} eventType
* @return {?}
*/
BrowserDomAdapter.prototype.createEvent = /**
* @param {?} eventType
* @return {?}
*/
function (eventType) {
var /** @type {?} */ evt = this.getDefaultDocument().createEvent('Event');
evt.initEvent(eventType, true, true);
return evt;
};
/**
* @param {?} evt
* @return {?}
*/
BrowserDomAdapter.prototype.preventDefault = /**
* @param {?} evt
* @return {?}
*/
function (evt) {
evt.preventDefault();
evt.returnValue = false;
};
/**
* @param {?} evt
* @return {?}
*/
BrowserDomAdapter.prototype.isPrevented = /**
* @param {?} evt
* @return {?}
*/
function (evt) {
return evt.defaultPrevented || evt.returnValue != null && !evt.returnValue;
};
/**
* @param {?} el
* @return {?}
*/
BrowserDomAdapter.prototype.getInnerHTML = /**
* @param {?} el
* @return {?}
*/
function (el) { return el.innerHTML; };
/**
* @param {?} el
* @return {?}
*/
BrowserDomAdapter.prototype.getTemplateContent = /**
* @param {?} el
* @return {?}
*/
function (el) {
return 'content' in el && this.isTemplateElement(el) ? (/** @type {?} */ (el)).content : null;
};
/**
* @param {?} el
* @return {?}
*/
BrowserDomAdapter.prototype.getOuterHTML = /**
* @param {?} el
* @return {?}
*/
function (el) { return el.outerHTML; };
/**
* @param {?} node
* @return {?}
*/
BrowserDomAdapter.prototype.nodeName = /**
* @param {?} node
* @return {?}
*/
function (node) { return node.nodeName; };
/**
* @param {?} node
* @return {?}
*/
BrowserDomAdapter.prototype.nodeValue = /**
* @param {?} node
* @return {?}
*/
function (node) { return node.nodeValue; };
/**
* @param {?} node
* @return {?}
*/
BrowserDomAdapter.prototype.type = /**
* @param {?} node
* @return {?}
*/
function (node) { return node.type; };
/**
* @param {?} node
* @return {?}
*/
BrowserDomAdapter.prototype.content = /**
* @param {?} node
* @return {?}
*/
function (node) {
if (this.hasProperty(node, 'content')) {
return (/** @type {?} */ (node)).content;
}
else {
return node;
}
};
/**
* @param {?} el
* @return {?}
*/
BrowserDomAdapter.prototype.firstChild = /**
* @param {?} el
* @return {?}
*/
function (el) { return el.firstChild; };
/**
* @param {?} el
* @return {?}
*/
BrowserDomAdapter.prototype.nextSibling = /**
* @param {?} el
* @return {?}
*/
function (el) { return el.nextSibling; };
/**
* @param {?} el
* @return {?}
*/
BrowserDomAdapter.prototype.parentElement = /**
* @param {?} el
* @return {?}
*/
function (el) { return el.parentNode; };
/**
* @param {?} el
* @return {?}
*/
BrowserDomAdapter.prototype.childNodes = /**
* @param {?} el
* @return {?}
*/
function (el) { return el.childNodes; };
/**
* @param {?} el
* @return {?}
*/
BrowserDomAdapter.prototype.childNodesAsList = /**
* @param {?} el
* @return {?}
*/
function (el) {
var /** @type {?} */ childNodes = el.childNodes;
var /** @type {?} */ res = new Array(childNodes.length);
for (var /** @type {?} */ i = 0; i < childNodes.length; i++) {
res[i] = childNodes[i];
}
return res;
};
/**
* @param {?} el
* @return {?}
*/
BrowserDomAdapter.prototype.clearNodes = /**
* @param {?} el
* @return {?}
*/
function (el) {
while (el.firstChild) {
el.removeChild(el.firstChild);
}
};
/**
* @param {?} el
* @param {?} node
* @return {?}
*/
BrowserDomAdapter.prototype.appendChild = /**
* @param {?} el
* @param {?} node
* @return {?}
*/
function (el, node) { el.appendChild(node); };
/**
* @param {?} el
* @param {?} node
* @return {?}
*/
BrowserDomAdapter.prototype.removeChild = /**
* @param {?} el
* @param {?} node
* @return {?}
*/
function (el, node) { el.removeChild(node); };
/**
* @param {?} el
* @param {?} newChild
* @param {?} oldChild
* @return {?}
*/
BrowserDomAdapter.prototype.replaceChild = /**
* @param {?} el
* @param {?} newChild
* @param {?} oldChild
* @return {?}
*/
function (el, newChild, oldChild) { el.replaceChild(newChild, oldChild); };
/**
* @param {?} node
* @return {?}
*/
BrowserDomAdapter.prototype.remove = /**
* @param {?} node
* @return {?}
*/
function (node) {
if (node.parentNode) {
node.parentNode.removeChild(node);
}
return node;
};
/**
* @param {?} parent
* @param {?} ref
* @param {?} node
* @return {?}
*/
BrowserDomAdapter.prototype.insertBefore = /**
* @param {?} parent
* @param {?} ref
* @param {?} node
* @return {?}
*/
function (parent, ref, node) { parent.insertBefore(node, ref); };
/**
* @param {?} parent
* @param {?} ref
* @param {?} nodes
* @return {?}
*/
BrowserDomAdapter.prototype.insertAllBefore = /**
* @param {?} parent
* @param {?} ref
* @param {?} nodes
* @return {?}
*/
function (parent, ref, nodes) {
nodes.forEach(function (n) { return parent.insertBefore(n, ref); });
};
/**
* @param {?} parent
* @param {?} ref
* @param {?} node
* @return {?}
*/
BrowserDomAdapter.prototype.insertAfter = /**
* @param {?} parent
* @param {?} ref
* @param {?} node
* @return {?}
*/
function (parent, ref, node) { parent.insertBefore(node, ref.nextSibling); };
/**
* @param {?} el
* @param {?} value
* @return {?}
*/
BrowserDomAdapter.prototype.setInnerHTML = /**
* @param {?} el
* @param {?} value
* @return {?}
*/
function (el, value) { el.innerHTML = value; };
/**
* @param {?} el
* @return {?}
*/
BrowserDomAdapter.prototype.getText = /**
* @param {?} el
* @return {?}
*/
function (el) { return el.textContent; };
/**
* @param {?} el
* @param {?} value
* @return {?}
*/
BrowserDomAdapter.prototype.setText = /**
* @param {?} el
* @param {?} value
* @return {?}
*/
function (el, value) { el.textContent = value; };
/**
* @param {?} el
* @return {?}
*/
BrowserDomAdapter.prototype.getValue = /**
* @param {?} el
* @return {?}
*/
function (el) { return el.value; };
/**
* @param {?} el
* @param {?} value
* @return {?}
*/
BrowserDomAdapter.prototype.setValue = /**
* @param {?} el
* @param {?} value
* @return {?}
*/
function (el, value) { el.value = value; };
/**
* @param {?} el
* @return {?}
*/
BrowserDomAdapter.prototype.getChecked = /**
* @param {?} el
* @return {?}
*/
function (el) { return el.checked; };
/**
* @param {?} el
* @param {?} value
* @return {?}
*/
BrowserDomAdapter.prototype.setChecked = /**
* @param {?} el
* @param {?} value
* @return {?}
*/
function (el, value) { el.checked = value; };
/**
* @param {?} text
* @return {?}
*/
BrowserDomAdapter.prototype.createComment = /**
* @param {?} text
* @return {?}
*/
function (text) { return this.getDefaultDocument().createComment(text); };
/**
* @param {?} html
* @return {?}
*/
BrowserDomAdapter.prototype.createTemplate = /**
* @param {?} html
* @return {?}
*/
function (html) {
var /** @type {?} */ t = this.getDefaultDocument().createElement('template');
t.innerHTML = html;
return t;
};
/**
* @param {?} tagName
* @param {?=} doc
* @return {?}
*/
BrowserDomAdapter.prototype.createElement = /**
* @param {?} tagName
* @param {?=} doc
* @return {?}
*/
function (tagName, doc) {
doc = doc || this.getDefaultDocument();
return doc.createElement(tagName);
};
/**
* @param {?} ns
* @param {?} tagName
* @param {?=} doc
* @return {?}
*/
BrowserDomAdapter.prototype.createElementNS = /**
* @param {?} ns
* @param {?} tagName
* @param {?=} doc
* @return {?}
*/
function (ns, tagName, doc) {
doc = doc || this.getDefaultDocument();
return doc.createElementNS(ns, tagName);
};
/**
* @param {?} text
* @param {?=} doc
* @return {?}
*/
BrowserDomAdapter.prototype.createTextNode = /**
* @param {?} text
* @param {?=} doc
* @return {?}
*/
function (text, doc) {
doc = doc || this.getDefaultDocument();
return doc.createTextNode(text);
};
/**
* @param {?} attrName
* @param {?} attrValue
* @param {?=} doc
* @return {?}
*/
BrowserDomAdapter.prototype.createScriptTag = /**
* @param {?} attrName
* @param {?} attrValue
* @param {?=} doc
* @return {?}
*/
function (attrName, attrValue, doc) {
doc = doc || this.getDefaultDocument();
var /** @type {?} */ el = /** @type {?} */ (doc.createElement('SCRIPT'));
el.setAttribute(attrName, attrValue);
return el;
};
/**
* @param {?} css
* @param {?=} doc
* @return {?}
*/
BrowserDomAdapter.prototype.createStyleElement = /**
* @param {?} css
* @param {?=} doc
* @return {?}
*/
function (css, doc) {
doc = doc || this.getDefaultDocument();
var /** @type {?} */ style = /** @type {?} */ (doc.createElement('style'));
this.appendChild(style, this.createTextNode(css, doc));
return style;
};
/**
* @param {?} el
* @return {?}
*/
BrowserDomAdapter.prototype.createShadowRoot = /**
* @param {?} el
* @return {?}
*/
function (el) { return (/** @type {?} */ (el)).createShadowRoot(); };
/**
* @param {?} el
* @return {?}
*/
BrowserDomAdapter.prototype.getShadowRoot = /**
* @param {?} el
* @return {?}
*/
function (el) { return (/** @type {?} */ (el)).shadowRoot; };
/**
* @param {?} el
* @return {?}
*/
BrowserDomAdapter.prototype.getHost = /**
* @param {?} el
* @return {?}
*/
function (el) { return (/** @type {?} */ (el)).host; };
/**
* @param {?} node
* @return {?}
*/
BrowserDomAdapter.prototype.clone = /**
* @param {?} node
* @return {?}
*/
function (node) { return node.cloneNode(true); };
/**
* @param {?} element
* @param {?} name
* @return {?}
*/
BrowserDomAdapter.prototype.getElementsByClassName = /**
* @param {?} element
* @param {?} name
* @return {?}
*/
function (element, name) {
return element.getElementsByClassName(name);
};
/**
* @param {?} element
* @param {?} name
* @return {?}
*/
BrowserDomAdapter.prototype.getElementsByTagName = /**
* @param {?} element
* @param {?} name
* @return {?}
*/
function (element, name) {
return element.getElementsByTagName(name);
};
/**
* @param {?} element
* @return {?}
*/
BrowserDomAdapter.prototype.classList = /**
* @param {?} element
* @return {?}
*/
function (element) { return Array.prototype.slice.call(element.classList, 0); };
/**
* @param {?} element
* @param {?} className
* @return {?}
*/
BrowserDomAdapter.prototype.addClass = /**
* @param {?} element
* @param {?} className
* @return {?}
*/
function (element, className) { element.classList.add(className); };
/**
* @param {?} element
* @param {?} className
* @return {?}
*/
BrowserDomAdapter.prototype.removeClass = /**
* @param {?} element
* @param {?} className
* @return {?}
*/
function (element, className) { element.classList.remove(className); };
/**
* @param {?} element
* @param {?} className
* @return {?}
*/
BrowserDomAdapter.prototype.hasClass = /**
* @param {?} element
* @param {?} className
* @return {?}
*/
function (element, className) {
return element.classList.contains(className);
};
/**
* @param {?} element
* @param {?} styleName
* @param {?} styleValue
* @return {?}
*/
BrowserDomAdapter.prototype.setStyle = /**
* @param {?} element
* @param {?} styleName
* @param {?} styleValue
* @return {?}
*/
function (element, styleName, styleValue) {
element.style[styleName] = styleValue;
};
/**
* @param {?} element
* @param {?} stylename
* @return {?}
*/
BrowserDomAdapter.prototype.removeStyle = /**
* @param {?} element
* @param {?} stylename
* @return {?}
*/
function (element, stylename) {
// IE requires '' instead of null
// see https://github.com/angular/angular/issues/7916
element.style[stylename] = '';
};
/**
* @param {?} element
* @param {?} stylename
* @return {?}
*/
BrowserDomAdapter.prototype.getStyle = /**
* @param {?} element
* @param {?} stylename
* @return {?}
*/
function (element, stylename) { return element.style[stylename]; };
/**
* @param {?} element
* @param {?} styleName
* @param {?=} styleValue
* @return {?}
*/
BrowserDomAdapter.prototype.hasStyle = /**
* @param {?} element
* @param {?} styleName
* @param {?=} styleValue
* @return {?}
*/
function (element, styleName, styleValue) {
var /** @type {?} */ value = this.getStyle(element, styleName) || '';
return styleValue ? value == styleValue : value.length > 0;
};
/**
* @param {?} element
* @return {?}
*/
BrowserDomAdapter.prototype.tagName = /**
* @param {?} element
* @return {?}
*/
function (element) { return element.tagName; };
/**
* @param {?} element
* @return {?}
*/
BrowserDomAdapter.prototype.attributeMap = /**
* @param {?} element
* @return {?}
*/
function (element) {
var /** @type {?} */ res = new Map();
var /** @type {?} */ elAttrs = element.attributes;
for (var /** @type {?} */ i = 0; i < elAttrs.length; i++) {
var /** @type {?} */ attrib = elAttrs.item(i);
res.set(attrib.name, attrib.value);
}
return res;
};
/**
* @param {?} element
* @param {?} attribute
* @return {?}
*/
BrowserDomAdapter.prototype.hasAttribute = /**
* @param {?} element
* @param {?} attribute
* @return {?}
*/
function (element, attribute) {
return element.hasAttribute(attribute);
};
/**
* @param {?} element
* @param {?} ns
* @param {?} attribute
* @return {?}
*/
BrowserDomAdapter.prototype.hasAttributeNS = /**
* @param {?} element
* @param {?} ns
* @param {?} attribute
* @return {?}
*/
function (element, ns, attribute) {
return element.hasAttributeNS(ns, attribute);
};
/**
* @param {?} element
* @param {?} attribute
* @return {?}
*/
BrowserDomAdapter.prototype.getAttribute = /**
* @param {?} element
* @param {?} attribute
* @return {?}
*/
function (element, attribute) {
return element.getAttribute(attribute);
};
/**
* @param {?} element
* @param {?} ns
* @param {?} name
* @return {?}
*/
BrowserDomAdapter.prototype.getAttributeNS = /**
* @param {?} element
* @param {?} ns
* @param {?} name
* @return {?}
*/
function (element, ns, name) {
return element.getAttributeNS(ns, name);
};
/**
* @param {?} element
* @param {?} name
* @param {?} value
* @return {?}
*/
BrowserDomAdapter.prototype.setAttribute = /**
* @param {?} element
* @param {?} name
* @param {?} value
* @return {?}
*/
function (element, name, value) { element.setAttribute(name, value); };
/**
* @param {?} element
* @param {?} ns
* @param {?} name
* @param {?} value
* @return {?}
*/
BrowserDomAdapter.prototype.setAttributeNS = /**
* @param {?} element
* @param {?} ns
* @param {?} name
* @param {?} value
* @return {?}
*/
function (element, ns, name, value) {
element.setAttributeNS(ns, name, value);
};
/**
* @param {?} element
* @param {?} attribute
* @return {?}
*/
BrowserDomAdapter.prototype.removeAttribute = /**
* @param {?} element
* @param {?} attribute
* @return {?}
*/
function (element, attribute) { element.removeAttribute(attribute); };
/**
* @param {?} element
* @param {?} ns
* @param {?} name
* @return {?}
*/
BrowserDomAdapter.prototype.removeAttributeNS = /**
* @param {?} element
* @param {?} ns
* @param {?} name
* @return {?}
*/
function (element, ns, name) {
element.removeAttributeNS(ns, name);
};
/**
* @param {?} el
* @return {?}
*/
BrowserDomAdapter.prototype.templateAwareRoot = /**
* @param {?} el
* @return {?}
*/
function (el) { return this.isTemplateElement(el) ? this.content(el) : el; };
/**
* @return {?}
*/
BrowserDomAdapter.prototype.createHtmlDocument = /**
* @return {?}
*/
function () {
return document.implementation.createHTMLDocument('fakeTitle');
};
/**
* @return {?}
*/
BrowserDomAdapter.prototype.getDefaultDocument = /**
* @return {?}
*/
function () { return document; };
/**
* @param {?} el
* @return {?}
*/
BrowserDomAdapter.prototype.getBoundingClientRect = /**
* @param {?} el
* @return {?}
*/
function (el) {
try {
return el.getBoundingClientRect();
}
catch (/** @type {?} */ e) {
return { top: 0, bottom: 0, left: 0, right: 0, width: 0, height: 0 };
}
};
/**
* @param {?} doc
* @return {?}
*/
BrowserDomAdapter.prototype.getTitle = /**
* @param {?} doc
* @return {?}
*/
function (doc) { return doc.title; };
/**
* @param {?} doc
* @param {?} newTitle
* @return {?}
*/
BrowserDomAdapter.prototype.setTitle = /**
* @param {?} doc
* @param {?} newTitle
* @return {?}
*/
function (doc, newTitle) { doc.title = newTitle || ''; };
/**
* @param {?} n
* @param {?} selector
* @return {?}
*/
BrowserDomAdapter.prototype.elementMatches = /**
* @param {?} n
* @param {?} selector
* @return {?}
*/
function (n, selector) {
if (this.isElementNode(n)) {
return n.matches && n.matches(selector) ||
n.msMatchesSelector && n.msMatchesSelector(selector) ||
n.webkitMatchesSelector && n.webkitMatchesSelector(selector);
}
return false;
};
/**
* @param {?} el
* @return {?}
*/
BrowserDomAdapter.prototype.isTemplateElement = /**
* @param {?} el
* @return {?}
*/
function (el) {
return this.isElementNode(el) && el.nodeName === 'TEMPLATE';
};
/**
* @param {?} node
* @return {?}
*/
BrowserDomAdapter.prototype.isTextNode = /**
* @param {?} node
* @return {?}
*/
function (node) { return node.nodeType === Node.TEXT_NODE; };
/**
* @param {?} node
* @return {?}
*/
BrowserDomAdapter.prototype.isCommentNode = /**
* @param {?} node
* @return {?}
*/
function (node) { return node.nodeType === Node.COMMENT_NODE; };
/**
* @param {?} node
* @return {?}
*/
BrowserDomAdapter.prototype.isElementNode = /**
* @param {?} node
* @return {?}
*/
function (node) { return node.nodeType === Node.ELEMENT_NODE; };
/**
* @param {?} node
* @return {?}
*/
BrowserDomAdapter.prototype.hasShadowRoot = /**
* @param {?} node
* @return {?}
*/
function (node) {
return node.shadowRoot != null && node instanceof HTMLElement;
};
/**
* @param {?} node
* @return {?}
*/
BrowserDomAdapter.prototype.isShadowRoot = /**
* @param {?} node
* @return {?}
*/
function (node) { return node instanceof DocumentFragment; };
/**
* @param {?} node
* @return {?}
*/
BrowserDomAdapter.prototype.importIntoDoc = /**
* @param {?} node
* @return {?}
*/
function (node) { return document.importNode(this.templateAwareRoot(node), true); };
/**
* @param {?} node
* @return {?}
*/
BrowserDomAdapter.prototype.adoptNode = /**
* @param {?} node
* @return {?}
*/
function (node) { return document.adoptNode(node); };
/**
* @param {?} el
* @return {?}
*/
BrowserDomAdapter.prototype.getHref = /**
* @param {?} el
* @return {?}
*/
function (el) { return /** @type {?} */ ((el.getAttribute('href'))); };
/**
* @param {?} event
* @return {?}
*/
BrowserDomAdapter.prototype.getEventKey = /**
* @param {?} event
* @return {?}
*/
function (event) {
var /** @type {?} */ key = event.key;
if (key == null) {
key = event.keyIdentifier;
// keyIdentifier is defined in the old draft of DOM Level 3 Events implemented by Chrome and
// Safari cf
// http://www.w3.org/TR/2007/WD-DOM-Level-3-Events-20071221/events.html#Events-KeyboardEvents-Interfaces
if (key == null) {
return 'Unidentified';
}
if (key.startsWith('U+')) {
key = String.fromCharCode(parseInt(key.substring(2), 16));
if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) {
// There is a bug in Chrome for numeric keypad keys:
// https://code.google.com/p/chromium/issues/detail?id=155654
// 1, 2, 3 ... are reported as A, B, C ...
key = (/** @type {?} */ (_chromeNumKeyPadMap))[key];
}
}
}
return _keyMap[key] || key;
};
/**
* @param {?} doc
* @param {?} target
* @return {?}
*/
BrowserDomAdapter.prototype.getGlobalEventTarget = /**
* @param {?} doc
* @param {?} target
* @return {?}
*/
function (doc, target) {
if (target === 'window') {
return window;
}
if (target === 'document') {
return doc;
}
if (target === 'body') {
return doc.body;
}
return null;
};
/**
* @return {?}
*/
BrowserDomAdapter.prototype.getHistory = /**
* @return {?}
*/
function () { return window.history; };
/**
* @return {?}
*/
BrowserDomAdapter.prototype.getLocation = /**
* @return {?}
*/
function () { return window.location; };
/**
* @param {?} doc
* @return {?}
*/
BrowserDomAdapter.prototype.getBaseHref = /**
* @param {?} doc
* @return {?}
*/
function (doc) {
var /** @type {?} */ href = getBaseElementHref();
return href == null ? null : relativePath(href);
};
/**
* @return {?}
*/
BrowserDomAdapter.prototype.resetBaseElement = /**
* @return {?}
*/
function () { baseElement = null; };
/**
* @return {?}
*/
BrowserDomAdapter.prototype.getUserAgent = /**
* @return {?}
*/
function () { return window.navigator.userAgent; };
/**
* @param {?} element
* @param {?} name
* @param {?} value
* @return {?}
*/
BrowserDomAdapter.prototype.setData = /**
* @param {?} element
* @param {?} name
* @param {?} value
* @return {?}
*/
function (element, name, value) {
this.setAttribute(element, 'data-' + name, value);
};
/**
* @param {?} element
* @param {?} name
* @return {?}
*/
BrowserDomAdapter.prototype.getData = /**
* @param {?} element
* @param {?} name
* @return {?}
*/
function (element, name) {
return this.getAttribute(element, 'data-' + name);
};
/**
* @param {?} element
* @return {?}
*/
BrowserDomAdapter.prototype.getComputedStyle = /**
* @param {?} element
* @return {?}
*/
function (element) { return getComputedStyle(element); };
// TODO(tbosch): move this into a separate environment class once we have it
/**
* @return {?}
*/
BrowserDomAdapter.prototype.supportsWebAnimation = /**
* @return {?}
*/
function () {
return typeof (/** @type {?} */ (Element)).prototype['animate'] === 'function';
};
/**
* @return {?}
*/
BrowserDomAdapter.prototype.performanceNow = /**
* @return {?}
*/
function () {
// performance.now() is not available in all browsers, see
// http://caniuse.com/#search=performance.now
return window.performance && window.performance.now ? window.performance.now() :
new Date().getTime();
};
/**
* @return {?}
*/
BrowserDomAdapter.prototype.supportsCookies = /**
* @return {?}
*/
function () { return true; };
/**
* @param {?} name
* @return {?}
*/
BrowserDomAdapter.prototype.getCookie = /**
* @param {?} name
* @return {?}
*/
function (name) { return Object(__WEBPACK_IMPORTED_MODULE_0__angular_common__["j" /* ɵparseCookieValue */])(document.cookie, name); };
/**
* @param {?} name
* @param {?} value
* @return {?}
*/
BrowserDomAdapter.prototype.setCookie = /**
* @param {?} name
* @param {?} value
* @return {?}
*/
function (name, value) {
// document.cookie is magical, assigning into it assigns/overrides one cookie value, but does
// not clear other cookies.
document.cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value);
};
return BrowserDomAdapter;
}(GenericBrowserDomAdapter));
var baseElement = null;
/**
* @return {?}
*/
function getBaseElementHref() {
if (!baseElement) {
baseElement = /** @type {?} */ ((document.querySelector('base')));
if (!baseElement) {
return null;
}
}
return baseElement.getAttribute('href');
}
// based on urlUtils.js in AngularJS 1
var urlParsingNode;
/**
* @param {?} url
* @return {?}
*/
function relativePath(url) {
if (!urlParsingNode) {
urlParsingNode = document.createElement('a');
}
urlParsingNode.setAttribute('href', url);
return (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname :
'/' + urlParsingNode.pathname;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* A DI Token representing the main rendering context. In a browser this is the DOM Document.
*
* Note: Document might not be available in the Application Context when Application and Rendering
* Contexts are not the same (e.g. when running the application into a Web Worker).
*
* @deprecated import from `\@angular/common` instead.
*/
var DOCUMENT$1 = __WEBPACK_IMPORTED_MODULE_0__angular_common__["c" /* DOCUMENT */];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @return {?}
*/
function supportsState() {
return !!window.history.pushState;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* `PlatformLocation` encapsulates all of the direct calls to platform APIs.
* This class should not be used directly by an application developer. Instead, use
* {\@link Location}.
*/
var BrowserPlatformLocation = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(BrowserPlatformLocation, _super);
function BrowserPlatformLocation(_doc) {
var _this = _super.call(this) || this;
_this._doc = _doc;
_this._init();
return _this;
}
// This is moved to its own method so that `MockPlatformLocationStrategy` can overwrite it
/** @internal */
/**
* \@internal
* @return {?}
*/
BrowserPlatformLocation.prototype._init = /**
* \@internal
* @return {?}
*/
function () {
(/** @type {?} */ (this)).location = getDOM().getLocation();
this._history = getDOM().getHistory();
};
/**
* @return {?}
*/
BrowserPlatformLocation.prototype.getBaseHrefFromDOM = /**
* @return {?}
*/
function () { return /** @type {?} */ ((getDOM().getBaseHref(this._doc))); };
/**
* @param {?} fn
* @return {?}
*/
BrowserPlatformLocation.prototype.onPopState = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
getDOM().getGlobalEventTarget(this._doc, 'window').addEventListener('popstate', fn, false);
};
/**
* @param {?} fn
* @return {?}
*/
BrowserPlatformLocation.prototype.onHashChange = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
getDOM().getGlobalEventTarget(this._doc, 'window').addEventListener('hashchange', fn, false);
};
Object.defineProperty(BrowserPlatformLocation.prototype, "pathname", {
get: /**
* @return {?}
*/
function () { return this.location.pathname; },
set: /**
* @param {?} newPath
* @return {?}
*/
function (newPath) { this.location.pathname = newPath; },
enumerable: true,
configurable: true
});
Object.defineProperty(BrowserPlatformLocation.prototype, "search", {
get: /**
* @return {?}
*/
function () { return this.location.search; },
enumerable: true,
configurable: true
});
Object.defineProperty(BrowserPlatformLocation.prototype, "hash", {
get: /**
* @return {?}
*/
function () { return this.location.hash; },
enumerable: true,
configurable: true
});
/**
* @param {?} state
* @param {?} title
* @param {?} url
* @return {?}
*/
BrowserPlatformLocation.prototype.pushState = /**
* @param {?} state
* @param {?} title
* @param {?} url
* @return {?}
*/
function (state, title, url) {
if (supportsState()) {
this._history.pushState(state, title, url);
}
else {
this.location.hash = url;
}
};
/**
* @param {?} state
* @param {?} title
* @param {?} url
* @return {?}
*/
BrowserPlatformLocation.prototype.replaceState = /**
* @param {?} state
* @param {?} title
* @param {?} url
* @return {?}
*/
function (state, title, url) {
if (supportsState()) {
this._history.replaceState(state, title, url);
}
else {
this.location.hash = url;
}
};
/**
* @return {?}
*/
BrowserPlatformLocation.prototype.forward = /**
* @return {?}
*/
function () { this._history.forward(); };
/**
* @return {?}
*/
BrowserPlatformLocation.prototype.back = /**
* @return {?}
*/
function () { this._history.back(); };
BrowserPlatformLocation.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
BrowserPlatformLocation.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [DOCUMENT$1,] },] },
]; };
return BrowserPlatformLocation;
}(__WEBPACK_IMPORTED_MODULE_0__angular_common__["h" /* PlatformLocation */]));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* A service that can be used to get and add meta tags.
*
* \@experimental
*/
var Meta = (function () {
function Meta(_doc) {
this._doc = _doc;
this._dom = getDOM();
}
/**
* @param {?} tag
* @param {?=} forceCreation
* @return {?}
*/
Meta.prototype.addTag = /**
* @param {?} tag
* @param {?=} forceCreation
* @return {?}
*/
function (tag, forceCreation) {
if (forceCreation === void 0) { forceCreation = false; }
if (!tag)
return null;
return this._getOrCreateElement(tag, forceCreation);
};
/**
* @param {?} tags
* @param {?=} forceCreation
* @return {?}
*/
Meta.prototype.addTags = /**
* @param {?} tags
* @param {?=} forceCreation
* @return {?}
*/
function (tags, forceCreation) {
var _this = this;
if (forceCreation === void 0) { forceCreation = false; }
if (!tags)
return [];
return tags.reduce(function (result, tag) {
if (tag) {
result.push(_this._getOrCreateElement(tag, forceCreation));
}
return result;
}, []);
};
/**
* @param {?} attrSelector
* @return {?}
*/
Meta.prototype.getTag = /**
* @param {?} attrSelector
* @return {?}
*/
function (attrSelector) {
if (!attrSelector)
return null;
return this._dom.querySelector(this._doc, "meta[" + attrSelector + "]") || null;
};
/**
* @param {?} attrSelector
* @return {?}
*/
Meta.prototype.getTags = /**
* @param {?} attrSelector
* @return {?}
*/
function (attrSelector) {
if (!attrSelector)
return [];
var /** @type {?} */ list = this._dom.querySelectorAll(this._doc, "meta[" + attrSelector + "]");
return list ? [].slice.call(list) : [];
};
/**
* @param {?} tag
* @param {?=} selector
* @return {?}
*/
Meta.prototype.updateTag = /**
* @param {?} tag
* @param {?=} selector
* @return {?}
*/
function (tag, selector) {
if (!tag)
return null;
selector = selector || this._parseSelector(tag);
var /** @type {?} */ meta = /** @type {?} */ ((this.getTag(selector)));
if (meta) {
return this._setMetaElementAttributes(tag, meta);
}
return this._getOrCreateElement(tag, true);
};
/**
* @param {?} attrSelector
* @return {?}
*/
Meta.prototype.removeTag = /**
* @param {?} attrSelector
* @return {?}
*/
function (attrSelector) { this.removeTagElement(/** @type {?} */ ((this.getTag(attrSelector)))); };
/**
* @param {?} meta
* @return {?}
*/
Meta.prototype.removeTagElement = /**
* @param {?} meta
* @return {?}
*/
function (meta) {
if (meta) {
this._dom.remove(meta);
}
};
/**
* @param {?} meta
* @param {?=} forceCreation
* @return {?}
*/
Meta.prototype._getOrCreateElement = /**
* @param {?} meta
* @param {?=} forceCreation
* @return {?}
*/
function (meta, forceCreation) {
if (forceCreation === void 0) { forceCreation = false; }
if (!forceCreation) {
var /** @type {?} */ selector = this._parseSelector(meta);
var /** @type {?} */ elem = /** @type {?} */ ((this.getTag(selector)));
// It's allowed to have multiple elements with the same name so it's not enough to
// just check that element with the same name already present on the page. We also need to
// check if element has tag attributes
if (elem && this._containsAttributes(meta, elem))
return elem;
}
var /** @type {?} */ element = /** @type {?} */ (this._dom.createElement('meta'));
this._setMetaElementAttributes(meta, element);
var /** @type {?} */ head = this._dom.getElementsByTagName(this._doc, 'head')[0];
this._dom.appendChild(head, element);
return element;
};
/**
* @param {?} tag
* @param {?} el
* @return {?}
*/
Meta.prototype._setMetaElementAttributes = /**
* @param {?} tag
* @param {?} el
* @return {?}
*/
function (tag, el) {
var _this = this;
Object.keys(tag).forEach(function (prop) { return _this._dom.setAttribute(el, prop, tag[prop]); });
return el;
};
/**
* @param {?} tag
* @return {?}
*/
Meta.prototype._parseSelector = /**
* @param {?} tag
* @return {?}
*/
function (tag) {
var /** @type {?} */ attr = tag.name ? 'name' : 'property';
return attr + "=\"" + tag[attr] + "\"";
};
/**
* @param {?} tag
* @param {?} elem
* @return {?}
*/
Meta.prototype._containsAttributes = /**
* @param {?} tag
* @param {?} elem
* @return {?}
*/
function (tag, elem) {
var _this = this;
return Object.keys(tag).every(function (key) { return _this._dom.getAttribute(elem, key) === tag[key]; });
};
Meta.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
Meta.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [DOCUMENT$1,] },] },
]; };
return Meta;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* An id that identifies a particular application being bootstrapped, that should
* match across the client/server boundary.
*/
var TRANSITION_ID = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["B" /* InjectionToken */]('TRANSITION_ID');
/**
* @param {?} transitionId
* @param {?} document
* @param {?} injector
* @return {?}
*/
function appInitializerFactory(transitionId, document, injector) {
return function () {
// Wait for all application initializers to be completed before removing the styles set by
// the server.
injector.get(__WEBPACK_IMPORTED_MODULE_1__angular_core__["d" /* ApplicationInitStatus */]).donePromise.then(function () {
var /** @type {?} */ dom = getDOM();
var /** @type {?} */ styles = Array.prototype.slice.apply(dom.querySelectorAll(document, "style[ng-transition]"));
styles.filter(function (el) { return dom.getAttribute(el, 'ng-transition') === transitionId; })
.forEach(function (el) { return dom.remove(el); });
});
};
}
var SERVER_TRANSITION_PROVIDERS = [
{
provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["c" /* APP_INITIALIZER */],
useFactory: appInitializerFactory,
deps: [TRANSITION_ID, DOCUMENT$1, __WEBPACK_IMPORTED_MODULE_1__angular_core__["C" /* Injector */]],
multi: true
},
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var BrowserGetTestability = (function () {
function BrowserGetTestability() {
}
/**
* @return {?}
*/
BrowserGetTestability.init = /**
* @return {?}
*/
function () { Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_18" /* setTestabilityGetter */])(new BrowserGetTestability()); };
/**
* @param {?} registry
* @return {?}
*/
BrowserGetTestability.prototype.addToWindow = /**
* @param {?} registry
* @return {?}
*/
function (registry) {
__WEBPACK_IMPORTED_MODULE_1__angular_core__["_30" /* ɵglobal */]['getAngularTestability'] = function (elem, findInAncestors) {
if (findInAncestors === void 0) { findInAncestors = true; }
var /** @type {?} */ testability = registry.findTestabilityInTree(elem, findInAncestors);
if (testability == null) {
throw new Error('Could not find testability for element.');
}
return testability;
};
__WEBPACK_IMPORTED_MODULE_1__angular_core__["_30" /* ɵglobal */]['getAllAngularTestabilities'] = function () { return registry.getAllTestabilities(); };
__WEBPACK_IMPORTED_MODULE_1__angular_core__["_30" /* ɵglobal */]['getAllAngularRootElements'] = function () { return registry.getAllRootElements(); };
var /** @type {?} */ whenAllStable = function (callback /** TODO #9100 */) {
var /** @type {?} */ testabilities = __WEBPACK_IMPORTED_MODULE_1__angular_core__["_30" /* ɵglobal */]['getAllAngularTestabilities']();
var /** @type {?} */ count = testabilities.length;
var /** @type {?} */ didWork = false;
var /** @type {?} */ decrement = function (didWork_ /** TODO #9100 */) {
didWork = didWork || didWork_;
count--;
if (count == 0) {
callback(didWork);
}
};
testabilities.forEach(function (testability /** TODO #9100 */) {
testability.whenStable(decrement);
});
};
if (!__WEBPACK_IMPORTED_MODULE_1__angular_core__["_30" /* ɵglobal */]['frameworkStabilizers']) {
__WEBPACK_IMPORTED_MODULE_1__angular_core__["_30" /* ɵglobal */]['frameworkStabilizers'] = [];
}
__WEBPACK_IMPORTED_MODULE_1__angular_core__["_30" /* ɵglobal */]['frameworkStabilizers'].push(whenAllStable);
};
/**
* @param {?} registry
* @param {?} elem
* @param {?} findInAncestors
* @return {?}
*/
BrowserGetTestability.prototype.findTestabilityInTree = /**
* @param {?} registry
* @param {?} elem
* @param {?} findInAncestors
* @return {?}
*/
function (registry, elem, findInAncestors) {
if (elem == null) {
return null;
}
var /** @type {?} */ t = registry.getTestability(elem);
if (t != null) {
return t;
}
else if (!findInAncestors) {
return null;
}
if (getDOM().isShadowRoot(elem)) {
return this.findTestabilityInTree(registry, getDOM().getHost(elem), true);
}
return this.findTestabilityInTree(registry, getDOM().parentElement(elem), true);
};
return BrowserGetTestability;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* A service that can be used to get and set the title of a current HTML document.
*
* Since an Angular application can't be bootstrapped on the entire HTML document (`<html>` tag)
* it is not possible to bind to the `text` property of the `HTMLTitleElement` elements
* (representing the `<title>` tag). Instead, this service can be used to set and get the current
* title value.
*
* \@experimental
*/
var Title = (function () {
function Title(_doc) {
this._doc = _doc;
}
/**
* Get the title of the current HTML document.
*/
/**
* Get the title of the current HTML document.
* @return {?}
*/
Title.prototype.getTitle = /**
* Get the title of the current HTML document.
* @return {?}
*/
function () { return getDOM().getTitle(this._doc); };
/**
* Set the title of the current HTML document.
* @param newTitle
*/
/**
* Set the title of the current HTML document.
* @param {?} newTitle
* @return {?}
*/
Title.prototype.setTitle = /**
* Set the title of the current HTML document.
* @param {?} newTitle
* @return {?}
*/
function (newTitle) { getDOM().setTitle(this._doc, newTitle); };
Title.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
Title.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [DOCUMENT$1,] },] },
]; };
return Title;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @param {?} input
* @return {?}
*/
/**
* @param {?} input
* @return {?}
*/
/**
* Exports the value under a given `name` in the global property `ng`. For example `ng.probe` if
* `name` is `'probe'`.
* @param {?} name Name under which it will be exported. Keep in mind this will be a property of the
* global `ng` object.
* @param {?} value The value to export.
* @return {?}
*/
function exportNgVar(name, value) {
if (typeof COMPILED === 'undefined' || !COMPILED) {
// Note: we can't export `ng` when using closure enhanced optimization as:
// - closure declares globals itself for minified names, which sometimes clobber our `ng` global
// - we can't declare a closure extern as the namespace `ng` is already used within Google
// for typings for angularJS (via `goog.provide('ng....')`).
var /** @type {?} */ ng = __WEBPACK_IMPORTED_MODULE_1__angular_core__["_30" /* ɵglobal */]['ng'] = (/** @type {?} */ (__WEBPACK_IMPORTED_MODULE_1__angular_core__["_30" /* ɵglobal */]['ng'])) || {};
ng[name] = value;
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var CORE_TOKENS = {
'ApplicationRef': __WEBPACK_IMPORTED_MODULE_1__angular_core__["f" /* ApplicationRef */],
'NgZone': __WEBPACK_IMPORTED_MODULE_1__angular_core__["M" /* NgZone */],
};
var INSPECT_GLOBAL_NAME = 'probe';
var CORE_TOKENS_GLOBAL_NAME = 'coreTokens';
/**
* Returns a {\@link DebugElement} for the given native DOM element, or
* null if the given native element does not have an Angular view associated
* with it.
* @param {?} element
* @return {?}
*/
function inspectNativeElement(element) {
return Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_15" /* getDebugNode */])(element);
}
/**
* @param {?} coreTokens
* @return {?}
*/
function _createNgProbe(coreTokens) {
exportNgVar(INSPECT_GLOBAL_NAME, inspectNativeElement);
exportNgVar(CORE_TOKENS_GLOBAL_NAME, Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["a" /* __assign */])({}, CORE_TOKENS, _ngProbeTokensToMap(coreTokens || [])));
return function () { return inspectNativeElement; };
}
/**
* @param {?} tokens
* @return {?}
*/
function _ngProbeTokensToMap(tokens) {
return tokens.reduce(function (prev, t) { return (prev[t.name] = t.token, prev); }, {});
}
/**
* Providers which support debugging Angular applications (e.g. via `ng.probe`).
*/
var ELEMENT_PROBE_PROVIDERS = [
{
provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["c" /* APP_INITIALIZER */],
useFactory: _createNgProbe,
deps: [
[__WEBPACK_IMPORTED_MODULE_1__angular_core__["L" /* NgProbeToken */], new __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */]()],
],
multi: true,
},
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* \@stable
*/
var EVENT_MANAGER_PLUGINS = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["B" /* InjectionToken */]('EventManagerPlugins');
/**
* \@stable
*/
var EventManager = (function () {
function EventManager(plugins, _zone) {
var _this = this;
this._zone = _zone;
this._eventNameToPlugin = new Map();
plugins.forEach(function (p) { return p.manager = _this; });
this._plugins = plugins.slice().reverse();
}
/**
* @param {?} element
* @param {?} eventName
* @param {?} handler
* @return {?}
*/
EventManager.prototype.addEventListener = /**
* @param {?} element
* @param {?} eventName
* @param {?} handler
* @return {?}
*/
function (element, eventName, handler) {
var /** @type {?} */ plugin = this._findPluginFor(eventName);
return plugin.addEventListener(element, eventName, handler);
};
/**
* @param {?} target
* @param {?} eventName
* @param {?} handler
* @return {?}
*/
EventManager.prototype.addGlobalEventListener = /**
* @param {?} target
* @param {?} eventName
* @param {?} handler
* @return {?}
*/
function (target, eventName, handler) {
var /** @type {?} */ plugin = this._findPluginFor(eventName);
return plugin.addGlobalEventListener(target, eventName, handler);
};
/**
* @return {?}
*/
EventManager.prototype.getZone = /**
* @return {?}
*/
function () { return this._zone; };
/** @internal */
/**
* \@internal
* @param {?} eventName
* @return {?}
*/
EventManager.prototype._findPluginFor = /**
* \@internal
* @param {?} eventName
* @return {?}
*/
function (eventName) {
var /** @type {?} */ plugin = this._eventNameToPlugin.get(eventName);
if (plugin) {
return plugin;
}
var /** @type {?} */ plugins = this._plugins;
for (var /** @type {?} */ i = 0; i < plugins.length; i++) {
var /** @type {?} */ plugin_1 = plugins[i];
if (plugin_1.supports(eventName)) {
this._eventNameToPlugin.set(eventName, plugin_1);
return plugin_1;
}
}
throw new Error("No event manager plugin found for event " + eventName);
};
EventManager.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
EventManager.ctorParameters = function () { return [
{ type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [EVENT_MANAGER_PLUGINS,] },] },
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["M" /* NgZone */], },
]; };
return EventManager;
}());
/**
* @abstract
*/
var EventManagerPlugin = (function () {
function EventManagerPlugin(_doc) {
this._doc = _doc;
}
/**
* @param {?} element
* @param {?} eventName
* @param {?} handler
* @return {?}
*/
EventManagerPlugin.prototype.addGlobalEventListener = /**
* @param {?} element
* @param {?} eventName
* @param {?} handler
* @return {?}
*/
function (element, eventName, handler) {
var /** @type {?} */ target = getDOM().getGlobalEventTarget(this._doc, element);
if (!target) {
throw new Error("Unsupported event target " + target + " for event " + eventName);
}
return this.addEventListener(target, eventName, handler);
};
return EventManagerPlugin;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var SharedStylesHost = (function () {
function SharedStylesHost() {
/**
* \@internal
*/
this._stylesSet = new Set();
}
/**
* @param {?} styles
* @return {?}
*/
SharedStylesHost.prototype.addStyles = /**
* @param {?} styles
* @return {?}
*/
function (styles) {
var _this = this;
var /** @type {?} */ additions = new Set();
styles.forEach(function (style) {
if (!_this._stylesSet.has(style)) {
_this._stylesSet.add(style);
additions.add(style);
}
});
this.onStylesAdded(additions);
};
/**
* @param {?} additions
* @return {?}
*/
SharedStylesHost.prototype.onStylesAdded = /**
* @param {?} additions
* @return {?}
*/
function (additions) { };
/**
* @return {?}
*/
SharedStylesHost.prototype.getAllStyles = /**
* @return {?}
*/
function () { return Array.from(this._stylesSet); };
SharedStylesHost.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
SharedStylesHost.ctorParameters = function () { return []; };
return SharedStylesHost;
}());
var DomSharedStylesHost = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(DomSharedStylesHost, _super);
function DomSharedStylesHost(_doc) {
var _this = _super.call(this) || this;
_this._doc = _doc;
_this._hostNodes = new Set();
_this._styleNodes = new Set();
_this._hostNodes.add(_doc.head);
return _this;
}
/**
* @param {?} styles
* @param {?} host
* @return {?}
*/
DomSharedStylesHost.prototype._addStylesToHost = /**
* @param {?} styles
* @param {?} host
* @return {?}
*/
function (styles, host) {
var _this = this;
styles.forEach(function (style) {
var /** @type {?} */ styleEl = _this._doc.createElement('style');
styleEl.textContent = style;
_this._styleNodes.add(host.appendChild(styleEl));
});
};
/**
* @param {?} hostNode
* @return {?}
*/
DomSharedStylesHost.prototype.addHost = /**
* @param {?} hostNode
* @return {?}
*/
function (hostNode) {
this._addStylesToHost(this._stylesSet, hostNode);
this._hostNodes.add(hostNode);
};
/**
* @param {?} hostNode
* @return {?}
*/
DomSharedStylesHost.prototype.removeHost = /**
* @param {?} hostNode
* @return {?}
*/
function (hostNode) { this._hostNodes.delete(hostNode); };
/**
* @param {?} additions
* @return {?}
*/
DomSharedStylesHost.prototype.onStylesAdded = /**
* @param {?} additions
* @return {?}
*/
function (additions) {
var _this = this;
this._hostNodes.forEach(function (hostNode) { return _this._addStylesToHost(additions, hostNode); });
};
/**
* @return {?}
*/
DomSharedStylesHost.prototype.ngOnDestroy = /**
* @return {?}
*/
function () { this._styleNodes.forEach(function (styleNode) { return getDOM().remove(styleNode); }); };
DomSharedStylesHost.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
DomSharedStylesHost.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [DOCUMENT$1,] },] },
]; };
return DomSharedStylesHost;
}(SharedStylesHost));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var NAMESPACE_URIS = {
'svg': 'http://www.w3.org/2000/svg',
'xhtml': 'http://www.w3.org/1999/xhtml',
'xlink': 'http://www.w3.org/1999/xlink',
'xml': 'http://www.w3.org/XML/1998/namespace',
'xmlns': 'http://www.w3.org/2000/xmlns/',
};
var COMPONENT_REGEX = /%COMP%/g;
var COMPONENT_VARIABLE = '%COMP%';
var HOST_ATTR = "_nghost-" + COMPONENT_VARIABLE;
var CONTENT_ATTR = "_ngcontent-" + COMPONENT_VARIABLE;
/**
* @param {?} componentShortId
* @return {?}
*/
function shimContentAttribute(componentShortId) {
return CONTENT_ATTR.replace(COMPONENT_REGEX, componentShortId);
}
/**
* @param {?} componentShortId
* @return {?}
*/
function shimHostAttribute(componentShortId) {
return HOST_ATTR.replace(COMPONENT_REGEX, componentShortId);
}
/**
* @param {?} compId
* @param {?} styles
* @param {?} target
* @return {?}
*/
function flattenStyles(compId, styles, target) {
for (var /** @type {?} */ i = 0; i < styles.length; i++) {
var /** @type {?} */ style = styles[i];
if (Array.isArray(style)) {
flattenStyles(compId, style, target);
}
else {
style = style.replace(COMPONENT_REGEX, compId);
target.push(style);
}
}
return target;
}
/**
* @param {?} eventHandler
* @return {?}
*/
function decoratePreventDefault(eventHandler) {
return function (event) {
var /** @type {?} */ allowDefaultBehavior = eventHandler(event);
if (allowDefaultBehavior === false) {
// TODO(tbosch): move preventDefault into event plugins...
event.preventDefault();
event.returnValue = false;
}
};
}
var DomRendererFactory2 = (function () {
function DomRendererFactory2(eventManager, sharedStylesHost) {
this.eventManager = eventManager;
this.sharedStylesHost = sharedStylesHost;
this.rendererByCompId = new Map();
this.defaultRenderer = new DefaultDomRenderer2(eventManager);
}
/**
* @param {?} element
* @param {?} type
* @return {?}
*/
DomRendererFactory2.prototype.createRenderer = /**
* @param {?} element
* @param {?} type
* @return {?}
*/
function (element, type) {
if (!element || !type) {
return this.defaultRenderer;
}
switch (type.encapsulation) {
case __WEBPACK_IMPORTED_MODULE_1__angular_core__["_11" /* ViewEncapsulation */].Emulated: {
var /** @type {?} */ renderer = this.rendererByCompId.get(type.id);
if (!renderer) {
renderer =
new EmulatedEncapsulationDomRenderer2(this.eventManager, this.sharedStylesHost, type);
this.rendererByCompId.set(type.id, renderer);
}
(/** @type {?} */ (renderer)).applyToHost(element);
return renderer;
}
case __WEBPACK_IMPORTED_MODULE_1__angular_core__["_11" /* ViewEncapsulation */].Native:
return new ShadowDomRenderer(this.eventManager, this.sharedStylesHost, element, type);
default: {
if (!this.rendererByCompId.has(type.id)) {
var /** @type {?} */ styles = flattenStyles(type.id, type.styles, []);
this.sharedStylesHost.addStyles(styles);
this.rendererByCompId.set(type.id, this.defaultRenderer);
}
return this.defaultRenderer;
}
}
};
/**
* @return {?}
*/
DomRendererFactory2.prototype.begin = /**
* @return {?}
*/
function () { };
/**
* @return {?}
*/
DomRendererFactory2.prototype.end = /**
* @return {?}
*/
function () { };
DomRendererFactory2.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
DomRendererFactory2.ctorParameters = function () { return [
{ type: EventManager, },
{ type: DomSharedStylesHost, },
]; };
return DomRendererFactory2;
}());
var DefaultDomRenderer2 = (function () {
function DefaultDomRenderer2(eventManager) {
this.eventManager = eventManager;
this.data = Object.create(null);
}
/**
* @return {?}
*/
DefaultDomRenderer2.prototype.destroy = /**
* @return {?}
*/
function () { };
/**
* @param {?} name
* @param {?=} namespace
* @return {?}
*/
DefaultDomRenderer2.prototype.createElement = /**
* @param {?} name
* @param {?=} namespace
* @return {?}
*/
function (name, namespace) {
if (namespace) {
return document.createElementNS(NAMESPACE_URIS[namespace], name);
}
return document.createElement(name);
};
/**
* @param {?} value
* @return {?}
*/
DefaultDomRenderer2.prototype.createComment = /**
* @param {?} value
* @return {?}
*/
function (value) { return document.createComment(value); };
/**
* @param {?} value
* @return {?}
*/
DefaultDomRenderer2.prototype.createText = /**
* @param {?} value
* @return {?}
*/
function (value) { return document.createTextNode(value); };
/**
* @param {?} parent
* @param {?} newChild
* @return {?}
*/
DefaultDomRenderer2.prototype.appendChild = /**
* @param {?} parent
* @param {?} newChild
* @return {?}
*/
function (parent, newChild) { parent.appendChild(newChild); };
/**
* @param {?} parent
* @param {?} newChild
* @param {?} refChild
* @return {?}
*/
DefaultDomRenderer2.prototype.insertBefore = /**
* @param {?} parent
* @param {?} newChild
* @param {?} refChild
* @return {?}
*/
function (parent, newChild, refChild) {
if (parent) {
parent.insertBefore(newChild, refChild);
}
};
/**
* @param {?} parent
* @param {?} oldChild
* @return {?}
*/
DefaultDomRenderer2.prototype.removeChild = /**
* @param {?} parent
* @param {?} oldChild
* @return {?}
*/
function (parent, oldChild) {
if (parent) {
parent.removeChild(oldChild);
}
};
/**
* @param {?} selectorOrNode
* @return {?}
*/
DefaultDomRenderer2.prototype.selectRootElement = /**
* @param {?} selectorOrNode
* @return {?}
*/
function (selectorOrNode) {
var /** @type {?} */ el = typeof selectorOrNode === 'string' ? document.querySelector(selectorOrNode) :
selectorOrNode;
if (!el) {
throw new Error("The selector \"" + selectorOrNode + "\" did not match any elements");
}
el.textContent = '';
return el;
};
/**
* @param {?} node
* @return {?}
*/
DefaultDomRenderer2.prototype.parentNode = /**
* @param {?} node
* @return {?}
*/
function (node) { return node.parentNode; };
/**
* @param {?} node
* @return {?}
*/
DefaultDomRenderer2.prototype.nextSibling = /**
* @param {?} node
* @return {?}
*/
function (node) { return node.nextSibling; };
/**
* @param {?} el
* @param {?} name
* @param {?} value
* @param {?=} namespace
* @return {?}
*/
DefaultDomRenderer2.prototype.setAttribute = /**
* @param {?} el
* @param {?} name
* @param {?} value
* @param {?=} namespace
* @return {?}
*/
function (el, name, value, namespace) {
if (namespace) {
name = namespace + ":" + name;
var /** @type {?} */ namespaceUri = NAMESPACE_URIS[namespace];
if (namespaceUri) {
el.setAttributeNS(namespaceUri, name, value);
}
else {
el.setAttribute(name, value);
}
}
else {
el.setAttribute(name, value);
}
};
/**
* @param {?} el
* @param {?} name
* @param {?=} namespace
* @return {?}
*/
DefaultDomRenderer2.prototype.removeAttribute = /**
* @param {?} el
* @param {?} name
* @param {?=} namespace
* @return {?}
*/
function (el, name, namespace) {
if (namespace) {
var /** @type {?} */ namespaceUri = NAMESPACE_URIS[namespace];
if (namespaceUri) {
el.removeAttributeNS(namespaceUri, name);
}
else {
el.removeAttribute(namespace + ":" + name);
}
}
else {
el.removeAttribute(name);
}
};
/**
* @param {?} el
* @param {?} name
* @return {?}
*/
DefaultDomRenderer2.prototype.addClass = /**
* @param {?} el
* @param {?} name
* @return {?}
*/
function (el, name) { el.classList.add(name); };
/**
* @param {?} el
* @param {?} name
* @return {?}
*/
DefaultDomRenderer2.prototype.removeClass = /**
* @param {?} el
* @param {?} name
* @return {?}
*/
function (el, name) { el.classList.remove(name); };
/**
* @param {?} el
* @param {?} style
* @param {?} value
* @param {?} flags
* @return {?}
*/
DefaultDomRenderer2.prototype.setStyle = /**
* @param {?} el
* @param {?} style
* @param {?} value
* @param {?} flags
* @return {?}
*/
function (el, style, value, flags) {
if (flags & __WEBPACK_IMPORTED_MODULE_1__angular_core__["Y" /* RendererStyleFlags2 */].DashCase) {
el.style.setProperty(style, value, !!(flags & __WEBPACK_IMPORTED_MODULE_1__angular_core__["Y" /* RendererStyleFlags2 */].Important) ? 'important' : '');
}
else {
el.style[style] = value;
}
};
/**
* @param {?} el
* @param {?} style
* @param {?} flags
* @return {?}
*/
DefaultDomRenderer2.prototype.removeStyle = /**
* @param {?} el
* @param {?} style
* @param {?} flags
* @return {?}
*/
function (el, style, flags) {
if (flags & __WEBPACK_IMPORTED_MODULE_1__angular_core__["Y" /* RendererStyleFlags2 */].DashCase) {
el.style.removeProperty(style);
}
else {
// IE requires '' instead of null
// see https://github.com/angular/angular/issues/7916
el.style[style] = '';
}
};
/**
* @param {?} el
* @param {?} name
* @param {?} value
* @return {?}
*/
DefaultDomRenderer2.prototype.setProperty = /**
* @param {?} el
* @param {?} name
* @param {?} value
* @return {?}
*/
function (el, name, value) {
checkNoSyntheticProp(name, 'property');
el[name] = value;
};
/**
* @param {?} node
* @param {?} value
* @return {?}
*/
DefaultDomRenderer2.prototype.setValue = /**
* @param {?} node
* @param {?} value
* @return {?}
*/
function (node, value) { node.nodeValue = value; };
/**
* @param {?} target
* @param {?} event
* @param {?} callback
* @return {?}
*/
DefaultDomRenderer2.prototype.listen = /**
* @param {?} target
* @param {?} event
* @param {?} callback
* @return {?}
*/
function (target, event, callback) {
checkNoSyntheticProp(event, 'listener');
if (typeof target === 'string') {
return /** @type {?} */ (this.eventManager.addGlobalEventListener(target, event, decoratePreventDefault(callback)));
}
return /** @type {?} */ ((this.eventManager.addEventListener(target, event, decoratePreventDefault(callback))));
};
return DefaultDomRenderer2;
}());
var AT_CHARCODE = '@'.charCodeAt(0);
/**
* @param {?} name
* @param {?} nameKind
* @return {?}
*/
function checkNoSyntheticProp(name, nameKind) {
if (name.charCodeAt(0) === AT_CHARCODE) {
throw new Error("Found the synthetic " + nameKind + " " + name + ". Please include either \"BrowserAnimationsModule\" or \"NoopAnimationsModule\" in your application.");
}
}
var EmulatedEncapsulationDomRenderer2 = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(EmulatedEncapsulationDomRenderer2, _super);
function EmulatedEncapsulationDomRenderer2(eventManager, sharedStylesHost, component) {
var _this = _super.call(this, eventManager) || this;
_this.component = component;
var /** @type {?} */ styles = flattenStyles(component.id, component.styles, []);
sharedStylesHost.addStyles(styles);
_this.contentAttr = shimContentAttribute(component.id);
_this.hostAttr = shimHostAttribute(component.id);
return _this;
}
/**
* @param {?} element
* @return {?}
*/
EmulatedEncapsulationDomRenderer2.prototype.applyToHost = /**
* @param {?} element
* @return {?}
*/
function (element) { _super.prototype.setAttribute.call(this, element, this.hostAttr, ''); };
/**
* @param {?} parent
* @param {?} name
* @return {?}
*/
EmulatedEncapsulationDomRenderer2.prototype.createElement = /**
* @param {?} parent
* @param {?} name
* @return {?}
*/
function (parent, name) {
var /** @type {?} */ el = _super.prototype.createElement.call(this, parent, name);
_super.prototype.setAttribute.call(this, el, this.contentAttr, '');
return el;
};
return EmulatedEncapsulationDomRenderer2;
}(DefaultDomRenderer2));
var ShadowDomRenderer = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(ShadowDomRenderer, _super);
function ShadowDomRenderer(eventManager, sharedStylesHost, hostEl, component) {
var _this = _super.call(this, eventManager) || this;
_this.sharedStylesHost = sharedStylesHost;
_this.hostEl = hostEl;
_this.component = component;
_this.shadowRoot = (/** @type {?} */ (hostEl)).createShadowRoot();
_this.sharedStylesHost.addHost(_this.shadowRoot);
var /** @type {?} */ styles = flattenStyles(component.id, component.styles, []);
for (var /** @type {?} */ i = 0; i < styles.length; i++) {
var /** @type {?} */ styleEl = document.createElement('style');
styleEl.textContent = styles[i];
_this.shadowRoot.appendChild(styleEl);
}
return _this;
}
/**
* @param {?} node
* @return {?}
*/
ShadowDomRenderer.prototype.nodeOrShadowRoot = /**
* @param {?} node
* @return {?}
*/
function (node) { return node === this.hostEl ? this.shadowRoot : node; };
/**
* @return {?}
*/
ShadowDomRenderer.prototype.destroy = /**
* @return {?}
*/
function () { this.sharedStylesHost.removeHost(this.shadowRoot); };
/**
* @param {?} parent
* @param {?} newChild
* @return {?}
*/
ShadowDomRenderer.prototype.appendChild = /**
* @param {?} parent
* @param {?} newChild
* @return {?}
*/
function (parent, newChild) {
return _super.prototype.appendChild.call(this, this.nodeOrShadowRoot(parent), newChild);
};
/**
* @param {?} parent
* @param {?} newChild
* @param {?} refChild
* @return {?}
*/
ShadowDomRenderer.prototype.insertBefore = /**
* @param {?} parent
* @param {?} newChild
* @param {?} refChild
* @return {?}
*/
function (parent, newChild, refChild) {
return _super.prototype.insertBefore.call(this, this.nodeOrShadowRoot(parent), newChild, refChild);
};
/**
* @param {?} parent
* @param {?} oldChild
* @return {?}
*/
ShadowDomRenderer.prototype.removeChild = /**
* @param {?} parent
* @param {?} oldChild
* @return {?}
*/
function (parent, oldChild) {
return _super.prototype.removeChild.call(this, this.nodeOrShadowRoot(parent), oldChild);
};
/**
* @param {?} node
* @return {?}
*/
ShadowDomRenderer.prototype.parentNode = /**
* @param {?} node
* @return {?}
*/
function (node) {
return this.nodeOrShadowRoot(_super.prototype.parentNode.call(this, this.nodeOrShadowRoot(node)));
};
return ShadowDomRenderer;
}(DefaultDomRenderer2));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var ɵ0 = function (v) {
return '__zone_symbol__' + v;
};
/**
* Detect if Zone is present. If it is then use simple zone aware 'addEventListener'
* since Angular can do much more
* efficient bookkeeping than Zone can, because we have additional information. This speeds up
* addEventListener by 3x.
*/
var __symbol__ = (typeof Zone !== 'undefined') && (/** @type {?} */ (Zone))['__symbol__'] || ɵ0;
var ADD_EVENT_LISTENER = __symbol__('addEventListener');
var REMOVE_EVENT_LISTENER = __symbol__('removeEventListener');
var symbolNames = {};
var FALSE = 'FALSE';
var ANGULAR = 'ANGULAR';
var NATIVE_ADD_LISTENER = 'addEventListener';
var NATIVE_REMOVE_LISTENER = 'removeEventListener';
// use the same symbol string which is used in zone.js
var stopSymbol = '__zone_symbol__propagationStopped';
var stopMethodSymbol = '__zone_symbol__stopImmediatePropagation';
var blackListedEvents = (typeof Zone !== 'undefined') && (/** @type {?} */ (Zone))[__symbol__('BLACK_LISTED_EVENTS')];
var blackListedMap;
if (blackListedEvents) {
blackListedMap = {};
blackListedEvents.forEach(function (eventName) { blackListedMap[eventName] = eventName; });
}
var isBlackListedEvent = function (eventName) {
if (!blackListedMap) {
return false;
}
return blackListedMap.hasOwnProperty(eventName);
};
// a global listener to handle all dom event,
// so we do not need to create a closure everytime
var globalListener = function (event) {
var /** @type {?} */ symbolName = symbolNames[event.type];
if (!symbolName) {
return;
}
var /** @type {?} */ taskDatas = this[symbolName];
if (!taskDatas) {
return;
}
var /** @type {?} */ args = [event];
if (taskDatas.length === 1) {
// if taskDatas only have one element, just invoke it
var /** @type {?} */ taskData = taskDatas[0];
if (taskData.zone !== Zone.current) {
// only use Zone.run when Zone.current not equals to stored zone
return taskData.zone.run(taskData.handler, this, args);
}
else {
return taskData.handler.apply(this, args);
}
}
else {
// copy tasks as a snapshot to avoid event handlers remove
// itself or others
var /** @type {?} */ copiedTasks = taskDatas.slice();
for (var /** @type {?} */ i = 0; i < copiedTasks.length; i++) {
// if other listener call event.stopImmediatePropagation
// just break
if ((/** @type {?} */ (event))[stopSymbol] === true) {
break;
}
var /** @type {?} */ taskData = copiedTasks[i];
if (taskData.zone !== Zone.current) {
// only use Zone.run when Zone.current not equals to stored zone
taskData.zone.run(taskData.handler, this, args);
}
else {
taskData.handler.apply(this, args);
}
}
}
};
var DomEventsPlugin = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(DomEventsPlugin, _super);
function DomEventsPlugin(doc, ngZone) {
var _this = _super.call(this, doc) || this;
_this.ngZone = ngZone;
_this.patchEvent();
return _this;
}
/**
* @return {?}
*/
DomEventsPlugin.prototype.patchEvent = /**
* @return {?}
*/
function () {
if (!Event || !Event.prototype) {
return;
}
if ((/** @type {?} */ (Event.prototype))[stopMethodSymbol]) {
// already patched by zone.js
return;
}
var /** @type {?} */ delegate = (/** @type {?} */ (Event.prototype))[stopMethodSymbol] =
Event.prototype.stopImmediatePropagation;
Event.prototype.stopImmediatePropagation = function () {
if (this) {
this[stopSymbol] = true;
}
// should call native delegate in case
// in some enviroment part of the application
// will not use the patched Event
delegate && delegate.apply(this, arguments);
};
};
// This plugin should come last in the list of plugins, because it accepts all
// events.
/**
* @param {?} eventName
* @return {?}
*/
DomEventsPlugin.prototype.supports = /**
* @param {?} eventName
* @return {?}
*/
function (eventName) { return true; };
/**
* @param {?} element
* @param {?} eventName
* @param {?} handler
* @return {?}
*/
DomEventsPlugin.prototype.addEventListener = /**
* @param {?} element
* @param {?} eventName
* @param {?} handler
* @return {?}
*/
function (element, eventName, handler) {
var _this = this;
/**
* This code is about to add a listener to the DOM. If Zone.js is present, than
* `addEventListener` has been patched. The patched code adds overhead in both
* memory and speed (3x slower) than native. For this reason if we detect that
* Zone.js is present we use a simple version of zone aware addEventListener instead.
* The result is faster registration and the zone will be restored.
* But ZoneSpec.onScheduleTask, ZoneSpec.onInvokeTask, ZoneSpec.onCancelTask
* will not be invoked
* We also do manual zone restoration in element.ts renderEventHandlerClosure method.
*
* NOTE: it is possible that the element is from different iframe, and so we
* have to check before we execute the method.
*/
var /** @type {?} */ self = this;
var /** @type {?} */ zoneJsLoaded = element[ADD_EVENT_LISTENER];
var /** @type {?} */ callback = /** @type {?} */ (handler);
// if zonejs is loaded and current zone is not ngZone
// we keep Zone.current on target for later restoration.
if (zoneJsLoaded && (!__WEBPACK_IMPORTED_MODULE_1__angular_core__["M" /* NgZone */].isInAngularZone() || isBlackListedEvent(eventName))) {
var /** @type {?} */ symbolName = symbolNames[eventName];
if (!symbolName) {
symbolName = symbolNames[eventName] = __symbol__(ANGULAR + eventName + FALSE);
}
var /** @type {?} */ taskDatas = (/** @type {?} */ (element))[symbolName];
var /** @type {?} */ globalListenerRegistered = taskDatas && taskDatas.length > 0;
if (!taskDatas) {
taskDatas = (/** @type {?} */ (element))[symbolName] = [];
}
var /** @type {?} */ zone = isBlackListedEvent(eventName) ? Zone.root : Zone.current;
if (taskDatas.length === 0) {
taskDatas.push({ zone: zone, handler: callback });
}
else {
var /** @type {?} */ callbackRegistered = false;
for (var /** @type {?} */ i = 0; i < taskDatas.length; i++) {
if (taskDatas[i].handler === callback) {
callbackRegistered = true;
break;
}
}
if (!callbackRegistered) {
taskDatas.push({ zone: zone, handler: callback });
}
}
if (!globalListenerRegistered) {
element[ADD_EVENT_LISTENER](eventName, globalListener, false);
}
}
else {
element[NATIVE_ADD_LISTENER](eventName, callback, false);
}
return function () { return _this.removeEventListener(element, eventName, callback); };
};
/**
* @param {?} target
* @param {?} eventName
* @param {?} callback
* @return {?}
*/
DomEventsPlugin.prototype.removeEventListener = /**
* @param {?} target
* @param {?} eventName
* @param {?} callback
* @return {?}
*/
function (target, eventName, callback) {
var /** @type {?} */ underlyingRemove = target[REMOVE_EVENT_LISTENER];
// zone.js not loaded, use native removeEventListener
if (!underlyingRemove) {
return target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]);
}
var /** @type {?} */ symbolName = symbolNames[eventName];
var /** @type {?} */ taskDatas = symbolName && target[symbolName];
if (!taskDatas) {
// addEventListener not using patched version
// just call native removeEventListener
return target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]);
}
// fix issue 20532, should be able to remove
// listener which was added inside of ngZone
var /** @type {?} */ found = false;
for (var /** @type {?} */ i = 0; i < taskDatas.length; i++) {
// remove listener from taskDatas if the callback equals
if (taskDatas[i].handler === callback) {
found = true;
taskDatas.splice(i, 1);
break;
}
}
if (found) {
if (taskDatas.length === 0) {
// all listeners are removed, we can remove the globalListener from target
underlyingRemove.apply(target, [eventName, globalListener, false]);
}
}
else {
// not found in taskDatas, the callback may be added inside of ngZone
// use native remove listener to remove the calback
target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]);
}
};
DomEventsPlugin.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
DomEventsPlugin.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [DOCUMENT$1,] },] },
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["M" /* NgZone */], },
]; };
return DomEventsPlugin;
}(EventManagerPlugin));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var EVENT_NAMES = {
// pan
'pan': true,
'panstart': true,
'panmove': true,
'panend': true,
'pancancel': true,
'panleft': true,
'panright': true,
'panup': true,
'pandown': true,
// pinch
'pinch': true,
'pinchstart': true,
'pinchmove': true,
'pinchend': true,
'pinchcancel': true,
'pinchin': true,
'pinchout': true,
// press
'press': true,
'pressup': true,
// rotate
'rotate': true,
'rotatestart': true,
'rotatemove': true,
'rotateend': true,
'rotatecancel': true,
// swipe
'swipe': true,
'swipeleft': true,
'swiperight': true,
'swipeup': true,
'swipedown': true,
// tap
'tap': true,
};
/**
* A DI token that you can use to provide{\@link HammerGestureConfig} to Angular. Use it to configure
* Hammer gestures.
*
* \@experimental
*/
var HAMMER_GESTURE_CONFIG = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["B" /* InjectionToken */]('HammerGestureConfig');
/**
* @record
*/
/**
* \@experimental
*/
var HammerGestureConfig = (function () {
function HammerGestureConfig() {
this.events = [];
this.overrides = {};
}
/**
* @param {?} element
* @return {?}
*/
HammerGestureConfig.prototype.buildHammer = /**
* @param {?} element
* @return {?}
*/
function (element) {
var /** @type {?} */ mc = new Hammer(element);
mc.get('pinch').set({ enable: true });
mc.get('rotate').set({ enable: true });
for (var /** @type {?} */ eventName in this.overrides) {
mc.get(eventName).set(this.overrides[eventName]);
}
return mc;
};
HammerGestureConfig.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
HammerGestureConfig.ctorParameters = function () { return []; };
return HammerGestureConfig;
}());
var HammerGesturesPlugin = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(HammerGesturesPlugin, _super);
function HammerGesturesPlugin(doc, _config) {
var _this = _super.call(this, doc) || this;
_this._config = _config;
return _this;
}
/**
* @param {?} eventName
* @return {?}
*/
HammerGesturesPlugin.prototype.supports = /**
* @param {?} eventName
* @return {?}
*/
function (eventName) {
if (!EVENT_NAMES.hasOwnProperty(eventName.toLowerCase()) && !this.isCustomEvent(eventName)) {
return false;
}
if (!(/** @type {?} */ (window)).Hammer) {
throw new Error("Hammer.js is not loaded, can not bind " + eventName + " event");
}
return true;
};
/**
* @param {?} element
* @param {?} eventName
* @param {?} handler
* @return {?}
*/
HammerGesturesPlugin.prototype.addEventListener = /**
* @param {?} element
* @param {?} eventName
* @param {?} handler
* @return {?}
*/
function (element, eventName, handler) {
var _this = this;
var /** @type {?} */ zone = this.manager.getZone();
eventName = eventName.toLowerCase();
return zone.runOutsideAngular(function () {
// Creating the manager bind events, must be done outside of angular
var /** @type {?} */ mc = _this._config.buildHammer(element);
var /** @type {?} */ callback = function (eventObj) {
zone.runGuarded(function () { handler(eventObj); });
};
mc.on(eventName, callback);
return function () { return mc.off(eventName, callback); };
});
};
/**
* @param {?} eventName
* @return {?}
*/
HammerGesturesPlugin.prototype.isCustomEvent = /**
* @param {?} eventName
* @return {?}
*/
function (eventName) { return this._config.events.indexOf(eventName) > -1; };
HammerGesturesPlugin.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
HammerGesturesPlugin.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [DOCUMENT$1,] },] },
{ type: HammerGestureConfig, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [HAMMER_GESTURE_CONFIG,] },] },
]; };
return HammerGesturesPlugin;
}(EventManagerPlugin));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var MODIFIER_KEYS = ['alt', 'control', 'meta', 'shift'];
var ɵ0$1 = function (event) { return event.altKey; };
var ɵ1$1 = function (event) { return event.ctrlKey; };
var ɵ2$1 = function (event) { return event.metaKey; };
var ɵ3 = function (event) { return event.shiftKey; };
var MODIFIER_KEY_GETTERS = {
'alt': ɵ0$1,
'control': ɵ1$1,
'meta': ɵ2$1,
'shift': ɵ3
};
/**
* \@experimental
*/
var KeyEventsPlugin = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(KeyEventsPlugin, _super);
function KeyEventsPlugin(doc) {
return _super.call(this, doc) || this;
}
/**
* @param {?} eventName
* @return {?}
*/
KeyEventsPlugin.prototype.supports = /**
* @param {?} eventName
* @return {?}
*/
function (eventName) { return KeyEventsPlugin.parseEventName(eventName) != null; };
/**
* @param {?} element
* @param {?} eventName
* @param {?} handler
* @return {?}
*/
KeyEventsPlugin.prototype.addEventListener = /**
* @param {?} element
* @param {?} eventName
* @param {?} handler
* @return {?}
*/
function (element, eventName, handler) {
var /** @type {?} */ parsedEvent = /** @type {?} */ ((KeyEventsPlugin.parseEventName(eventName)));
var /** @type {?} */ outsideHandler = KeyEventsPlugin.eventCallback(parsedEvent['fullKey'], handler, this.manager.getZone());
return this.manager.getZone().runOutsideAngular(function () {
return getDOM().onAndCancel(element, parsedEvent['domEventName'], outsideHandler);
});
};
/**
* @param {?} eventName
* @return {?}
*/
KeyEventsPlugin.parseEventName = /**
* @param {?} eventName
* @return {?}
*/
function (eventName) {
var /** @type {?} */ parts = eventName.toLowerCase().split('.');
var /** @type {?} */ domEventName = parts.shift();
if ((parts.length === 0) || !(domEventName === 'keydown' || domEventName === 'keyup')) {
return null;
}
var /** @type {?} */ key = KeyEventsPlugin._normalizeKey(/** @type {?} */ ((parts.pop())));
var /** @type {?} */ fullKey = '';
MODIFIER_KEYS.forEach(function (modifierName) {
var /** @type {?} */ index = parts.indexOf(modifierName);
if (index > -1) {
parts.splice(index, 1);
fullKey += modifierName + '.';
}
});
fullKey += key;
if (parts.length != 0 || key.length === 0) {
// returning null instead of throwing to let another plugin process the event
return null;
}
var /** @type {?} */ result = {};
result['domEventName'] = domEventName;
result['fullKey'] = fullKey;
return result;
};
/**
* @param {?} event
* @return {?}
*/
KeyEventsPlugin.getEventFullKey = /**
* @param {?} event
* @return {?}
*/
function (event) {
var /** @type {?} */ fullKey = '';
var /** @type {?} */ key = getDOM().getEventKey(event);
key = key.toLowerCase();
if (key === ' ') {
key = 'space'; // for readability
}
else if (key === '.') {
key = 'dot'; // because '.' is used as a separator in event names
}
MODIFIER_KEYS.forEach(function (modifierName) {
if (modifierName != key) {
var /** @type {?} */ modifierGetter = MODIFIER_KEY_GETTERS[modifierName];
if (modifierGetter(event)) {
fullKey += modifierName + '.';
}
}
});
fullKey += key;
return fullKey;
};
/**
* @param {?} fullKey
* @param {?} handler
* @param {?} zone
* @return {?}
*/
KeyEventsPlugin.eventCallback = /**
* @param {?} fullKey
* @param {?} handler
* @param {?} zone
* @return {?}
*/
function (fullKey, handler, zone) {
return function (event /** TODO #9100 */) {
if (KeyEventsPlugin.getEventFullKey(event) === fullKey) {
zone.runGuarded(function () { return handler(event); });
}
};
};
/** @internal */
/**
* \@internal
* @param {?} keyName
* @return {?}
*/
KeyEventsPlugin._normalizeKey = /**
* \@internal
* @param {?} keyName
* @return {?}
*/
function (keyName) {
// TODO: switch to a Map if the mapping grows too much
switch (keyName) {
case 'esc':
return 'escape';
default:
return keyName;
}
};
KeyEventsPlugin.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
KeyEventsPlugin.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [DOCUMENT$1,] },] },
]; };
return KeyEventsPlugin;
}(EventManagerPlugin));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* A pattern that recognizes a commonly useful subset of URLs that are safe.
*
* This regular expression matches a subset of URLs that will not cause script
* execution if used in URL context within a HTML document. Specifically, this
* regular expression matches if (comment from here on and regex copied from
* Soy's EscapingConventions):
* (1) Either a protocol in a whitelist (http, https, mailto or ftp).
* (2) or no protocol. A protocol must be followed by a colon. The below
* allows that by allowing colons only after one of the characters [/?#].
* A colon after a hash (#) must be in the fragment.
* Otherwise, a colon after a (?) must be in a query.
* Otherwise, a colon after a single solidus (/) must be in a path.
* Otherwise, a colon after a double solidus (//) must be in the authority
* (before port).
*
* The pattern disallows &, used in HTML entity declarations before
* one of the characters in [/?#]. This disallows HTML entities used in the
* protocol name, which should never happen, e.g. "http" for "http".
* It also disallows HTML entities in the first path part of a relative path,
* e.g. "foo<bar/baz". Our existing escaping functions should not produce
* that. More importantly, it disallows masking of a colon,
* e.g. "javascript:...".
*
* This regular expression was taken from the Closure sanitization library.
*/
var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
/**
* A pattern that matches safe data URLs. Only matches image, video and audio types.
*/
var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+\/]+=*$/i;
/**
* @param {?} url
* @return {?}
*/
function sanitizeUrl(url) {
url = String(url);
if (url.match(SAFE_URL_PATTERN) || url.match(DATA_URL_PATTERN))
return url;
if (Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_16" /* isDevMode */])()) {
getDOM().log("WARNING: sanitizing unsafe URL value " + url + " (see http://g.co/ng/security#xss)");
}
return 'unsafe:' + url;
}
/**
* @param {?} srcset
* @return {?}
*/
function sanitizeSrcset(srcset) {
srcset = String(srcset);
return srcset.split(',').map(function (srcset) { return sanitizeUrl(srcset.trim()); }).join(', ');
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* A <body> element that can be safely used to parse untrusted HTML. Lazily initialized below.
*/
var inertElement = null;
/**
* Lazily initialized to make sure the DOM adapter gets set before use.
*/
var DOM = /** @type {?} */ ((null));
/**
* Returns an HTML element that is guaranteed to not execute code when creating elements in it.
* @return {?}
*/
function getInertElement() {
if (inertElement)
return inertElement;
DOM = getDOM();
// Prefer using <template> element if supported.
var /** @type {?} */ templateEl = DOM.createElement('template');
if ('content' in templateEl)
return templateEl;
var /** @type {?} */ doc = DOM.createHtmlDocument();
inertElement = DOM.querySelector(doc, 'body');
if (inertElement == null) {
// usually there should be only one body element in the document, but IE doesn't have any, so we
// need to create one.
var /** @type {?} */ html = DOM.createElement('html', doc);
inertElement = DOM.createElement('body', doc);
DOM.appendChild(html, inertElement);
DOM.appendChild(doc, html);
}
return inertElement;
}
/**
* @param {?} tags
* @return {?}
*/
function tagSet(tags) {
var /** @type {?} */ res = {};
for (var _i = 0, _a = tags.split(','); _i < _a.length; _i++) {
var t = _a[_i];
res[t] = true;
}
return res;
}
/**
* @param {...?} sets
* @return {?}
*/
function merge() {
var sets = [];
for (var _i = 0; _i < arguments.length; _i++) {
sets[_i] = arguments[_i];
}
var /** @type {?} */ res = {};
for (var _a = 0, sets_1 = sets; _a < sets_1.length; _a++) {
var s = sets_1[_a];
for (var /** @type {?} */ v in s) {
if (s.hasOwnProperty(v))
res[v] = true;
}
}
return res;
}
// Good source of info about elements and attributes
// http://dev.w3.org/html5/spec/Overview.html#semantics
// http://simon.html5.org/html-elements
// Safe Void Elements - HTML5
// http://dev.w3.org/html5/spec/Overview.html#void-elements
var VOID_ELEMENTS = tagSet('area,br,col,hr,img,wbr');
// Elements that you can, intentionally, leave open (and which close themselves)
// http://dev.w3.org/html5/spec/Overview.html#optional-tags
var OPTIONAL_END_TAG_BLOCK_ELEMENTS = tagSet('colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr');
var OPTIONAL_END_TAG_INLINE_ELEMENTS = tagSet('rp,rt');
var OPTIONAL_END_TAG_ELEMENTS = merge(OPTIONAL_END_TAG_INLINE_ELEMENTS, OPTIONAL_END_TAG_BLOCK_ELEMENTS);
// Safe Block Elements - HTML5
var BLOCK_ELEMENTS = merge(OPTIONAL_END_TAG_BLOCK_ELEMENTS, tagSet('address,article,' +
'aside,blockquote,caption,center,del,details,dialog,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,' +
'h6,header,hgroup,hr,ins,main,map,menu,nav,ol,pre,section,summary,table,ul'));
// Inline Elements - HTML5
var INLINE_ELEMENTS = merge(OPTIONAL_END_TAG_INLINE_ELEMENTS, tagSet('a,abbr,acronym,audio,b,' +
'bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,picture,q,ruby,rp,rt,s,' +
'samp,small,source,span,strike,strong,sub,sup,time,track,tt,u,var,video'));
var VALID_ELEMENTS = merge(VOID_ELEMENTS, BLOCK_ELEMENTS, INLINE_ELEMENTS, OPTIONAL_END_TAG_ELEMENTS);
// Attributes that have href and hence need to be sanitized
var URI_ATTRS = tagSet('background,cite,href,itemtype,longdesc,poster,src,xlink:href');
// Attributes that have special href set hence need to be sanitized
var SRCSET_ATTRS = tagSet('srcset');
var HTML_ATTRS = tagSet('abbr,accesskey,align,alt,autoplay,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,' +
'compact,controls,coords,datetime,default,dir,download,face,headers,height,hidden,hreflang,hspace,' +
'ismap,itemscope,itemprop,kind,label,lang,language,loop,media,muted,nohref,nowrap,open,preload,rel,rev,role,rows,rowspan,rules,' +
'scope,scrolling,shape,size,sizes,span,srclang,start,summary,tabindex,target,title,translate,type,usemap,' +
'valign,value,vspace,width');
// NB: This currently consciously doesn't support SVG. SVG sanitization has had several security
// issues in the past, so it seems safer to leave it out if possible. If support for binding SVG via
// innerHTML is required, SVG attributes should be added here.
// NB: Sanitization does not allow <form> elements or other active elements (<button> etc). Those
// can be sanitized, but they increase security surface area without a legitimate use case, so they
// are left out here.
var VALID_ATTRS = merge(URI_ATTRS, SRCSET_ATTRS, HTML_ATTRS);
/**
* SanitizingHtmlSerializer serializes a DOM fragment, stripping out any unsafe elements and unsafe
* attributes.
*/
var SanitizingHtmlSerializer = (function () {
function SanitizingHtmlSerializer() {
this.sanitizedSomething = false;
this.buf = [];
}
/**
* @param {?} el
* @return {?}
*/
SanitizingHtmlSerializer.prototype.sanitizeChildren = /**
* @param {?} el
* @return {?}
*/
function (el) {
// This cannot use a TreeWalker, as it has to run on Angular's various DOM adapters.
// However this code never accesses properties off of `document` before deleting its contents
// again, so it shouldn't be vulnerable to DOM clobbering.
var /** @type {?} */ current = /** @type {?} */ ((el.firstChild));
while (current) {
if (DOM.isElementNode(current)) {
this.startElement(/** @type {?} */ (current));
}
else if (DOM.isTextNode(current)) {
this.chars(/** @type {?} */ ((DOM.nodeValue(current))));
}
else {
// Strip non-element, non-text nodes.
this.sanitizedSomething = true;
}
if (DOM.firstChild(current)) {
current = /** @type {?} */ ((DOM.firstChild(current)));
continue;
}
while (current) {
// Leaving the element. Walk up and to the right, closing tags as we go.
if (DOM.isElementNode(current)) {
this.endElement(/** @type {?} */ (current));
}
var /** @type {?} */ next = checkClobberedElement(current, /** @type {?} */ ((DOM.nextSibling(current))));
if (next) {
current = next;
break;
}
current = checkClobberedElement(current, /** @type {?} */ ((DOM.parentElement(current))));
}
}
return this.buf.join('');
};
/**
* @param {?} element
* @return {?}
*/
SanitizingHtmlSerializer.prototype.startElement = /**
* @param {?} element
* @return {?}
*/
function (element) {
var _this = this;
var /** @type {?} */ tagName = DOM.nodeName(element).toLowerCase();
if (!VALID_ELEMENTS.hasOwnProperty(tagName)) {
this.sanitizedSomething = true;
return;
}
this.buf.push('<');
this.buf.push(tagName);
DOM.attributeMap(element).forEach(function (value, attrName) {
var /** @type {?} */ lower = attrName.toLowerCase();
if (!VALID_ATTRS.hasOwnProperty(lower)) {
_this.sanitizedSomething = true;
return;
}
// TODO(martinprobst): Special case image URIs for data:image/...
if (URI_ATTRS[lower])
value = sanitizeUrl(value);
if (SRCSET_ATTRS[lower])
value = sanitizeSrcset(value);
_this.buf.push(' ');
_this.buf.push(attrName);
_this.buf.push('="');
_this.buf.push(encodeEntities(value));
_this.buf.push('"');
});
this.buf.push('>');
};
/**
* @param {?} current
* @return {?}
*/
SanitizingHtmlSerializer.prototype.endElement = /**
* @param {?} current
* @return {?}
*/
function (current) {
var /** @type {?} */ tagName = DOM.nodeName(current).toLowerCase();
if (VALID_ELEMENTS.hasOwnProperty(tagName) && !VOID_ELEMENTS.hasOwnProperty(tagName)) {
this.buf.push('</');
this.buf.push(tagName);
this.buf.push('>');
}
};
/**
* @param {?} chars
* @return {?}
*/
SanitizingHtmlSerializer.prototype.chars = /**
* @param {?} chars
* @return {?}
*/
function (chars) { this.buf.push(encodeEntities(chars)); };
return SanitizingHtmlSerializer;
}());
/**
* @param {?} node
* @param {?} nextNode
* @return {?}
*/
function checkClobberedElement(node, nextNode) {
if (nextNode && DOM.contains(node, nextNode)) {
throw new Error("Failed to sanitize html because the element is clobbered: " + DOM.getOuterHTML(node));
}
return nextNode;
}
// Regular Expressions for parsing tags and attributes
var SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
// ! to ~ is the ASCII range.
var NON_ALPHANUMERIC_REGEXP = /([^\#-~ |!])/g;
/**
* Escapes all potentially dangerous characters, so that the
* resulting string can be safely inserted into attribute or
* element text.
* @param {?} value
* @return {?}
*/
function encodeEntities(value) {
return value.replace(/&/g, '&')
.replace(SURROGATE_PAIR_REGEXP, function (match) {
var /** @type {?} */ hi = match.charCodeAt(0);
var /** @type {?} */ low = match.charCodeAt(1);
return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
})
.replace(NON_ALPHANUMERIC_REGEXP, function (match) { return '&#' + match.charCodeAt(0) + ';'; })
.replace(/</g, '<')
.replace(/>/g, '>');
}
/**
* When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1'
* attribute to declare ns1 namespace and prefixes the attribute with 'ns1' (e.g. 'ns1:xlink:foo').
*
* This is undesirable since we don't want to allow any of these custom attributes. This method
* strips them all.
* @param {?} el
* @return {?}
*/
function stripCustomNsAttrs(el) {
DOM.attributeMap(el).forEach(function (_, attrName) {
if (attrName === 'xmlns:ns1' || attrName.indexOf('ns1:') === 0) {
DOM.removeAttribute(el, attrName);
}
});
for (var _i = 0, _a = DOM.childNodesAsList(el); _i < _a.length; _i++) {
var n = _a[_i];
if (DOM.isElementNode(n))
stripCustomNsAttrs(/** @type {?} */ (n));
}
}
/**
* Sanitizes the given unsafe, untrusted HTML fragment, and returns HTML text that is safe to add to
* the DOM in a browser environment.
* @param {?} defaultDoc
* @param {?} unsafeHtmlInput
* @return {?}
*/
function sanitizeHtml(defaultDoc, unsafeHtmlInput) {
try {
var /** @type {?} */ containerEl = getInertElement();
// Make sure unsafeHtml is actually a string (TypeScript types are not enforced at runtime).
var /** @type {?} */ unsafeHtml = unsafeHtmlInput ? String(unsafeHtmlInput) : '';
// mXSS protection. Repeatedly parse the document to make sure it stabilizes, so that a browser
// trying to auto-correct incorrect HTML cannot cause formerly inert HTML to become dangerous.
var /** @type {?} */ mXSSAttempts = 5;
var /** @type {?} */ parsedHtml = unsafeHtml;
do {
if (mXSSAttempts === 0) {
throw new Error('Failed to sanitize html because the input is unstable');
}
mXSSAttempts--;
unsafeHtml = parsedHtml;
DOM.setInnerHTML(containerEl, unsafeHtml);
if (defaultDoc.documentMode) {
// strip custom-namespaced attributes on IE<=11
stripCustomNsAttrs(containerEl);
}
parsedHtml = DOM.getInnerHTML(containerEl);
} while (unsafeHtml !== parsedHtml);
var /** @type {?} */ sanitizer = new SanitizingHtmlSerializer();
var /** @type {?} */ safeHtml = sanitizer.sanitizeChildren(DOM.getTemplateContent(containerEl) || containerEl);
// Clear out the body element.
var /** @type {?} */ parent_1 = DOM.getTemplateContent(containerEl) || containerEl;
for (var _i = 0, _a = DOM.childNodesAsList(parent_1); _i < _a.length; _i++) {
var child = _a[_i];
DOM.removeChild(parent_1, child);
}
if (Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_16" /* isDevMode */])() && sanitizer.sanitizedSomething) {
DOM.log('WARNING: sanitizing HTML stripped some content (see http://g.co/ng/security#xss).');
}
return safeHtml;
}
catch (/** @type {?} */ e) {
// In case anything goes wrong, clear out inertElement to reset the entire DOM structure.
inertElement = null;
throw e;
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Regular expression for safe style values.
*
* Quotes (" and ') are allowed, but a check must be done elsewhere to ensure they're balanced.
*
* ',' allows multiple values to be assigned to the same property (e.g. background-attachment or
* font-family) and hence could allow multiple values to get injected, but that should pose no risk
* of XSS.
*
* The function expression checks only for XSS safety, not for CSS validity.
*
* This regular expression was taken from the Closure sanitization library, and augmented for
* transformation values.
*/
var VALUES = '[-,."\'%_!# a-zA-Z0-9]+';
var TRANSFORMATION_FNS = '(?:matrix|translate|scale|rotate|skew|perspective)(?:X|Y|3d)?';
var COLOR_FNS = '(?:rgb|hsl)a?';
var GRADIENTS = '(?:repeating-)?(?:linear|radial)-gradient';
var CSS3_FNS = '(?:calc|attr)';
var FN_ARGS = '\\([-0-9.%, #a-zA-Z]+\\)';
var SAFE_STYLE_VALUE = new RegExp("^(" + VALUES + "|" +
("(?:" + TRANSFORMATION_FNS + "|" + COLOR_FNS + "|" + GRADIENTS + "|" + CSS3_FNS + ")") +
(FN_ARGS + ")$"), 'g');
/**
* Matches a `url(...)` value with an arbitrary argument as long as it does
* not contain parentheses.
*
* The URL value still needs to be sanitized separately.
*
* `url(...)` values are a very common use case, e.g. for `background-image`. With carefully crafted
* CSS style rules, it is possible to construct an information leak with `url` values in CSS, e.g.
* by observing whether scroll bars are displayed, or character ranges used by a font face
* definition.
*
* Angular only allows binding CSS values (as opposed to entire CSS rules), so it is unlikely that
* binding a URL value without further cooperation from the page will cause an information leak, and
* if so, it is just a leak, not a full blown XSS vulnerability.
*
* Given the common use case, low likelihood of attack vector, and low impact of an attack, this
* code is permissive and allows URLs that sanitize otherwise.
*/
var URL_RE = /^url\(([^)]+)\)$/;
/**
* Checks that quotes (" and ') are properly balanced inside a string. Assumes
* that neither escape (\) nor any other character that could result in
* breaking out of a string parsing context are allowed;
* see http://www.w3.org/TR/css3-syntax/#string-token-diagram.
*
* This code was taken from the Closure sanitization library.
* @param {?} value
* @return {?}
*/
function hasBalancedQuotes(value) {
var /** @type {?} */ outsideSingle = true;
var /** @type {?} */ outsideDouble = true;
for (var /** @type {?} */ i = 0; i < value.length; i++) {
var /** @type {?} */ c = value.charAt(i);
if (c === '\'' && outsideDouble) {
outsideSingle = !outsideSingle;
}
else if (c === '"' && outsideSingle) {
outsideDouble = !outsideDouble;
}
}
return outsideSingle && outsideDouble;
}
/**
* Sanitizes the given untrusted CSS style property value (i.e. not an entire object, just a single
* value) and returns a value that is safe to use in a browser environment.
* @param {?} value
* @return {?}
*/
function sanitizeStyle(value) {
value = String(value).trim(); // Make sure it's actually a string.
if (!value)
return '';
// Single url(...) values are supported, but only for URLs that sanitize cleanly. See above for
// reasoning behind this.
var /** @type {?} */ urlMatch = value.match(URL_RE);
if ((urlMatch && sanitizeUrl(urlMatch[1]) === urlMatch[1]) ||
value.match(SAFE_STYLE_VALUE) && hasBalancedQuotes(value)) {
return value; // Safe style values.
}
if (Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_16" /* isDevMode */])()) {
getDOM().log("WARNING: sanitizing unsafe style value " + value + " (see http://g.co/ng/security#xss).");
}
return 'unsafe';
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Marker interface for a value that's safe to use in a particular context.
*
* \@stable
* @record
*/
/**
* Marker interface for a value that's safe to use as HTML.
*
* \@stable
* @record
*/
/**
* Marker interface for a value that's safe to use as style (CSS).
*
* \@stable
* @record
*/
/**
* Marker interface for a value that's safe to use as JavaScript.
*
* \@stable
* @record
*/
/**
* Marker interface for a value that's safe to use as a URL linking to a document.
*
* \@stable
* @record
*/
/**
* Marker interface for a value that's safe to use as a URL to load executable code from.
*
* \@stable
* @record
*/
/**
* DomSanitizer helps preventing Cross Site Scripting Security bugs (XSS) by sanitizing
* values to be safe to use in the different DOM contexts.
*
* For example, when binding a URL in an `<a [href]="someValue">` hyperlink, `someValue` will be
* sanitized so that an attacker cannot inject e.g. a `javascript:` URL that would execute code on
* the website.
*
* In specific situations, it might be necessary to disable sanitization, for example if the
* application genuinely needs to produce a `javascript:` style link with a dynamic value in it.
* Users can bypass security by constructing a value with one of the `bypassSecurityTrust...`
* methods, and then binding to that value from the template.
*
* These situations should be very rare, and extraordinary care must be taken to avoid creating a
* Cross Site Scripting (XSS) security bug!
*
* When using `bypassSecurityTrust...`, make sure to call the method as early as possible and as
* close as possible to the source of the value, to make it easy to verify no security bug is
* created by its use.
*
* It is not required (and not recommended) to bypass security if the value is safe, e.g. a URL that
* does not start with a suspicious protocol, or an HTML snippet that does not contain dangerous
* code. The sanitizer leaves safe values intact.
*
* \@security Calling any of the `bypassSecurityTrust...` APIs disables Angular's built-in
* sanitization for the value passed in. Carefully check and audit all values and code paths going
* into this call. Make sure any user data is appropriately escaped for this security context.
* For more detail, see the [Security Guide](http://g.co/ng/security).
*
* \@stable
* @abstract
*/
var DomSanitizer = (function () {
function DomSanitizer() {
}
return DomSanitizer;
}());
var DomSanitizerImpl = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(DomSanitizerImpl, _super);
function DomSanitizerImpl(_doc) {
var _this = _super.call(this) || this;
_this._doc = _doc;
return _this;
}
/**
* @param {?} ctx
* @param {?} value
* @return {?}
*/
DomSanitizerImpl.prototype.sanitize = /**
* @param {?} ctx
* @param {?} value
* @return {?}
*/
function (ctx, value) {
if (value == null)
return null;
switch (ctx) {
case __WEBPACK_IMPORTED_MODULE_1__angular_core__["_0" /* SecurityContext */].NONE:
return /** @type {?} */ (value);
case __WEBPACK_IMPORTED_MODULE_1__angular_core__["_0" /* SecurityContext */].HTML:
if (value instanceof SafeHtmlImpl)
return value.changingThisBreaksApplicationSecurity;
this.checkNotSafeValue(value, 'HTML');
return sanitizeHtml(this._doc, String(value));
case __WEBPACK_IMPORTED_MODULE_1__angular_core__["_0" /* SecurityContext */].STYLE:
if (value instanceof SafeStyleImpl)
return value.changingThisBreaksApplicationSecurity;
this.checkNotSafeValue(value, 'Style');
return sanitizeStyle(/** @type {?} */ (value));
case __WEBPACK_IMPORTED_MODULE_1__angular_core__["_0" /* SecurityContext */].SCRIPT:
if (value instanceof SafeScriptImpl)
return value.changingThisBreaksApplicationSecurity;
this.checkNotSafeValue(value, 'Script');
throw new Error('unsafe value used in a script context');
case __WEBPACK_IMPORTED_MODULE_1__angular_core__["_0" /* SecurityContext */].URL:
if (value instanceof SafeResourceUrlImpl || value instanceof SafeUrlImpl) {
// Allow resource URLs in URL contexts, they are strictly more trusted.
return value.changingThisBreaksApplicationSecurity;
}
this.checkNotSafeValue(value, 'URL');
return sanitizeUrl(String(value));
case __WEBPACK_IMPORTED_MODULE_1__angular_core__["_0" /* SecurityContext */].RESOURCE_URL:
if (value instanceof SafeResourceUrlImpl) {
return value.changingThisBreaksApplicationSecurity;
}
this.checkNotSafeValue(value, 'ResourceURL');
throw new Error('unsafe value used in a resource URL context (see http://g.co/ng/security#xss)');
default:
throw new Error("Unexpected SecurityContext " + ctx + " (see http://g.co/ng/security#xss)");
}
};
/**
* @param {?} value
* @param {?} expectedType
* @return {?}
*/
DomSanitizerImpl.prototype.checkNotSafeValue = /**
* @param {?} value
* @param {?} expectedType
* @return {?}
*/
function (value, expectedType) {
if (value instanceof SafeValueImpl) {
throw new Error("Required a safe " + expectedType + ", got a " + value.getTypeName() + " " +
"(see http://g.co/ng/security#xss)");
}
};
/**
* @param {?} value
* @return {?}
*/
DomSanitizerImpl.prototype.bypassSecurityTrustHtml = /**
* @param {?} value
* @return {?}
*/
function (value) { return new SafeHtmlImpl(value); };
/**
* @param {?} value
* @return {?}
*/
DomSanitizerImpl.prototype.bypassSecurityTrustStyle = /**
* @param {?} value
* @return {?}
*/
function (value) { return new SafeStyleImpl(value); };
/**
* @param {?} value
* @return {?}
*/
DomSanitizerImpl.prototype.bypassSecurityTrustScript = /**
* @param {?} value
* @return {?}
*/
function (value) { return new SafeScriptImpl(value); };
/**
* @param {?} value
* @return {?}
*/
DomSanitizerImpl.prototype.bypassSecurityTrustUrl = /**
* @param {?} value
* @return {?}
*/
function (value) { return new SafeUrlImpl(value); };
/**
* @param {?} value
* @return {?}
*/
DomSanitizerImpl.prototype.bypassSecurityTrustResourceUrl = /**
* @param {?} value
* @return {?}
*/
function (value) {
return new SafeResourceUrlImpl(value);
};
DomSanitizerImpl.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
DomSanitizerImpl.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */], args: [DOCUMENT$1,] },] },
]; };
return DomSanitizerImpl;
}(DomSanitizer));
/**
* @abstract
*/
var SafeValueImpl = (function () {
function SafeValueImpl(changingThisBreaksApplicationSecurity) {
// empty
this.changingThisBreaksApplicationSecurity = changingThisBreaksApplicationSecurity;
}
/**
* @return {?}
*/
SafeValueImpl.prototype.toString = /**
* @return {?}
*/
function () {
return "SafeValue must use [property]=binding: " + this.changingThisBreaksApplicationSecurity +
" (see http://g.co/ng/security#xss)";
};
return SafeValueImpl;
}());
var SafeHtmlImpl = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(SafeHtmlImpl, _super);
function SafeHtmlImpl() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @return {?}
*/
SafeHtmlImpl.prototype.getTypeName = /**
* @return {?}
*/
function () { return 'HTML'; };
return SafeHtmlImpl;
}(SafeValueImpl));
var SafeStyleImpl = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(SafeStyleImpl, _super);
function SafeStyleImpl() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @return {?}
*/
SafeStyleImpl.prototype.getTypeName = /**
* @return {?}
*/
function () { return 'Style'; };
return SafeStyleImpl;
}(SafeValueImpl));
var SafeScriptImpl = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(SafeScriptImpl, _super);
function SafeScriptImpl() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @return {?}
*/
SafeScriptImpl.prototype.getTypeName = /**
* @return {?}
*/
function () { return 'Script'; };
return SafeScriptImpl;
}(SafeValueImpl));
var SafeUrlImpl = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(SafeUrlImpl, _super);
function SafeUrlImpl() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @return {?}
*/
SafeUrlImpl.prototype.getTypeName = /**
* @return {?}
*/
function () { return 'URL'; };
return SafeUrlImpl;
}(SafeValueImpl));
var SafeResourceUrlImpl = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_2_tslib__["b" /* __extends */])(SafeResourceUrlImpl, _super);
function SafeResourceUrlImpl() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @return {?}
*/
SafeResourceUrlImpl.prototype.getTypeName = /**
* @return {?}
*/
function () { return 'ResourceURL'; };
return SafeResourceUrlImpl;
}(SafeValueImpl));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var INTERNAL_BROWSER_PLATFORM_PROVIDERS = [
{ provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Q" /* PLATFORM_ID */], useValue: __WEBPACK_IMPORTED_MODULE_0__angular_common__["i" /* ɵPLATFORM_BROWSER_ID */] },
{ provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["R" /* PLATFORM_INITIALIZER */], useValue: initDomAdapter, multi: true },
{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_common__["h" /* PlatformLocation */], useClass: BrowserPlatformLocation, deps: [DOCUMENT$1] },
{ provide: DOCUMENT$1, useFactory: _document, deps: [] },
];
/**
* \@security Replacing built-in sanitization providers exposes the application to XSS risks.
* Attacker-controlled data introduced by an unsanitized provider could expose your
* application to XSS risks. For more detail, see the [Security Guide](http://g.co/ng/security).
* \@experimental
*/
var BROWSER_SANITIZATION_PROVIDERS = [
{ provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Z" /* Sanitizer */], useExisting: DomSanitizer },
{ provide: DomSanitizer, useClass: DomSanitizerImpl, deps: [DOCUMENT$1] },
];
/**
* \@stable
*/
var platformBrowser = Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_13" /* createPlatformFactory */])(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_17" /* platformCore */], 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS);
/**
* @return {?}
*/
function initDomAdapter() {
BrowserDomAdapter.makeCurrent();
BrowserGetTestability.init();
}
/**
* @return {?}
*/
function errorHandler() {
return new __WEBPACK_IMPORTED_MODULE_1__angular_core__["u" /* ErrorHandler */]();
}
/**
* @return {?}
*/
function _document() {
return document;
}
/**
* The ng module for the browser.
*
* \@stable
*/
var BrowserModule = (function () {
function BrowserModule(parentModule) {
if (parentModule) {
throw new Error("BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.");
}
}
/**
* Configures a browser-based application to transition from a server-rendered app, if
* one is present on the page. The specified parameters must include an application id,
* which must match between the client and server applications.
*
* @experimental
*/
/**
* Configures a browser-based application to transition from a server-rendered app, if
* one is present on the page. The specified parameters must include an application id,
* which must match between the client and server applications.
*
* \@experimental
* @param {?} params
* @return {?}
*/
BrowserModule.withServerTransition = /**
* Configures a browser-based application to transition from a server-rendered app, if
* one is present on the page. The specified parameters must include an application id,
* which must match between the client and server applications.
*
* \@experimental
* @param {?} params
* @return {?}
*/
function (params) {
return {
ngModule: BrowserModule,
providers: [
{ provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["b" /* APP_ID */], useValue: params.appId },
{ provide: TRANSITION_ID, useExisting: __WEBPACK_IMPORTED_MODULE_1__angular_core__["b" /* APP_ID */] },
SERVER_TRANSITION_PROVIDERS,
],
};
};
BrowserModule.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["I" /* NgModule */], args: [{
providers: [
BROWSER_SANITIZATION_PROVIDERS,
{ provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["u" /* ErrorHandler */], useFactory: errorHandler, deps: [] },
{ provide: EVENT_MANAGER_PLUGINS, useClass: DomEventsPlugin, multi: true },
{ provide: EVENT_MANAGER_PLUGINS, useClass: KeyEventsPlugin, multi: true },
{ provide: EVENT_MANAGER_PLUGINS, useClass: HammerGesturesPlugin, multi: true },
{ provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig },
DomRendererFactory2,
{ provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["X" /* RendererFactory2 */], useExisting: DomRendererFactory2 },
{ provide: SharedStylesHost, useExisting: DomSharedStylesHost },
DomSharedStylesHost,
__WEBPACK_IMPORTED_MODULE_1__angular_core__["_6" /* Testability */],
EventManager,
ELEMENT_PROBE_PROVIDERS,
Meta,
Title,
],
exports: [__WEBPACK_IMPORTED_MODULE_0__angular_common__["b" /* CommonModule */], __WEBPACK_IMPORTED_MODULE_1__angular_core__["e" /* ApplicationModule */]]
},] },
];
/** @nocollapse */
BrowserModule.ctorParameters = function () { return [
{ type: BrowserModule, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_2" /* SkipSelf */] },] },
]; };
return BrowserModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var win = typeof window !== 'undefined' && window || /** @type {?} */ ({});
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var ChangeDetectionPerfRecord = (function () {
function ChangeDetectionPerfRecord(msPerTick, numTicks) {
this.msPerTick = msPerTick;
this.numTicks = numTicks;
}
return ChangeDetectionPerfRecord;
}());
/**
* Entry point for all Angular profiling-related debug tools. This object
* corresponds to the `ng.profiler` in the dev console.
*/
var AngularProfiler = (function () {
function AngularProfiler(ref) {
this.appRef = ref.injector.get(__WEBPACK_IMPORTED_MODULE_1__angular_core__["f" /* ApplicationRef */]);
}
// tslint:disable:no-console
/**
* Exercises change detection in a loop and then prints the average amount of
* time in milliseconds how long a single round of change detection takes for
* the current state of the UI. It runs a minimum of 5 rounds for a minimum
* of 500 milliseconds.
*
* Optionally, a user may pass a `config` parameter containing a map of
* options. Supported options are:
*
* `record` (boolean) - causes the profiler to record a CPU profile while
* it exercises the change detector. Example:
*
* ```
* ng.profiler.timeChangeDetection({record: true})
* ```
*/
/**
* Exercises change detection in a loop and then prints the average amount of
* time in milliseconds how long a single round of change detection takes for
* the current state of the UI. It runs a minimum of 5 rounds for a minimum
* of 500 milliseconds.
*
* Optionally, a user may pass a `config` parameter containing a map of
* options. Supported options are:
*
* `record` (boolean) - causes the profiler to record a CPU profile while
* it exercises the change detector. Example:
*
* ```
* ng.profiler.timeChangeDetection({record: true})
* ```
* @param {?} config
* @return {?}
*/
AngularProfiler.prototype.timeChangeDetection = /**
* Exercises change detection in a loop and then prints the average amount of
* time in milliseconds how long a single round of change detection takes for
* the current state of the UI. It runs a minimum of 5 rounds for a minimum
* of 500 milliseconds.
*
* Optionally, a user may pass a `config` parameter containing a map of
* options. Supported options are:
*
* `record` (boolean) - causes the profiler to record a CPU profile while
* it exercises the change detector. Example:
*
* ```
* ng.profiler.timeChangeDetection({record: true})
* ```
* @param {?} config
* @return {?}
*/
function (config) {
var /** @type {?} */ record = config && config['record'];
var /** @type {?} */ profileName = 'Change Detection';
// Profiler is not available in Android browsers, nor in IE 9 without dev tools opened
var /** @type {?} */ isProfilerAvailable = win.console.profile != null;
if (record && isProfilerAvailable) {
win.console.profile(profileName);
}
var /** @type {?} */ start = getDOM().performanceNow();
var /** @type {?} */ numTicks = 0;
while (numTicks < 5 || (getDOM().performanceNow() - start) < 500) {
this.appRef.tick();
numTicks++;
}
var /** @type {?} */ end = getDOM().performanceNow();
if (record && isProfilerAvailable) {
// need to cast to <any> because type checker thinks there's no argument
// while in fact there is:
//
// https://developer.mozilla.org/en-US/docs/Web/API/Console/profileEnd
(/** @type {?} */ (win.console.profileEnd))(profileName);
}
var /** @type {?} */ msPerTick = (end - start) / numTicks;
win.console.log("ran " + numTicks + " change detection cycles");
win.console.log(msPerTick.toFixed(2) + " ms per check");
return new ChangeDetectionPerfRecord(msPerTick, numTicks);
};
return AngularProfiler;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var PROFILER_GLOBAL_NAME = 'profiler';
/**
* Enabled Angular debug tools that are accessible via your browser's
* developer console.
*
* Usage:
*
* 1. Open developer console (e.g. in Chrome Ctrl + Shift + j)
* 1. Type `ng.` (usually the console will show auto-complete suggestion)
* 1. Try the change detection profiler `ng.profiler.timeChangeDetection()`
* then hit Enter.
*
* \@experimental All debugging apis are currently experimental.
* @template T
* @param {?} ref
* @return {?}
*/
function enableDebugTools(ref) {
exportNgVar(PROFILER_GLOBAL_NAME, new AngularProfiler(ref));
return ref;
}
/**
* Disables Angular tools.
*
* \@experimental All debugging apis are currently experimental.
* @return {?}
*/
function disableDebugTools() {
exportNgVar(PROFILER_GLOBAL_NAME, null);
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @param {?} text
* @return {?}
*/
function escapeHtml(text) {
var /** @type {?} */ escapedText = {
'&': '&a;',
'"': '&q;',
'\'': '&s;',
'<': '&l;',
'>': '&g;',
};
return text.replace(/[&"'<>]/g, function (s) { return escapedText[s]; });
}
/**
* @param {?} text
* @return {?}
*/
function unescapeHtml(text) {
var /** @type {?} */ unescapedText = {
'&a;': '&',
'&q;': '"',
'&s;': '\'',
'&l;': '<',
'&g;': '>',
};
return text.replace(/&[^;]+;/g, function (s) { return unescapedText[s]; });
}
/**
* Create a `StateKey<T>` that can be used to store value of type T with `TransferState`.
*
* Example:
*
* ```
* const COUNTER_KEY = makeStateKey<number>('counter');
* let value = 10;
*
* transferState.set(COUNTER_KEY, value);
* ```
*
* \@experimental
* @template T
* @param {?} key
* @return {?}
*/
function makeStateKey(key) {
return /** @type {?} */ (key);
}
/**
* A key value store that is transferred from the application on the server side to the application
* on the client side.
*
* `TransferState` will be available as an injectable token. To use it import
* `ServerTransferStateModule` on the server and `BrowserTransferStateModule` on the client.
*
* The values in the store are serialized/deserialized using JSON.stringify/JSON.parse. So only
* boolean, number, string, null and non-class objects will be serialized and deserialzied in a
* non-lossy manner.
*
* \@experimental
*/
var TransferState = (function () {
function TransferState() {
this.store = {};
this.onSerializeCallbacks = {};
}
/** @internal */
/**
* \@internal
* @param {?} initState
* @return {?}
*/
TransferState.init = /**
* \@internal
* @param {?} initState
* @return {?}
*/
function (initState) {
var /** @type {?} */ transferState = new TransferState();
transferState.store = initState;
return transferState;
};
/**
* Get the value corresponding to a key. Return `defaultValue` if key is not found.
*/
/**
* Get the value corresponding to a key. Return `defaultValue` if key is not found.
* @template T
* @param {?} key
* @param {?} defaultValue
* @return {?}
*/
TransferState.prototype.get = /**
* Get the value corresponding to a key. Return `defaultValue` if key is not found.
* @template T
* @param {?} key
* @param {?} defaultValue
* @return {?}
*/
function (key, defaultValue) { return /** @type {?} */ (this.store[key]) || defaultValue; };
/**
* Set the value corresponding to a key.
*/
/**
* Set the value corresponding to a key.
* @template T
* @param {?} key
* @param {?} value
* @return {?}
*/
TransferState.prototype.set = /**
* Set the value corresponding to a key.
* @template T
* @param {?} key
* @param {?} value
* @return {?}
*/
function (key, value) { this.store[key] = value; };
/**
* Remove a key from the store.
*/
/**
* Remove a key from the store.
* @template T
* @param {?} key
* @return {?}
*/
TransferState.prototype.remove = /**
* Remove a key from the store.
* @template T
* @param {?} key
* @return {?}
*/
function (key) { delete this.store[key]; };
/**
* Test whether a key exists in the store.
*/
/**
* Test whether a key exists in the store.
* @template T
* @param {?} key
* @return {?}
*/
TransferState.prototype.hasKey = /**
* Test whether a key exists in the store.
* @template T
* @param {?} key
* @return {?}
*/
function (key) { return this.store.hasOwnProperty(key); };
/**
* Register a callback to provide the value for a key when `toJson` is called.
*/
/**
* Register a callback to provide the value for a key when `toJson` is called.
* @template T
* @param {?} key
* @param {?} callback
* @return {?}
*/
TransferState.prototype.onSerialize = /**
* Register a callback to provide the value for a key when `toJson` is called.
* @template T
* @param {?} key
* @param {?} callback
* @return {?}
*/
function (key, callback) {
this.onSerializeCallbacks[key] = callback;
};
/**
* Serialize the current state of the store to JSON.
*/
/**
* Serialize the current state of the store to JSON.
* @return {?}
*/
TransferState.prototype.toJson = /**
* Serialize the current state of the store to JSON.
* @return {?}
*/
function () {
// Call the onSerialize callbacks and put those values into the store.
for (var /** @type {?} */ key in this.onSerializeCallbacks) {
if (this.onSerializeCallbacks.hasOwnProperty(key)) {
try {
this.store[key] = this.onSerializeCallbacks[key]();
}
catch (/** @type {?} */ e) {
console.warn('Exception in onSerialize callback: ', e);
}
}
}
return JSON.stringify(this.store);
};
TransferState.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
TransferState.ctorParameters = function () { return []; };
return TransferState;
}());
/**
* @param {?} doc
* @param {?} appId
* @return {?}
*/
function initTransferState(doc, appId) {
// Locate the script tag with the JSON data transferred from the server.
// The id of the script tag is set to the Angular appId + 'state'.
var /** @type {?} */ script = doc.getElementById(appId + '-state');
var /** @type {?} */ initialState = {};
if (script && script.textContent) {
try {
initialState = JSON.parse(unescapeHtml(script.textContent));
}
catch (/** @type {?} */ e) {
console.warn('Exception while restoring TransferState for app ' + appId, e);
}
}
return TransferState.init(initialState);
}
/**
* NgModule to install on the client side while using the `TransferState` to transfer state from
* server to client.
*
* \@experimental
*/
var BrowserTransferStateModule = (function () {
function BrowserTransferStateModule() {
}
BrowserTransferStateModule.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["I" /* NgModule */], args: [{
providers: [{ provide: TransferState, useFactory: initTransferState, deps: [DOCUMENT$1, __WEBPACK_IMPORTED_MODULE_1__angular_core__["b" /* APP_ID */]] }],
},] },
];
/** @nocollapse */
BrowserTransferStateModule.ctorParameters = function () { return []; };
return BrowserTransferStateModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Predicates for use with {\@link DebugElement}'s query functions.
*
* \@experimental All debugging apis are currently experimental.
*/
var By = (function () {
function By() {
}
/**
* Match all elements.
*
* ## Example
*
* {@example platform-browser/dom/debug/ts/by/by.ts region='by_all'}
*/
/**
* Match all elements.
*
* ## Example
*
* {\@example platform-browser/dom/debug/ts/by/by.ts region='by_all'}
* @return {?}
*/
By.all = /**
* Match all elements.
*
* ## Example
*
* {\@example platform-browser/dom/debug/ts/by/by.ts region='by_all'}
* @return {?}
*/
function () { return function (debugElement) { return true; }; };
/**
* Match elements by the given CSS selector.
*
* ## Example
*
* {@example platform-browser/dom/debug/ts/by/by.ts region='by_css'}
*/
/**
* Match elements by the given CSS selector.
*
* ## Example
*
* {\@example platform-browser/dom/debug/ts/by/by.ts region='by_css'}
* @param {?} selector
* @return {?}
*/
By.css = /**
* Match elements by the given CSS selector.
*
* ## Example
*
* {\@example platform-browser/dom/debug/ts/by/by.ts region='by_css'}
* @param {?} selector
* @return {?}
*/
function (selector) {
return function (debugElement) {
return debugElement.nativeElement != null ?
getDOM().elementMatches(debugElement.nativeElement, selector) :
false;
};
};
/**
* Match elements that have the given directive present.
*
* ## Example
*
* {@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'}
*/
/**
* Match elements that have the given directive present.
*
* ## Example
*
* {\@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'}
* @param {?} type
* @return {?}
*/
By.directive = /**
* Match elements that have the given directive present.
*
* ## Example
*
* {\@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'}
* @param {?} type
* @return {?}
*/
function (type) {
return function (debugElement) { return /** @type {?} */ ((debugElement.providerTokens)).indexOf(type) !== -1; };
};
return By;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @module
* @description
* Entry point for all public APIs of the common package.
*/
/**
* \@stable
*/
var VERSION = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["_7" /* Version */]('5.0.3');
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @module
* @description
* Entry point for all public APIs of this package.
*/
// This file only reexports content of the `src` folder. Keep it that way.
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Generated bundle index. Do not edit.
*/
//# sourceMappingURL=platform-browser.js.map
/***/ }),
/* 34 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return MenuController; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_util__ = __webpack_require__(3);
/**
* @name MenuController
* @description
* The MenuController is a provider which makes it easy to control a [Menu](../../Menu/Menu/).
* Its methods can be used to display the menu, enable the menu, toggle the menu, and more.
* The controller will grab a reference to the menu by the `side`, `id`, or, if neither
* of these are passed to it, it will grab the first menu it finds.
*
*
* @usage
*
* Add a basic menu component to start with. See the [Menu](../../Menu/Menu/) API docs
* for more information on adding menu components.
*
* ```html
* <ion-menu [content]="mycontent">
* <ion-content>
* <ion-list>
* ...
* </ion-list>
* </ion-content>
* </ion-menu>
*
* <ion-nav #mycontent [root]="rootPage"></ion-nav>
* ```
*
* To call the controller methods, inject the `MenuController` provider
* into the page. Then, create some methods for opening, closing, and
* toggling the menu.
*
* ```ts
* import { Component } from '@angular/core';
* import { MenuController } from 'ionic-angular';
*
* @Component({...})
* export class MyPage {
*
* constructor(public menuCtrl: MenuController) {
*
* }
*
* openMenu() {
* this.menuCtrl.open();
* }
*
* closeMenu() {
* this.menuCtrl.close();
* }
*
* toggleMenu() {
* this.menuCtrl.toggle();
* }
*
* }
* ```
*
* Since only one menu exists, the `MenuController` will grab the
* correct menu and call the correct method for each.
*
*
* ### Multiple Menus on Different Sides
*
* For applications with both a left and right menu, the desired menu can be
* grabbed by passing the `side` of the menu. If nothing is passed, it will
* default to the `"left"` menu.
*
* ```html
* <ion-menu side="left" [content]="mycontent">...</ion-menu>
* <ion-menu side="right" [content]="mycontent">...</ion-menu>
* <ion-nav #mycontent [root]="rootPage"></ion-nav>
* ```
*
* ```ts
* toggleLeftMenu() {
* this.menuCtrl.toggle();
* }
*
* toggleRightMenu() {
* this.menuCtrl.toggle('right');
* }
* ```
*
*
* ### Multiple Menus on the Same Side
*
* An application can have multiple menus on the same side. In order to determine
* the menu to control, an `id` should be passed. In the example below, the menu
* with the `authenticated` id will be enabled, and the menu with the `unauthenticated`
* id will be disabled.
*
* ```html
* <ion-menu id="authenticated" side="left" [content]="mycontent">...</ion-menu>
* <ion-menu id="unauthenticated" side="left" [content]="mycontent">...</ion-menu>
* <ion-nav #mycontent [root]="rootPage"></ion-nav>
* ```
*
* ```ts
* enableAuthenticatedMenu() {
* this.menuCtrl.enable(true, 'authenticated');
* this.menuCtrl.enable(false, 'unauthenticated');
* }
* ```
*
* Note: if an app only has one menu, there is no reason to pass an `id`.
*
*
* @demo /docs/demos/src/menu/
*
* @see {@link /docs/components#menus Menu Component Docs}
* @see {@link ../Menu Menu API Docs}
*
*/
var MenuController = (function () {
function MenuController() {
this._menus = [];
}
/**
* Programatically open the Menu.
* @param {string} [menuId] Optionally get the menu by its id, or side.
* @return {Promise} returns a promise when the menu is fully opened
*/
MenuController.prototype.open = function (menuId) {
var menu = this.get(menuId);
if (menu && !this.isAnimating()) {
var openedMenu = this.getOpen();
if (openedMenu && menu !== openedMenu) {
openedMenu.setOpen(false, false);
}
return menu.open();
}
return Promise.resolve(false);
};
/**
* Programatically close the Menu. If no `menuId` is given as the first
* argument then it'll close any menu which is open. If a `menuId`
* is given then it'll close that exact menu.
* @param {string} [menuId] Optionally get the menu by its id, or side.
* @return {Promise} returns a promise when the menu is fully closed
*/
MenuController.prototype.close = function (menuId) {
var menu;
if (menuId) {
// find the menu by its id
menu = this.get(menuId);
}
else {
// find the menu that is open
menu = this.getOpen();
}
if (menu) {
// close the menu
return menu.close();
}
return Promise.resolve(false);
};
/**
* Toggle the menu. If it's closed, it will open, and if opened, it
* will close.
* @param {string} [menuId] Optionally get the menu by its id, or side.
* @return {Promise} returns a promise when the menu has been toggled
*/
MenuController.prototype.toggle = function (menuId) {
var menu = this.get(menuId);
if (menu && !this.isAnimating()) {
var openedMenu = this.getOpen();
if (openedMenu && menu !== openedMenu) {
openedMenu.setOpen(false, false);
}
return menu.toggle();
}
return Promise.resolve(false);
};
/**
* Used to enable or disable a menu. For example, there could be multiple
* left menus, but only one of them should be able to be opened at the same
* time. If there are multiple menus on the same side, then enabling one menu
* will also automatically disable all the others that are on the same side.
* @param {string} [menuId] Optionally get the menu by its id, or side.
* @return {Menu} Returns the instance of the menu, which is useful for chaining.
*/
MenuController.prototype.enable = function (shouldEnable, menuId) {
var menu = this.get(menuId);
if (menu) {
return menu.enable(shouldEnable);
}
};
/**
* Used to enable or disable the ability to swipe open the menu.
* @param {boolean} shouldEnable True if it should be swipe-able, false if not.
* @param {string} [menuId] Optionally get the menu by its id, or side.
* @return {Menu} Returns the instance of the menu, which is useful for chaining.
*/
MenuController.prototype.swipeEnable = function (shouldEnable, menuId) {
var menu = this.get(menuId);
if (menu) {
return menu.swipeEnable(shouldEnable);
}
};
/**
* @param {string} [menuId] Optionally get the menu by its id, or side.
* @return {boolean} Returns true if the specified menu is currently open, otherwise false.
* If the menuId is not specified, it returns true if ANY menu is currenly open.
*/
MenuController.prototype.isOpen = function (menuId) {
if (menuId) {
var menu = this.get(menuId);
return menu && menu.isOpen || false;
}
else {
return !!this.getOpen();
}
};
/**
* @param {string} [menuId] Optionally get the menu by its id, or side.
* @return {boolean} Returns true if the menu is currently enabled, otherwise false.
*/
MenuController.prototype.isEnabled = function (menuId) {
var menu = this.get(menuId);
return menu && menu.enabled || false;
};
/**
* Used to get a menu instance. If a `menuId` is not provided then it'll
* return the first menu found. If a `menuId` is `left` or `right`, then
* it'll return the enabled menu on that side. Otherwise, if a `menuId` is
* provided, then it'll try to find the menu using the menu's `id`
* property. If a menu is not found then it'll return `null`.
* @param {string} [menuId] Optionally get the menu by its id, or side.
* @return {Menu} Returns the instance of the menu if found, otherwise `null`.
*/
MenuController.prototype.get = function (menuId) {
var menu;
if (menuId === 'left' || menuId === 'right') {
// there could be more than one menu on the same side
// so first try to get the enabled one
menu = this._menus.find(function (m) { return m.side === menuId && m.enabled; });
if (menu) {
return menu;
}
// didn't find a menu side that is enabled
// so try to get the first menu side found
return this._menus.find(function (m) { return m.side === menuId; }) || null;
}
else if (menuId) {
// the menuId was not left or right
// so try to get the menu by its "id"
return this._menus.find(function (m) { return m.id === menuId; }) || null;
}
// return the first enabled menu
menu = this._menus.find(function (m) { return m.enabled; });
if (menu) {
return menu;
}
// get the first menu in the array, if one exists
return (this._menus.length ? this._menus[0] : null);
};
/**
* @return {Menu} Returns the instance of the menu already opened, otherwise `null`.
*/
MenuController.prototype.getOpen = function () {
return this._menus.find(function (m) { return m.isOpen; });
};
/**
* @return {Array<Menu>} Returns an array of all menu instances.
*/
MenuController.prototype.getMenus = function () {
return this._menus;
};
/**
* @hidden
* @return {boolean} if any menu is currently animating
*/
MenuController.prototype.isAnimating = function () {
return this._menus.some(function (menu) { return menu.isAnimating(); });
};
/**
* @hidden
*/
MenuController.prototype._register = function (menu) {
(void 0) /* assert */;
this._menus.push(menu);
};
/**
* @hidden
*/
MenuController.prototype._unregister = function (menu) {
(void 0) /* assert */;
Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["q" /* removeArrayItem */])(this._menus, menu);
};
/**
* @hidden
*/
MenuController.prototype._setActiveMenu = function (menu) {
(void 0) /* assert */;
(void 0) /* assert */;
// if this menu should be enabled
// then find all the other menus on this same side
// and automatically disable other same side menus
var side = menu.side;
this._menus
.filter(function (m) { return m.side === side && m !== menu; })
.map(function (m) { return m.enable(false); });
};
/**
* @hidden
*/
MenuController.registerType = function (name, cls) {
menuTypes[name] = cls;
};
/**
* @hidden
*/
MenuController.create = function (type, menuCmp, plt) {
return new menuTypes[type](menuCmp, plt);
};
return MenuController;
}());
var menuTypes = {};
//# sourceMappingURL=menu-controller.js.map
/***/ }),
/* 35 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Transition; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__animations_animation__ = __webpack_require__(15);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
*
* - play
* - Add before classes - DOM WRITE
* - Remove before classes - DOM WRITE
* - Add before inline styles - DOM WRITE
* - set inline FROM styles - DOM WRITE
* - RAF
* - read toolbar dimensions - DOM READ
* - write content top/bottom padding - DOM WRITE
* - set css transition duration/easing - DOM WRITE
* - RAF
* - set inline TO styles - DOM WRITE
*/
var Transition = (function (_super) {
__extends(Transition, _super);
function Transition(plt, enteringView, leavingView, opts) {
var _this = _super.call(this, plt, null, opts) || this;
_this.enteringView = enteringView;
_this.leavingView = leavingView;
return _this;
}
Transition.prototype.init = function () { };
Transition.prototype.registerStart = function (trnsStart) {
this._trnsStart = trnsStart;
};
Transition.prototype.start = function () {
this._trnsStart && this._trnsStart();
this._trnsStart = null;
// bubble up start
this.parent && this.parent.start();
};
Transition.prototype.destroy = function () {
_super.prototype.destroy.call(this);
this.parent = this.enteringView = this.leavingView = this._trnsStart = null;
};
return Transition;
}(__WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */]));
//# sourceMappingURL=transition.js.map
/***/ }),
/* 36 */,
/* 37 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return IonicStorageModule; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__storage__ = __webpack_require__(406);
/* unused harmony reexport StorageConfigToken */
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_1__storage__["a"]; });
var IonicStorageModule = (function () {
function IonicStorageModule() {
}
IonicStorageModule.forRoot = function (storageConfig) {
if (storageConfig === void 0) { storageConfig = null; }
return {
ngModule: IonicStorageModule,
providers: [
{ provide: __WEBPACK_IMPORTED_MODULE_1__storage__["b" /* StorageConfigToken */], useValue: storageConfig },
{ provide: __WEBPACK_IMPORTED_MODULE_1__storage__["a" /* Storage */], useFactory: __WEBPACK_IMPORTED_MODULE_1__storage__["c" /* provideStorage */], deps: [__WEBPACK_IMPORTED_MODULE_1__storage__["b" /* StorageConfigToken */]] },
]
};
};
IonicStorageModule.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["I" /* NgModule */], args: [{},] },
];
/** @nocollapse */
IonicStorageModule.ctorParameters = function () { return []; };
return IonicStorageModule;
}());
/***/ }),
/* 38 */,
/* 39 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var isArray_1 = __webpack_require__(70);
var isObject_1 = __webpack_require__(123);
var isFunction_1 = __webpack_require__(69);
var tryCatch_1 = __webpack_require__(124);
var errorObject_1 = __webpack_require__(71);
var UnsubscriptionError_1 = __webpack_require__(358);
/**
* Represents a disposable resource, such as the execution of an Observable. A
* Subscription has one important method, `unsubscribe`, that takes no argument
* and just disposes the resource held by the subscription.
*
* Additionally, subscriptions may be grouped together through the `add()`
* method, which will attach a child Subscription to the current Subscription.
* When a Subscription is unsubscribed, all its children (and its grandchildren)
* will be unsubscribed as well.
*
* @class Subscription
*/
var Subscription = (function () {
/**
* @param {function(): void} [unsubscribe] A function describing how to
* perform the disposal of resources when the `unsubscribe` method is called.
*/
function Subscription(unsubscribe) {
/**
* A flag to indicate whether this Subscription has already been unsubscribed.
* @type {boolean}
*/
this.closed = false;
this._parent = null;
this._parents = null;
this._subscriptions = null;
if (unsubscribe) {
this._unsubscribe = unsubscribe;
}
}
/**
* Disposes the resources held by the subscription. May, for instance, cancel
* an ongoing Observable execution or cancel any other type of work that
* started when the Subscription was created.
* @return {void}
*/
Subscription.prototype.unsubscribe = function () {
var hasErrors = false;
var errors;
if (this.closed) {
return;
}
var _a = this, _parent = _a._parent, _parents = _a._parents, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions;
this.closed = true;
this._parent = null;
this._parents = null;
// null out _subscriptions first so any child subscriptions that attempt
// to remove themselves from this subscription will noop
this._subscriptions = null;
var index = -1;
var len = _parents ? _parents.length : 0;
// if this._parent is null, then so is this._parents, and we
// don't have to remove ourselves from any parent subscriptions.
while (_parent) {
_parent.remove(this);
// if this._parents is null or index >= len,
// then _parent is set to null, and the loop exits
_parent = ++index < len && _parents[index] || null;
}
if (isFunction_1.isFunction(_unsubscribe)) {
var trial = tryCatch_1.tryCatch(_unsubscribe).call(this);
if (trial === errorObject_1.errorObject) {
hasErrors = true;
errors = errors || (errorObject_1.errorObject.e instanceof UnsubscriptionError_1.UnsubscriptionError ?
flattenUnsubscriptionErrors(errorObject_1.errorObject.e.errors) : [errorObject_1.errorObject.e]);
}
}
if (isArray_1.isArray(_subscriptions)) {
index = -1;
len = _subscriptions.length;
while (++index < len) {
var sub = _subscriptions[index];
if (isObject_1.isObject(sub)) {
var trial = tryCatch_1.tryCatch(sub.unsubscribe).call(sub);
if (trial === errorObject_1.errorObject) {
hasErrors = true;
errors = errors || [];
var err = errorObject_1.errorObject.e;
if (err instanceof UnsubscriptionError_1.UnsubscriptionError) {
errors = errors.concat(flattenUnsubscriptionErrors(err.errors));
}
else {
errors.push(err);
}
}
}
}
}
if (hasErrors) {
throw new UnsubscriptionError_1.UnsubscriptionError(errors);
}
};
/**
* Adds a tear down to be called during the unsubscribe() of this
* Subscription.
*
* If the tear down being added is a subscription that is already
* unsubscribed, is the same reference `add` is being called on, or is
* `Subscription.EMPTY`, it will not be added.
*
* If this subscription is already in an `closed` state, the passed
* tear down logic will be executed immediately.
*
* @param {TeardownLogic} teardown The additional logic to execute on
* teardown.
* @return {Subscription} Returns the Subscription used or created to be
* added to the inner subscriptions list. This Subscription can be used with
* `remove()` to remove the passed teardown logic from the inner subscriptions
* list.
*/
Subscription.prototype.add = function (teardown) {
if (!teardown || (teardown === Subscription.EMPTY)) {
return Subscription.EMPTY;
}
if (teardown === this) {
return this;
}
var subscription = teardown;
switch (typeof teardown) {
case 'function':
subscription = new Subscription(teardown);
case 'object':
if (subscription.closed || typeof subscription.unsubscribe !== 'function') {
return subscription;
}
else if (this.closed) {
subscription.unsubscribe();
return subscription;
}
else if (typeof subscription._addParent !== 'function' /* quack quack */) {
var tmp = subscription;
subscription = new Subscription();
subscription._subscriptions = [tmp];
}
break;
default:
throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');
}
var subscriptions = this._subscriptions || (this._subscriptions = []);
subscriptions.push(subscription);
subscription._addParent(this);
return subscription;
};
/**
* Removes a Subscription from the internal list of subscriptions that will
* unsubscribe during the unsubscribe process of this Subscription.
* @param {Subscription} subscription The subscription to remove.
* @return {void}
*/
Subscription.prototype.remove = function (subscription) {
var subscriptions = this._subscriptions;
if (subscriptions) {
var subscriptionIndex = subscriptions.indexOf(subscription);
if (subscriptionIndex !== -1) {
subscriptions.splice(subscriptionIndex, 1);
}
}
};
Subscription.prototype._addParent = function (parent) {
var _a = this, _parent = _a._parent, _parents = _a._parents;
if (!_parent || _parent === parent) {
// If we don't have a parent, or the new parent is the same as the
// current parent, then set this._parent to the new parent.
this._parent = parent;
}
else if (!_parents) {
// If there's already one parent, but not multiple, allocate an Array to
// store the rest of the parent Subscriptions.
this._parents = [parent];
}
else if (_parents.indexOf(parent) === -1) {
// Only add the new parent to the _parents list if it's not already there.
_parents.push(parent);
}
};
Subscription.EMPTY = (function (empty) {
empty.closed = true;
return empty;
}(new Subscription()));
return Subscription;
}());
exports.Subscription = Subscription;
function flattenUnsubscriptionErrors(errors) {
return errors.reduce(function (errs, err) { return errs.concat((err instanceof UnsubscriptionError_1.UnsubscriptionError) ? err.errors : err); }, []);
}
//# sourceMappingURL=Subscription.js.map
/***/ }),
/* 40 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PageTransition; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__animations_animation__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__transition__ = __webpack_require__(35);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
*/
var PageTransition = (function (_super) {
__extends(PageTransition, _super);
function PageTransition() {
return _super !== null && _super.apply(this, arguments) || this;
}
PageTransition.prototype.init = function () {
var _this = this;
if (this.enteringView) {
this.enteringPage = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, this.enteringView.pageRef());
this.add(this.enteringPage.beforeAddClass('show-page'));
// Resize content before transition starts
this.beforeAddRead(function () {
_this.enteringView.readReady.emit();
});
this.beforeAddWrite(function () {
_this.enteringView.writeReady.emit();
});
}
};
PageTransition.prototype.destroy = function () {
_super.prototype.destroy.call(this);
this.enteringPage && this.enteringPage.destroy();
this.enteringPage = null;
};
return PageTransition;
}(__WEBPACK_IMPORTED_MODULE_1__transition__["a" /* Transition */]));
//# sourceMappingURL=page-transition.js.map
/***/ }),
/* 41 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export HttpBackend */
/* unused harmony export HttpHandler */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HttpClient; });
/* unused harmony export HttpHeaders */
/* unused harmony export HTTP_INTERCEPTORS */
/* unused harmony export JsonpClientBackend */
/* unused harmony export JsonpInterceptor */
/* unused harmony export HttpClientJsonpModule */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return HttpClientModule; });
/* unused harmony export HttpClientXsrfModule */
/* unused harmony export ɵinterceptingHandler */
/* unused harmony export HttpParams */
/* unused harmony export HttpUrlEncodingCodec */
/* unused harmony export HttpRequest */
/* unused harmony export HttpErrorResponse */
/* unused harmony export HttpEventType */
/* unused harmony export HttpHeaderResponse */
/* unused harmony export HttpResponse */
/* unused harmony export HttpResponseBase */
/* unused harmony export HttpXhrBackend */
/* unused harmony export XhrFactory */
/* unused harmony export HttpXsrfTokenExtractor */
/* unused harmony export ɵa */
/* unused harmony export ɵb */
/* unused harmony export ɵc */
/* unused harmony export ɵd */
/* unused harmony export ɵg */
/* unused harmony export ɵh */
/* unused harmony export ɵe */
/* unused harmony export ɵf */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rxjs_observable_of__ = __webpack_require__(401);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rxjs_observable_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_rxjs_observable_of__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_operator_concatMap__ = __webpack_require__(402);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_operator_concatMap___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_rxjs_operator_concatMap__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_operator_filter__ = __webpack_require__(404);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_operator_filter___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_rxjs_operator_filter__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_rxjs_operator_map__ = __webpack_require__(134);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_rxjs_operator_map___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_rxjs_operator_map__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_tslib__ = __webpack_require__(31);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__angular_common__ = __webpack_require__(43);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_rxjs_Observable__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_rxjs_Observable___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7_rxjs_Observable__);
/**
* @license Angular v5.0.3
* (c) 2010-2017 Google, Inc. https://angular.io/
* License: MIT
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Transforms an `HttpRequest` into a stream of `HttpEvent`s, one of which will likely be a
* `HttpResponse`.
*
* `HttpHandler` is injectable. When injected, the handler instance dispatches requests to the
* first interceptor in the chain, which dispatches to the second, etc, eventually reaching the
* `HttpBackend`.
*
* In an `HttpInterceptor`, the `HttpHandler` parameter is the next interceptor in the chain.
*
* \@stable
* @abstract
*/
var HttpHandler = (function () {
function HttpHandler() {
}
return HttpHandler;
}());
/**
* A final `HttpHandler` which will dispatch the request via browser HTTP APIs to a backend.
*
* Interceptors sit between the `HttpClient` interface and the `HttpBackend`.
*
* When injected, `HttpBackend` dispatches requests directly to the backend, without going
* through the interceptor chain.
*
* \@stable
* @abstract
*/
var HttpBackend = (function () {
function HttpBackend() {
}
return HttpBackend;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @record
*/
/**
* Immutable set of Http headers, with lazy parsing.
* \@stable
*/
var HttpHeaders = (function () {
function HttpHeaders(headers) {
var _this = this;
/**
* Internal map of lowercased header names to the normalized
* form of the name (the form seen first).
*/
this.normalizedNames = new Map();
/**
* Queued updates to be materialized the next initialization.
*/
this.lazyUpdate = null;
if (!headers) {
this.headers = new Map();
}
else if (typeof headers === 'string') {
this.lazyInit = function () {
_this.headers = new Map();
headers.split('\n').forEach(function (line) {
var /** @type {?} */ index = line.indexOf(':');
if (index > 0) {
var /** @type {?} */ name_1 = line.slice(0, index);
var /** @type {?} */ key = name_1.toLowerCase();
var /** @type {?} */ value = line.slice(index + 1).trim();
_this.maybeSetNormalizedName(name_1, key);
if (_this.headers.has(key)) {
/** @type {?} */ ((_this.headers.get(key))).push(value);
}
else {
_this.headers.set(key, [value]);
}
}
});
};
}
else {
this.lazyInit = function () {
_this.headers = new Map();
Object.keys(headers).forEach(function (name) {
var /** @type {?} */ values = headers[name];
var /** @type {?} */ key = name.toLowerCase();
if (typeof values === 'string') {
values = [values];
}
if (values.length > 0) {
_this.headers.set(key, values);
_this.maybeSetNormalizedName(name, key);
}
});
};
}
}
/**
* Checks for existence of header by given name.
*/
/**
* Checks for existence of header by given name.
* @param {?} name
* @return {?}
*/
HttpHeaders.prototype.has = /**
* Checks for existence of header by given name.
* @param {?} name
* @return {?}
*/
function (name) {
this.init();
return this.headers.has(name.toLowerCase());
};
/**
* Returns first header that matches given name.
*/
/**
* Returns first header that matches given name.
* @param {?} name
* @return {?}
*/
HttpHeaders.prototype.get = /**
* Returns first header that matches given name.
* @param {?} name
* @return {?}
*/
function (name) {
this.init();
var /** @type {?} */ values = this.headers.get(name.toLowerCase());
return values && values.length > 0 ? values[0] : null;
};
/**
* Returns the names of the headers
*/
/**
* Returns the names of the headers
* @return {?}
*/
HttpHeaders.prototype.keys = /**
* Returns the names of the headers
* @return {?}
*/
function () {
this.init();
return Array.from(this.normalizedNames.values());
};
/**
* Returns list of header values for a given name.
*/
/**
* Returns list of header values for a given name.
* @param {?} name
* @return {?}
*/
HttpHeaders.prototype.getAll = /**
* Returns list of header values for a given name.
* @param {?} name
* @return {?}
*/
function (name) {
this.init();
return this.headers.get(name.toLowerCase()) || null;
};
/**
* @param {?} name
* @param {?} value
* @return {?}
*/
HttpHeaders.prototype.append = /**
* @param {?} name
* @param {?} value
* @return {?}
*/
function (name, value) {
return this.clone({ name: name, value: value, op: 'a' });
};
/**
* @param {?} name
* @param {?} value
* @return {?}
*/
HttpHeaders.prototype.set = /**
* @param {?} name
* @param {?} value
* @return {?}
*/
function (name, value) {
return this.clone({ name: name, value: value, op: 's' });
};
/**
* @param {?} name
* @param {?=} value
* @return {?}
*/
HttpHeaders.prototype.delete = /**
* @param {?} name
* @param {?=} value
* @return {?}
*/
function (name, value) {
return this.clone({ name: name, value: value, op: 'd' });
};
/**
* @param {?} name
* @param {?} lcName
* @return {?}
*/
HttpHeaders.prototype.maybeSetNormalizedName = /**
* @param {?} name
* @param {?} lcName
* @return {?}
*/
function (name, lcName) {
if (!this.normalizedNames.has(lcName)) {
this.normalizedNames.set(lcName, name);
}
};
/**
* @return {?}
*/
HttpHeaders.prototype.init = /**
* @return {?}
*/
function () {
var _this = this;
if (!!this.lazyInit) {
if (this.lazyInit instanceof HttpHeaders) {
this.copyFrom(this.lazyInit);
}
else {
this.lazyInit();
}
this.lazyInit = null;
if (!!this.lazyUpdate) {
this.lazyUpdate.forEach(function (update) { return _this.applyUpdate(update); });
this.lazyUpdate = null;
}
}
};
/**
* @param {?} other
* @return {?}
*/
HttpHeaders.prototype.copyFrom = /**
* @param {?} other
* @return {?}
*/
function (other) {
var _this = this;
other.init();
Array.from(other.headers.keys()).forEach(function (key) {
_this.headers.set(key, /** @type {?} */ ((other.headers.get(key))));
_this.normalizedNames.set(key, /** @type {?} */ ((other.normalizedNames.get(key))));
});
};
/**
* @param {?} update
* @return {?}
*/
HttpHeaders.prototype.clone = /**
* @param {?} update
* @return {?}
*/
function (update) {
var /** @type {?} */ clone = new HttpHeaders();
clone.lazyInit =
(!!this.lazyInit && this.lazyInit instanceof HttpHeaders) ? this.lazyInit : this;
clone.lazyUpdate = (this.lazyUpdate || []).concat([update]);
return clone;
};
/**
* @param {?} update
* @return {?}
*/
HttpHeaders.prototype.applyUpdate = /**
* @param {?} update
* @return {?}
*/
function (update) {
var /** @type {?} */ key = update.name.toLowerCase();
switch (update.op) {
case 'a':
case 's':
var /** @type {?} */ value = /** @type {?} */ ((update.value));
if (typeof value === 'string') {
value = [value];
}
if (value.length === 0) {
return;
}
this.maybeSetNormalizedName(update.name, key);
var /** @type {?} */ base = (update.op === 'a' ? this.headers.get(key) : undefined) || [];
base.push.apply(base, value);
this.headers.set(key, base);
break;
case 'd':
var /** @type {?} */ toDelete_1 = /** @type {?} */ (update.value);
if (!toDelete_1) {
this.headers.delete(key);
this.normalizedNames.delete(key);
}
else {
var /** @type {?} */ existing = this.headers.get(key);
if (!existing) {
return;
}
existing = existing.filter(function (value) { return toDelete_1.indexOf(value) === -1; });
if (existing.length === 0) {
this.headers.delete(key);
this.normalizedNames.delete(key);
}
else {
this.headers.set(key, existing);
}
}
break;
}
};
/**
* @internal
*/
/**
* \@internal
* @param {?} fn
* @return {?}
*/
HttpHeaders.prototype.forEach = /**
* \@internal
* @param {?} fn
* @return {?}
*/
function (fn) {
var _this = this;
this.init();
Array.from(this.normalizedNames.keys())
.forEach(function (key) { return fn(/** @type {?} */ ((_this.normalizedNames.get(key))), /** @type {?} */ ((_this.headers.get(key)))); });
};
return HttpHeaders;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* A codec for encoding and decoding parameters in URLs.
*
* Used by `HttpParams`.
*
* \@stable
*
* @record
*/
/**
* A `HttpParameterCodec` that uses `encodeURIComponent` and `decodeURIComponent` to
* serialize and parse URL parameter keys and values.
*
* \@stable
*/
var HttpUrlEncodingCodec = (function () {
function HttpUrlEncodingCodec() {
}
/**
* @param {?} k
* @return {?}
*/
HttpUrlEncodingCodec.prototype.encodeKey = /**
* @param {?} k
* @return {?}
*/
function (k) { return standardEncoding(k); };
/**
* @param {?} v
* @return {?}
*/
HttpUrlEncodingCodec.prototype.encodeValue = /**
* @param {?} v
* @return {?}
*/
function (v) { return standardEncoding(v); };
/**
* @param {?} k
* @return {?}
*/
HttpUrlEncodingCodec.prototype.decodeKey = /**
* @param {?} k
* @return {?}
*/
function (k) { return decodeURIComponent(k); };
/**
* @param {?} v
* @return {?}
*/
HttpUrlEncodingCodec.prototype.decodeValue = /**
* @param {?} v
* @return {?}
*/
function (v) { return decodeURIComponent(v); };
return HttpUrlEncodingCodec;
}());
/**
* @param {?} rawParams
* @param {?} codec
* @return {?}
*/
function paramParser(rawParams, codec) {
var /** @type {?} */ map$$1 = new Map();
if (rawParams.length > 0) {
var /** @type {?} */ params = rawParams.split('&');
params.forEach(function (param) {
var /** @type {?} */ eqIdx = param.indexOf('=');
var _a = eqIdx == -1 ?
[codec.decodeKey(param), ''] :
[codec.decodeKey(param.slice(0, eqIdx)), codec.decodeValue(param.slice(eqIdx + 1))], key = _a[0], val = _a[1];
var /** @type {?} */ list = map$$1.get(key) || [];
list.push(val);
map$$1.set(key, list);
});
}
return map$$1;
}
/**
* @param {?} v
* @return {?}
*/
function standardEncoding(v) {
return encodeURIComponent(v)
.replace(/%40/gi, '@')
.replace(/%3A/gi, ':')
.replace(/%24/gi, '$')
.replace(/%2C/gi, ',')
.replace(/%3B/gi, ';')
.replace(/%2B/gi, '+')
.replace(/%3D/gi, '=')
.replace(/%3F/gi, '?')
.replace(/%2F/gi, '/');
}
/**
* Options used to construct an `HttpParams` instance.
* @record
*/
/**
* An HTTP request/response body that represents serialized parameters,
* per the MIME type `application/x-www-form-urlencoded`.
*
* This class is immutable - all mutation operations return a new instance.
*
* \@stable
*/
var HttpParams = (function () {
function HttpParams(options) {
if (options === void 0) { options = /** @type {?} */ ({}); }
var _this = this;
this.updates = null;
this.cloneFrom = null;
this.encoder = options.encoder || new HttpUrlEncodingCodec();
if (!!options.fromString) {
if (!!options.fromObject) {
throw new Error("Cannot specify both fromString and fromObject.");
}
this.map = paramParser(options.fromString, this.encoder);
}
else if (!!options.fromObject) {
this.map = new Map();
Object.keys(options.fromObject).forEach(function (key) {
var /** @type {?} */ value = (/** @type {?} */ (options.fromObject))[key]; /** @type {?} */
((_this.map)).set(key, Array.isArray(value) ? value : [value]);
});
}
else {
this.map = null;
}
}
/**
* Check whether the body has one or more values for the given parameter name.
*/
/**
* Check whether the body has one or more values for the given parameter name.
* @param {?} param
* @return {?}
*/
HttpParams.prototype.has = /**
* Check whether the body has one or more values for the given parameter name.
* @param {?} param
* @return {?}
*/
function (param) {
this.init();
return /** @type {?} */ ((this.map)).has(param);
};
/**
* Get the first value for the given parameter name, or `null` if it's not present.
*/
/**
* Get the first value for the given parameter name, or `null` if it's not present.
* @param {?} param
* @return {?}
*/
HttpParams.prototype.get = /**
* Get the first value for the given parameter name, or `null` if it's not present.
* @param {?} param
* @return {?}
*/
function (param) {
this.init();
var /** @type {?} */ res = /** @type {?} */ ((this.map)).get(param);
return !!res ? res[0] : null;
};
/**
* Get all values for the given parameter name, or `null` if it's not present.
*/
/**
* Get all values for the given parameter name, or `null` if it's not present.
* @param {?} param
* @return {?}
*/
HttpParams.prototype.getAll = /**
* Get all values for the given parameter name, or `null` if it's not present.
* @param {?} param
* @return {?}
*/
function (param) {
this.init();
return /** @type {?} */ ((this.map)).get(param) || null;
};
/**
* Get all the parameter names for this body.
*/
/**
* Get all the parameter names for this body.
* @return {?}
*/
HttpParams.prototype.keys = /**
* Get all the parameter names for this body.
* @return {?}
*/
function () {
this.init();
return Array.from(/** @type {?} */ ((this.map)).keys());
};
/**
* Construct a new body with an appended value for the given parameter name.
*/
/**
* Construct a new body with an appended value for the given parameter name.
* @param {?} param
* @param {?} value
* @return {?}
*/
HttpParams.prototype.append = /**
* Construct a new body with an appended value for the given parameter name.
* @param {?} param
* @param {?} value
* @return {?}
*/
function (param, value) { return this.clone({ param: param, value: value, op: 'a' }); };
/**
* Construct a new body with a new value for the given parameter name.
*/
/**
* Construct a new body with a new value for the given parameter name.
* @param {?} param
* @param {?} value
* @return {?}
*/
HttpParams.prototype.set = /**
* Construct a new body with a new value for the given parameter name.
* @param {?} param
* @param {?} value
* @return {?}
*/
function (param, value) { return this.clone({ param: param, value: value, op: 's' }); };
/**
* Construct a new body with either the given value for the given parameter
* removed, if a value is given, or all values for the given parameter removed
* if not.
*/
/**
* Construct a new body with either the given value for the given parameter
* removed, if a value is given, or all values for the given parameter removed
* if not.
* @param {?} param
* @param {?=} value
* @return {?}
*/
HttpParams.prototype.delete = /**
* Construct a new body with either the given value for the given parameter
* removed, if a value is given, or all values for the given parameter removed
* if not.
* @param {?} param
* @param {?=} value
* @return {?}
*/
function (param, value) { return this.clone({ param: param, value: value, op: 'd' }); };
/**
* Serialize the body to an encoded string, where key-value pairs (separated by `=`) are
* separated by `&`s.
*/
/**
* Serialize the body to an encoded string, where key-value pairs (separated by `=`) are
* separated by `&`s.
* @return {?}
*/
HttpParams.prototype.toString = /**
* Serialize the body to an encoded string, where key-value pairs (separated by `=`) are
* separated by `&`s.
* @return {?}
*/
function () {
var _this = this;
this.init();
return this.keys()
.map(function (key) {
var /** @type {?} */ eKey = _this.encoder.encodeKey(key);
return /** @type {?} */ ((/** @type {?} */ ((_this.map)).get(key))).map(function (value) { return eKey + '=' + _this.encoder.encodeValue(value); }).join('&');
})
.join('&');
};
/**
* @param {?} update
* @return {?}
*/
HttpParams.prototype.clone = /**
* @param {?} update
* @return {?}
*/
function (update) {
var /** @type {?} */ clone = new HttpParams(/** @type {?} */ ({ encoder: this.encoder }));
clone.cloneFrom = this.cloneFrom || this;
clone.updates = (this.updates || []).concat([update]);
return clone;
};
/**
* @return {?}
*/
HttpParams.prototype.init = /**
* @return {?}
*/
function () {
var _this = this;
if (this.map === null) {
this.map = new Map();
}
if (this.cloneFrom !== null) {
this.cloneFrom.init();
this.cloneFrom.keys().forEach(function (key) { return /** @type {?} */ ((_this.map)).set(key, /** @type {?} */ ((/** @type {?} */ ((/** @type {?} */ ((_this.cloneFrom)).map)).get(key)))); }); /** @type {?} */
((this.updates)).forEach(function (update) {
switch (update.op) {
case 'a':
case 's':
var /** @type {?} */ base = (update.op === 'a' ? /** @type {?} */ ((_this.map)).get(update.param) : undefined) || [];
base.push(/** @type {?} */ ((update.value))); /** @type {?} */
((_this.map)).set(update.param, base);
break;
case 'd':
if (update.value !== undefined) {
var /** @type {?} */ base_1 = /** @type {?} */ ((_this.map)).get(update.param) || [];
var /** @type {?} */ idx = base_1.indexOf(update.value);
if (idx !== -1) {
base_1.splice(idx, 1);
}
if (base_1.length > 0) {
/** @type {?} */ ((_this.map)).set(update.param, base_1);
}
else {
/** @type {?} */ ((_this.map)).delete(update.param);
}
}
else {
/** @type {?} */ ((_this.map)).delete(update.param);
break;
}
}
});
this.cloneFrom = null;
}
};
return HttpParams;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Determine whether the given HTTP method may include a body.
* @param {?} method
* @return {?}
*/
function mightHaveBody(method) {
switch (method) {
case 'DELETE':
case 'GET':
case 'HEAD':
case 'OPTIONS':
case 'JSONP':
return false;
default:
return true;
}
}
/**
* Safely assert whether the given value is an ArrayBuffer.
*
* In some execution environments ArrayBuffer is not defined.
* @param {?} value
* @return {?}
*/
function isArrayBuffer(value) {
return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;
}
/**
* Safely assert whether the given value is a Blob.
*
* In some execution environments Blob is not defined.
* @param {?} value
* @return {?}
*/
function isBlob(value) {
return typeof Blob !== 'undefined' && value instanceof Blob;
}
/**
* Safely assert whether the given value is a FormData instance.
*
* In some execution environments FormData is not defined.
* @param {?} value
* @return {?}
*/
function isFormData(value) {
return typeof FormData !== 'undefined' && value instanceof FormData;
}
/**
* An outgoing HTTP request with an optional typed body.
*
* `HttpRequest` represents an outgoing request, including URL, method,
* headers, body, and other request configuration options. Instances should be
* assumed to be immutable. To modify a `HttpRequest`, the `clone`
* method should be used.
*
* \@stable
*/
var HttpRequest = (function () {
function HttpRequest(method, url, third, fourth) {
this.url = url;
/**
* The request body, or `null` if one isn't set.
*
* Bodies are not enforced to be immutable, as they can include a reference to any
* user-defined data type. However, interceptors should take care to preserve
* idempotence by treating them as such.
*/
this.body = null;
/**
* Whether this request should be made in a way that exposes progress events.
*
* Progress events are expensive (change detection runs on each event) and so
* they should only be requested if the consumer intends to monitor them.
*/
this.reportProgress = false;
/**
* Whether this request should be sent with outgoing credentials (cookies).
*/
this.withCredentials = false;
/**
* The expected response type of the server.
*
* This is used to parse the response appropriately before returning it to
* the requestee.
*/
this.responseType = 'json';
this.method = method.toUpperCase();
// Next, need to figure out which argument holds the HttpRequestInit
// options, if any.
var /** @type {?} */ options;
// Check whether a body argument is expected. The only valid way to omit
// the body argument is to use a known no-body method like GET.
if (mightHaveBody(this.method) || !!fourth) {
// Body is the third argument, options are the fourth.
this.body = /** @type {?} */ (third) || null;
options = fourth;
}
else {
// No body required, options are the third argument. The body stays null.
options = /** @type {?} */ (third);
}
// If options have been passed, interpret them.
if (options) {
// Normalize reportProgress and withCredentials.
this.reportProgress = !!options.reportProgress;
this.withCredentials = !!options.withCredentials;
// Override default response type of 'json' if one is provided.
if (!!options.responseType) {
this.responseType = options.responseType;
}
// Override headers if they're provided.
if (!!options.headers) {
this.headers = options.headers;
}
if (!!options.params) {
this.params = options.params;
}
}
// If no headers have been passed in, construct a new HttpHeaders instance.
if (!this.headers) {
this.headers = new HttpHeaders();
}
// If no parameters have been passed in, construct a new HttpUrlEncodedParams instance.
if (!this.params) {
this.params = new HttpParams();
this.urlWithParams = url;
}
else {
// Encode the parameters to a string in preparation for inclusion in the URL.
var /** @type {?} */ params = this.params.toString();
if (params.length === 0) {
// No parameters, the visible URL is just the URL given at creation time.
this.urlWithParams = url;
}
else {
// Does the URL already have query parameters? Look for '?'.
var /** @type {?} */ qIdx = url.indexOf('?');
// There are 3 cases to handle:
// 1) No existing parameters -> append '?' followed by params.
// 2) '?' exists and is followed by existing query string ->
// append '&' followed by params.
// 3) '?' exists at the end of the url -> append params directly.
// This basically amounts to determining the character, if any, with
// which to join the URL and parameters.
var /** @type {?} */ sep = qIdx === -1 ? '?' : (qIdx < url.length - 1 ? '&' : '');
this.urlWithParams = url + sep + params;
}
}
}
/**
* Transform the free-form body into a serialized format suitable for
* transmission to the server.
*/
/**
* Transform the free-form body into a serialized format suitable for
* transmission to the server.
* @return {?}
*/
HttpRequest.prototype.serializeBody = /**
* Transform the free-form body into a serialized format suitable for
* transmission to the server.
* @return {?}
*/
function () {
// If no body is present, no need to serialize it.
if (this.body === null) {
return null;
}
// Check whether the body is already in a serialized form. If so,
// it can just be returned directly.
if (isArrayBuffer(this.body) || isBlob(this.body) || isFormData(this.body) ||
typeof this.body === 'string') {
return this.body;
}
// Check whether the body is an instance of HttpUrlEncodedParams.
if (this.body instanceof HttpParams) {
return this.body.toString();
}
// Check whether the body is an object or array, and serialize with JSON if so.
if (typeof this.body === 'object' || typeof this.body === 'boolean' ||
Array.isArray(this.body)) {
return JSON.stringify(this.body);
}
// Fall back on toString() for everything else.
return (/** @type {?} */ (this.body)).toString();
};
/**
* Examine the body and attempt to infer an appropriate MIME type
* for it.
*
* If no such type can be inferred, this method will return `null`.
*/
/**
* Examine the body and attempt to infer an appropriate MIME type
* for it.
*
* If no such type can be inferred, this method will return `null`.
* @return {?}
*/
HttpRequest.prototype.detectContentTypeHeader = /**
* Examine the body and attempt to infer an appropriate MIME type
* for it.
*
* If no such type can be inferred, this method will return `null`.
* @return {?}
*/
function () {
// An empty body has no content type.
if (this.body === null) {
return null;
}
// FormData bodies rely on the browser's content type assignment.
if (isFormData(this.body)) {
return null;
}
// Blobs usually have their own content type. If it doesn't, then
// no type can be inferred.
if (isBlob(this.body)) {
return this.body.type || null;
}
// Array buffers have unknown contents and thus no type can be inferred.
if (isArrayBuffer(this.body)) {
return null;
}
// Technically, strings could be a form of JSON data, but it's safe enough
// to assume they're plain strings.
if (typeof this.body === 'string') {
return 'text/plain';
}
// `HttpUrlEncodedParams` has its own content-type.
if (this.body instanceof HttpParams) {
return 'application/x-www-form-urlencoded;charset=UTF-8';
}
// Arrays, objects, and numbers will be encoded as JSON.
if (typeof this.body === 'object' || typeof this.body === 'number' ||
Array.isArray(this.body)) {
return 'application/json';
}
// No type could be inferred.
return null;
};
/**
* @param {?=} update
* @return {?}
*/
HttpRequest.prototype.clone = /**
* @param {?=} update
* @return {?}
*/
function (update) {
if (update === void 0) { update = {}; }
// For method, url, and responseType, take the current value unless
// it is overridden in the update hash.
var /** @type {?} */ method = update.method || this.method;
var /** @type {?} */ url = update.url || this.url;
var /** @type {?} */ responseType = update.responseType || this.responseType;
// The body is somewhat special - a `null` value in update.body means
// whatever current body is present is being overridden with an empty
// body, whereas an `undefined` value in update.body implies no
// override.
var /** @type {?} */ body = (update.body !== undefined) ? update.body : this.body;
// Carefully handle the boolean options to differentiate between
// `false` and `undefined` in the update args.
var /** @type {?} */ withCredentials = (update.withCredentials !== undefined) ? update.withCredentials : this.withCredentials;
var /** @type {?} */ reportProgress = (update.reportProgress !== undefined) ? update.reportProgress : this.reportProgress;
// Headers and params may be appended to if `setHeaders` or
// `setParams` are used.
var /** @type {?} */ headers = update.headers || this.headers;
var /** @type {?} */ params = update.params || this.params;
// Check whether the caller has asked to add headers.
if (update.setHeaders !== undefined) {
// Set every requested header.
headers =
Object.keys(update.setHeaders)
.reduce(function (headers, name) { return headers.set(name, /** @type {?} */ ((update.setHeaders))[name]); }, headers);
}
// Check whether the caller has asked to set params.
if (update.setParams) {
// Set every requested param.
params = Object.keys(update.setParams)
.reduce(function (params, param) { return params.set(param, /** @type {?} */ ((update.setParams))[param]); }, params);
}
// Finally, construct the new HttpRequest using the pieces from above.
return new HttpRequest(method, url, body, {
params: params, headers: headers, reportProgress: reportProgress, responseType: responseType, withCredentials: withCredentials,
});
};
return HttpRequest;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/** @enum {number} */
var HttpEventType = {
/**
* The request was sent out over the wire.
*/
Sent: 0,
/**
* An upload progress event was received.
*/
UploadProgress: 1,
/**
* The response status code and headers were received.
*/
ResponseHeader: 2,
/**
* A download progress event was received.
*/
DownloadProgress: 3,
/**
* The full response including the body was received.
*/
Response: 4,
/**
* A custom event from an interceptor or a backend.
*/
User: 5,
};
HttpEventType[HttpEventType.Sent] = "Sent";
HttpEventType[HttpEventType.UploadProgress] = "UploadProgress";
HttpEventType[HttpEventType.ResponseHeader] = "ResponseHeader";
HttpEventType[HttpEventType.DownloadProgress] = "DownloadProgress";
HttpEventType[HttpEventType.Response] = "Response";
HttpEventType[HttpEventType.User] = "User";
/**
* Base interface for progress events.
*
* \@stable
* @record
*/
/**
* A download progress event.
*
* \@stable
* @record
*/
/**
* An upload progress event.
*
* \@stable
* @record
*/
/**
* An event indicating that the request was sent to the server. Useful
* when a request may be retried multiple times, to distinguish between
* retries on the final event stream.
*
* \@stable
* @record
*/
/**
* A user-defined event.
*
* Grouping all custom events under this type ensures they will be handled
* and forwarded by all implementations of interceptors.
*
* \@stable
* @record
*/
/**
* An error that represents a failed attempt to JSON.parse text coming back
* from the server.
*
* It bundles the Error object with the actual response body that failed to parse.
*
* \@stable
* @record
*/
/**
* Base class for both `HttpResponse` and `HttpHeaderResponse`.
*
* \@stable
* @abstract
*/
var HttpResponseBase = (function () {
/**
* Super-constructor for all responses.
*
* The single parameter accepted is an initialization hash. Any properties
* of the response passed there will override the default values.
*/
function HttpResponseBase(init, defaultStatus, defaultStatusText) {
if (defaultStatus === void 0) { defaultStatus = 200; }
if (defaultStatusText === void 0) { defaultStatusText = 'OK'; }
// If the hash has values passed, use them to initialize the response.
// Otherwise use the default values.
this.headers = init.headers || new HttpHeaders();
this.status = init.status !== undefined ? init.status : defaultStatus;
this.statusText = init.statusText || defaultStatusText;
this.url = init.url || null;
// Cache the ok value to avoid defining a getter.
this.ok = this.status >= 200 && this.status < 300;
}
return HttpResponseBase;
}());
/**
* A partial HTTP response which only includes the status and header data,
* but no response body.
*
* `HttpHeaderResponse` is a `HttpEvent` available on the response
* event stream, only when progress events are requested.
*
* \@stable
*/
var HttpHeaderResponse = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_5_tslib__["b" /* __extends */])(HttpHeaderResponse, _super);
/**
* Create a new `HttpHeaderResponse` with the given parameters.
*/
function HttpHeaderResponse(init) {
if (init === void 0) { init = {}; }
var _this = _super.call(this, init) || this;
_this.type = HttpEventType.ResponseHeader;
return _this;
}
/**
* Copy this `HttpHeaderResponse`, overriding its contents with the
* given parameter hash.
*/
/**
* Copy this `HttpHeaderResponse`, overriding its contents with the
* given parameter hash.
* @param {?=} update
* @return {?}
*/
HttpHeaderResponse.prototype.clone = /**
* Copy this `HttpHeaderResponse`, overriding its contents with the
* given parameter hash.
* @param {?=} update
* @return {?}
*/
function (update) {
if (update === void 0) { update = {}; }
// Perform a straightforward initialization of the new HttpHeaderResponse,
// overriding the current parameters with new ones if given.
return new HttpHeaderResponse({
headers: update.headers || this.headers,
status: update.status !== undefined ? update.status : this.status,
statusText: update.statusText || this.statusText,
url: update.url || this.url || undefined,
});
};
return HttpHeaderResponse;
}(HttpResponseBase));
/**
* A full HTTP response, including a typed response body (which may be `null`
* if one was not returned).
*
* `HttpResponse` is a `HttpEvent` available on the response event
* stream.
*
* \@stable
*/
var HttpResponse = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_5_tslib__["b" /* __extends */])(HttpResponse, _super);
/**
* Construct a new `HttpResponse`.
*/
function HttpResponse(init) {
if (init === void 0) { init = {}; }
var _this = _super.call(this, init) || this;
_this.type = HttpEventType.Response;
_this.body = init.body || null;
return _this;
}
/**
* @param {?=} update
* @return {?}
*/
HttpResponse.prototype.clone = /**
* @param {?=} update
* @return {?}
*/
function (update) {
if (update === void 0) { update = {}; }
return new HttpResponse({
body: (update.body !== undefined) ? update.body : this.body,
headers: update.headers || this.headers,
status: (update.status !== undefined) ? update.status : this.status,
statusText: update.statusText || this.statusText,
url: update.url || this.url || undefined,
});
};
return HttpResponse;
}(HttpResponseBase));
/**
* A response that represents an error or failure, either from a
* non-successful HTTP status, an error while executing the request,
* or some other failure which occurred during the parsing of the response.
*
* Any error returned on the `Observable` response stream will be
* wrapped in an `HttpErrorResponse` to provide additional context about
* the state of the HTTP layer when the error occurred. The error property
* will contain either a wrapped Error object or the error response returned
* from the server.
*
* \@stable
*/
var HttpErrorResponse = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_5_tslib__["b" /* __extends */])(HttpErrorResponse, _super);
function HttpErrorResponse(init) {
var _this =
// Initialize with a default status of 0 / Unknown Error.
_super.call(this, init, 0, 'Unknown Error') || this;
_this.name = 'HttpErrorResponse';
/**
* Errors are never okay, even when the status code is in the 2xx success range.
*/
_this.ok = false;
// If the response was successful, then this was a parse error. Otherwise, it was
// a protocol-level failure of some sort. Either the request failed in transit
// or the server returned an unsuccessful status code.
if (_this.status >= 200 && _this.status < 300) {
_this.message = "Http failure during parsing for " + (init.url || '(unknown url)');
}
else {
_this.message =
"Http failure response for " + (init.url || '(unknown url)') + ": " + init.status + " " + init.statusText;
}
_this.error = init.error || null;
return _this;
}
return HttpErrorResponse;
}(HttpResponseBase));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Construct an instance of `HttpRequestOptions<T>` from a source `HttpMethodOptions` and
* the given `body`. Basically, this clones the object and adds the body.
* @template T
* @param {?} options
* @param {?} body
* @return {?}
*/
function addBody(options, body) {
return {
body: body,
headers: options.headers,
observe: options.observe,
params: options.params,
reportProgress: options.reportProgress,
responseType: options.responseType,
withCredentials: options.withCredentials,
};
}
/**
* Perform HTTP requests.
*
* `HttpClient` is available as an injectable class, with methods to perform HTTP requests.
* Each request method has multiple signatures, and the return type varies according to which
* signature is called (mainly the values of `observe` and `responseType`).
*
* \@stable
*/
var HttpClient = (function () {
function HttpClient(handler) {
this.handler = handler;
}
/**
* Constructs an `Observable` for a particular HTTP request that, when subscribed,
* fires the request through the chain of registered interceptors and on to the
* server.
*
* This method can be called in one of two ways. Either an `HttpRequest`
* instance can be passed directly as the only parameter, or a method can be
* passed as the first parameter, a string URL as the second, and an
* options hash as the third.
*
* If a `HttpRequest` object is passed directly, an `Observable` of the
* raw `HttpEvent` stream will be returned.
*
* If a request is instead built by providing a URL, the options object
* determines the return type of `request()`. In addition to configuring
* request parameters such as the outgoing headers and/or the body, the options
* hash specifies two key pieces of information about the request: the
* `responseType` and what to `observe`.
*
* The `responseType` value determines how a successful response body will be
* parsed. If `responseType` is the default `json`, a type interface for the
* resulting object may be passed as a type parameter to `request()`.
*
* The `observe` value determines the return type of `request()`, based on what
* the consumer is interested in observing. A value of `events` will return an
* `Observable<HttpEvent>` representing the raw `HttpEvent` stream,
* including progress events by default. A value of `response` will return an
* `Observable<HttpResponse<T>>` where the `T` parameter of `HttpResponse`
* depends on the `responseType` and any optionally provided type parameter.
* A value of `body` will return an `Observable<T>` with the same `T` body type.
*/
/**
* Constructs an `Observable` for a particular HTTP request that, when subscribed,
* fires the request through the chain of registered interceptors and on to the
* server.
*
* This method can be called in one of two ways. Either an `HttpRequest`
* instance can be passed directly as the only parameter, or a method can be
* passed as the first parameter, a string URL as the second, and an
* options hash as the third.
*
* If a `HttpRequest` object is passed directly, an `Observable` of the
* raw `HttpEvent` stream will be returned.
*
* If a request is instead built by providing a URL, the options object
* determines the return type of `request()`. In addition to configuring
* request parameters such as the outgoing headers and/or the body, the options
* hash specifies two key pieces of information about the request: the
* `responseType` and what to `observe`.
*
* The `responseType` value determines how a successful response body will be
* parsed. If `responseType` is the default `json`, a type interface for the
* resulting object may be passed as a type parameter to `request()`.
*
* The `observe` value determines the return type of `request()`, based on what
* the consumer is interested in observing. A value of `events` will return an
* `Observable<HttpEvent>` representing the raw `HttpEvent` stream,
* including progress events by default. A value of `response` will return an
* `Observable<HttpResponse<T>>` where the `T` parameter of `HttpResponse`
* depends on the `responseType` and any optionally provided type parameter.
* A value of `body` will return an `Observable<T>` with the same `T` body type.
* @param {?} first
* @param {?=} url
* @param {?=} options
* @return {?}
*/
HttpClient.prototype.request = /**
* Constructs an `Observable` for a particular HTTP request that, when subscribed,
* fires the request through the chain of registered interceptors and on to the
* server.
*
* This method can be called in one of two ways. Either an `HttpRequest`
* instance can be passed directly as the only parameter, or a method can be
* passed as the first parameter, a string URL as the second, and an
* options hash as the third.
*
* If a `HttpRequest` object is passed directly, an `Observable` of the
* raw `HttpEvent` stream will be returned.
*
* If a request is instead built by providing a URL, the options object
* determines the return type of `request()`. In addition to configuring
* request parameters such as the outgoing headers and/or the body, the options
* hash specifies two key pieces of information about the request: the
* `responseType` and what to `observe`.
*
* The `responseType` value determines how a successful response body will be
* parsed. If `responseType` is the default `json`, a type interface for the
* resulting object may be passed as a type parameter to `request()`.
*
* The `observe` value determines the return type of `request()`, based on what
* the consumer is interested in observing. A value of `events` will return an
* `Observable<HttpEvent>` representing the raw `HttpEvent` stream,
* including progress events by default. A value of `response` will return an
* `Observable<HttpResponse<T>>` where the `T` parameter of `HttpResponse`
* depends on the `responseType` and any optionally provided type parameter.
* A value of `body` will return an `Observable<T>` with the same `T` body type.
* @param {?} first
* @param {?=} url
* @param {?=} options
* @return {?}
*/
function (first, url, options) {
var _this = this;
if (options === void 0) { options = {}; }
var /** @type {?} */ req;
// Firstly, check whether the primary argument is an instance of `HttpRequest`.
if (first instanceof HttpRequest) {
// It is. The other arguments must be undefined (per the signatures) and can be
// ignored.
req = /** @type {?} */ (first);
}
else {
// It's a string, so it represents a URL. Construct a request based on it,
// and incorporate the remaining arguments (assuming GET unless a method is
// provided.
// Figure out the headers.
var /** @type {?} */ headers = undefined;
if (!!options.headers !== undefined) {
if (options.headers instanceof HttpHeaders) {
headers = options.headers;
}
else {
headers = new HttpHeaders(options.headers);
}
}
// Sort out parameters.
var /** @type {?} */ params = undefined;
if (!!options.params) {
if (options.params instanceof HttpParams) {
params = options.params;
}
else {
params = new HttpParams(/** @type {?} */ ({ fromObject: options.params }));
}
}
// Construct the request.
req = new HttpRequest(first, /** @type {?} */ ((url)), options.body || null, {
headers: headers,
params: params,
reportProgress: options.reportProgress,
// By default, JSON is assumed to be returned for all calls.
responseType: options.responseType || 'json',
withCredentials: options.withCredentials,
});
}
// Start with an Observable.of() the initial request, and run the handler (which
// includes all interceptors) inside a concatMap(). This way, the handler runs
// inside an Observable chain, which causes interceptors to be re-run on every
// subscription (this also makes retries re-run the handler, including interceptors).
var /** @type {?} */ events$ = __WEBPACK_IMPORTED_MODULE_2_rxjs_operator_concatMap__["concatMap"].call(Object(__WEBPACK_IMPORTED_MODULE_1_rxjs_observable_of__["of"])(req), function (req) { return _this.handler.handle(req); });
// If coming via the API signature which accepts a previously constructed HttpRequest,
// the only option is to get the event stream. Otherwise, return the event stream if
// that is what was requested.
if (first instanceof HttpRequest || options.observe === 'events') {
return events$;
}
// The requested stream contains either the full response or the body. In either
// case, the first step is to filter the event stream to extract a stream of
// responses(s).
var /** @type {?} */ res$ = __WEBPACK_IMPORTED_MODULE_3_rxjs_operator_filter__["filter"].call(events$, function (event) { return event instanceof HttpResponse; });
// Decide which stream to return.
switch (options.observe || 'body') {
case 'body':
// The requested stream is the body. Map the response stream to the response
// body. This could be done more simply, but a misbehaving interceptor might
// transform the response body into a different format and ignore the requested
// responseType. Guard against this by validating that the response is of the
// requested type.
switch (req.responseType) {
case 'arraybuffer':
return __WEBPACK_IMPORTED_MODULE_4_rxjs_operator_map__["map"].call(res$, function (res) {
// Validate that the body is an ArrayBuffer.
if (res.body !== null && !(res.body instanceof ArrayBuffer)) {
throw new Error('Response is not an ArrayBuffer.');
}
return res.body;
});
case 'blob':
return __WEBPACK_IMPORTED_MODULE_4_rxjs_operator_map__["map"].call(res$, function (res) {
// Validate that the body is a Blob.
if (res.body !== null && !(res.body instanceof Blob)) {
throw new Error('Response is not a Blob.');
}
return res.body;
});
case 'text':
return __WEBPACK_IMPORTED_MODULE_4_rxjs_operator_map__["map"].call(res$, function (res) {
// Validate that the body is a string.
if (res.body !== null && typeof res.body !== 'string') {
throw new Error('Response is not a string.');
}
return res.body;
});
case 'json':
default:
// No validation needed for JSON responses, as they can be of any type.
return __WEBPACK_IMPORTED_MODULE_4_rxjs_operator_map__["map"].call(res$, function (res) { return res.body; });
}
case 'response':
// The response stream was requested directly, so return it.
return res$;
default:
// Guard against new future observe types being added.
throw new Error("Unreachable: unhandled observe type " + options.observe + "}");
}
};
/**
* Constructs an `Observable` which, when subscribed, will cause the configured
* DELETE request to be executed on the server. See the individual overloads for
* details of `delete()`'s return type based on the provided options.
*/
/**
* Constructs an `Observable` which, when subscribed, will cause the configured
* DELETE request to be executed on the server. See the individual overloads for
* details of `delete()`'s return type based on the provided options.
* @param {?} url
* @param {?=} options
* @return {?}
*/
HttpClient.prototype.delete = /**
* Constructs an `Observable` which, when subscribed, will cause the configured
* DELETE request to be executed on the server. See the individual overloads for
* details of `delete()`'s return type based on the provided options.
* @param {?} url
* @param {?=} options
* @return {?}
*/
function (url, options) {
if (options === void 0) { options = {}; }
return this.request('DELETE', url, /** @type {?} */ (options));
};
/**
* Constructs an `Observable` which, when subscribed, will cause the configured
* GET request to be executed on the server. See the individual overloads for
* details of `get()`'s return type based on the provided options.
*/
/**
* Constructs an `Observable` which, when subscribed, will cause the configured
* GET request to be executed on the server. See the individual overloads for
* details of `get()`'s return type based on the provided options.
* @param {?} url
* @param {?=} options
* @return {?}
*/
HttpClient.prototype.get = /**
* Constructs an `Observable` which, when subscribed, will cause the configured
* GET request to be executed on the server. See the individual overloads for
* details of `get()`'s return type based on the provided options.
* @param {?} url
* @param {?=} options
* @return {?}
*/
function (url, options) {
if (options === void 0) { options = {}; }
return this.request('GET', url, /** @type {?} */ (options));
};
/**
* Constructs an `Observable` which, when subscribed, will cause the configured
* HEAD request to be executed on the server. See the individual overloads for
* details of `head()`'s return type based on the provided options.
*/
/**
* Constructs an `Observable` which, when subscribed, will cause the configured
* HEAD request to be executed on the server. See the individual overloads for
* details of `head()`'s return type based on the provided options.
* @param {?} url
* @param {?=} options
* @return {?}
*/
HttpClient.prototype.head = /**
* Constructs an `Observable` which, when subscribed, will cause the configured
* HEAD request to be executed on the server. See the individual overloads for
* details of `head()`'s return type based on the provided options.
* @param {?} url
* @param {?=} options
* @return {?}
*/
function (url, options) {
if (options === void 0) { options = {}; }
return this.request('HEAD', url, /** @type {?} */ (options));
};
/**
* Constructs an `Observable` which, when subscribed, will cause a request
* with the special method `JSONP` to be dispatched via the interceptor pipeline.
*
* A suitable interceptor must be installed (e.g. via the `HttpClientJsonpModule`).
* If no such interceptor is reached, then the `JSONP` request will likely be
* rejected by the configured backend.
*/
/**
* Constructs an `Observable` which, when subscribed, will cause a request
* with the special method `JSONP` to be dispatched via the interceptor pipeline.
*
* A suitable interceptor must be installed (e.g. via the `HttpClientJsonpModule`).
* If no such interceptor is reached, then the `JSONP` request will likely be
* rejected by the configured backend.
* @template T
* @param {?} url
* @param {?} callbackParam
* @return {?}
*/
HttpClient.prototype.jsonp = /**
* Constructs an `Observable` which, when subscribed, will cause a request
* with the special method `JSONP` to be dispatched via the interceptor pipeline.
*
* A suitable interceptor must be installed (e.g. via the `HttpClientJsonpModule`).
* If no such interceptor is reached, then the `JSONP` request will likely be
* rejected by the configured backend.
* @template T
* @param {?} url
* @param {?} callbackParam
* @return {?}
*/
function (url, callbackParam) {
return this.request('JSONP', url, {
params: new HttpParams().append(callbackParam, 'JSONP_CALLBACK'),
observe: 'body',
responseType: 'json',
});
};
/**
* Constructs an `Observable` which, when subscribed, will cause the configured
* OPTIONS request to be executed on the server. See the individual overloads for
* details of `options()`'s return type based on the provided options.
*/
/**
* Constructs an `Observable` which, when subscribed, will cause the configured
* OPTIONS request to be executed on the server. See the individual overloads for
* details of `options()`'s return type based on the provided options.
* @param {?} url
* @param {?=} options
* @return {?}
*/
HttpClient.prototype.options = /**
* Constructs an `Observable` which, when subscribed, will cause the configured
* OPTIONS request to be executed on the server. See the individual overloads for
* details of `options()`'s return type based on the provided options.
* @param {?} url
* @param {?=} options
* @return {?}
*/
function (url, options) {
if (options === void 0) { options = {}; }
return this.request('OPTIONS', url, /** @type {?} */ (options));
};
/**
* Constructs an `Observable` which, when subscribed, will cause the configured
* PATCH request to be executed on the server. See the individual overloads for
* details of `patch()`'s return type based on the provided options.
*/
/**
* Constructs an `Observable` which, when subscribed, will cause the configured
* PATCH request to be executed on the server. See the individual overloads for
* details of `patch()`'s return type based on the provided options.
* @param {?} url
* @param {?} body
* @param {?=} options
* @return {?}
*/
HttpClient.prototype.patch = /**
* Constructs an `Observable` which, when subscribed, will cause the configured
* PATCH request to be executed on the server. See the individual overloads for
* details of `patch()`'s return type based on the provided options.
* @param {?} url
* @param {?} body
* @param {?=} options
* @return {?}
*/
function (url, body, options) {
if (options === void 0) { options = {}; }
return this.request('PATCH', url, addBody(options, body));
};
/**
* Constructs an `Observable` which, when subscribed, will cause the configured
* POST request to be executed on the server. See the individual overloads for
* details of `post()`'s return type based on the provided options.
*/
/**
* Constructs an `Observable` which, when subscribed, will cause the configured
* POST request to be executed on the server. See the individual overloads for
* details of `post()`'s return type based on the provided options.
* @param {?} url
* @param {?} body
* @param {?=} options
* @return {?}
*/
HttpClient.prototype.post = /**
* Constructs an `Observable` which, when subscribed, will cause the configured
* POST request to be executed on the server. See the individual overloads for
* details of `post()`'s return type based on the provided options.
* @param {?} url
* @param {?} body
* @param {?=} options
* @return {?}
*/
function (url, body, options) {
if (options === void 0) { options = {}; }
return this.request('POST', url, addBody(options, body));
};
/**
* Constructs an `Observable` which, when subscribed, will cause the configured
* POST request to be executed on the server. See the individual overloads for
* details of `post()`'s return type based on the provided options.
*/
/**
* Constructs an `Observable` which, when subscribed, will cause the configured
* POST request to be executed on the server. See the individual overloads for
* details of `post()`'s return type based on the provided options.
* @param {?} url
* @param {?} body
* @param {?=} options
* @return {?}
*/
HttpClient.prototype.put = /**
* Constructs an `Observable` which, when subscribed, will cause the configured
* POST request to be executed on the server. See the individual overloads for
* details of `post()`'s return type based on the provided options.
* @param {?} url
* @param {?} body
* @param {?=} options
* @return {?}
*/
function (url, body, options) {
if (options === void 0) { options = {}; }
return this.request('PUT', url, addBody(options, body));
};
HttpClient.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
HttpClient.ctorParameters = function () { return [
{ type: HttpHandler, },
]; };
return HttpClient;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Intercepts `HttpRequest` and handles them.
*
* Most interceptors will transform the outgoing request before passing it to the
* next interceptor in the chain, by calling `next.handle(transformedReq)`.
*
* In rare cases, interceptors may wish to completely handle a request themselves,
* and not delegate to the remainder of the chain. This behavior is allowed.
*
* \@stable
* @record
*/
/**
* `HttpHandler` which applies an `HttpInterceptor` to an `HttpRequest`.
*
* \@stable
*/
var HttpInterceptorHandler = (function () {
function HttpInterceptorHandler(next, interceptor) {
this.next = next;
this.interceptor = interceptor;
}
/**
* @param {?} req
* @return {?}
*/
HttpInterceptorHandler.prototype.handle = /**
* @param {?} req
* @return {?}
*/
function (req) {
return this.interceptor.intercept(req, this.next);
};
return HttpInterceptorHandler;
}());
/**
* A multi-provider token which represents the array of `HttpInterceptor`s that
* are registered.
*
* \@stable
*/
var HTTP_INTERCEPTORS = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["B" /* InjectionToken */]('HTTP_INTERCEPTORS');
var NoopInterceptor = (function () {
function NoopInterceptor() {
}
/**
* @param {?} req
* @param {?} next
* @return {?}
*/
NoopInterceptor.prototype.intercept = /**
* @param {?} req
* @param {?} next
* @return {?}
*/
function (req, next) {
return next.handle(req);
};
NoopInterceptor.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
NoopInterceptor.ctorParameters = function () { return []; };
return NoopInterceptor;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// Every request made through JSONP needs a callback name that's unique across the
// whole page. Each request is assigned an id and the callback name is constructed
// from that. The next id to be assigned is tracked in a global variable here that
// is shared among all applications on the page.
var nextRequestId = 0;
// Error text given when a JSONP script is injected, but doesn't invoke the callback
// passed in its URL.
var JSONP_ERR_NO_CALLBACK = 'JSONP injected script did not invoke callback.';
// Error text given when a request is passed to the JsonpClientBackend that doesn't
// have a request method JSONP.
var JSONP_ERR_WRONG_METHOD = 'JSONP requests must use JSONP request method.';
var JSONP_ERR_WRONG_RESPONSE_TYPE = 'JSONP requests must use Json response type.';
/**
* DI token/abstract type representing a map of JSONP callbacks.
*
* In the browser, this should always be the `window` object.
*
* \@stable
* @abstract
*/
var JsonpCallbackContext = (function () {
function JsonpCallbackContext() {
}
return JsonpCallbackContext;
}());
/**
* `HttpBackend` that only processes `HttpRequest` with the JSONP method,
* by performing JSONP style requests.
*
* \@stable
*/
var JsonpClientBackend = (function () {
function JsonpClientBackend(callbackMap, document) {
this.callbackMap = callbackMap;
this.document = document;
}
/**
* Get the name of the next callback method, by incrementing the global `nextRequestId`.
* @return {?}
*/
JsonpClientBackend.prototype.nextCallback = /**
* Get the name of the next callback method, by incrementing the global `nextRequestId`.
* @return {?}
*/
function () { return "ng_jsonp_callback_" + nextRequestId++; };
/**
* Process a JSONP request and return an event stream of the results.
*/
/**
* Process a JSONP request and return an event stream of the results.
* @param {?} req
* @return {?}
*/
JsonpClientBackend.prototype.handle = /**
* Process a JSONP request and return an event stream of the results.
* @param {?} req
* @return {?}
*/
function (req) {
var _this = this;
// Firstly, check both the method and response type. If either doesn't match
// then the request was improperly routed here and cannot be handled.
if (req.method !== 'JSONP') {
throw new Error(JSONP_ERR_WRONG_METHOD);
}
else if (req.responseType !== 'json') {
throw new Error(JSONP_ERR_WRONG_RESPONSE_TYPE);
}
// Everything else happens inside the Observable boundary.
return new __WEBPACK_IMPORTED_MODULE_7_rxjs_Observable__["Observable"](function (observer) {
// The first step to make a request is to generate the callback name, and replace the
// callback placeholder in the URL with the name. Care has to be taken here to ensure
// a trailing &, if matched, gets inserted back into the URL in the correct place.
var /** @type {?} */ callback = _this.nextCallback();
var /** @type {?} */ url = req.urlWithParams.replace(/=JSONP_CALLBACK(&|$)/, "=" + callback + "$1");
// Construct the <script> tag and point it at the URL.
var /** @type {?} */ node = _this.document.createElement('script');
node.src = url;
// A JSONP request requires waiting for multiple callbacks. These variables
// are closed over and track state across those callbacks.
// The response object, if one has been received, or null otherwise.
var /** @type {?} */ body = null;
// Whether the response callback has been called.
var /** @type {?} */ finished = false;
// Whether the request has been cancelled (and thus any other callbacks)
// should be ignored.
var /** @type {?} */ cancelled = false;
// Set the response callback in this.callbackMap (which will be the window
// object in the browser. The script being loaded via the <script> tag will
// eventually call this callback.
// Set the response callback in this.callbackMap (which will be the window
// object in the browser. The script being loaded via the <script> tag will
// eventually call this callback.
_this.callbackMap[callback] = function (data) {
// Data has been received from the JSONP script. Firstly, delete this callback.
delete _this.callbackMap[callback];
// Next, make sure the request wasn't cancelled in the meantime.
if (cancelled) {
return;
}
// Set state to indicate data was received.
body = data;
finished = true;
};
// cleanup() is a utility closure that removes the <script> from the page and
// the response callback from the window. This logic is used in both the
// success, error, and cancellation paths, so it's extracted out for convenience.
var /** @type {?} */ cleanup = function () {
// Remove the <script> tag if it's still on the page.
if (node.parentNode) {
node.parentNode.removeChild(node);
}
// Remove the response callback from the callbackMap (window object in the
// browser).
delete _this.callbackMap[callback];
};
// onLoad() is the success callback which runs after the response callback
// if the JSONP script loads successfully. The event itself is unimportant.
// If something went wrong, onLoad() may run without the response callback
// having been invoked.
var /** @type {?} */ onLoad = function (event) {
// Do nothing if the request has been cancelled.
if (cancelled) {
return;
}
// Cleanup the page.
cleanup();
// Check whether the response callback has run.
if (!finished) {
// It hasn't, something went wrong with the request. Return an error via
// the Observable error path. All JSONP errors have status 0.
observer.error(new HttpErrorResponse({
url: url,
status: 0,
statusText: 'JSONP Error',
error: new Error(JSONP_ERR_NO_CALLBACK),
}));
return;
}
// Success. body either contains the response body or null if none was
// returned.
observer.next(new HttpResponse({
body: body,
status: 200,
statusText: 'OK', url: url,
}));
// Complete the stream, the resposne is over.
observer.complete();
};
// onError() is the error callback, which runs if the script returned generates
// a Javascript error. It emits the error via the Observable error channel as
// a HttpErrorResponse.
var /** @type {?} */ onError = function (error) {
// If the request was already cancelled, no need to emit anything.
if (cancelled) {
return;
}
cleanup();
// Wrap the error in a HttpErrorResponse.
observer.error(new HttpErrorResponse({
error: error,
status: 0,
statusText: 'JSONP Error', url: url,
}));
};
// Subscribe to both the success (load) and error events on the <script> tag,
// and add it to the page.
node.addEventListener('load', onLoad);
node.addEventListener('error', onError);
_this.document.body.appendChild(node);
// The request has now been successfully sent.
observer.next({ type: HttpEventType.Sent });
// Cancellation handler.
return function () {
// Track the cancellation so event listeners won't do anything even if already scheduled.
cancelled = true;
// Remove the event listeners so they won't run if the events later fire.
node.removeEventListener('load', onLoad);
node.removeEventListener('error', onError);
// And finally, clean up the page.
cleanup();
};
});
};
JsonpClientBackend.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
JsonpClientBackend.ctorParameters = function () { return [
{ type: JsonpCallbackContext, },
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["z" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_6__angular_common__["c" /* DOCUMENT */],] },] },
]; };
return JsonpClientBackend;
}());
/**
* An `HttpInterceptor` which identifies requests with the method JSONP and
* shifts them to the `JsonpClientBackend`.
*
* \@stable
*/
var JsonpInterceptor = (function () {
function JsonpInterceptor(jsonp) {
this.jsonp = jsonp;
}
/**
* @param {?} req
* @param {?} next
* @return {?}
*/
JsonpInterceptor.prototype.intercept = /**
* @param {?} req
* @param {?} next
* @return {?}
*/
function (req, next) {
if (req.method === 'JSONP') {
return this.jsonp.handle(/** @type {?} */ (req));
}
// Fall through for normal HTTP requests.
return next.handle(req);
};
JsonpInterceptor.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
JsonpInterceptor.ctorParameters = function () { return [
{ type: JsonpClientBackend, },
]; };
return JsonpInterceptor;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var XSSI_PREFIX = /^\)\]\}',?\n/;
/**
* Determine an appropriate URL for the response, by checking either
* XMLHttpRequest.responseURL or the X-Request-URL header.
* @param {?} xhr
* @return {?}
*/
function getResponseUrl(xhr) {
if ('responseURL' in xhr && xhr.responseURL) {
return xhr.responseURL;
}
if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
return xhr.getResponseHeader('X-Request-URL');
}
return null;
}
/**
* A wrapper around the `XMLHttpRequest` constructor.
*
* \@stable
* @abstract
*/
var XhrFactory = (function () {
function XhrFactory() {
}
return XhrFactory;
}());
/**
* A factory for \@{link HttpXhrBackend} that uses the `XMLHttpRequest` browser API.
*
* \@stable
*/
var BrowserXhr = (function () {
function BrowserXhr() {
}
/**
* @return {?}
*/
BrowserXhr.prototype.build = /**
* @return {?}
*/
function () { return /** @type {?} */ ((new XMLHttpRequest())); };
BrowserXhr.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
BrowserXhr.ctorParameters = function () { return []; };
return BrowserXhr;
}());
/**
* An `HttpBackend` which uses the XMLHttpRequest API to send
* requests to a backend server.
*
* \@stable
*/
var HttpXhrBackend = (function () {
function HttpXhrBackend(xhrFactory) {
this.xhrFactory = xhrFactory;
}
/**
* Process a request and return a stream of response events.
*/
/**
* Process a request and return a stream of response events.
* @param {?} req
* @return {?}
*/
HttpXhrBackend.prototype.handle = /**
* Process a request and return a stream of response events.
* @param {?} req
* @return {?}
*/
function (req) {
var _this = this;
// Quick check to give a better error message when a user attempts to use
// HttpClient.jsonp() without installing the JsonpClientModule
if (req.method === 'JSONP') {
throw new Error("Attempted to construct Jsonp request without JsonpClientModule installed.");
}
// Everything happens on Observable subscription.
return new __WEBPACK_IMPORTED_MODULE_7_rxjs_Observable__["Observable"](function (observer) {
// Start by setting up the XHR object with request method, URL, and withCredentials flag.
var /** @type {?} */ xhr = _this.xhrFactory.build();
xhr.open(req.method, req.urlWithParams);
if (!!req.withCredentials) {
xhr.withCredentials = true;
}
// Add all the requested headers.
req.headers.forEach(function (name, values) { return xhr.setRequestHeader(name, values.join(',')); });
// Add an Accept header if one isn't present already.
if (!req.headers.has('Accept')) {
xhr.setRequestHeader('Accept', 'application/json, text/plain, */*');
}
// Auto-detect the Content-Type header if one isn't present already.
if (!req.headers.has('Content-Type')) {
var /** @type {?} */ detectedType = req.detectContentTypeHeader();
// Sometimes Content-Type detection fails.
if (detectedType !== null) {
xhr.setRequestHeader('Content-Type', detectedType);
}
}
// Set the responseType if one was requested.
if (req.responseType) {
var /** @type {?} */ responseType = req.responseType.toLowerCase();
// JSON responses need to be processed as text. This is because if the server
// returns an XSSI-prefixed JSON response, the browser will fail to parse it,
// xhr.response will be null, and xhr.responseText cannot be accessed to
// retrieve the prefixed JSON data in order to strip the prefix. Thus, all JSON
// is parsed by first requesting text and then applying JSON.parse.
xhr.responseType = /** @type {?} */ (((responseType !== 'json') ? responseType : 'text'));
}
// Serialize the request body if one is present. If not, this will be set to null.
var /** @type {?} */ reqBody = req.serializeBody();
// If progress events are enabled, response headers will be delivered
// in two events - the HttpHeaderResponse event and the full HttpResponse
// event. However, since response headers don't change in between these
// two events, it doesn't make sense to parse them twice. So headerResponse
// caches the data extracted from the response whenever it's first parsed,
// to ensure parsing isn't duplicated.
var /** @type {?} */ headerResponse = null;
// partialFromXhr extracts the HttpHeaderResponse from the current XMLHttpRequest
// state, and memoizes it into headerResponse.
var /** @type {?} */ partialFromXhr = function () {
if (headerResponse !== null) {
return headerResponse;
}
// Read status and normalize an IE9 bug (http://bugs.jquery.com/ticket/1450).
var /** @type {?} */ status = xhr.status === 1223 ? 204 : xhr.status;
var /** @type {?} */ statusText = xhr.statusText || 'OK';
// Parse headers from XMLHttpRequest - this step is lazy.
var /** @type {?} */ headers = new HttpHeaders(xhr.getAllResponseHeaders());
// Read the response URL from the XMLHttpResponse instance and fall back on the
// request URL.
var /** @type {?} */ url = getResponseUrl(xhr) || req.url;
// Construct the HttpHeaderResponse and memoize it.
headerResponse = new HttpHeaderResponse({ headers: headers, status: status, statusText: statusText, url: url });
return headerResponse;
};
// Next, a few closures are defined for the various events which XMLHttpRequest can
// emit. This allows them to be unregistered as event listeners later.
// First up is the load event, which represents a response being fully available.
var /** @type {?} */ onLoad = function () {
// Read response state from the memoized partial data.
var _a = partialFromXhr(), headers = _a.headers, status = _a.status, statusText = _a.statusText, url = _a.url;
// The body will be read out if present.
var /** @type {?} */ body = null;
if (status !== 204) {
// Use XMLHttpRequest.response if set, responseText otherwise.
body = (typeof xhr.response === 'undefined') ? xhr.responseText : xhr.response;
}
// Normalize another potential bug (this one comes from CORS).
if (status === 0) {
status = !!body ? 200 : 0;
}
// ok determines whether the response will be transmitted on the event or
// error channel. Unsuccessful status codes (not 2xx) will always be errors,
// but a successful status code can still result in an error if the user
// asked for JSON data and the body cannot be parsed as such.
var /** @type {?} */ ok = status >= 200 && status < 300;
// Check whether the body needs to be parsed as JSON (in many cases the browser
// will have done that already).
if (ok && req.responseType === 'json' && typeof body === 'string') {
// Attempt the parse. If it fails, a parse error should be delivered to the user.
body = body.replace(XSSI_PREFIX, '');
try {
body = JSON.parse(body);
}
catch (/** @type {?} */ error) {
// Even though the response status was 2xx, this is still an error.
ok = false;
// The parse error contains the text of the body that failed to parse.
body = /** @type {?} */ ({ error: error, text: body });
}
}
else if (!ok && req.responseType === 'json' && typeof body === 'string') {
try {
// Attempt to parse the body as JSON.
body = JSON.parse(body);
}
catch (/** @type {?} */ error) {
// Cannot be certain that the body was meant to be parsed as JSON.
// Leave the body as a string.
}
}
if (ok) {
// A successful response is delivered on the event stream.
observer.next(new HttpResponse({
body: body,
headers: headers,
status: status,
statusText: statusText,
url: url || undefined,
}));
// The full body has been received and delivered, no further events
// are possible. This request is complete.
observer.complete();
}
else {
// An unsuccessful request is delivered on the error channel.
observer.error(new HttpErrorResponse({
// The error in this case is the response body (error from the server).
error: body,
headers: headers,
status: status,
statusText: statusText,
url: url || undefined,
}));
}
};
// The onError callback is called when something goes wrong at the network level.
// Connection timeout, DNS error, offline, etc. These are actual errors, and are
// transmitted on the error channel.
var /** @type {?} */ onError = function (error) {
var /** @type {?} */ res = new HttpErrorResponse({
error: error,
status: xhr.status || 0,
statusText: xhr.statusText || 'Unknown Error',
});
observer.error(res);
};
// The sentHeaders flag tracks whether the HttpResponseHeaders event
// has been sent on the stream. This is necessary to track if progress
// is enabled since the event will be sent on only the first download
// progerss event.
var /** @type {?} */ sentHeaders = false;
// The download progress event handler, which is only registered if
// progress events are enabled.
var /** @type {?} */ onDownProgress = function (event) {
// Send the HttpResponseHeaders event if it hasn't been sent already.
if (!sentHeaders) {
observer.next(partialFromXhr());
sentHeaders = true;
}
// Start building the download progress event to deliver on the response
// event stream.
var /** @type {?} */ progressEvent = {
type: HttpEventType.DownloadProgress,
loaded: event.loaded,
};
// Set the total number of bytes in the event if it's available.
if (event.lengthComputable) {
progressEvent.total = event.total;
}
// If the request was for text content and a partial response is
// available on XMLHttpRequest, include it in the progress event
// to allow for streaming reads.
if (req.responseType === 'text' && !!xhr.responseText) {
progressEvent.partialText = xhr.responseText;
}
// Finally, fire the event.
observer.next(progressEvent);
};
// The upload progress event handler, which is only registered if
// progress events are enabled.
var /** @type {?} */ onUpProgress = function (event) {
// Upload progress events are simpler. Begin building the progress
// event.
var /** @type {?} */ progress = {
type: HttpEventType.UploadProgress,
loaded: event.loaded,
};
// If the total number of bytes being uploaded is available, include
// it.
if (event.lengthComputable) {
progress.total = event.total;
}
// Send the event.
observer.next(progress);
};
// By default, register for load and error events.
xhr.addEventListener('load', onLoad);
xhr.addEventListener('error', onError);
// Progress events are only enabled if requested.
if (req.reportProgress) {
// Download progress is always enabled if requested.
xhr.addEventListener('progress', onDownProgress);
// Upload progress depends on whether there is a body to upload.
if (reqBody !== null && xhr.upload) {
xhr.upload.addEventListener('progress', onUpProgress);
}
}
// Fire the request, and notify the event stream that it was fired.
xhr.send(reqBody);
observer.next({ type: HttpEventType.Sent });
// This is the return from the Observable function, which is the
// request cancellation handler.
return function () {
// On a cancellation, remove all registered event listeners.
xhr.removeEventListener('error', onError);
xhr.removeEventListener('load', onLoad);
if (req.reportProgress) {
xhr.removeEventListener('progress', onDownProgress);
if (reqBody !== null && xhr.upload) {
xhr.upload.removeEventListener('progress', onUpProgress);
}
}
// Finally, abort the in-flight request.
xhr.abort();
};
});
};
HttpXhrBackend.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
HttpXhrBackend.ctorParameters = function () { return [
{ type: XhrFactory, },
]; };
return HttpXhrBackend;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var XSRF_COOKIE_NAME = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["B" /* InjectionToken */]('XSRF_COOKIE_NAME');
var XSRF_HEADER_NAME = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["B" /* InjectionToken */]('XSRF_HEADER_NAME');
/**
* Retrieves the current XSRF token to use with the next outgoing request.
*
* \@stable
* @abstract
*/
var HttpXsrfTokenExtractor = (function () {
function HttpXsrfTokenExtractor() {
}
return HttpXsrfTokenExtractor;
}());
/**
* `HttpXsrfTokenExtractor` which retrieves the token from a cookie.
*/
var HttpXsrfCookieExtractor = (function () {
function HttpXsrfCookieExtractor(doc, platform, cookieName) {
this.doc = doc;
this.platform = platform;
this.cookieName = cookieName;
this.lastCookieString = '';
this.lastToken = null;
/**
* \@internal for testing
*/
this.parseCount = 0;
}
/**
* @return {?}
*/
HttpXsrfCookieExtractor.prototype.getToken = /**
* @return {?}
*/
function () {
if (this.platform === 'server') {
return null;
}
var /** @type {?} */ cookieString = this.doc.cookie || '';
if (cookieString !== this.lastCookieString) {
this.parseCount++;
this.lastToken = Object(__WEBPACK_IMPORTED_MODULE_6__angular_common__["j" /* ɵparseCookieValue */])(cookieString, this.cookieName);
this.lastCookieString = cookieString;
}
return this.lastToken;
};
HttpXsrfCookieExtractor.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
HttpXsrfCookieExtractor.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["z" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_6__angular_common__["c" /* DOCUMENT */],] },] },
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["z" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["Q" /* PLATFORM_ID */],] },] },
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["z" /* Inject */], args: [XSRF_COOKIE_NAME,] },] },
]; };
return HttpXsrfCookieExtractor;
}());
/**
* `HttpInterceptor` which adds an XSRF token to eligible outgoing requests.
*/
var HttpXsrfInterceptor = (function () {
function HttpXsrfInterceptor(tokenService, headerName) {
this.tokenService = tokenService;
this.headerName = headerName;
}
/**
* @param {?} req
* @param {?} next
* @return {?}
*/
HttpXsrfInterceptor.prototype.intercept = /**
* @param {?} req
* @param {?} next
* @return {?}
*/
function (req, next) {
var /** @type {?} */ lcUrl = req.url.toLowerCase();
// Skip both non-mutating requests and absolute URLs.
// Non-mutating requests don't require a token, and absolute URLs require special handling
// anyway as the cookie set
// on our origin is not the same as the token expected by another origin.
if (req.method === 'GET' || req.method === 'HEAD' || lcUrl.startsWith('http://') ||
lcUrl.startsWith('https://')) {
return next.handle(req);
}
var /** @type {?} */ token = this.tokenService.getToken();
// Be careful not to overwrite an existing header of the same name.
if (token !== null && !req.headers.has(this.headerName)) {
req = req.clone({ headers: req.headers.set(this.headerName, token) });
}
return next.handle(req);
};
HttpXsrfInterceptor.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
HttpXsrfInterceptor.ctorParameters = function () { return [
{ type: HttpXsrfTokenExtractor, },
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["z" /* Inject */], args: [XSRF_HEADER_NAME,] },] },
]; };
return HttpXsrfInterceptor;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Constructs an `HttpHandler` that applies a bunch of `HttpInterceptor`s
* to a request before passing it to the given `HttpBackend`.
*
* Meant to be used as a factory function within `HttpClientModule`.
*
* \@stable
* @param {?} backend
* @param {?=} interceptors
* @return {?}
*/
function interceptingHandler(backend, interceptors) {
if (interceptors === void 0) { interceptors = []; }
if (!interceptors) {
return backend;
}
return interceptors.reduceRight(function (next, interceptor) { return new HttpInterceptorHandler(next, interceptor); }, backend);
}
/**
* Factory function that determines where to store JSONP callbacks.
*
* Ordinarily JSONP callbacks are stored on the `window` object, but this may not exist
* in test environments. In that case, callbacks are stored on an anonymous object instead.
*
* \@stable
* @return {?}
*/
function jsonpCallbackContext() {
if (typeof window === 'object') {
return window;
}
return {};
}
/**
* `NgModule` which adds XSRF protection support to outgoing requests.
*
* Provided the server supports a cookie-based XSRF protection system, this
* module can be used directly to configure XSRF protection with the correct
* cookie and header names.
*
* If no such names are provided, the default is to use `X-XSRF-TOKEN` for
* the header name and `XSRF-TOKEN` for the cookie name.
*
* \@stable
*/
var HttpClientXsrfModule = (function () {
function HttpClientXsrfModule() {
}
/**
* Disable the default XSRF protection.
*/
/**
* Disable the default XSRF protection.
* @return {?}
*/
HttpClientXsrfModule.disable = /**
* Disable the default XSRF protection.
* @return {?}
*/
function () {
return {
ngModule: HttpClientXsrfModule,
providers: [
{ provide: HttpXsrfInterceptor, useClass: NoopInterceptor },
],
};
};
/**
* Configure XSRF protection to use the given cookie name or header name,
* or the default names (as described above) if not provided.
*/
/**
* Configure XSRF protection to use the given cookie name or header name,
* or the default names (as described above) if not provided.
* @param {?=} options
* @return {?}
*/
HttpClientXsrfModule.withOptions = /**
* Configure XSRF protection to use the given cookie name or header name,
* or the default names (as described above) if not provided.
* @param {?=} options
* @return {?}
*/
function (options) {
if (options === void 0) { options = {}; }
return {
ngModule: HttpClientXsrfModule,
providers: [
options.cookieName ? { provide: XSRF_COOKIE_NAME, useValue: options.cookieName } : [],
options.headerName ? { provide: XSRF_HEADER_NAME, useValue: options.headerName } : [],
],
};
};
HttpClientXsrfModule.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["I" /* NgModule */], args: [{
providers: [
HttpXsrfInterceptor,
{ provide: HTTP_INTERCEPTORS, useExisting: HttpXsrfInterceptor, multi: true },
{ provide: HttpXsrfTokenExtractor, useClass: HttpXsrfCookieExtractor },
{ provide: XSRF_COOKIE_NAME, useValue: 'XSRF-TOKEN' },
{ provide: XSRF_HEADER_NAME, useValue: 'X-XSRF-TOKEN' },
],
},] },
];
/** @nocollapse */
HttpClientXsrfModule.ctorParameters = function () { return []; };
return HttpClientXsrfModule;
}());
/**
* `NgModule` which provides the `HttpClient` and associated services.
*
* Interceptors can be added to the chain behind `HttpClient` by binding them
* to the multiprovider for `HTTP_INTERCEPTORS`.
*
* \@stable
*/
var HttpClientModule = (function () {
function HttpClientModule() {
}
HttpClientModule.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["I" /* NgModule */], args: [{
imports: [
HttpClientXsrfModule.withOptions({
cookieName: 'XSRF-TOKEN',
headerName: 'X-XSRF-TOKEN',
}),
],
providers: [
HttpClient,
// HttpHandler is the backend + interceptors and is constructed
// using the interceptingHandler factory function.
{
provide: HttpHandler,
useFactory: interceptingHandler,
deps: [HttpBackend, [new __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */](), new __WEBPACK_IMPORTED_MODULE_0__angular_core__["z" /* Inject */](HTTP_INTERCEPTORS)]],
},
HttpXhrBackend,
{ provide: HttpBackend, useExisting: HttpXhrBackend },
BrowserXhr,
{ provide: XhrFactory, useExisting: BrowserXhr },
],
},] },
];
/** @nocollapse */
HttpClientModule.ctorParameters = function () { return []; };
return HttpClientModule;
}());
/**
* `NgModule` which enables JSONP support in `HttpClient`.
*
* Without this module, Jsonp requests will reach the backend
* with method JSONP, where they'll be rejected.
*
* \@stable
*/
var HttpClientJsonpModule = (function () {
function HttpClientJsonpModule() {
}
HttpClientJsonpModule.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["I" /* NgModule */], args: [{
providers: [
JsonpClientBackend,
{ provide: JsonpCallbackContext, useFactory: jsonpCallbackContext },
{ provide: HTTP_INTERCEPTORS, useClass: JsonpInterceptor, multi: true },
],
},] },
];
/** @nocollapse */
HttpClientJsonpModule.ctorParameters = function () { return []; };
return HttpClientJsonpModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Generated bundle index. Do not edit.
*/
//# sourceMappingURL=http.js.map
/***/ }),
/* 42 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Observable_1 = __webpack_require__(9);
var Subscriber_1 = __webpack_require__(25);
var Subscription_1 = __webpack_require__(39);
var ObjectUnsubscribedError_1 = __webpack_require__(374);
var SubjectSubscription_1 = __webpack_require__(375);
var rxSubscriber_1 = __webpack_require__(72);
/**
* @class SubjectSubscriber<T>
*/
var SubjectSubscriber = (function (_super) {
__extends(SubjectSubscriber, _super);
function SubjectSubscriber(destination) {
_super.call(this, destination);
this.destination = destination;
}
return SubjectSubscriber;
}(Subscriber_1.Subscriber));
exports.SubjectSubscriber = SubjectSubscriber;
/**
* @class Subject<T>
*/
var Subject = (function (_super) {
__extends(Subject, _super);
function Subject() {
_super.call(this);
this.observers = [];
this.closed = false;
this.isStopped = false;
this.hasError = false;
this.thrownError = null;
}
Subject.prototype[rxSubscriber_1.rxSubscriber] = function () {
return new SubjectSubscriber(this);
};
Subject.prototype.lift = function (operator) {
var subject = new AnonymousSubject(this, this);
subject.operator = operator;
return subject;
};
Subject.prototype.next = function (value) {
if (this.closed) {
throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();
}
if (!this.isStopped) {
var observers = this.observers;
var len = observers.length;
var copy = observers.slice();
for (var i = 0; i < len; i++) {
copy[i].next(value);
}
}
};
Subject.prototype.error = function (err) {
if (this.closed) {
throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();
}
this.hasError = true;
this.thrownError = err;
this.isStopped = true;
var observers = this.observers;
var len = observers.length;
var copy = observers.slice();
for (var i = 0; i < len; i++) {
copy[i].error(err);
}
this.observers.length = 0;
};
Subject.prototype.complete = function () {
if (this.closed) {
throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();
}
this.isStopped = true;
var observers = this.observers;
var len = observers.length;
var copy = observers.slice();
for (var i = 0; i < len; i++) {
copy[i].complete();
}
this.observers.length = 0;
};
Subject.prototype.unsubscribe = function () {
this.isStopped = true;
this.closed = true;
this.observers = null;
};
Subject.prototype._trySubscribe = function (subscriber) {
if (this.closed) {
throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();
}
else {
return _super.prototype._trySubscribe.call(this, subscriber);
}
};
Subject.prototype._subscribe = function (subscriber) {
if (this.closed) {
throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();
}
else if (this.hasError) {
subscriber.error(this.thrownError);
return Subscription_1.Subscription.EMPTY;
}
else if (this.isStopped) {
subscriber.complete();
return Subscription_1.Subscription.EMPTY;
}
else {
this.observers.push(subscriber);
return new SubjectSubscription_1.SubjectSubscription(this, subscriber);
}
};
Subject.prototype.asObservable = function () {
var observable = new Observable_1.Observable();
observable.source = this;
return observable;
};
Subject.create = function (destination, source) {
return new AnonymousSubject(destination, source);
};
return Subject;
}(Observable_1.Observable));
exports.Subject = Subject;
/**
* @class AnonymousSubject<T>
*/
var AnonymousSubject = (function (_super) {
__extends(AnonymousSubject, _super);
function AnonymousSubject(destination, source) {
_super.call(this);
this.destination = destination;
this.source = source;
}
AnonymousSubject.prototype.next = function (value) {
var destination = this.destination;
if (destination && destination.next) {
destination.next(value);
}
};
AnonymousSubject.prototype.error = function (err) {
var destination = this.destination;
if (destination && destination.error) {
this.destination.error(err);
}
};
AnonymousSubject.prototype.complete = function () {
var destination = this.destination;
if (destination && destination.complete) {
this.destination.complete();
}
};
AnonymousSubject.prototype._subscribe = function (subscriber) {
var source = this.source;
if (source) {
return this.source.subscribe(subscriber);
}
else {
return Subscription_1.Subscription.EMPTY;
}
};
return AnonymousSubject;
}(Subject));
exports.AnonymousSubject = AnonymousSubject;
//# sourceMappingURL=Subject.js.map
/***/ }),
/* 43 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export NgLocaleLocalization */
/* unused harmony export NgLocalization */
/* unused harmony export registerLocaleData */
/* unused harmony export Plural */
/* unused harmony export NumberFormatStyle */
/* unused harmony export FormStyle */
/* unused harmony export TranslationWidth */
/* unused harmony export FormatWidth */
/* unused harmony export NumberSymbol */
/* unused harmony export WeekDay */
/* unused harmony export getLocaleDayPeriods */
/* unused harmony export getLocaleDayNames */
/* unused harmony export getLocaleMonthNames */
/* unused harmony export getLocaleId */
/* unused harmony export getLocaleEraNames */
/* unused harmony export getLocaleWeekEndRange */
/* unused harmony export getLocaleFirstDayOfWeek */
/* unused harmony export getLocaleDateFormat */
/* unused harmony export getLocaleDateTimeFormat */
/* unused harmony export getLocaleExtraDayPeriodRules */
/* unused harmony export getLocaleExtraDayPeriods */
/* unused harmony export getLocalePluralCase */
/* unused harmony export getLocaleTimeFormat */
/* unused harmony export getLocaleNumberSymbol */
/* unused harmony export getLocaleNumberFormat */
/* unused harmony export getLocaleCurrencyName */
/* unused harmony export getLocaleCurrencySymbol */
/* unused harmony export CURRENCIES */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return parseCookieValue; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return CommonModule; });
/* unused harmony export DeprecatedI18NPipesModule */
/* unused harmony export NgClass */
/* unused harmony export NgForOf */
/* unused harmony export NgForOfContext */
/* unused harmony export NgIf */
/* unused harmony export NgIfContext */
/* unused harmony export NgPlural */
/* unused harmony export NgPluralCase */
/* unused harmony export NgStyle */
/* unused harmony export NgSwitch */
/* unused harmony export NgSwitchCase */
/* unused harmony export NgSwitchDefault */
/* unused harmony export NgTemplateOutlet */
/* unused harmony export NgComponentOutlet */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return DOCUMENT; });
/* unused harmony export AsyncPipe */
/* unused harmony export DatePipe */
/* unused harmony export I18nPluralPipe */
/* unused harmony export I18nSelectPipe */
/* unused harmony export JsonPipe */
/* unused harmony export LowerCasePipe */
/* unused harmony export CurrencyPipe */
/* unused harmony export DecimalPipe */
/* unused harmony export PercentPipe */
/* unused harmony export SlicePipe */
/* unused harmony export UpperCasePipe */
/* unused harmony export TitleCasePipe */
/* unused harmony export DeprecatedDatePipe */
/* unused harmony export DeprecatedCurrencyPipe */
/* unused harmony export DeprecatedDecimalPipe */
/* unused harmony export DeprecatedPercentPipe */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return PLATFORM_BROWSER_ID; });
/* unused harmony export ɵPLATFORM_SERVER_ID */
/* unused harmony export ɵPLATFORM_WORKER_APP_ID */
/* unused harmony export ɵPLATFORM_WORKER_UI_ID */
/* unused harmony export isPlatformBrowser */
/* unused harmony export isPlatformServer */
/* unused harmony export isPlatformWorkerApp */
/* unused harmony export isPlatformWorkerUi */
/* unused harmony export VERSION */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return PlatformLocation; });
/* unused harmony export LOCATION_INITIALIZED */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return LocationStrategy; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return APP_BASE_HREF; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return HashLocationStrategy; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return PathLocationStrategy; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return Location; });
/* unused harmony export ɵe */
/* unused harmony export ɵd */
/* unused harmony export ɵa */
/* unused harmony export ɵb */
/* unused harmony export ɵg */
/* unused harmony export ɵf */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_tslib__ = __webpack_require__(31);
/**
* @license Angular v5.0.3
* (c) 2010-2017 Google, Inc. https://angular.io/
* License: MIT
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* This class should not be used directly by an application developer. Instead, use
* {\@link Location}.
*
* `PlatformLocation` encapsulates all calls to DOM apis, which allows the Router to be platform
* agnostic.
* This means that we can have different implementation of `PlatformLocation` for the different
* platforms that angular supports. For example, `\@angular/platform-browser` provides an
* implementation specific to the browser environment, while `\@angular/platform-webworker` provides
* one suitable for use with web workers.
*
* The `PlatformLocation` class is used directly by all implementations of {\@link LocationStrategy}
* when they need to interact with the DOM apis like pushState, popState, etc...
*
* {\@link LocationStrategy} in turn is used by the {\@link Location} service which is used directly
* by the {\@link Router} in order to navigate between routes. Since all interactions between {\@link
* Router} /
* {\@link Location} / {\@link LocationStrategy} and DOM apis flow through the `PlatformLocation`
* class they are all platform independent.
*
* \@stable
* @abstract
*/
var PlatformLocation = (function () {
function PlatformLocation() {
}
return PlatformLocation;
}());
/**
* \@whatItDoes indicates when a location is initialized
* \@experimental
*/
var LOCATION_INITIALIZED = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["B" /* InjectionToken */]('Location Initialized');
/**
* A serializable version of the event from onPopState or onHashChange
*
* \@experimental
* @record
*/
/**
* \@experimental
* @record
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* `LocationStrategy` is responsible for representing and reading route state
* from the browser's URL. Angular provides two strategies:
* {\@link HashLocationStrategy} and {\@link PathLocationStrategy}.
*
* This is used under the hood of the {\@link Location} service.
*
* Applications should use the {\@link Router} or {\@link Location} services to
* interact with application route state.
*
* For instance, {\@link HashLocationStrategy} produces URLs like
* `http://example.com#/foo`, and {\@link PathLocationStrategy} produces
* `http://example.com/foo` as an equivalent URL.
*
* See these two classes for more.
*
* \@stable
* @abstract
*/
var LocationStrategy = (function () {
function LocationStrategy() {
}
return LocationStrategy;
}());
/**
* The `APP_BASE_HREF` token represents the base href to be used with the
* {\@link PathLocationStrategy}.
*
* If you're using {\@link PathLocationStrategy}, you must provide a provider to a string
* representing the URL prefix that should be preserved when generating and recognizing
* URLs.
*
* ### Example
*
* ```typescript
* import {Component, NgModule} from '\@angular/core';
* import {APP_BASE_HREF} from '\@angular/common';
*
* \@NgModule({
* providers: [{provide: APP_BASE_HREF, useValue: '/my/app'}]
* })
* class AppModule {}
* ```
*
* \@stable
*/
var APP_BASE_HREF = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["B" /* InjectionToken */]('appBaseHref');
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* \@experimental
* @record
*/
/**
* \@whatItDoes `Location` is a service that applications can use to interact with a browser's URL.
* \@description
* Depending on which {\@link LocationStrategy} is used, `Location` will either persist
* to the URL's path or the URL's hash segment.
*
* Note: it's better to use {\@link Router#navigate} service to trigger route changes. Use
* `Location` only if you need to interact with or create normalized URLs outside of
* routing.
*
* `Location` is responsible for normalizing the URL against the application's base href.
* A normalized URL is absolute from the URL host, includes the application's base href, and has no
* trailing slash:
* - `/my/app/user/123` is normalized
* - `my/app/user/123` **is not** normalized
* - `/my/app/user/123/` **is not** normalized
*
* ### Example
* {\@example common/location/ts/path_location_component.ts region='LocationComponent'}
* \@stable
*/
var Location = (function () {
function Location(platformStrategy) {
var _this = this;
/**
* \@internal
*/
this._subject = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
this._platformStrategy = platformStrategy;
var /** @type {?} */ browserBaseHref = this._platformStrategy.getBaseHref();
this._baseHref = Location.stripTrailingSlash(_stripIndexHtml(browserBaseHref));
this._platformStrategy.onPopState(function (ev) {
_this._subject.emit({
'url': _this.path(true),
'pop': true,
'type': ev.type,
});
});
}
/**
* Returns the normalized URL path.
*/
// TODO: vsavkin. Remove the boolean flag and always include hash once the deprecated router is
// removed.
/**
* Returns the normalized URL path.
* @param {?=} includeHash
* @return {?}
*/
Location.prototype.path = /**
* Returns the normalized URL path.
* @param {?=} includeHash
* @return {?}
*/
function (includeHash) {
if (includeHash === void 0) { includeHash = false; }
return this.normalize(this._platformStrategy.path(includeHash));
};
/**
* Normalizes the given path and compares to the current normalized path.
*/
/**
* Normalizes the given path and compares to the current normalized path.
* @param {?} path
* @param {?=} query
* @return {?}
*/
Location.prototype.isCurrentPathEqualTo = /**
* Normalizes the given path and compares to the current normalized path.
* @param {?} path
* @param {?=} query
* @return {?}
*/
function (path, query) {
if (query === void 0) { query = ''; }
return this.path() == this.normalize(path + Location.normalizeQueryParams(query));
};
/**
* Given a string representing a URL, returns the normalized URL path without leading or
* trailing slashes.
*/
/**
* Given a string representing a URL, returns the normalized URL path without leading or
* trailing slashes.
* @param {?} url
* @return {?}
*/
Location.prototype.normalize = /**
* Given a string representing a URL, returns the normalized URL path without leading or
* trailing slashes.
* @param {?} url
* @return {?}
*/
function (url) {
return Location.stripTrailingSlash(_stripBaseHref(this._baseHref, _stripIndexHtml(url)));
};
/**
* Given a string representing a URL, returns the platform-specific external URL path.
* If the given URL doesn't begin with a leading slash (`'/'`), this method adds one
* before normalizing. This method will also add a hash if `HashLocationStrategy` is
* used, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use.
*/
/**
* Given a string representing a URL, returns the platform-specific external URL path.
* If the given URL doesn't begin with a leading slash (`'/'`), this method adds one
* before normalizing. This method will also add a hash if `HashLocationStrategy` is
* used, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use.
* @param {?} url
* @return {?}
*/
Location.prototype.prepareExternalUrl = /**
* Given a string representing a URL, returns the platform-specific external URL path.
* If the given URL doesn't begin with a leading slash (`'/'`), this method adds one
* before normalizing. This method will also add a hash if `HashLocationStrategy` is
* used, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use.
* @param {?} url
* @return {?}
*/
function (url) {
if (url && url[0] !== '/') {
url = '/' + url;
}
return this._platformStrategy.prepareExternalUrl(url);
};
// TODO: rename this method to pushState
/**
* Changes the browsers URL to the normalized version of the given URL, and pushes a
* new item onto the platform's history.
*/
/**
* Changes the browsers URL to the normalized version of the given URL, and pushes a
* new item onto the platform's history.
* @param {?} path
* @param {?=} query
* @return {?}
*/
Location.prototype.go = /**
* Changes the browsers URL to the normalized version of the given URL, and pushes a
* new item onto the platform's history.
* @param {?} path
* @param {?=} query
* @return {?}
*/
function (path, query) {
if (query === void 0) { query = ''; }
this._platformStrategy.pushState(null, '', path, query);
};
/**
* Changes the browsers URL to the normalized version of the given URL, and replaces
* the top item on the platform's history stack.
*/
/**
* Changes the browsers URL to the normalized version of the given URL, and replaces
* the top item on the platform's history stack.
* @param {?} path
* @param {?=} query
* @return {?}
*/
Location.prototype.replaceState = /**
* Changes the browsers URL to the normalized version of the given URL, and replaces
* the top item on the platform's history stack.
* @param {?} path
* @param {?=} query
* @return {?}
*/
function (path, query) {
if (query === void 0) { query = ''; }
this._platformStrategy.replaceState(null, '', path, query);
};
/**
* Navigates forward in the platform's history.
*/
/**
* Navigates forward in the platform's history.
* @return {?}
*/
Location.prototype.forward = /**
* Navigates forward in the platform's history.
* @return {?}
*/
function () { this._platformStrategy.forward(); };
/**
* Navigates back in the platform's history.
*/
/**
* Navigates back in the platform's history.
* @return {?}
*/
Location.prototype.back = /**
* Navigates back in the platform's history.
* @return {?}
*/
function () { this._platformStrategy.back(); };
/**
* Subscribe to the platform's `popState` events.
*/
/**
* Subscribe to the platform's `popState` events.
* @param {?} onNext
* @param {?=} onThrow
* @param {?=} onReturn
* @return {?}
*/
Location.prototype.subscribe = /**
* Subscribe to the platform's `popState` events.
* @param {?} onNext
* @param {?=} onThrow
* @param {?=} onReturn
* @return {?}
*/
function (onNext, onThrow, onReturn) {
return this._subject.subscribe({ next: onNext, error: onThrow, complete: onReturn });
};
/**
* Given a string of url parameters, prepend with '?' if needed, otherwise return parameters as
* is.
* @param {?} params
* @return {?}
*/
Location.normalizeQueryParams = /**
* Given a string of url parameters, prepend with '?' if needed, otherwise return parameters as
* is.
* @param {?} params
* @return {?}
*/
function (params) {
return params && params[0] !== '?' ? '?' + params : params;
};
/**
* Given 2 parts of a url, join them with a slash if needed.
* @param {?} start
* @param {?} end
* @return {?}
*/
Location.joinWithSlash = /**
* Given 2 parts of a url, join them with a slash if needed.
* @param {?} start
* @param {?} end
* @return {?}
*/
function (start, end) {
if (start.length == 0) {
return end;
}
if (end.length == 0) {
return start;
}
var /** @type {?} */ slashes = 0;
if (start.endsWith('/')) {
slashes++;
}
if (end.startsWith('/')) {
slashes++;
}
if (slashes == 2) {
return start + end.substring(1);
}
if (slashes == 1) {
return start + end;
}
return start + '/' + end;
};
/**
* If url has a trailing slash, remove it, otherwise return url as is. This
* method looks for the first occurence of either #, ?, or the end of the
* line as `/` characters after any of these should not be replaced.
* @param {?} url
* @return {?}
*/
Location.stripTrailingSlash = /**
* If url has a trailing slash, remove it, otherwise return url as is. This
* method looks for the first occurence of either #, ?, or the end of the
* line as `/` characters after any of these should not be replaced.
* @param {?} url
* @return {?}
*/
function (url) {
var /** @type {?} */ match = url.match(/#|\?|$/);
var /** @type {?} */ pathEndIdx = match && match.index || url.length;
var /** @type {?} */ droppedSlashIdx = pathEndIdx - (url[pathEndIdx - 1] === '/' ? 1 : 0);
return url.slice(0, droppedSlashIdx) + url.slice(pathEndIdx);
};
Location.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
Location.ctorParameters = function () { return [
{ type: LocationStrategy, },
]; };
return Location;
}());
/**
* @param {?} baseHref
* @param {?} url
* @return {?}
*/
function _stripBaseHref(baseHref, url) {
return baseHref && url.startsWith(baseHref) ? url.substring(baseHref.length) : url;
}
/**
* @param {?} url
* @return {?}
*/
function _stripIndexHtml(url) {
return url.replace(/\/index.html$/, '');
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* \@whatItDoes Use URL hash for storing application location data.
* \@description
* `HashLocationStrategy` is a {\@link LocationStrategy} used to configure the
* {\@link Location} service to represent its state in the
* [hash fragment](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax)
* of the browser's URL.
*
* For instance, if you call `location.go('/foo')`, the browser's URL will become
* `example.com#/foo`.
*
* ### Example
*
* {\@example common/location/ts/hash_location_component.ts region='LocationComponent'}
*
* \@stable
*/
var HashLocationStrategy = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __extends */])(HashLocationStrategy, _super);
function HashLocationStrategy(_platformLocation, _baseHref) {
var _this = _super.call(this) || this;
_this._platformLocation = _platformLocation;
_this._baseHref = '';
if (_baseHref != null) {
_this._baseHref = _baseHref;
}
return _this;
}
/**
* @param {?} fn
* @return {?}
*/
HashLocationStrategy.prototype.onPopState = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
this._platformLocation.onPopState(fn);
this._platformLocation.onHashChange(fn);
};
/**
* @return {?}
*/
HashLocationStrategy.prototype.getBaseHref = /**
* @return {?}
*/
function () { return this._baseHref; };
/**
* @param {?=} includeHash
* @return {?}
*/
HashLocationStrategy.prototype.path = /**
* @param {?=} includeHash
* @return {?}
*/
function (includeHash) {
if (includeHash === void 0) { includeHash = false; }
// the hash value is always prefixed with a `#`
// and if it is empty then it will stay empty
var /** @type {?} */ path = this._platformLocation.hash;
if (path == null)
path = '#';
return path.length > 0 ? path.substring(1) : path;
};
/**
* @param {?} internal
* @return {?}
*/
HashLocationStrategy.prototype.prepareExternalUrl = /**
* @param {?} internal
* @return {?}
*/
function (internal) {
var /** @type {?} */ url = Location.joinWithSlash(this._baseHref, internal);
return url.length > 0 ? ('#' + url) : url;
};
/**
* @param {?} state
* @param {?} title
* @param {?} path
* @param {?} queryParams
* @return {?}
*/
HashLocationStrategy.prototype.pushState = /**
* @param {?} state
* @param {?} title
* @param {?} path
* @param {?} queryParams
* @return {?}
*/
function (state, title, path, queryParams) {
var /** @type {?} */ url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams));
if (url.length == 0) {
url = this._platformLocation.pathname;
}
this._platformLocation.pushState(state, title, url);
};
/**
* @param {?} state
* @param {?} title
* @param {?} path
* @param {?} queryParams
* @return {?}
*/
HashLocationStrategy.prototype.replaceState = /**
* @param {?} state
* @param {?} title
* @param {?} path
* @param {?} queryParams
* @return {?}
*/
function (state, title, path, queryParams) {
var /** @type {?} */ url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams));
if (url.length == 0) {
url = this._platformLocation.pathname;
}
this._platformLocation.replaceState(state, title, url);
};
/**
* @return {?}
*/
HashLocationStrategy.prototype.forward = /**
* @return {?}
*/
function () { this._platformLocation.forward(); };
/**
* @return {?}
*/
HashLocationStrategy.prototype.back = /**
* @return {?}
*/
function () { this._platformLocation.back(); };
HashLocationStrategy.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
HashLocationStrategy.ctorParameters = function () { return [
{ type: PlatformLocation, },
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["z" /* Inject */], args: [APP_BASE_HREF,] },] },
]; };
return HashLocationStrategy;
}(LocationStrategy));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* \@whatItDoes Use URL for storing application location data.
* \@description
* `PathLocationStrategy` is a {\@link LocationStrategy} used to configure the
* {\@link Location} service to represent its state in the
* [path](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax) of the
* browser's URL.
*
* If you're using `PathLocationStrategy`, you must provide a {\@link APP_BASE_HREF}
* or add a base element to the document. This URL prefix that will be preserved
* when generating and recognizing URLs.
*
* For instance, if you provide an `APP_BASE_HREF` of `'/my/app'` and call
* `location.go('/foo')`, the browser's URL will become
* `example.com/my/app/foo`.
*
* Similarly, if you add `<base href='/my/app'/>` to the document and call
* `location.go('/foo')`, the browser's URL will become
* `example.com/my/app/foo`.
*
* ### Example
*
* {\@example common/location/ts/path_location_component.ts region='LocationComponent'}
*
* \@stable
*/
var PathLocationStrategy = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __extends */])(PathLocationStrategy, _super);
function PathLocationStrategy(_platformLocation, href) {
var _this = _super.call(this) || this;
_this._platformLocation = _platformLocation;
if (href == null) {
href = _this._platformLocation.getBaseHrefFromDOM();
}
if (href == null) {
throw new Error("No base href set. Please provide a value for the APP_BASE_HREF token or add a base element to the document.");
}
_this._baseHref = href;
return _this;
}
/**
* @param {?} fn
* @return {?}
*/
PathLocationStrategy.prototype.onPopState = /**
* @param {?} fn
* @return {?}
*/
function (fn) {
this._platformLocation.onPopState(fn);
this._platformLocation.onHashChange(fn);
};
/**
* @return {?}
*/
PathLocationStrategy.prototype.getBaseHref = /**
* @return {?}
*/
function () { return this._baseHref; };
/**
* @param {?} internal
* @return {?}
*/
PathLocationStrategy.prototype.prepareExternalUrl = /**
* @param {?} internal
* @return {?}
*/
function (internal) {
return Location.joinWithSlash(this._baseHref, internal);
};
/**
* @param {?=} includeHash
* @return {?}
*/
PathLocationStrategy.prototype.path = /**
* @param {?=} includeHash
* @return {?}
*/
function (includeHash) {
if (includeHash === void 0) { includeHash = false; }
var /** @type {?} */ pathname = this._platformLocation.pathname +
Location.normalizeQueryParams(this._platformLocation.search);
var /** @type {?} */ hash = this._platformLocation.hash;
return hash && includeHash ? "" + pathname + hash : pathname;
};
/**
* @param {?} state
* @param {?} title
* @param {?} url
* @param {?} queryParams
* @return {?}
*/
PathLocationStrategy.prototype.pushState = /**
* @param {?} state
* @param {?} title
* @param {?} url
* @param {?} queryParams
* @return {?}
*/
function (state, title, url, queryParams) {
var /** @type {?} */ externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams));
this._platformLocation.pushState(state, title, externalUrl);
};
/**
* @param {?} state
* @param {?} title
* @param {?} url
* @param {?} queryParams
* @return {?}
*/
PathLocationStrategy.prototype.replaceState = /**
* @param {?} state
* @param {?} title
* @param {?} url
* @param {?} queryParams
* @return {?}
*/
function (state, title, url, queryParams) {
var /** @type {?} */ externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams));
this._platformLocation.replaceState(state, title, externalUrl);
};
/**
* @return {?}
*/
PathLocationStrategy.prototype.forward = /**
* @return {?}
*/
function () { this._platformLocation.forward(); };
/**
* @return {?}
*/
PathLocationStrategy.prototype.back = /**
* @return {?}
*/
function () { this._platformLocation.back(); };
PathLocationStrategy.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
PathLocationStrategy.ctorParameters = function () { return [
{ type: PlatformLocation, },
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["z" /* Inject */], args: [APP_BASE_HREF,] },] },
]; };
return PathLocationStrategy;
}(LocationStrategy));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* \@experimental
*/
var CURRENCIES = {
'AOA': [, 'Kz'],
'ARS': [, '$'],
'AUD': ['A$', '$'],
'BAM': [, 'KM'],
'BBD': [, '$'],
'BDT': [, '৳'],
'BMD': [, '$'],
'BND': [, '$'],
'BOB': [, 'Bs'],
'BRL': ['R$'],
'BSD': [, '$'],
'BWP': [, 'P'],
'BYN': [, 'р.'],
'BZD': [, '$'],
'CAD': ['CA$', '$'],
'CLP': [, '$'],
'CNY': ['CN¥', '¥'],
'COP': [, '$'],
'CRC': [, '₡'],
'CUC': [, '$'],
'CUP': [, '$'],
'CZK': [, 'Kč'],
'DKK': [, 'kr'],
'DOP': [, '$'],
'EGP': [, 'E£'],
'ESP': [, '₧'],
'EUR': ['€'],
'FJD': [, '$'],
'FKP': [, '£'],
'GBP': ['£'],
'GEL': [, '₾'],
'GIP': [, '£'],
'GNF': [, 'FG'],
'GTQ': [, 'Q'],
'GYD': [, '$'],
'HKD': ['HK$', '$'],
'HNL': [, 'L'],
'HRK': [, 'kn'],
'HUF': [, 'Ft'],
'IDR': [, 'Rp'],
'ILS': ['₪'],
'INR': ['₹'],
'ISK': [, 'kr'],
'JMD': [, '$'],
'JPY': ['¥'],
'KHR': [, '៛'],
'KMF': [, 'CF'],
'KPW': [, '₩'],
'KRW': ['₩'],
'KYD': [, '$'],
'KZT': [, '₸'],
'LAK': [, '₭'],
'LBP': [, 'L£'],
'LKR': [, 'Rs'],
'LRD': [, '$'],
'LTL': [, 'Lt'],
'LVL': [, 'Ls'],
'MGA': [, 'Ar'],
'MMK': [, 'K'],
'MNT': [, '₮'],
'MUR': [, 'Rs'],
'MXN': ['MX$', '$'],
'MYR': [, 'RM'],
'NAD': [, '$'],
'NGN': [, '₦'],
'NIO': [, 'C$'],
'NOK': [, 'kr'],
'NPR': [, 'Rs'],
'NZD': ['NZ$', '$'],
'PHP': [, '₱'],
'PKR': [, 'Rs'],
'PLN': [, 'zł'],
'PYG': [, '₲'],
'RON': [, 'lei'],
'RUB': [, '₽'],
'RUR': [, 'р.'],
'RWF': [, 'RF'],
'SBD': [, '$'],
'SEK': [, 'kr'],
'SGD': [, '$'],
'SHP': [, '£'],
'SRD': [, '$'],
'SSP': [, '£'],
'STD': [, 'Db'],
'SYP': [, '£'],
'THB': [, '฿'],
'TOP': [, 'T$'],
'TRY': [, '₺'],
'TTD': [, '$'],
'TWD': ['NT$', '$'],
'UAH': [, '₴'],
'USD': ['$'],
'UYU': [, '$'],
'VEF': [, 'Bs'],
'VND': ['₫'],
'XAF': ['FCFA'],
'XCD': ['EC$', '$'],
'XOF': ['CFA'],
'XPF': ['CFPF'],
'ZAR': [, 'R'],
'ZMW': [, 'ZK'],
};
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// THIS CODE IS GENERATED - DO NOT MODIFY
// See angular/tools/gulp-tasks/cldr/extract.js
var localeEn = [
'en',
[
['a', 'p'],
['AM', 'PM'],
],
[
['AM', 'PM'],
,
],
[
['S', 'M', 'T', 'W', 'T', 'F', 'S'], ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']
],
,
[
['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
[
'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September',
'October', 'November', 'December'
]
],
,
[['B', 'A'], ['BC', 'AD'], ['Before Christ', 'Anno Domini']], 0, [6, 0],
['M/d/yy', 'MMM d, y', 'MMMM d, y', 'EEEE, MMMM d, y'],
['h:mm a', 'h:mm:ss a', 'h:mm:ss a z', 'h:mm:ss a zzzz'],
[
'{1}, {0}',
,
'{1} \'at\' {0}',
],
['.', ',', ';', '%', '+', '-', 'E', '×', '‰', '∞', 'NaN', ':'],
['#,##0.###', '#,##0%', '¤#,##0.00', '#E0'], '$', 'US Dollar',
function (n) {
var /** @type {?} */ i = Math.floor(Math.abs(n)), /** @type {?} */ v = n.toString().replace(/^[^.]*\.?/, '').length;
if (i === 1 && v === 0)
return 1;
return 5;
}
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* \@experimental i18n support is experimental.
*/
var LOCALE_DATA = {};
/**
* Register global data to be used internally by Angular. See the
* {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import additional locale data.
*
* \@experimental i18n support is experimental.
* @param {?} data
* @param {?=} extraData
* @return {?}
*/
function registerLocaleData(data, extraData) {
var /** @type {?} */ localeId = data[0 /* LocaleId */].toLowerCase().replace(/_/g, '-');
LOCALE_DATA[localeId] = data;
if (extraData) {
LOCALE_DATA[localeId][18 /* ExtraData */] = extraData;
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/** @enum {number} */
var NumberFormatStyle = {
Decimal: 0,
Percent: 1,
Currency: 2,
Scientific: 3,
};
NumberFormatStyle[NumberFormatStyle.Decimal] = "Decimal";
NumberFormatStyle[NumberFormatStyle.Percent] = "Percent";
NumberFormatStyle[NumberFormatStyle.Currency] = "Currency";
NumberFormatStyle[NumberFormatStyle.Scientific] = "Scientific";
/** @enum {number} */
var Plural = {
Zero: 0,
One: 1,
Two: 2,
Few: 3,
Many: 4,
Other: 5,
};
Plural[Plural.Zero] = "Zero";
Plural[Plural.One] = "One";
Plural[Plural.Two] = "Two";
Plural[Plural.Few] = "Few";
Plural[Plural.Many] = "Many";
Plural[Plural.Other] = "Other";
/** @enum {number} */
var FormStyle = {
Format: 0,
Standalone: 1,
};
FormStyle[FormStyle.Format] = "Format";
FormStyle[FormStyle.Standalone] = "Standalone";
/** @enum {number} */
var TranslationWidth = {
Narrow: 0,
Abbreviated: 1,
Wide: 2,
Short: 3,
};
TranslationWidth[TranslationWidth.Narrow] = "Narrow";
TranslationWidth[TranslationWidth.Abbreviated] = "Abbreviated";
TranslationWidth[TranslationWidth.Wide] = "Wide";
TranslationWidth[TranslationWidth.Short] = "Short";
/** @enum {number} */
var FormatWidth = {
Short: 0,
Medium: 1,
Long: 2,
Full: 3,
};
FormatWidth[FormatWidth.Short] = "Short";
FormatWidth[FormatWidth.Medium] = "Medium";
FormatWidth[FormatWidth.Long] = "Long";
FormatWidth[FormatWidth.Full] = "Full";
/** @enum {number} */
var NumberSymbol = {
Decimal: 0,
Group: 1,
List: 2,
PercentSign: 3,
PlusSign: 4,
MinusSign: 5,
Exponential: 6,
SuperscriptingExponent: 7,
PerMille: 8,
Infinity: 9,
NaN: 10,
TimeSeparator: 11,
CurrencyDecimal: 12,
CurrencyGroup: 13,
};
NumberSymbol[NumberSymbol.Decimal] = "Decimal";
NumberSymbol[NumberSymbol.Group] = "Group";
NumberSymbol[NumberSymbol.List] = "List";
NumberSymbol[NumberSymbol.PercentSign] = "PercentSign";
NumberSymbol[NumberSymbol.PlusSign] = "PlusSign";
NumberSymbol[NumberSymbol.MinusSign] = "MinusSign";
NumberSymbol[NumberSymbol.Exponential] = "Exponential";
NumberSymbol[NumberSymbol.SuperscriptingExponent] = "SuperscriptingExponent";
NumberSymbol[NumberSymbol.PerMille] = "PerMille";
NumberSymbol[NumberSymbol.Infinity] = "Infinity";
NumberSymbol[NumberSymbol.NaN] = "NaN";
NumberSymbol[NumberSymbol.TimeSeparator] = "TimeSeparator";
NumberSymbol[NumberSymbol.CurrencyDecimal] = "CurrencyDecimal";
NumberSymbol[NumberSymbol.CurrencyGroup] = "CurrencyGroup";
/** @enum {number} */
var WeekDay = {
Sunday: 0,
Monday: 1,
Tuesday: 2,
Wednesday: 3,
Thursday: 4,
Friday: 5,
Saturday: 6,
};
WeekDay[WeekDay.Sunday] = "Sunday";
WeekDay[WeekDay.Monday] = "Monday";
WeekDay[WeekDay.Tuesday] = "Tuesday";
WeekDay[WeekDay.Wednesday] = "Wednesday";
WeekDay[WeekDay.Thursday] = "Thursday";
WeekDay[WeekDay.Friday] = "Friday";
WeekDay[WeekDay.Saturday] = "Saturday";
/**
* The locale id for the chosen locale (e.g `en-GB`).
*
* \@experimental i18n support is experimental.
* @param {?} locale
* @return {?}
*/
function getLocaleId(locale) {
return findLocaleData(locale)[0 /* LocaleId */];
}
/**
* Periods of the day (e.g. `[AM, PM]` for en-US).
*
* \@experimental i18n support is experimental.
* @param {?} locale
* @param {?} formStyle
* @param {?} width
* @return {?}
*/
function getLocaleDayPeriods(locale, formStyle, width) {
var /** @type {?} */ data = findLocaleData(locale);
var /** @type {?} */ amPmData = /** @type {?} */ ([data[1 /* DayPeriodsFormat */], data[2 /* DayPeriodsStandalone */]]);
var /** @type {?} */ amPm = getLastDefinedValue(amPmData, formStyle);
return getLastDefinedValue(amPm, width);
}
/**
* Days of the week for the Gregorian calendar (e.g. `[Sunday, Monday, ... Saturday]` for en-US).
*
* \@experimental i18n support is experimental.
* @param {?} locale
* @param {?} formStyle
* @param {?} width
* @return {?}
*/
function getLocaleDayNames(locale, formStyle, width) {
var /** @type {?} */ data = findLocaleData(locale);
var /** @type {?} */ daysData = /** @type {?} */ ([data[3 /* DaysFormat */], data[4 /* DaysStandalone */]]);
var /** @type {?} */ days = getLastDefinedValue(daysData, formStyle);
return getLastDefinedValue(days, width);
}
/**
* Months of the year for the Gregorian calendar (e.g. `[January, February, ...]` for en-US).
*
* \@experimental i18n support is experimental.
* @param {?} locale
* @param {?} formStyle
* @param {?} width
* @return {?}
*/
function getLocaleMonthNames(locale, formStyle, width) {
var /** @type {?} */ data = findLocaleData(locale);
var /** @type {?} */ monthsData = /** @type {?} */ ([data[5 /* MonthsFormat */], data[6 /* MonthsStandalone */]]);
var /** @type {?} */ months = getLastDefinedValue(monthsData, formStyle);
return getLastDefinedValue(months, width);
}
/**
* Eras for the Gregorian calendar (e.g. AD/BC).
*
* \@experimental i18n support is experimental.
* @param {?} locale
* @param {?} width
* @return {?}
*/
function getLocaleEraNames(locale, width) {
var /** @type {?} */ data = findLocaleData(locale);
var /** @type {?} */ erasData = /** @type {?} */ (data[7 /* Eras */]);
return getLastDefinedValue(erasData, width);
}
/**
* First day of the week for this locale, based on english days (Sunday = 0, Monday = 1, ...).
* For example in french the value would be 1 because the first day of the week is Monday.
*
* \@experimental i18n support is experimental.
* @param {?} locale
* @return {?}
*/
function getLocaleFirstDayOfWeek(locale) {
var /** @type {?} */ data = findLocaleData(locale);
return data[8 /* FirstDayOfWeek */];
}
/**
* Range of days in the week that represent the week-end for this locale, based on english days
* (Sunday = 0, Monday = 1, ...).
* For example in english the value would be [6,0] for Saturday to Sunday.
*
* \@experimental i18n support is experimental.
* @param {?} locale
* @return {?}
*/
function getLocaleWeekEndRange(locale) {
var /** @type {?} */ data = findLocaleData(locale);
return data[9 /* WeekendRange */];
}
/**
* Date format that depends on the locale.
*
* There are four basic date formats:
* - `full` should contain long-weekday (EEEE), year (y), long-month (MMMM), day (d).
*
* For example, English uses `EEEE, MMMM d, y`, corresponding to a date like
* "Tuesday, September 14, 1999".
*
* - `long` should contain year, long-month, day.
*
* For example, `MMMM d, y`, corresponding to a date like "September 14, 1999".
*
* - `medium` should contain year, abbreviated-month (MMM), day.
*
* For example, `MMM d, y`, corresponding to a date like "Sep 14, 1999".
* For languages that do not use abbreviated months, use the numeric month (MM/M). For example,
* `y/MM/dd`, corresponding to a date like "1999/09/14".
*
* - `short` should contain year, numeric-month (MM/M), and day.
*
* For example, `M/d/yy`, corresponding to a date like "9/14/99".
*
* \@experimental i18n support is experimental.
* @param {?} locale
* @param {?} width
* @return {?}
*/
function getLocaleDateFormat(locale, width) {
var /** @type {?} */ data = findLocaleData(locale);
return data[10 /* DateFormat */][width];
}
/**
* Time format that depends on the locale.
*
* The standard formats include four basic time formats:
* - `full` should contain hour (h/H), minute (mm), second (ss), and zone (zzzz).
* - `long` should contain hour, minute, second, and zone (z)
* - `medium` should contain hour, minute, second.
* - `short` should contain hour, minute.
*
* Note: The patterns depend on whether the main country using your language uses 12-hour time or
* not:
* - For 12-hour time, use a pattern like `hh:mm a` using h to mean a 12-hour clock cycle running
* 1 through 12 (midnight plus 1 minute is 12:01), or using K to mean a 12-hour clock cycle
* running 0 through 11 (midnight plus 1 minute is 0:01).
* - For 24-hour time, use a pattern like `HH:mm` using H to mean a 24-hour clock cycle running 0
* through 23 (midnight plus 1 minute is 0:01), or using k to mean a 24-hour clock cycle running
* 1 through 24 (midnight plus 1 minute is 24:01).
*
* \@experimental i18n support is experimental.
* @param {?} locale
* @param {?} width
* @return {?}
*/
function getLocaleTimeFormat(locale, width) {
var /** @type {?} */ data = findLocaleData(locale);
return data[11 /* TimeFormat */][width];
}
/**
* Date-time format that depends on the locale.
*
* The date-time pattern shows how to combine separate patterns for date (represented by {1})
* and time (represented by {0}) into a single pattern. It usually doesn't need to be changed.
* What you want to pay attention to are:
* - possibly removing a space for languages that don't use it, such as many East Asian languages
* - possibly adding a comma, other punctuation, or a combining word
*
* For example:
* - English uses `{1} 'at' {0}` or `{1}, {0}` (depending on date style), while Japanese uses
* `{1}{0}`.
* - An English formatted date-time using the combining pattern `{1}, {0}` could be
* `Dec 10, 2010, 3:59:49 PM`. Notice the comma and space between the date portion and the time
* portion.
*
* There are four formats (`full`, `long`, `medium`, `short`); the determination of which to use
* is normally based on the date style. For example, if the date has a full month and weekday
* name, the full combining pattern will be used to combine that with a time. If the date has
* numeric month, the short version of the combining pattern will be used to combine that with a
* time. English uses `{1} 'at' {0}` for full and long styles, and `{1}, {0}` for medium and short
* styles.
*
* \@experimental i18n support is experimental.
* @param {?} locale
* @param {?} width
* @return {?}
*/
function getLocaleDateTimeFormat(locale, width) {
var /** @type {?} */ data = findLocaleData(locale);
var /** @type {?} */ dateTimeFormatData = /** @type {?} */ (data[12 /* DateTimeFormat */]);
return getLastDefinedValue(dateTimeFormatData, width);
}
/**
* Number symbol that can be used to replace placeholders in number formats.
* See {\@link NumberSymbol} for more information.
*
* \@experimental i18n support is experimental.
* @param {?} locale
* @param {?} symbol
* @return {?}
*/
function getLocaleNumberSymbol(locale, symbol) {
var /** @type {?} */ data = findLocaleData(locale);
var /** @type {?} */ res = data[13 /* NumberSymbols */][symbol];
if (typeof res === 'undefined') {
if (symbol === NumberSymbol.CurrencyDecimal) {
return data[13 /* NumberSymbols */][NumberSymbol.Decimal];
}
else if (symbol === NumberSymbol.CurrencyGroup) {
return data[13 /* NumberSymbols */][NumberSymbol.Group];
}
}
return res;
}
/**
* Number format that depends on the locale.
*
* Numbers are formatted using patterns, like `#,###.00`. For example, the pattern `#,###.00`
* when used to format the number 12345.678 could result in "12'345,67". That would happen if the
* grouping separator for your language is an apostrophe, and the decimal separator is a comma.
*
* <b>Important:</b> The characters `.` `,` `0` `#` (and others below) are special placeholders;
* they stand for the decimal separator, and so on, and are NOT real characters.
* You must NOT "translate" the placeholders; for example, don't change `.` to `,` even though in
* your language the decimal point is written with a comma. The symbols should be replaced by the
* local equivalents, using the Number Symbols for your language.
*
* Here are the special characters used in number patterns:
*
* | Symbol | Meaning |
* |--------|---------|
* | . | Replaced automatically by the character used for the decimal point. |
* | , | Replaced by the "grouping" (thousands) separator. |
* | 0 | Replaced by a digit (or zero if there aren't enough digits). |
* | # | Replaced by a digit (or nothing if there aren't enough). |
* | ¤ | This will be replaced by a currency symbol, such as $ or USD. |
* | % | This marks a percent format. The % symbol may change position, but must be retained. |
* | E | This marks a scientific format. The E symbol may change position, but must be retained. |
* | ' | Special characters used as literal characters are quoted with ASCII single quotes. |
*
* You can find more information
* [on the CLDR website](http://cldr.unicode.org/translation/number-patterns)
*
* \@experimental i18n support is experimental.
* @param {?} locale
* @param {?} type
* @return {?}
*/
function getLocaleNumberFormat(locale, type) {
var /** @type {?} */ data = findLocaleData(locale);
return data[14 /* NumberFormats */][type];
}
/**
* The symbol used to represent the currency for the main country using this locale (e.g. $ for
* the locale en-US).
* The symbol will be `null` if the main country cannot be determined.
*
* \@experimental i18n support is experimental.
* @param {?} locale
* @return {?}
*/
function getLocaleCurrencySymbol(locale) {
var /** @type {?} */ data = findLocaleData(locale);
return data[15 /* CurrencySymbol */] || null;
}
/**
* The name of the currency for the main country using this locale (e.g. USD for the locale
* en-US).
* The name will be `null` if the main country cannot be determined.
*
* \@experimental i18n support is experimental.
* @param {?} locale
* @return {?}
*/
function getLocaleCurrencyName(locale) {
var /** @type {?} */ data = findLocaleData(locale);
return data[16 /* CurrencyName */] || null;
}
/**
* The locale plural function used by ICU expressions to determine the plural case to use.
* See {\@link NgPlural} for more information.
*
* \@experimental i18n support is experimental.
* @param {?} locale
* @return {?}
*/
function getLocalePluralCase(locale) {
var /** @type {?} */ data = findLocaleData(locale);
return data[17 /* PluralCase */];
}
/**
* @param {?} data
* @return {?}
*/
function checkFullData(data) {
if (!data[18 /* ExtraData */]) {
throw new Error("Missing extra locale data for the locale \"" + data[0 /* LocaleId */] + "\". Use \"registerLocaleData\" to load new data. See the \"I18n guide\" on angular.io to know more.");
}
}
/**
* Rules used to determine which day period to use (See `dayPeriods` below).
* The rules can either be an array or a single value. If it's an array, consider it as "from"
* and "to". If it's a single value then it means that the period is only valid at this exact
* value.
* There is always the same number of rules as the number of day periods, which means that the
* first rule is applied to the first day period and so on.
* You should fallback to AM/PM when there are no rules available.
*
* Note: this is only available if you load the full locale data.
* See the {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import additional locale
* data.
*
* \@experimental i18n support is experimental.
* @param {?} locale
* @return {?}
*/
function getLocaleExtraDayPeriodRules(locale) {
var /** @type {?} */ data = findLocaleData(locale);
checkFullData(data);
var /** @type {?} */ rules = data[18 /* ExtraData */][2 /* ExtraDayPeriodsRules */] || [];
return rules.map(function (rule) {
if (typeof rule === 'string') {
return extractTime(rule);
}
return [extractTime(rule[0]), extractTime(rule[1])];
});
}
/**
* Day Periods indicate roughly how the day is broken up in different languages (e.g. morning,
* noon, afternoon, midnight, ...).
* You should use the function {\@link getLocaleExtraDayPeriodRules} to determine which period to
* use.
* You should fallback to AM/PM when there are no day periods available.
*
* Note: this is only available if you load the full locale data.
* See the {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import additional locale
* data.
*
* \@experimental i18n support is experimental.
* @param {?} locale
* @param {?} formStyle
* @param {?} width
* @return {?}
*/
function getLocaleExtraDayPeriods(locale, formStyle, width) {
var /** @type {?} */ data = findLocaleData(locale);
checkFullData(data);
var /** @type {?} */ dayPeriodsData = /** @type {?} */ ([
data[18 /* ExtraData */][0 /* ExtraDayPeriodFormats */],
data[18 /* ExtraData */][1 /* ExtraDayPeriodStandalone */]
]);
var /** @type {?} */ dayPeriods = getLastDefinedValue(dayPeriodsData, formStyle) || [];
return getLastDefinedValue(dayPeriods, width) || [];
}
/**
* Returns the first value that is defined in an array, going backwards.
*
* To avoid repeating the same data (e.g. when "format" and "standalone" are the same) we only
* add the first one to the locale data arrays, the other ones are only defined when different.
* We use this function to retrieve the first defined value.
*
* \@experimental i18n support is experimental.
* @template T
* @param {?} data
* @param {?} index
* @return {?}
*/
function getLastDefinedValue(data, index) {
for (var /** @type {?} */ i = index; i > -1; i--) {
if (typeof data[i] !== 'undefined') {
return data[i];
}
}
throw new Error('Locale data API: locale data undefined');
}
/**
* Extract the hours and minutes from a string like "15:45"
* @param {?} time
* @return {?}
*/
function extractTime(time) {
var _a = time.split(':'), h = _a[0], m = _a[1];
return { hours: +h, minutes: +m };
}
/**
* Finds the locale data for a locale id
*
* \@experimental i18n support is experimental.
* @param {?} locale
* @return {?}
*/
function findLocaleData(locale) {
var /** @type {?} */ normalizedLocale = locale.toLowerCase().replace(/_/g, '-');
var /** @type {?} */ match = LOCALE_DATA[normalizedLocale];
if (match) {
return match;
}
// let's try to find a parent locale
var /** @type {?} */ parentLocale = normalizedLocale.split('-')[0];
match = LOCALE_DATA[parentLocale];
if (match) {
return match;
}
if (parentLocale === 'en') {
return localeEn;
}
throw new Error("Missing locale data for the locale \"" + locale + "\".");
}
/**
* Return the currency symbol for a given currency code, or the code if no symbol available
* (e.g.: $, US$, or USD)
*
* \@internal
* @param {?} code
* @param {?} format
* @return {?}
*/
function findCurrencySymbol(code, format) {
var /** @type {?} */ currency = CURRENCIES[code] || {};
var /** @type {?} */ symbol = currency[0] || code;
return format === 'wide' ? symbol : currency[1] || symbol;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @deprecated from v5
*/
var DEPRECATED_PLURAL_FN = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["B" /* InjectionToken */]('UseV4Plurals');
/**
* \@experimental
* @abstract
*/
var NgLocalization = (function () {
function NgLocalization() {
}
return NgLocalization;
}());
/**
* Returns the plural category for a given value.
* - "=value" when the case exists,
* - the plural category otherwise
*
* \@internal
* @param {?} value
* @param {?} cases
* @param {?} ngLocalization
* @param {?=} locale
* @return {?}
*/
function getPluralCategory(value, cases, ngLocalization, locale) {
var /** @type {?} */ key = "=" + value;
if (cases.indexOf(key) > -1) {
return key;
}
key = ngLocalization.getPluralCategory(value, locale);
if (cases.indexOf(key) > -1) {
return key;
}
if (cases.indexOf('other') > -1) {
return 'other';
}
throw new Error("No plural message found for value \"" + value + "\"");
}
/**
* Returns the plural case based on the locale
*
* \@experimental
*/
var NgLocaleLocalization = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __extends */])(NgLocaleLocalization, _super);
function NgLocaleLocalization(locale, /** @deprecated from v5 */
deprecatedPluralFn) {
var _this = _super.call(this) || this;
_this.locale = locale;
_this.deprecatedPluralFn = deprecatedPluralFn;
return _this;
}
/**
* @param {?} value
* @param {?=} locale
* @return {?}
*/
NgLocaleLocalization.prototype.getPluralCategory = /**
* @param {?} value
* @param {?=} locale
* @return {?}
*/
function (value, locale) {
var /** @type {?} */ plural = this.deprecatedPluralFn ? this.deprecatedPluralFn(locale || this.locale, value) :
getLocalePluralCase(locale || this.locale)(value);
switch (plural) {
case Plural.Zero:
return 'zero';
case Plural.One:
return 'one';
case Plural.Two:
return 'two';
case Plural.Few:
return 'few';
case Plural.Many:
return 'many';
default:
return 'other';
}
};
NgLocaleLocalization.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
NgLocaleLocalization.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["z" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["G" /* LOCALE_ID */],] },] },
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["z" /* Inject */], args: [DEPRECATED_PLURAL_FN,] },] },
]; };
return NgLocaleLocalization;
}(NgLocalization));
/**
* Returns the plural case based on the locale
*
* @deprecated from v5 the plural case function is in locale data files common/locales/*.ts
* \@experimental
* @param {?} locale
* @param {?} nLike
* @return {?}
*/
function getPluralCase(locale, nLike) {
// TODO(vicb): lazy compute
if (typeof nLike === 'string') {
nLike = parseInt(/** @type {?} */ (nLike), 10);
}
var /** @type {?} */ n = /** @type {?} */ (nLike);
var /** @type {?} */ nDecimal = n.toString().replace(/^[^.]*\.?/, '');
var /** @type {?} */ i = Math.floor(Math.abs(n));
var /** @type {?} */ v = nDecimal.length;
var /** @type {?} */ f = parseInt(nDecimal, 10);
var /** @type {?} */ t = parseInt(n.toString().replace(/^[^.]*\.?|0+$/g, ''), 10) || 0;
var /** @type {?} */ lang = locale.split('-')[0].toLowerCase();
switch (lang) {
case 'af':
case 'asa':
case 'az':
case 'bem':
case 'bez':
case 'bg':
case 'brx':
case 'ce':
case 'cgg':
case 'chr':
case 'ckb':
case 'ee':
case 'el':
case 'eo':
case 'es':
case 'eu':
case 'fo':
case 'fur':
case 'gsw':
case 'ha':
case 'haw':
case 'hu':
case 'jgo':
case 'jmc':
case 'ka':
case 'kk':
case 'kkj':
case 'kl':
case 'ks':
case 'ksb':
case 'ky':
case 'lb':
case 'lg':
case 'mas':
case 'mgo':
case 'ml':
case 'mn':
case 'nb':
case 'nd':
case 'ne':
case 'nn':
case 'nnh':
case 'nyn':
case 'om':
case 'or':
case 'os':
case 'ps':
case 'rm':
case 'rof':
case 'rwk':
case 'saq':
case 'seh':
case 'sn':
case 'so':
case 'sq':
case 'ta':
case 'te':
case 'teo':
case 'tk':
case 'tr':
case 'ug':
case 'uz':
case 'vo':
case 'vun':
case 'wae':
case 'xog':
if (n === 1)
return Plural.One;
return Plural.Other;
case 'ak':
case 'ln':
case 'mg':
case 'pa':
case 'ti':
if (n === Math.floor(n) && n >= 0 && n <= 1)
return Plural.One;
return Plural.Other;
case 'am':
case 'as':
case 'bn':
case 'fa':
case 'gu':
case 'hi':
case 'kn':
case 'mr':
case 'zu':
if (i === 0 || n === 1)
return Plural.One;
return Plural.Other;
case 'ar':
if (n === 0)
return Plural.Zero;
if (n === 1)
return Plural.One;
if (n === 2)
return Plural.Two;
if (n % 100 === Math.floor(n % 100) && n % 100 >= 3 && n % 100 <= 10)
return Plural.Few;
if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 99)
return Plural.Many;
return Plural.Other;
case 'ast':
case 'ca':
case 'de':
case 'en':
case 'et':
case 'fi':
case 'fy':
case 'gl':
case 'it':
case 'nl':
case 'sv':
case 'sw':
case 'ur':
case 'yi':
if (i === 1 && v === 0)
return Plural.One;
return Plural.Other;
case 'be':
if (n % 10 === 1 && !(n % 100 === 11))
return Plural.One;
if (n % 10 === Math.floor(n % 10) && n % 10 >= 2 && n % 10 <= 4 &&
!(n % 100 >= 12 && n % 100 <= 14))
return Plural.Few;
if (n % 10 === 0 || n % 10 === Math.floor(n % 10) && n % 10 >= 5 && n % 10 <= 9 ||
n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 14)
return Plural.Many;
return Plural.Other;
case 'br':
if (n % 10 === 1 && !(n % 100 === 11 || n % 100 === 71 || n % 100 === 91))
return Plural.One;
if (n % 10 === 2 && !(n % 100 === 12 || n % 100 === 72 || n % 100 === 92))
return Plural.Two;
if (n % 10 === Math.floor(n % 10) && (n % 10 >= 3 && n % 10 <= 4 || n % 10 === 9) &&
!(n % 100 >= 10 && n % 100 <= 19 || n % 100 >= 70 && n % 100 <= 79 ||
n % 100 >= 90 && n % 100 <= 99))
return Plural.Few;
if (!(n === 0) && n % 1e6 === 0)
return Plural.Many;
return Plural.Other;
case 'bs':
case 'hr':
case 'sr':
if (v === 0 && i % 10 === 1 && !(i % 100 === 11) || f % 10 === 1 && !(f % 100 === 11))
return Plural.One;
if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 &&
!(i % 100 >= 12 && i % 100 <= 14) ||
f % 10 === Math.floor(f % 10) && f % 10 >= 2 && f % 10 <= 4 &&
!(f % 100 >= 12 && f % 100 <= 14))
return Plural.Few;
return Plural.Other;
case 'cs':
case 'sk':
if (i === 1 && v === 0)
return Plural.One;
if (i === Math.floor(i) && i >= 2 && i <= 4 && v === 0)
return Plural.Few;
if (!(v === 0))
return Plural.Many;
return Plural.Other;
case 'cy':
if (n === 0)
return Plural.Zero;
if (n === 1)
return Plural.One;
if (n === 2)
return Plural.Two;
if (n === 3)
return Plural.Few;
if (n === 6)
return Plural.Many;
return Plural.Other;
case 'da':
if (n === 1 || !(t === 0) && (i === 0 || i === 1))
return Plural.One;
return Plural.Other;
case 'dsb':
case 'hsb':
if (v === 0 && i % 100 === 1 || f % 100 === 1)
return Plural.One;
if (v === 0 && i % 100 === 2 || f % 100 === 2)
return Plural.Two;
if (v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 3 && i % 100 <= 4 ||
f % 100 === Math.floor(f % 100) && f % 100 >= 3 && f % 100 <= 4)
return Plural.Few;
return Plural.Other;
case 'ff':
case 'fr':
case 'hy':
case 'kab':
if (i === 0 || i === 1)
return Plural.One;
return Plural.Other;
case 'fil':
if (v === 0 && (i === 1 || i === 2 || i === 3) ||
v === 0 && !(i % 10 === 4 || i % 10 === 6 || i % 10 === 9) ||
!(v === 0) && !(f % 10 === 4 || f % 10 === 6 || f % 10 === 9))
return Plural.One;
return Plural.Other;
case 'ga':
if (n === 1)
return Plural.One;
if (n === 2)
return Plural.Two;
if (n === Math.floor(n) && n >= 3 && n <= 6)
return Plural.Few;
if (n === Math.floor(n) && n >= 7 && n <= 10)
return Plural.Many;
return Plural.Other;
case 'gd':
if (n === 1 || n === 11)
return Plural.One;
if (n === 2 || n === 12)
return Plural.Two;
if (n === Math.floor(n) && (n >= 3 && n <= 10 || n >= 13 && n <= 19))
return Plural.Few;
return Plural.Other;
case 'gv':
if (v === 0 && i % 10 === 1)
return Plural.One;
if (v === 0 && i % 10 === 2)
return Plural.Two;
if (v === 0 &&
(i % 100 === 0 || i % 100 === 20 || i % 100 === 40 || i % 100 === 60 || i % 100 === 80))
return Plural.Few;
if (!(v === 0))
return Plural.Many;
return Plural.Other;
case 'he':
if (i === 1 && v === 0)
return Plural.One;
if (i === 2 && v === 0)
return Plural.Two;
if (v === 0 && !(n >= 0 && n <= 10) && n % 10 === 0)
return Plural.Many;
return Plural.Other;
case 'is':
if (t === 0 && i % 10 === 1 && !(i % 100 === 11) || !(t === 0))
return Plural.One;
return Plural.Other;
case 'ksh':
if (n === 0)
return Plural.Zero;
if (n === 1)
return Plural.One;
return Plural.Other;
case 'kw':
case 'naq':
case 'se':
case 'smn':
if (n === 1)
return Plural.One;
if (n === 2)
return Plural.Two;
return Plural.Other;
case 'lag':
if (n === 0)
return Plural.Zero;
if ((i === 0 || i === 1) && !(n === 0))
return Plural.One;
return Plural.Other;
case 'lt':
if (n % 10 === 1 && !(n % 100 >= 11 && n % 100 <= 19))
return Plural.One;
if (n % 10 === Math.floor(n % 10) && n % 10 >= 2 && n % 10 <= 9 &&
!(n % 100 >= 11 && n % 100 <= 19))
return Plural.Few;
if (!(f === 0))
return Plural.Many;
return Plural.Other;
case 'lv':
case 'prg':
if (n % 10 === 0 || n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 19 ||
v === 2 && f % 100 === Math.floor(f % 100) && f % 100 >= 11 && f % 100 <= 19)
return Plural.Zero;
if (n % 10 === 1 && !(n % 100 === 11) || v === 2 && f % 10 === 1 && !(f % 100 === 11) ||
!(v === 2) && f % 10 === 1)
return Plural.One;
return Plural.Other;
case 'mk':
if (v === 0 && i % 10 === 1 || f % 10 === 1)
return Plural.One;
return Plural.Other;
case 'mt':
if (n === 1)
return Plural.One;
if (n === 0 || n % 100 === Math.floor(n % 100) && n % 100 >= 2 && n % 100 <= 10)
return Plural.Few;
if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 19)
return Plural.Many;
return Plural.Other;
case 'pl':
if (i === 1 && v === 0)
return Plural.One;
if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 &&
!(i % 100 >= 12 && i % 100 <= 14))
return Plural.Few;
if (v === 0 && !(i === 1) && i % 10 === Math.floor(i % 10) && i % 10 >= 0 && i % 10 <= 1 ||
v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 5 && i % 10 <= 9 ||
v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 12 && i % 100 <= 14)
return Plural.Many;
return Plural.Other;
case 'pt':
if (n === Math.floor(n) && n >= 0 && n <= 2 && !(n === 2))
return Plural.One;
return Plural.Other;
case 'ro':
if (i === 1 && v === 0)
return Plural.One;
if (!(v === 0) || n === 0 ||
!(n === 1) && n % 100 === Math.floor(n % 100) && n % 100 >= 1 && n % 100 <= 19)
return Plural.Few;
return Plural.Other;
case 'ru':
case 'uk':
if (v === 0 && i % 10 === 1 && !(i % 100 === 11))
return Plural.One;
if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 &&
!(i % 100 >= 12 && i % 100 <= 14))
return Plural.Few;
if (v === 0 && i % 10 === 0 ||
v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 5 && i % 10 <= 9 ||
v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 11 && i % 100 <= 14)
return Plural.Many;
return Plural.Other;
case 'shi':
if (i === 0 || n === 1)
return Plural.One;
if (n === Math.floor(n) && n >= 2 && n <= 10)
return Plural.Few;
return Plural.Other;
case 'si':
if (n === 0 || n === 1 || i === 0 && f === 1)
return Plural.One;
return Plural.Other;
case 'sl':
if (v === 0 && i % 100 === 1)
return Plural.One;
if (v === 0 && i % 100 === 2)
return Plural.Two;
if (v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 3 && i % 100 <= 4 || !(v === 0))
return Plural.Few;
return Plural.Other;
case 'tzm':
if (n === Math.floor(n) && n >= 0 && n <= 1 || n === Math.floor(n) && n >= 11 && n <= 99)
return Plural.One;
return Plural.Other;
// When there is no specification, the default is always "other"
// Spec: http://cldr.unicode.org/index/cldr-spec/plural-rules
// > other (required—general plural form — also used if the language only has a single form)
default:
return Plural.Other;
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @param {?} cookieStr
* @param {?} name
* @return {?}
*/
function parseCookieValue(cookieStr, name) {
name = encodeURIComponent(name);
for (var _i = 0, _a = cookieStr.split(';'); _i < _a.length; _i++) {
var cookie = _a[_i];
var /** @type {?} */ eqIndex = cookie.indexOf('=');
var _b = eqIndex == -1 ? [cookie, ''] : [cookie.slice(0, eqIndex), cookie.slice(eqIndex + 1)], cookieName = _b[0], cookieValue = _b[1];
if (cookieName.trim() === name) {
return decodeURIComponent(cookieValue);
}
}
return null;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* \@ngModule CommonModule
*
* \@whatItDoes Adds and removes CSS classes on an HTML element.
*
* \@howToUse
* ```
* <some-element [ngClass]="'first second'">...</some-element>
*
* <some-element [ngClass]="['first', 'second']">...</some-element>
*
* <some-element [ngClass]="{'first': true, 'second': true, 'third': false}">...</some-element>
*
* <some-element [ngClass]="stringExp|arrayExp|objExp">...</some-element>
*
* <some-element [ngClass]="{'class1 class2 class3' : true}">...</some-element>
* ```
*
* \@description
*
* The CSS classes are updated as follows, depending on the type of the expression evaluation:
* - `string` - the CSS classes listed in the string (space delimited) are added,
* - `Array` - the CSS classes declared as Array elements are added,
* - `Object` - keys are CSS classes that get added when the expression given in the value
* evaluates to a truthy value, otherwise they are removed.
*
* \@stable
*/
var NgClass = (function () {
function NgClass(_iterableDiffers, _keyValueDiffers, _ngEl, _renderer) {
this._iterableDiffers = _iterableDiffers;
this._keyValueDiffers = _keyValueDiffers;
this._ngEl = _ngEl;
this._renderer = _renderer;
this._initialClasses = [];
}
Object.defineProperty(NgClass.prototype, "klass", {
set: /**
* @param {?} v
* @return {?}
*/
function (v) {
this._applyInitialClasses(true);
this._initialClasses = typeof v === 'string' ? v.split(/\s+/) : [];
this._applyInitialClasses(false);
this._applyClasses(this._rawClass, false);
},
enumerable: true,
configurable: true
});
Object.defineProperty(NgClass.prototype, "ngClass", {
set: /**
* @param {?} v
* @return {?}
*/
function (v) {
this._cleanupClasses(this._rawClass);
this._iterableDiffer = null;
this._keyValueDiffer = null;
this._rawClass = typeof v === 'string' ? v.split(/\s+/) : v;
if (this._rawClass) {
if (Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_33" /* ɵisListLikeIterable */])(this._rawClass)) {
this._iterableDiffer = this._iterableDiffers.find(this._rawClass).create();
}
else {
this._keyValueDiffer = this._keyValueDiffers.find(this._rawClass).create();
}
}
},
enumerable: true,
configurable: true
});
/**
* @return {?}
*/
NgClass.prototype.ngDoCheck = /**
* @return {?}
*/
function () {
if (this._iterableDiffer) {
var /** @type {?} */ iterableChanges = this._iterableDiffer.diff(/** @type {?} */ (this._rawClass));
if (iterableChanges) {
this._applyIterableChanges(iterableChanges);
}
}
else if (this._keyValueDiffer) {
var /** @type {?} */ keyValueChanges = this._keyValueDiffer.diff(/** @type {?} */ (this._rawClass));
if (keyValueChanges) {
this._applyKeyValueChanges(keyValueChanges);
}
}
};
/**
* @param {?} rawClassVal
* @return {?}
*/
NgClass.prototype._cleanupClasses = /**
* @param {?} rawClassVal
* @return {?}
*/
function (rawClassVal) {
this._applyClasses(rawClassVal, true);
this._applyInitialClasses(false);
};
/**
* @param {?} changes
* @return {?}
*/
NgClass.prototype._applyKeyValueChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
var _this = this;
changes.forEachAddedItem(function (record) { return _this._toggleClass(record.key, record.currentValue); });
changes.forEachChangedItem(function (record) { return _this._toggleClass(record.key, record.currentValue); });
changes.forEachRemovedItem(function (record) {
if (record.previousValue) {
_this._toggleClass(record.key, false);
}
});
};
/**
* @param {?} changes
* @return {?}
*/
NgClass.prototype._applyIterableChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
var _this = this;
changes.forEachAddedItem(function (record) {
if (typeof record.item === 'string') {
_this._toggleClass(record.item, true);
}
else {
throw new Error("NgClass can only toggle CSS classes expressed as strings, got " + Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_48" /* ɵstringify */])(record.item));
}
});
changes.forEachRemovedItem(function (record) { return _this._toggleClass(record.item, false); });
};
/**
* @param {?} isCleanup
* @return {?}
*/
NgClass.prototype._applyInitialClasses = /**
* @param {?} isCleanup
* @return {?}
*/
function (isCleanup) {
var _this = this;
this._initialClasses.forEach(function (klass) { return _this._toggleClass(klass, !isCleanup); });
};
/**
* @param {?} rawClassVal
* @param {?} isCleanup
* @return {?}
*/
NgClass.prototype._applyClasses = /**
* @param {?} rawClassVal
* @param {?} isCleanup
* @return {?}
*/
function (rawClassVal, isCleanup) {
var _this = this;
if (rawClassVal) {
if (Array.isArray(rawClassVal) || rawClassVal instanceof Set) {
(/** @type {?} */ (rawClassVal)).forEach(function (klass) { return _this._toggleClass(klass, !isCleanup); });
}
else {
Object.keys(rawClassVal).forEach(function (klass) {
if (rawClassVal[klass] != null)
_this._toggleClass(klass, !isCleanup);
});
}
}
};
/**
* @param {?} klass
* @param {?} enabled
* @return {?}
*/
NgClass.prototype._toggleClass = /**
* @param {?} klass
* @param {?} enabled
* @return {?}
*/
function (klass, enabled) {
var _this = this;
klass = klass.trim();
if (klass) {
klass.split(/\s+/g).forEach(function (klass) {
if (enabled) {
_this._renderer.addClass(_this._ngEl.nativeElement, klass);
}
else {
_this._renderer.removeClass(_this._ngEl.nativeElement, klass);
}
});
}
};
NgClass.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{ selector: '[ngClass]' },] },
];
/** @nocollapse */
NgClass.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["E" /* IterableDiffers */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["F" /* KeyValueDiffers */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["W" /* Renderer2 */], },
]; };
NgClass.propDecorators = {
"klass": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */], args: ['class',] },],
"ngClass": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
};
return NgClass;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Instantiates a single {\@link Component} type and inserts its Host View into current View.
* `NgComponentOutlet` provides a declarative approach for dynamic component creation.
*
* `NgComponentOutlet` requires a component type, if a falsy value is set the view will clear and
* any existing component will get destroyed.
*
* ### Fine tune control
*
* You can control the component creation process by using the following optional attributes:
*
* * `ngComponentOutletInjector`: Optional custom {\@link Injector} that will be used as parent for
* the Component. Defaults to the injector of the current view container.
*
* * `ngComponentOutletContent`: Optional list of projectable nodes to insert into the content
* section of the component, if exists.
*
* * `ngComponentOutletNgModuleFactory`: Optional module factory to allow dynamically loading other
* module, then load a component from that module.
*
* ### Syntax
*
* Simple
* ```
* <ng-container *ngComponentOutlet="componentTypeExpression"></ng-container>
* ```
*
* Customized injector/content
* ```
* <ng-container *ngComponentOutlet="componentTypeExpression;
* injector: injectorExpression;
* content: contentNodesExpression;">
* </ng-container>
* ```
*
* Customized ngModuleFactory
* ```
* <ng-container *ngComponentOutlet="componentTypeExpression;
* ngModuleFactory: moduleFactory;">
* </ng-container>
* ```
* ## Example
*
* {\@example common/ngComponentOutlet/ts/module.ts region='SimpleExample'}
*
* A more complete example with additional options:
*
* {\@example common/ngComponentOutlet/ts/module.ts region='CompleteExample'}
* A more complete example with ngModuleFactory:
*
* {\@example common/ngComponentOutlet/ts/module.ts region='NgModuleFactoryExample'}
*
* \@experimental
*/
var NgComponentOutlet = (function () {
function NgComponentOutlet(_viewContainerRef) {
this._viewContainerRef = _viewContainerRef;
this._componentRef = null;
this._moduleRef = null;
}
/**
* @param {?} changes
* @return {?}
*/
NgComponentOutlet.prototype.ngOnChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
this._viewContainerRef.clear();
this._componentRef = null;
if (this.ngComponentOutlet) {
var /** @type {?} */ elInjector = this.ngComponentOutletInjector || this._viewContainerRef.parentInjector;
if (changes['ngComponentOutletNgModuleFactory']) {
if (this._moduleRef)
this._moduleRef.destroy();
if (this.ngComponentOutletNgModuleFactory) {
var /** @type {?} */ parentModule = elInjector.get(__WEBPACK_IMPORTED_MODULE_0__angular_core__["K" /* NgModuleRef */]);
this._moduleRef = this.ngComponentOutletNgModuleFactory.create(parentModule.injector);
}
else {
this._moduleRef = null;
}
}
var /** @type {?} */ componentFactoryResolver = this._moduleRef ? this._moduleRef.componentFactoryResolver :
elInjector.get(__WEBPACK_IMPORTED_MODULE_0__angular_core__["o" /* ComponentFactoryResolver */]);
var /** @type {?} */ componentFactory = componentFactoryResolver.resolveComponentFactory(this.ngComponentOutlet);
this._componentRef = this._viewContainerRef.createComponent(componentFactory, this._viewContainerRef.length, elInjector, this.ngComponentOutletContent);
}
};
/**
* @return {?}
*/
NgComponentOutlet.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
if (this._moduleRef)
this._moduleRef.destroy();
};
NgComponentOutlet.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{ selector: '[ngComponentOutlet]' },] },
];
/** @nocollapse */
NgComponentOutlet.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_10" /* ViewContainerRef */], },
]; };
NgComponentOutlet.propDecorators = {
"ngComponentOutlet": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
"ngComponentOutletInjector": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
"ngComponentOutletContent": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
"ngComponentOutletNgModuleFactory": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
};
return NgComponentOutlet;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* \@stable
*/
var NgForOfContext = (function () {
function NgForOfContext($implicit, ngForOf, index, count) {
this.$implicit = $implicit;
this.ngForOf = ngForOf;
this.index = index;
this.count = count;
}
Object.defineProperty(NgForOfContext.prototype, "first", {
get: /**
* @return {?}
*/
function () { return this.index === 0; },
enumerable: true,
configurable: true
});
Object.defineProperty(NgForOfContext.prototype, "last", {
get: /**
* @return {?}
*/
function () { return this.index === this.count - 1; },
enumerable: true,
configurable: true
});
Object.defineProperty(NgForOfContext.prototype, "even", {
get: /**
* @return {?}
*/
function () { return this.index % 2 === 0; },
enumerable: true,
configurable: true
});
Object.defineProperty(NgForOfContext.prototype, "odd", {
get: /**
* @return {?}
*/
function () { return !this.even; },
enumerable: true,
configurable: true
});
return NgForOfContext;
}());
/**
* The `NgForOf` directive instantiates a template once per item from an iterable. The context
* for each instantiated template inherits from the outer context with the given loop variable
* set to the current item from the iterable.
*
* ### Local Variables
*
* `NgForOf` provides several exported values that can be aliased to local variables:
*
* - `$implicit: T`: The value of the individual items in the iterable (`ngForOf`).
* - `ngForOf: NgIterable<T>`: The value of the iterable expression. Useful when the expression is
* more complex then a property access, for example when using the async pipe (`userStreams |
* async`).
* - `index: number`: The index of the current item in the iterable.
* - `first: boolean`: True when the item is the first item in the iterable.
* - `last: boolean`: True when the item is the last item in the iterable.
* - `even: boolean`: True when the item has an even index in the iterable.
* - `odd: boolean`: True when the item has an odd index in the iterable.
*
* ```
* <li *ngFor="let user of userObservable | async as users; index as i; first as isFirst">
* {{i}}/{{users.length}}. {{user}} <span *ngIf="isFirst">default</span>
* </li>
* ```
*
* ### Change Propagation
*
* When the contents of the iterator changes, `NgForOf` makes the corresponding changes to the DOM:
*
* * When an item is added, a new instance of the template is added to the DOM.
* * When an item is removed, its template instance is removed from the DOM.
* * When items are reordered, their respective templates are reordered in the DOM.
* * Otherwise, the DOM element for that item will remain the same.
*
* Angular uses object identity to track insertions and deletions within the iterator and reproduce
* those changes in the DOM. This has important implications for animations and any stateful
* controls (such as `<input>` elements which accept user input) that are present. Inserted rows can
* be animated in, deleted rows can be animated out, and unchanged rows retain any unsaved state
* such as user input.
*
* It is possible for the identities of elements in the iterator to change while the data does not.
* This can happen, for example, if the iterator produced from an RPC to the server, and that
* RPC is re-run. Even if the data hasn't changed, the second response will produce objects with
* different identities, and Angular will tear down the entire DOM and rebuild it (as if all old
* elements were deleted and all new elements inserted). This is an expensive operation and should
* be avoided if possible.
*
* To customize the default tracking algorithm, `NgForOf` supports `trackBy` option.
* `trackBy` takes a function which has two arguments: `index` and `item`.
* If `trackBy` is given, Angular tracks changes by the return value of the function.
*
* ### Syntax
*
* - `<li *ngFor="let item of items; index as i; trackBy: trackByFn">...</li>`
*
* With `<ng-template>` element:
*
* ```
* <ng-template ngFor let-item [ngForOf]="items" let-i="index" [ngForTrackBy]="trackByFn">
* <li>...</li>
* </ng-template>
* ```
*
* ### Example
*
* See a [live demo](http://plnkr.co/edit/KVuXxDp0qinGDyo307QW?p=preview) for a more detailed
* example.
*
* \@stable
*/
var NgForOf = (function () {
function NgForOf(_viewContainer, _template, _differs) {
this._viewContainer = _viewContainer;
this._template = _template;
this._differs = _differs;
this._differ = null;
}
Object.defineProperty(NgForOf.prototype, "ngForTrackBy", {
get: /**
* @return {?}
*/
function () { return this._trackByFn; },
set: /**
* @param {?} fn
* @return {?}
*/
function (fn) {
if (Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_16" /* isDevMode */])() && fn != null && typeof fn !== 'function') {
// TODO(vicb): use a log service once there is a public one available
if (/** @type {?} */ (console) && /** @type {?} */ (console.warn)) {
console.warn("trackBy must be a function, but received " + JSON.stringify(fn) + ". " +
"See https://angular.io/docs/ts/latest/api/common/index/NgFor-directive.html#!#change-propagation for more information.");
}
}
this._trackByFn = fn;
},
enumerable: true,
configurable: true
});
Object.defineProperty(NgForOf.prototype, "ngForTemplate", {
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
// TODO(TS2.1): make TemplateRef<Partial<NgForRowOf<T>>> once we move to TS v2.1
// The current type is too restrictive; a template that just uses index, for example,
// should be acceptable.
if (value) {
this._template = value;
}
},
enumerable: true,
configurable: true
});
/**
* @param {?} changes
* @return {?}
*/
NgForOf.prototype.ngOnChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
if ('ngForOf' in changes) {
// React on ngForOf changes only once all inputs have been initialized
var /** @type {?} */ value = changes['ngForOf'].currentValue;
if (!this._differ && value) {
try {
this._differ = this._differs.find(value).create(this.ngForTrackBy);
}
catch (/** @type {?} */ e) {
throw new Error("Cannot find a differ supporting object '" + value + "' of type '" + getTypeNameForDebugging(value) + "'. NgFor only supports binding to Iterables such as Arrays.");
}
}
}
};
/**
* @return {?}
*/
NgForOf.prototype.ngDoCheck = /**
* @return {?}
*/
function () {
if (this._differ) {
var /** @type {?} */ changes = this._differ.diff(this.ngForOf);
if (changes)
this._applyChanges(changes);
}
};
/**
* @param {?} changes
* @return {?}
*/
NgForOf.prototype._applyChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
var _this = this;
var /** @type {?} */ insertTuples = [];
changes.forEachOperation(function (item, adjustedPreviousIndex, currentIndex) {
if (item.previousIndex == null) {
var /** @type {?} */ view = _this._viewContainer.createEmbeddedView(_this._template, new NgForOfContext(/** @type {?} */ ((null)), _this.ngForOf, -1, -1), currentIndex);
var /** @type {?} */ tuple = new RecordViewTuple(item, view);
insertTuples.push(tuple);
}
else if (currentIndex == null) {
_this._viewContainer.remove(adjustedPreviousIndex);
}
else {
var /** @type {?} */ view = /** @type {?} */ ((_this._viewContainer.get(adjustedPreviousIndex)));
_this._viewContainer.move(view, currentIndex);
var /** @type {?} */ tuple = new RecordViewTuple(item, /** @type {?} */ (view));
insertTuples.push(tuple);
}
});
for (var /** @type {?} */ i = 0; i < insertTuples.length; i++) {
this._perViewChange(insertTuples[i].view, insertTuples[i].record);
}
for (var /** @type {?} */ i = 0, /** @type {?} */ ilen = this._viewContainer.length; i < ilen; i++) {
var /** @type {?} */ viewRef = /** @type {?} */ (this._viewContainer.get(i));
viewRef.context.index = i;
viewRef.context.count = ilen;
}
changes.forEachIdentityChange(function (record) {
var /** @type {?} */ viewRef = /** @type {?} */ (_this._viewContainer.get(record.currentIndex));
viewRef.context.$implicit = record.item;
});
};
/**
* @param {?} view
* @param {?} record
* @return {?}
*/
NgForOf.prototype._perViewChange = /**
* @param {?} view
* @param {?} record
* @return {?}
*/
function (view, record) {
view.context.$implicit = record.item;
};
NgForOf.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{ selector: '[ngFor][ngForOf]' },] },
];
/** @nocollapse */
NgForOf.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_10" /* ViewContainerRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_5" /* TemplateRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["E" /* IterableDiffers */], },
]; };
NgForOf.propDecorators = {
"ngForOf": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
"ngForTrackBy": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
"ngForTemplate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
};
return NgForOf;
}());
var RecordViewTuple = (function () {
function RecordViewTuple(record, view) {
this.record = record;
this.view = view;
}
return RecordViewTuple;
}());
/**
* @param {?} type
* @return {?}
*/
function getTypeNameForDebugging(type) {
return type['name'] || typeof type;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Conditionally includes a template based on the value of an `expression`.
*
* `ngIf` evaluates the `expression` and then renders the `then` or `else` template in its place
* when expression is truthy or falsy respectively. Typically the:
* - `then` template is the inline template of `ngIf` unless bound to a different value.
* - `else` template is blank unless it is bound.
*
* ## Most common usage
*
* The most common usage of the `ngIf` directive is to conditionally show the inline template as
* seen in this example:
* {\@example common/ngIf/ts/module.ts region='NgIfSimple'}
*
* ## Showing an alternative template using `else`
*
* If it is necessary to display a template when the `expression` is falsy use the `else` template
* binding as shown. Note that the `else` binding points to a `<ng-template>` labeled `#elseBlock`.
* The template can be defined anywhere in the component view but is typically placed right after
* `ngIf` for readability.
*
* {\@example common/ngIf/ts/module.ts region='NgIfElse'}
*
* ## Using non-inlined `then` template
*
* Usually the `then` template is the inlined template of the `ngIf`, but it can be changed using
* a binding (just like `else`). Because `then` and `else` are bindings, the template references can
* change at runtime as shown in this example.
*
* {\@example common/ngIf/ts/module.ts region='NgIfThenElse'}
*
* ## Storing conditional result in a variable
*
* A common pattern is that we need to show a set of properties from the same object. If the
* object is undefined, then we have to use the safe-traversal-operator `?.` to guard against
* dereferencing a `null` value. This is especially the case when waiting on async data such as
* when using the `async` pipe as shown in following example:
*
* ```
* Hello {{ (userStream|async)?.last }}, {{ (userStream|async)?.first }}!
* ```
*
* There are several inefficiencies in the above example:
* - We create multiple subscriptions on `userStream`. One for each `async` pipe, or two in the
* example above.
* - We cannot display an alternative screen while waiting for the data to arrive asynchronously.
* - We have to use the safe-traversal-operator `?.` to access properties, which is cumbersome.
* - We have to place the `async` pipe in parenthesis.
*
* A better way to do this is to use `ngIf` and store the result of the condition in a local
* variable as shown in the the example below:
*
* {\@example common/ngIf/ts/module.ts region='NgIfAs'}
*
* Notice that:
* - We use only one `async` pipe and hence only one subscription gets created.
* - `ngIf` stores the result of the `userStream|async` in the local variable `user`.
* - The local `user` can then be bound repeatedly in a more efficient way.
* - No need to use the safe-traversal-operator `?.` to access properties as `ngIf` will only
* display the data if `userStream` returns a value.
* - We can display an alternative template while waiting for the data.
*
* ### Syntax
*
* Simple form:
* - `<div *ngIf="condition">...</div>`
* - `<ng-template [ngIf]="condition"><div>...</div></ng-template>`
*
* Form with an else block:
* ```
* <div *ngIf="condition; else elseBlock">...</div>
* <ng-template #elseBlock>...</ng-template>
* ```
*
* Form with a `then` and `else` block:
* ```
* <div *ngIf="condition; then thenBlock else elseBlock"></div>
* <ng-template #thenBlock>...</ng-template>
* <ng-template #elseBlock>...</ng-template>
* ```
*
* Form with storing the value locally:
* ```
* <div *ngIf="condition as value; else elseBlock">{{value}}</div>
* <ng-template #elseBlock>...</ng-template>
* ```
*
* \@stable
*/
var NgIf = (function () {
function NgIf(_viewContainer, templateRef) {
this._viewContainer = _viewContainer;
this._context = new NgIfContext();
this._thenTemplateRef = null;
this._elseTemplateRef = null;
this._thenViewRef = null;
this._elseViewRef = null;
this._thenTemplateRef = templateRef;
}
Object.defineProperty(NgIf.prototype, "ngIf", {
set: /**
* @param {?} condition
* @return {?}
*/
function (condition) {
this._context.$implicit = this._context.ngIf = condition;
this._updateView();
},
enumerable: true,
configurable: true
});
Object.defineProperty(NgIf.prototype, "ngIfThen", {
set: /**
* @param {?} templateRef
* @return {?}
*/
function (templateRef) {
this._thenTemplateRef = templateRef;
this._thenViewRef = null; // clear previous view if any.
this._updateView();
},
enumerable: true,
configurable: true
});
Object.defineProperty(NgIf.prototype, "ngIfElse", {
set: /**
* @param {?} templateRef
* @return {?}
*/
function (templateRef) {
this._elseTemplateRef = templateRef;
this._elseViewRef = null; // clear previous view if any.
this._updateView();
},
enumerable: true,
configurable: true
});
/**
* @return {?}
*/
NgIf.prototype._updateView = /**
* @return {?}
*/
function () {
if (this._context.$implicit) {
if (!this._thenViewRef) {
this._viewContainer.clear();
this._elseViewRef = null;
if (this._thenTemplateRef) {
this._thenViewRef =
this._viewContainer.createEmbeddedView(this._thenTemplateRef, this._context);
}
}
}
else {
if (!this._elseViewRef) {
this._viewContainer.clear();
this._thenViewRef = null;
if (this._elseTemplateRef) {
this._elseViewRef =
this._viewContainer.createEmbeddedView(this._elseTemplateRef, this._context);
}
}
}
};
NgIf.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{ selector: '[ngIf]' },] },
];
/** @nocollapse */
NgIf.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_10" /* ViewContainerRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_5" /* TemplateRef */], },
]; };
NgIf.propDecorators = {
"ngIf": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
"ngIfThen": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
"ngIfElse": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
};
return NgIf;
}());
/**
* \@stable
*/
var NgIfContext = (function () {
function NgIfContext() {
this.$implicit = null;
this.ngIf = null;
}
return NgIfContext;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var SwitchView = (function () {
function SwitchView(_viewContainerRef, _templateRef) {
this._viewContainerRef = _viewContainerRef;
this._templateRef = _templateRef;
this._created = false;
}
/**
* @return {?}
*/
SwitchView.prototype.create = /**
* @return {?}
*/
function () {
this._created = true;
this._viewContainerRef.createEmbeddedView(this._templateRef);
};
/**
* @return {?}
*/
SwitchView.prototype.destroy = /**
* @return {?}
*/
function () {
this._created = false;
this._viewContainerRef.clear();
};
/**
* @param {?} created
* @return {?}
*/
SwitchView.prototype.enforceState = /**
* @param {?} created
* @return {?}
*/
function (created) {
if (created && !this._created) {
this.create();
}
else if (!created && this._created) {
this.destroy();
}
};
return SwitchView;
}());
/**
* \@ngModule CommonModule
*
* \@whatItDoes Adds / removes DOM sub-trees when the nest match expressions matches the switch
* expression.
*
* \@howToUse
* ```
* <container-element [ngSwitch]="switch_expression">
* <some-element *ngSwitchCase="match_expression_1">...</some-element>
* <some-element *ngSwitchCase="match_expression_2">...</some-element>
* <some-other-element *ngSwitchCase="match_expression_3">...</some-other-element>
* <ng-container *ngSwitchCase="match_expression_3">
* <!-- use a ng-container to group multiple root nodes -->
* <inner-element></inner-element>
* <inner-other-element></inner-other-element>
* </ng-container>
* <some-element *ngSwitchDefault>...</some-element>
* </container-element>
* ```
* \@description
*
* `NgSwitch` stamps out nested views when their match expression value matches the value of the
* switch expression.
*
* In other words:
* - you define a container element (where you place the directive with a switch expression on the
* `[ngSwitch]="..."` attribute)
* - you define inner views inside the `NgSwitch` and place a `*ngSwitchCase` attribute on the view
* root elements.
*
* Elements within `NgSwitch` but outside of a `NgSwitchCase` or `NgSwitchDefault` directives will
* be preserved at the location.
*
* The `ngSwitchCase` directive informs the parent `NgSwitch` of which view to display when the
* expression is evaluated.
* When no matching expression is found on a `ngSwitchCase` view, the `ngSwitchDefault` view is
* stamped out.
*
* \@stable
*/
var NgSwitch = (function () {
function NgSwitch() {
this._defaultUsed = false;
this._caseCount = 0;
this._lastCaseCheckIndex = 0;
this._lastCasesMatched = false;
}
Object.defineProperty(NgSwitch.prototype, "ngSwitch", {
set: /**
* @param {?} newValue
* @return {?}
*/
function (newValue) {
this._ngSwitch = newValue;
if (this._caseCount === 0) {
this._updateDefaultCases(true);
}
},
enumerable: true,
configurable: true
});
/** @internal */
/**
* \@internal
* @return {?}
*/
NgSwitch.prototype._addCase = /**
* \@internal
* @return {?}
*/
function () { return this._caseCount++; };
/** @internal */
/**
* \@internal
* @param {?} view
* @return {?}
*/
NgSwitch.prototype._addDefault = /**
* \@internal
* @param {?} view
* @return {?}
*/
function (view) {
if (!this._defaultViews) {
this._defaultViews = [];
}
this._defaultViews.push(view);
};
/** @internal */
/**
* \@internal
* @param {?} value
* @return {?}
*/
NgSwitch.prototype._matchCase = /**
* \@internal
* @param {?} value
* @return {?}
*/
function (value) {
var /** @type {?} */ matched = value == this._ngSwitch;
this._lastCasesMatched = this._lastCasesMatched || matched;
this._lastCaseCheckIndex++;
if (this._lastCaseCheckIndex === this._caseCount) {
this._updateDefaultCases(!this._lastCasesMatched);
this._lastCaseCheckIndex = 0;
this._lastCasesMatched = false;
}
return matched;
};
/**
* @param {?} useDefault
* @return {?}
*/
NgSwitch.prototype._updateDefaultCases = /**
* @param {?} useDefault
* @return {?}
*/
function (useDefault) {
if (this._defaultViews && useDefault !== this._defaultUsed) {
this._defaultUsed = useDefault;
for (var /** @type {?} */ i = 0; i < this._defaultViews.length; i++) {
var /** @type {?} */ defaultView = this._defaultViews[i];
defaultView.enforceState(useDefault);
}
}
};
NgSwitch.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{ selector: '[ngSwitch]' },] },
];
/** @nocollapse */
NgSwitch.ctorParameters = function () { return []; };
NgSwitch.propDecorators = {
"ngSwitch": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
};
return NgSwitch;
}());
/**
* \@ngModule CommonModule
*
* \@whatItDoes Creates a view that will be added/removed from the parent {\@link NgSwitch} when the
* given expression evaluate to respectively the same/different value as the switch
* expression.
*
* \@howToUse
* ```
* <container-element [ngSwitch]="switch_expression">
* <some-element *ngSwitchCase="match_expression_1">...</some-element>
* </container-element>
* ```
* \@description
*
* Insert the sub-tree when the expression evaluates to the same value as the enclosing switch
* expression.
*
* If multiple match expressions match the switch expression value, all of them are displayed.
*
* See {\@link NgSwitch} for more details and example.
*
* \@stable
*/
var NgSwitchCase = (function () {
function NgSwitchCase(viewContainer, templateRef, ngSwitch) {
this.ngSwitch = ngSwitch;
ngSwitch._addCase();
this._view = new SwitchView(viewContainer, templateRef);
}
/**
* @return {?}
*/
NgSwitchCase.prototype.ngDoCheck = /**
* @return {?}
*/
function () { this._view.enforceState(this.ngSwitch._matchCase(this.ngSwitchCase)); };
NgSwitchCase.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{ selector: '[ngSwitchCase]' },] },
];
/** @nocollapse */
NgSwitchCase.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_10" /* ViewContainerRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_5" /* TemplateRef */], },
{ type: NgSwitch, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["w" /* Host */] },] },
]; };
NgSwitchCase.propDecorators = {
"ngSwitchCase": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
};
return NgSwitchCase;
}());
/**
* \@ngModule CommonModule
* \@whatItDoes Creates a view that is added to the parent {\@link NgSwitch} when no case expressions
* match the
* switch expression.
*
* \@howToUse
* ```
* <container-element [ngSwitch]="switch_expression">
* <some-element *ngSwitchCase="match_expression_1">...</some-element>
* <some-other-element *ngSwitchDefault>...</some-other-element>
* </container-element>
* ```
*
* \@description
*
* Insert the sub-tree when no case expressions evaluate to the same value as the enclosing switch
* expression.
*
* See {\@link NgSwitch} for more details and example.
*
* \@stable
*/
var NgSwitchDefault = (function () {
function NgSwitchDefault(viewContainer, templateRef, ngSwitch) {
ngSwitch._addDefault(new SwitchView(viewContainer, templateRef));
}
NgSwitchDefault.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{ selector: '[ngSwitchDefault]' },] },
];
/** @nocollapse */
NgSwitchDefault.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_10" /* ViewContainerRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_5" /* TemplateRef */], },
{ type: NgSwitch, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["w" /* Host */] },] },
]; };
return NgSwitchDefault;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* \@ngModule CommonModule
*
* \@whatItDoes Adds / removes DOM sub-trees based on a numeric value. Tailored for pluralization.
*
* \@howToUse
* ```
* <some-element [ngPlural]="value">
* <ng-template ngPluralCase="=0">there is nothing</ng-template>
* <ng-template ngPluralCase="=1">there is one</ng-template>
* <ng-template ngPluralCase="few">there are a few</ng-template>
* </some-element>
* ```
*
* \@description
*
* Displays DOM sub-trees that match the switch expression value, or failing that, DOM sub-trees
* that match the switch expression's pluralization category.
*
* To use this directive you must provide a container element that sets the `[ngPlural]` attribute
* to a switch expression. Inner elements with a `[ngPluralCase]` will display based on their
* expression:
* - if `[ngPluralCase]` is set to a value starting with `=`, it will only display if the value
* matches the switch expression exactly,
* - otherwise, the view will be treated as a "category match", and will only display if exact
* value matches aren't found and the value maps to its category for the defined locale.
*
* See http://cldr.unicode.org/index/cldr-spec/plural-rules
*
* \@experimental
*/
var NgPlural = (function () {
function NgPlural(_localization) {
this._localization = _localization;
this._caseViews = {};
}
Object.defineProperty(NgPlural.prototype, "ngPlural", {
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
this._switchValue = value;
this._updateView();
},
enumerable: true,
configurable: true
});
/**
* @param {?} value
* @param {?} switchView
* @return {?}
*/
NgPlural.prototype.addCase = /**
* @param {?} value
* @param {?} switchView
* @return {?}
*/
function (value, switchView) { this._caseViews[value] = switchView; };
/**
* @return {?}
*/
NgPlural.prototype._updateView = /**
* @return {?}
*/
function () {
this._clearViews();
var /** @type {?} */ cases = Object.keys(this._caseViews);
var /** @type {?} */ key = getPluralCategory(this._switchValue, cases, this._localization);
this._activateView(this._caseViews[key]);
};
/**
* @return {?}
*/
NgPlural.prototype._clearViews = /**
* @return {?}
*/
function () {
if (this._activeView)
this._activeView.destroy();
};
/**
* @param {?} view
* @return {?}
*/
NgPlural.prototype._activateView = /**
* @param {?} view
* @return {?}
*/
function (view) {
if (view) {
this._activeView = view;
this._activeView.create();
}
};
NgPlural.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{ selector: '[ngPlural]' },] },
];
/** @nocollapse */
NgPlural.ctorParameters = function () { return [
{ type: NgLocalization, },
]; };
NgPlural.propDecorators = {
"ngPlural": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
};
return NgPlural;
}());
/**
* \@ngModule CommonModule
*
* \@whatItDoes Creates a view that will be added/removed from the parent {\@link NgPlural} when the
* given expression matches the plural expression according to CLDR rules.
*
* \@howToUse
* ```
* <some-element [ngPlural]="value">
* <ng-template ngPluralCase="=0">...</ng-template>
* <ng-template ngPluralCase="other">...</ng-template>
* </some-element>
* ```
*
* See {\@link NgPlural} for more details and example.
*
* \@experimental
*/
var NgPluralCase = (function () {
function NgPluralCase(value, template, viewContainer, ngPlural) {
this.value = value;
var /** @type {?} */ isANumber = !isNaN(Number(value));
ngPlural.addCase(isANumber ? "=" + value : value, new SwitchView(viewContainer, template));
}
NgPluralCase.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{ selector: '[ngPluralCase]' },] },
];
/** @nocollapse */
NgPluralCase.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["g" /* Attribute */], args: ['ngPluralCase',] },] },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_5" /* TemplateRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_10" /* ViewContainerRef */], },
{ type: NgPlural, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["w" /* Host */] },] },
]; };
return NgPluralCase;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* \@ngModule CommonModule
*
* \@whatItDoes Update an HTML element styles.
*
* \@howToUse
* ```
* <some-element [ngStyle]="{'font-style': styleExp}">...</some-element>
*
* <some-element [ngStyle]="{'max-width.px': widthExp}">...</some-element>
*
* <some-element [ngStyle]="objExp">...</some-element>
* ```
*
* \@description
*
* The styles are updated according to the value of the expression evaluation:
* - keys are style names with an optional `.<unit>` suffix (ie 'top.px', 'font-style.em'),
* - values are the values assigned to those properties (expressed in the given unit).
*
* \@stable
*/
var NgStyle = (function () {
function NgStyle(_differs, _ngEl, _renderer) {
this._differs = _differs;
this._ngEl = _ngEl;
this._renderer = _renderer;
}
Object.defineProperty(NgStyle.prototype, "ngStyle", {
set: /**
* @param {?} v
* @return {?}
*/
function (v) {
this._ngStyle = v;
if (!this._differ && v) {
this._differ = this._differs.find(v).create();
}
},
enumerable: true,
configurable: true
});
/**
* @return {?}
*/
NgStyle.prototype.ngDoCheck = /**
* @return {?}
*/
function () {
if (this._differ) {
var /** @type {?} */ changes = this._differ.diff(this._ngStyle);
if (changes) {
this._applyChanges(changes);
}
}
};
/**
* @param {?} changes
* @return {?}
*/
NgStyle.prototype._applyChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
var _this = this;
changes.forEachRemovedItem(function (record) { return _this._setStyle(record.key, null); });
changes.forEachAddedItem(function (record) { return _this._setStyle(record.key, record.currentValue); });
changes.forEachChangedItem(function (record) { return _this._setStyle(record.key, record.currentValue); });
};
/**
* @param {?} nameAndUnit
* @param {?} value
* @return {?}
*/
NgStyle.prototype._setStyle = /**
* @param {?} nameAndUnit
* @param {?} value
* @return {?}
*/
function (nameAndUnit, value) {
var _a = nameAndUnit.split('.'), name = _a[0], unit = _a[1];
value = value != null && unit ? "" + value + unit : value;
this._renderer.setStyle(this._ngEl.nativeElement, name, /** @type {?} */ (value));
};
NgStyle.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{ selector: '[ngStyle]' },] },
];
/** @nocollapse */
NgStyle.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["F" /* KeyValueDiffers */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["W" /* Renderer2 */], },
]; };
NgStyle.propDecorators = {
"ngStyle": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
};
return NgStyle;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* \@ngModule CommonModule
*
* \@whatItDoes Inserts an embedded view from a prepared `TemplateRef`
*
* \@howToUse
* ```
* <ng-container *ngTemplateOutlet="templateRefExp; context: contextExp"></ng-container>
* ```
*
* \@description
*
* You can attach a context object to the `EmbeddedViewRef` by setting `[ngTemplateOutletContext]`.
* `[ngTemplateOutletContext]` should be an object, the object's keys will be available for binding
* by the local template `let` declarations.
*
* Note: using the key `$implicit` in the context object will set it's value as default.
*
* ## Example
*
* {\@example common/ngTemplateOutlet/ts/module.ts region='NgTemplateOutlet'}
*
* \@stable
*/
var NgTemplateOutlet = (function () {
function NgTemplateOutlet(_viewContainerRef) {
this._viewContainerRef = _viewContainerRef;
}
/**
* @param {?} changes
* @return {?}
*/
NgTemplateOutlet.prototype.ngOnChanges = /**
* @param {?} changes
* @return {?}
*/
function (changes) {
var /** @type {?} */ recreateView = this._shouldRecreateView(changes);
if (recreateView) {
if (this._viewRef) {
this._viewContainerRef.remove(this._viewContainerRef.indexOf(this._viewRef));
}
if (this.ngTemplateOutlet) {
this._viewRef = this._viewContainerRef.createEmbeddedView(this.ngTemplateOutlet, this.ngTemplateOutletContext);
}
}
else {
if (this._viewRef && this.ngTemplateOutletContext) {
this._updateExistingContext(this.ngTemplateOutletContext);
}
}
};
/**
* We need to re-create existing embedded view if:
* - templateRef has changed
* - context has changes
*
* We mark context object as changed when the corresponding object
* shape changes (new properties are added or existing properties are removed).
* In other words we consider context with the same properties as "the same" even
* if object reference changes (see https://github.com/angular/angular/issues/13407).
* @param {?} changes
* @return {?}
*/
NgTemplateOutlet.prototype._shouldRecreateView = /**
* We need to re-create existing embedded view if:
* - templateRef has changed
* - context has changes
*
* We mark context object as changed when the corresponding object
* shape changes (new properties are added or existing properties are removed).
* In other words we consider context with the same properties as "the same" even
* if object reference changes (see https://github.com/angular/angular/issues/13407).
* @param {?} changes
* @return {?}
*/
function (changes) {
var /** @type {?} */ ctxChange = changes['ngTemplateOutletContext'];
return !!changes['ngTemplateOutlet'] || (ctxChange && this._hasContextShapeChanged(ctxChange));
};
/**
* @param {?} ctxChange
* @return {?}
*/
NgTemplateOutlet.prototype._hasContextShapeChanged = /**
* @param {?} ctxChange
* @return {?}
*/
function (ctxChange) {
var /** @type {?} */ prevCtxKeys = Object.keys(ctxChange.previousValue || {});
var /** @type {?} */ currCtxKeys = Object.keys(ctxChange.currentValue || {});
if (prevCtxKeys.length === currCtxKeys.length) {
for (var _i = 0, currCtxKeys_1 = currCtxKeys; _i < currCtxKeys_1.length; _i++) {
var propName = currCtxKeys_1[_i];
if (prevCtxKeys.indexOf(propName) === -1) {
return true;
}
}
return false;
}
else {
return true;
}
};
/**
* @param {?} ctx
* @return {?}
*/
NgTemplateOutlet.prototype._updateExistingContext = /**
* @param {?} ctx
* @return {?}
*/
function (ctx) {
for (var _i = 0, _a = Object.keys(ctx); _i < _a.length; _i++) {
var propName = _a[_i];
(/** @type {?} */ (this._viewRef.context))[propName] = (/** @type {?} */ (this.ngTemplateOutletContext))[propName];
}
};
NgTemplateOutlet.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{ selector: '[ngTemplateOutlet]' },] },
];
/** @nocollapse */
NgTemplateOutlet.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_10" /* ViewContainerRef */], },
]; };
NgTemplateOutlet.propDecorators = {
"ngTemplateOutletContext": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
"ngTemplateOutlet": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
};
return NgTemplateOutlet;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* A collection of Angular directives that are likely to be used in each and every Angular
* application.
*/
var COMMON_DIRECTIVES = [
NgClass,
NgComponentOutlet,
NgForOf,
NgIf,
NgTemplateOutlet,
NgStyle,
NgSwitch,
NgSwitchCase,
NgSwitchDefault,
NgPlural,
NgPluralCase,
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var NAMED_FORMATS = {};
var DATE_FORMATS_SPLIT = /((?:[^GyMLwWdEabBhHmsSzZO']+)|(?:'(?:[^']|'')*')|(?:G{1,5}|y{1,4}|M{1,5}|L{1,5}|w{1,2}|W{1}|d{1,2}|E{1,6}|a{1,5}|b{1,5}|B{1,5}|h{1,2}|H{1,2}|m{1,2}|s{1,2}|S{1,3}|z{1,4}|Z{1,5}|O{1,4}))([\s\S]*)/;
/** @enum {number} */
var ZoneWidth = {
Short: 0,
ShortGMT: 1,
Long: 2,
Extended: 3,
};
ZoneWidth[ZoneWidth.Short] = "Short";
ZoneWidth[ZoneWidth.ShortGMT] = "ShortGMT";
ZoneWidth[ZoneWidth.Long] = "Long";
ZoneWidth[ZoneWidth.Extended] = "Extended";
/** @enum {number} */
var DateType = {
FullYear: 0,
Month: 1,
Date: 2,
Hours: 3,
Minutes: 4,
Seconds: 5,
Milliseconds: 6,
Day: 7,
};
DateType[DateType.FullYear] = "FullYear";
DateType[DateType.Month] = "Month";
DateType[DateType.Date] = "Date";
DateType[DateType.Hours] = "Hours";
DateType[DateType.Minutes] = "Minutes";
DateType[DateType.Seconds] = "Seconds";
DateType[DateType.Milliseconds] = "Milliseconds";
DateType[DateType.Day] = "Day";
/** @enum {number} */
var TranslationType = {
DayPeriods: 0,
Days: 1,
Months: 2,
Eras: 3,
};
TranslationType[TranslationType.DayPeriods] = "DayPeriods";
TranslationType[TranslationType.Days] = "Days";
TranslationType[TranslationType.Months] = "Months";
TranslationType[TranslationType.Eras] = "Eras";
/**
* Transforms a date to a locale string based on a pattern and a timezone
*
* \@internal
* @param {?} date
* @param {?} format
* @param {?} locale
* @param {?=} timezone
* @return {?}
*/
function formatDate(date, format, locale, timezone) {
var /** @type {?} */ namedFormat = getNamedFormat(locale, format);
format = namedFormat || format;
var /** @type {?} */ parts = [];
var /** @type {?} */ match;
while (format) {
match = DATE_FORMATS_SPLIT.exec(format);
if (match) {
parts = parts.concat(match.slice(1));
var /** @type {?} */ part = parts.pop();
if (!part) {
break;
}
format = part;
}
else {
parts.push(format);
break;
}
}
var /** @type {?} */ dateTimezoneOffset = date.getTimezoneOffset();
if (timezone) {
dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
date = convertTimezoneToLocal(date, timezone, true);
}
var /** @type {?} */ text = '';
parts.forEach(function (value) {
var /** @type {?} */ dateFormatter = getDateFormatter(value);
text += dateFormatter ?
dateFormatter(date, locale, dateTimezoneOffset) :
value === '\'\'' ? '\'' : value.replace(/(^'|'$)/g, '').replace(/''/g, '\'');
});
return text;
}
/**
* @param {?} locale
* @param {?} format
* @return {?}
*/
function getNamedFormat(locale, format) {
var /** @type {?} */ localeId = getLocaleId(locale);
NAMED_FORMATS[localeId] = NAMED_FORMATS[localeId] || {};
if (NAMED_FORMATS[localeId][format]) {
return NAMED_FORMATS[localeId][format];
}
var /** @type {?} */ formatValue = '';
switch (format) {
case 'shortDate':
formatValue = getLocaleDateFormat(locale, FormatWidth.Short);
break;
case 'mediumDate':
formatValue = getLocaleDateFormat(locale, FormatWidth.Medium);
break;
case 'longDate':
formatValue = getLocaleDateFormat(locale, FormatWidth.Long);
break;
case 'fullDate':
formatValue = getLocaleDateFormat(locale, FormatWidth.Full);
break;
case 'shortTime':
formatValue = getLocaleTimeFormat(locale, FormatWidth.Short);
break;
case 'mediumTime':
formatValue = getLocaleTimeFormat(locale, FormatWidth.Medium);
break;
case 'longTime':
formatValue = getLocaleTimeFormat(locale, FormatWidth.Long);
break;
case 'fullTime':
formatValue = getLocaleTimeFormat(locale, FormatWidth.Full);
break;
case 'short':
var /** @type {?} */ shortTime = getNamedFormat(locale, 'shortTime');
var /** @type {?} */ shortDate = getNamedFormat(locale, 'shortDate');
formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Short), [shortTime, shortDate]);
break;
case 'medium':
var /** @type {?} */ mediumTime = getNamedFormat(locale, 'mediumTime');
var /** @type {?} */ mediumDate = getNamedFormat(locale, 'mediumDate');
formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Medium), [mediumTime, mediumDate]);
break;
case 'long':
var /** @type {?} */ longTime = getNamedFormat(locale, 'longTime');
var /** @type {?} */ longDate = getNamedFormat(locale, 'longDate');
formatValue =
formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Long), [longTime, longDate]);
break;
case 'full':
var /** @type {?} */ fullTime = getNamedFormat(locale, 'fullTime');
var /** @type {?} */ fullDate = getNamedFormat(locale, 'fullDate');
formatValue =
formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Full), [fullTime, fullDate]);
break;
}
if (formatValue) {
NAMED_FORMATS[localeId][format] = formatValue;
}
return formatValue;
}
/**
* @param {?} str
* @param {?} opt_values
* @return {?}
*/
function formatDateTime(str, opt_values) {
if (opt_values) {
str = str.replace(/\{([^}]+)}/g, function (match, key) {
return (opt_values != null && key in opt_values) ? opt_values[key] : match;
});
}
return str;
}
/**
* @param {?} num
* @param {?} digits
* @param {?=} minusSign
* @param {?=} trim
* @param {?=} negWrap
* @return {?}
*/
function padNumber(num, digits, minusSign, trim, negWrap) {
if (minusSign === void 0) { minusSign = '-'; }
var /** @type {?} */ neg = '';
if (num < 0 || (negWrap && num <= 0)) {
if (negWrap) {
num = -num + 1;
}
else {
num = -num;
neg = minusSign;
}
}
var /** @type {?} */ strNum = '' + num;
while (strNum.length < digits)
strNum = '0' + strNum;
if (trim) {
strNum = strNum.substr(strNum.length - digits);
}
return neg + strNum;
}
/**
* Returns a date formatter that transforms a date into its locale digit representation
* @param {?} name
* @param {?} size
* @param {?=} offset
* @param {?=} trim
* @param {?=} negWrap
* @return {?}
*/
function dateGetter(name, size, offset, trim, negWrap) {
if (offset === void 0) { offset = 0; }
if (trim === void 0) { trim = false; }
if (negWrap === void 0) { negWrap = false; }
return function (date, locale) {
var /** @type {?} */ part = getDatePart(name, date, size);
if (offset > 0 || part > -offset) {
part += offset;
}
if (name === DateType.Hours && part === 0 && offset === -12) {
part = 12;
}
return padNumber(part, size, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign), trim, negWrap);
};
}
/**
* @param {?} name
* @param {?} date
* @param {?} size
* @return {?}
*/
function getDatePart(name, date, size) {
switch (name) {
case DateType.FullYear:
return date.getFullYear();
case DateType.Month:
return date.getMonth();
case DateType.Date:
return date.getDate();
case DateType.Hours:
return date.getHours();
case DateType.Minutes:
return date.getMinutes();
case DateType.Seconds:
return date.getSeconds();
case DateType.Milliseconds:
var /** @type {?} */ div = size === 1 ? 100 : (size === 2 ? 10 : 1);
return Math.round(date.getMilliseconds() / div);
case DateType.Day:
return date.getDay();
default:
throw new Error("Unknown DateType value \"" + name + "\".");
}
}
/**
* Returns a date formatter that transforms a date into its locale string representation
* @param {?} name
* @param {?} width
* @param {?=} form
* @param {?=} extended
* @return {?}
*/
function dateStrGetter(name, width, form, extended) {
if (form === void 0) { form = FormStyle.Format; }
if (extended === void 0) { extended = false; }
return function (date, locale) {
return getDateTranslation(date, locale, name, width, form, extended);
};
}
/**
* Returns the locale translation of a date for a given form, type and width
* @param {?} date
* @param {?} locale
* @param {?} name
* @param {?} width
* @param {?} form
* @param {?} extended
* @return {?}
*/
function getDateTranslation(date, locale, name, width, form, extended) {
switch (name) {
case TranslationType.Months:
return getLocaleMonthNames(locale, form, width)[date.getMonth()];
case TranslationType.Days:
return getLocaleDayNames(locale, form, width)[date.getDay()];
case TranslationType.DayPeriods:
var /** @type {?} */ currentHours_1 = date.getHours();
var /** @type {?} */ currentMinutes_1 = date.getMinutes();
if (extended) {
var /** @type {?} */ rules = getLocaleExtraDayPeriodRules(locale);
var /** @type {?} */ dayPeriods_1 = getLocaleExtraDayPeriods(locale, form, width);
var /** @type {?} */ result_1;
rules.forEach(function (rule, index) {
if (Array.isArray(rule)) {
// morning, afternoon, evening, night
var _a = rule[0], hoursFrom = _a.hours, minutesFrom = _a.minutes;
var _b = rule[1], hoursTo = _b.hours, minutesTo = _b.minutes;
if (currentHours_1 >= hoursFrom && currentMinutes_1 >= minutesFrom &&
(currentHours_1 < hoursTo ||
(currentHours_1 === hoursTo && currentMinutes_1 < minutesTo))) {
result_1 = dayPeriods_1[index];
}
}
else {
// noon or midnight
var hours = rule.hours, minutes = rule.minutes;
if (hours === currentHours_1 && minutes === currentMinutes_1) {
result_1 = dayPeriods_1[index];
}
}
});
if (result_1) {
return result_1;
}
}
// if no rules for the day periods, we use am/pm by default
return getLocaleDayPeriods(locale, form, /** @type {?} */ (width))[currentHours_1 < 12 ? 0 : 1];
case TranslationType.Eras:
return getLocaleEraNames(locale, /** @type {?} */ (width))[date.getFullYear() <= 0 ? 0 : 1];
}
}
/**
* Returns a date formatter that transforms a date and an offset into a timezone with ISO8601 or
* GMT format depending on the width (eg: short = +0430, short:GMT = GMT+4, long = GMT+04:30,
* extended = +04:30)
* @param {?} width
* @return {?}
*/
function timeZoneGetter(width) {
return function (date, locale, offset) {
var /** @type {?} */ zone = -1 * offset;
var /** @type {?} */ minusSign = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign);
var /** @type {?} */ hours = zone > 0 ? Math.floor(zone / 60) : Math.ceil(zone / 60);
switch (width) {
case ZoneWidth.Short:
return ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) +
padNumber(Math.abs(zone % 60), 2, minusSign);
case ZoneWidth.ShortGMT:
return 'GMT' + ((zone >= 0) ? '+' : '') + padNumber(hours, 1, minusSign);
case ZoneWidth.Long:
return 'GMT' + ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) + ':' +
padNumber(Math.abs(zone % 60), 2, minusSign);
case ZoneWidth.Extended:
if (offset === 0) {
return 'Z';
}
else {
return ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) + ':' +
padNumber(Math.abs(zone % 60), 2, minusSign);
}
default:
throw new Error("Unknown zone width \"" + width + "\"");
}
};
}
var JANUARY = 0;
var THURSDAY = 4;
/**
* @param {?} year
* @return {?}
*/
function getFirstThursdayOfYear(year) {
var /** @type {?} */ firstDayOfYear = (new Date(year, JANUARY, 1)).getDay();
return new Date(year, 0, 1 + ((firstDayOfYear <= THURSDAY) ? THURSDAY : THURSDAY + 7) - firstDayOfYear);
}
/**
* @param {?} datetime
* @return {?}
*/
function getThursdayThisWeek(datetime) {
return new Date(datetime.getFullYear(), datetime.getMonth(), datetime.getDate() + (THURSDAY - datetime.getDay()));
}
/**
* @param {?} size
* @param {?=} monthBased
* @return {?}
*/
function weekGetter(size, monthBased) {
if (monthBased === void 0) { monthBased = false; }
return function (date, locale) {
var /** @type {?} */ result;
if (monthBased) {
var /** @type {?} */ nbDaysBefore1stDayOfMonth = new Date(date.getFullYear(), date.getMonth(), 1).getDay() - 1;
var /** @type {?} */ today = date.getDate();
result = 1 + Math.floor((today + nbDaysBefore1stDayOfMonth) / 7);
}
else {
var /** @type {?} */ firstThurs = getFirstThursdayOfYear(date.getFullYear());
var /** @type {?} */ thisThurs = getThursdayThisWeek(date);
var /** @type {?} */ diff = thisThurs.getTime() - firstThurs.getTime();
result = 1 + Math.round(diff / 6.048e8); // 6.048e8 ms per week
}
return padNumber(result, size, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
};
}
var DATE_FORMATS = {};
/**
* @param {?} format
* @return {?}
*/
function getDateFormatter(format) {
if (DATE_FORMATS[format]) {
return DATE_FORMATS[format];
}
var /** @type {?} */ formatter;
switch (format) {
// Era name (AD/BC)
case 'G':
case 'GG':
case 'GGG':
formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Abbreviated);
break;
case 'GGGG':
formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Wide);
break;
case 'GGGGG':
formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Narrow);
break;
// 1 digit representation of the year, e.g. (AD 1 => 1, AD 199 => 199)
case 'y':
formatter = dateGetter(DateType.FullYear, 1, 0, false, true);
break;
// 2 digit representation of the year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)
case 'yy':
formatter = dateGetter(DateType.FullYear, 2, 0, true, true);
break;
// 3 digit representation of the year, padded (000-999). (e.g. AD 2001 => 01, AD 2010 => 10)
case 'yyy':
formatter = dateGetter(DateType.FullYear, 3, 0, false, true);
break;
// 4 digit representation of the year (e.g. AD 1 => 0001, AD 2010 => 2010)
case 'yyyy':
formatter = dateGetter(DateType.FullYear, 4, 0, false, true);
break;
// Month of the year (1-12), numeric
case 'M':
case 'L':
formatter = dateGetter(DateType.Month, 1, 1);
break;
case 'MM':
case 'LL':
formatter = dateGetter(DateType.Month, 2, 1);
break;
// Month of the year (January, ...), string, format
case 'MMM':
formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Abbreviated);
break;
case 'MMMM':
formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Wide);
break;
case 'MMMMM':
formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Narrow);
break;
// Month of the year (January, ...), string, standalone
case 'LLL':
formatter =
dateStrGetter(TranslationType.Months, TranslationWidth.Abbreviated, FormStyle.Standalone);
break;
case 'LLLL':
formatter =
dateStrGetter(TranslationType.Months, TranslationWidth.Wide, FormStyle.Standalone);
break;
case 'LLLLL':
formatter =
dateStrGetter(TranslationType.Months, TranslationWidth.Narrow, FormStyle.Standalone);
break;
// Week of the year (1, ... 52)
case 'w':
formatter = weekGetter(1);
break;
case 'ww':
formatter = weekGetter(2);
break;
// Week of the month (1, ...)
case 'W':
formatter = weekGetter(1, true);
break;
// Day of the month (1-31)
case 'd':
formatter = dateGetter(DateType.Date, 1);
break;
case 'dd':
formatter = dateGetter(DateType.Date, 2);
break;
// Day of the Week
case 'E':
case 'EE':
case 'EEE':
formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Abbreviated);
break;
case 'EEEE':
formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Wide);
break;
case 'EEEEE':
formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Narrow);
break;
case 'EEEEEE':
formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Short);
break;
// Generic period of the day (am-pm)
case 'a':
case 'aa':
case 'aaa':
formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated);
break;
case 'aaaa':
formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide);
break;
case 'aaaaa':
formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow);
break;
// Extended period of the day (midnight, at night, ...), standalone
case 'b':
case 'bb':
case 'bbb':
formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated, FormStyle.Standalone, true);
break;
case 'bbbb':
formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide, FormStyle.Standalone, true);
break;
case 'bbbbb':
formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow, FormStyle.Standalone, true);
break;
// Extended period of the day (midnight, night, ...), standalone
case 'B':
case 'BB':
case 'BBB':
formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated, FormStyle.Format, true);
break;
case 'BBBB':
formatter =
dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide, FormStyle.Format, true);
break;
case 'BBBBB':
formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow, FormStyle.Format, true);
break;
// Hour in AM/PM, (1-12)
case 'h':
formatter = dateGetter(DateType.Hours, 1, -12);
break;
case 'hh':
formatter = dateGetter(DateType.Hours, 2, -12);
break;
// Hour of the day (0-23)
case 'H':
formatter = dateGetter(DateType.Hours, 1);
break;
// Hour in day, padded (00-23)
case 'HH':
formatter = dateGetter(DateType.Hours, 2);
break;
// Minute of the hour (0-59)
case 'm':
formatter = dateGetter(DateType.Minutes, 1);
break;
case 'mm':
formatter = dateGetter(DateType.Minutes, 2);
break;
// Second of the minute (0-59)
case 's':
formatter = dateGetter(DateType.Seconds, 1);
break;
case 'ss':
formatter = dateGetter(DateType.Seconds, 2);
break;
// Fractional second padded (0-9)
case 'S':
formatter = dateGetter(DateType.Milliseconds, 1);
break;
case 'SS':
formatter = dateGetter(DateType.Milliseconds, 2);
break;
// = millisecond
case 'SSS':
formatter = dateGetter(DateType.Milliseconds, 3);
break;
// Timezone ISO8601 short format (-0430)
case 'Z':
case 'ZZ':
case 'ZZZ':
formatter = timeZoneGetter(ZoneWidth.Short);
break;
// Timezone ISO8601 extended format (-04:30)
case 'ZZZZZ':
formatter = timeZoneGetter(ZoneWidth.Extended);
break;
// Timezone GMT short format (GMT+4)
case 'O':
case 'OO':
case 'OOO':
// Should be location, but fallback to format O instead because we don't have the data yet
case 'z':
case 'zz':
case 'zzz':
formatter = timeZoneGetter(ZoneWidth.ShortGMT);
break;
// Timezone GMT long format (GMT+0430)
case 'OOOO':
case 'ZZZZ':
// Should be location, but fallback to format O instead because we don't have the data yet
case 'zzzz':
formatter = timeZoneGetter(ZoneWidth.Long);
break;
default:
return null;
}
DATE_FORMATS[format] = formatter;
return formatter;
}
/**
* @param {?} timezone
* @param {?} fallback
* @return {?}
*/
function timezoneToOffset(timezone, fallback) {
// Support: IE 9-11 only, Edge 13-15+
// IE/Edge do not "understand" colon (`:`) in timezone
timezone = timezone.replace(/:/g, '');
var /** @type {?} */ requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;
return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;
}
/**
* @param {?} date
* @param {?} minutes
* @return {?}
*/
function addDateMinutes(date, minutes) {
date = new Date(date.getTime());
date.setMinutes(date.getMinutes() + minutes);
return date;
}
/**
* @param {?} date
* @param {?} timezone
* @param {?} reverse
* @return {?}
*/
function convertTimezoneToLocal(date, timezone, reverse) {
var /** @type {?} */ reverseValue = reverse ? -1 : 1;
var /** @type {?} */ dateTimezoneOffset = date.getTimezoneOffset();
var /** @type {?} */ timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
return addDateMinutes(date, reverseValue * (timezoneOffset - dateTimezoneOffset));
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @param {?} type
* @param {?} value
* @return {?}
*/
function invalidPipeArgumentError(type, value) {
return Error("InvalidPipeArgument: '" + value + "' for pipe '" + Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_48" /* ɵstringify */])(type) + "'");
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var ISO8601_DATE_REGEX = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
/**
* \@ngModule CommonModule
* \@whatItDoes Formats a date according to locale rules.
* \@howToUse `date_expression | date[:format[:timezone[:locale]]]`
* \@description
*
* Where:
* - `expression` is a date object or a number (milliseconds since UTC epoch) or an ISO string
* (https://www.w3.org/TR/NOTE-datetime).
* - `format` indicates which date/time components to include. The format can be predefined as
* shown below (all examples are given for `en-US`) or custom as shown in the table.
* - `'short'`: equivalent to `'M/d/yy, h:mm a'` (e.g. `6/15/15, 9:03 AM`)
* - `'medium'`: equivalent to `'MMM d, y, h:mm:ss a'` (e.g. `Jun 15, 2015, 9:03:01 AM`)
* - `'long'`: equivalent to `'MMMM d, y, h:mm:ss a z'` (e.g. `June 15, 2015 at 9:03:01 AM GMT+1`)
* - `'full'`: equivalent to `'EEEE, MMMM d, y, h:mm:ss a zzzz'` (e.g. `Monday, June 15, 2015 at
* 9:03:01 AM GMT+01:00`)
* - `'shortDate'`: equivalent to `'M/d/yy'` (e.g. `6/15/15`)
* - `'mediumDate'`: equivalent to `'MMM d, y'` (e.g. `Jun 15, 2015`)
* - `'longDate'`: equivalent to `'MMMM d, y'` (e.g. `June 15, 2015`)
* - `'fullDate'`: equivalent to `'EEEE, MMMM d, y'` (e.g. `Monday, June 15, 2015`)
* - `'shortTime'`: equivalent to `'h:mm a'` (e.g. `9:03 AM`)
* - `'mediumTime'`: equivalent to `'h:mm:ss a'` (e.g. `9:03:01 AM`)
* - `'longTime'`: equivalent to `'h:mm:ss a z'` (e.g. `9:03:01 AM GMT+1`)
* - `'fullTime'`: equivalent to `'h:mm:ss a zzzz'` (e.g. `9:03:01 AM GMT+01:00`)
* - `timezone` to be used for formatting. It understands UTC/GMT and the continental US time zone
* abbreviations, but for general use, use a time zone offset, for example,
* `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian)
* If not specified, the local system timezone of the end-user's browser will be used.
* - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by
* default)
*
*
* | Field Type | Format | Description | Example Value |
* |--------------------|-------------|---------------------------------------------------------------|------------------------------------------------------------|
* | Era | G, GG & GGG | Abbreviated | AD |
* | | GGGG | Wide | Anno Domini |
* | | GGGGG | Narrow | A |
* | Year | y | Numeric: minimum digits | 2, 20, 201, 2017, 20173 |
* | | yy | Numeric: 2 digits + zero padded | 02, 20, 01, 17, 73 |
* | | yyy | Numeric: 3 digits + zero padded | 002, 020, 201, 2017, 20173 |
* | | yyyy | Numeric: 4 digits or more + zero padded | 0002, 0020, 0201, 2017, 20173 |
* | Month | M | Numeric: 1 digit | 9, 12 |
* | | MM | Numeric: 2 digits + zero padded | 09, 12 |
* | | MMM | Abbreviated | Sep |
* | | MMMM | Wide | September |
* | | MMMMM | Narrow | S |
* | Month standalone | L | Numeric: 1 digit | 9, 12 |
* | | LL | Numeric: 2 digits + zero padded | 09, 12 |
* | | LLL | Abbreviated | Sep |
* | | LLLL | Wide | September |
* | | LLLLL | Narrow | S |
* | Week of year | w | Numeric: minimum digits | 1... 53 |
* | | ww | Numeric: 2 digits + zero padded | 01... 53 |
* | Week of month | W | Numeric: 1 digit | 1... 5 |
* | Day of month | d | Numeric: minimum digits | 1 |
* | | dd | Numeric: 2 digits + zero padded | 01 |
* | Week day | E, EE & EEE | Abbreviated | Tue |
* | | EEEE | Wide | Tuesday |
* | | EEEEE | Narrow | T |
* | | EEEEEE | Short | Tu |
* | Period | a, aa & aaa | Abbreviated | am/pm or AM/PM |
* | | aaaa | Wide (fallback to `a` when missing) | ante meridiem/post meridiem |
* | | aaaaa | Narrow | a/p |
* | Period* | B, BB & BBB | Abbreviated | mid. |
* | | BBBB | Wide | am, pm, midnight, noon, morning, afternoon, evening, night |
* | | BBBBB | Narrow | md |
* | Period standalone* | b, bb & bbb | Abbreviated | mid. |
* | | bbbb | Wide | am, pm, midnight, noon, morning, afternoon, evening, night |
* | | bbbbb | Narrow | md |
* | Hour 1-12 | h | Numeric: minimum digits | 1, 12 |
* | | hh | Numeric: 2 digits + zero padded | 01, 12 |
* | Hour 0-23 | H | Numeric: minimum digits | 0, 23 |
* | | HH | Numeric: 2 digits + zero padded | 00, 23 |
* | Minute | m | Numeric: minimum digits | 8, 59 |
* | | mm | Numeric: 2 digits + zero padded | 08, 59 |
* | Second | s | Numeric: minimum digits | 0... 59 |
* | | ss | Numeric: 2 digits + zero padded | 00... 59 |
* | Fractional seconds | S | Numeric: 1 digit | 0... 9 |
* | | SS | Numeric: 2 digits + zero padded | 00... 99 |
* | | SSS | Numeric: 3 digits + zero padded (= milliseconds) | 000... 999 |
* | Zone | z, zz & zzz | Short specific non location format (fallback to O) | GMT-8 |
* | | zzzz | Long specific non location format (fallback to OOOO) | GMT-08:00 |
* | | Z, ZZ & ZZZ | ISO8601 basic format | -0800 |
* | | ZZZZ | Long localized GMT format | GMT-8:00 |
* | | ZZZZZ | ISO8601 extended format + Z indicator for offset 0 (= XXXXX) | -08:00 |
* | | O, OO & OOO | Short localized GMT format | GMT-8 |
* | | OOOO | Long localized GMT format | GMT-08:00 |
*
*
* When the expression is a ISO string without time (e.g. 2016-09-19) the time zone offset is not
* applied and the formatted text will have the same day, month and year of the expression.
*
* WARNINGS:
* - this pipe has only access to en-US locale data by default. If you want to localize the dates
* in another language, you will have to import data for other locales.
* See the {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import additional locale
* data.
* - Fields suffixed with * are only available in the extra dataset.
* See the {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import extra locale
* data.
* - this pipe is marked as pure hence it will not be re-evaluated when the input is mutated.
* Instead users should treat the date as an immutable object and change the reference when the
* pipe needs to re-run (this is to avoid reformatting the date on every change detection run
* which would be an expensive operation).
*
* ### Examples
*
* Assuming `dateObj` is (year: 2015, month: 6, day: 15, hour: 21, minute: 43, second: 11)
* in the _local_ time and locale is 'en-US':
*
* {\@example common/pipes/ts/date_pipe.ts region='DatePipe'}
*
* \@stable
*/
var DatePipe = (function () {
function DatePipe(locale) {
this.locale = locale;
}
/**
* @param {?} value
* @param {?=} format
* @param {?=} timezone
* @param {?=} locale
* @return {?}
*/
DatePipe.prototype.transform = /**
* @param {?} value
* @param {?=} format
* @param {?=} timezone
* @param {?=} locale
* @return {?}
*/
function (value, format, timezone, locale) {
if (format === void 0) { format = 'mediumDate'; }
if (value == null || value === '' || value !== value)
return null;
if (typeof value === 'string') {
value = value.trim();
}
var /** @type {?} */ date;
if (isDate$1(value)) {
date = value;
}
else if (!isNaN(value - parseFloat(value))) {
date = new Date(parseFloat(value));
}
else if (typeof value === 'string' && /^(\d{4}-\d{1,2}-\d{1,2})$/.test(value)) {
/**
* For ISO Strings without time the day, month and year must be extracted from the ISO String
* before Date creation to avoid time offset and errors in the new Date.
* If we only replace '-' with ',' in the ISO String ("2015,01,01"), and try to create a new
* date, some browsers (e.g. IE 9) will throw an invalid Date error
* If we leave the '-' ("2015-01-01") and try to create a new Date("2015-01-01") the timeoffset
* is applied
* Note: ISO months are 0 for January, 1 for February, ...
*/
var _a = value.split('-').map(function (val) { return +val; }), y = _a[0], m = _a[1], d = _a[2];
date = new Date(y, m - 1, d);
}
else {
date = new Date(value);
}
if (!isDate$1(date)) {
var /** @type {?} */ match = void 0;
if ((typeof value === 'string') && (match = value.match(ISO8601_DATE_REGEX))) {
date = isoStringToDate(match);
}
else {
throw invalidPipeArgumentError(DatePipe, value);
}
}
return formatDate(date, format, locale || this.locale, timezone);
};
DatePipe.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["S" /* Pipe */], args: [{ name: 'date', pure: true },] },
];
/** @nocollapse */
DatePipe.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["z" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["G" /* LOCALE_ID */],] },] },
]; };
return DatePipe;
}());
/**
* \@internal
* @param {?} match
* @return {?}
*/
function isoStringToDate(match) {
var /** @type {?} */ date = new Date(0);
var /** @type {?} */ tzHour = 0;
var /** @type {?} */ tzMin = 0;
var /** @type {?} */ dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;
var /** @type {?} */ timeSetter = match[8] ? date.setUTCHours : date.setHours;
if (match[9]) {
tzHour = +(match[9] + match[10]);
tzMin = +(match[9] + match[11]);
}
dateSetter.call(date, +(match[1]), +(match[2]) - 1, +(match[3]));
var /** @type {?} */ h = +(match[4] || '0') - tzHour;
var /** @type {?} */ m = +(match[5] || '0') - tzMin;
var /** @type {?} */ s = +(match[6] || '0');
var /** @type {?} */ ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000);
timeSetter.call(date, h, m, s, ms);
return date;
}
/**
* @param {?} value
* @return {?}
*/
function isDate$1(value) {
return value instanceof Date && !isNaN(value.valueOf());
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var NumberFormatter = (function () {
function NumberFormatter() {
}
/**
* @param {?} num
* @param {?} locale
* @param {?} style
* @param {?=} opts
* @return {?}
*/
NumberFormatter.format = /**
* @param {?} num
* @param {?} locale
* @param {?} style
* @param {?=} opts
* @return {?}
*/
function (num, locale, style, opts) {
if (opts === void 0) { opts = {}; }
var minimumIntegerDigits = opts.minimumIntegerDigits, minimumFractionDigits = opts.minimumFractionDigits, maximumFractionDigits = opts.maximumFractionDigits, currency = opts.currency, _a = opts.currencyAsSymbol, currencyAsSymbol = _a === void 0 ? false : _a;
var /** @type {?} */ options = {
minimumIntegerDigits: minimumIntegerDigits,
minimumFractionDigits: minimumFractionDigits,
maximumFractionDigits: maximumFractionDigits,
style: NumberFormatStyle[style].toLowerCase()
};
if (style == NumberFormatStyle.Currency) {
options.currency = typeof currency == 'string' ? currency : undefined;
options.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code';
}
return new Intl.NumberFormat(locale, options).format(num);
};
return NumberFormatter;
}());
var DATE_FORMATS_SPLIT$1 = /((?:[^yMLdHhmsazZEwGjJ']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|J+|j+|m+|s+|a|z|Z|G+|w+))(.*)/;
var PATTERN_ALIASES = {
// Keys are quoted so they do not get renamed during closure compilation.
'yMMMdjms': datePartGetterFactory(combine([
digitCondition('year', 1),
nameCondition('month', 3),
digitCondition('day', 1),
digitCondition('hour', 1),
digitCondition('minute', 1),
digitCondition('second', 1),
])),
'yMdjm': datePartGetterFactory(combine([
digitCondition('year', 1), digitCondition('month', 1), digitCondition('day', 1),
digitCondition('hour', 1), digitCondition('minute', 1)
])),
'yMMMMEEEEd': datePartGetterFactory(combine([
digitCondition('year', 1), nameCondition('month', 4), nameCondition('weekday', 4),
digitCondition('day', 1)
])),
'yMMMMd': datePartGetterFactory(combine([digitCondition('year', 1), nameCondition('month', 4), digitCondition('day', 1)])),
'yMMMd': datePartGetterFactory(combine([digitCondition('year', 1), nameCondition('month', 3), digitCondition('day', 1)])),
'yMd': datePartGetterFactory(combine([digitCondition('year', 1), digitCondition('month', 1), digitCondition('day', 1)])),
'jms': datePartGetterFactory(combine([digitCondition('hour', 1), digitCondition('second', 1), digitCondition('minute', 1)])),
'jm': datePartGetterFactory(combine([digitCondition('hour', 1), digitCondition('minute', 1)]))
};
var DATE_FORMATS$1 = {
// Keys are quoted so they do not get renamed.
'yyyy': datePartGetterFactory(digitCondition('year', 4)),
'yy': datePartGetterFactory(digitCondition('year', 2)),
'y': datePartGetterFactory(digitCondition('year', 1)),
'MMMM': datePartGetterFactory(nameCondition('month', 4)),
'MMM': datePartGetterFactory(nameCondition('month', 3)),
'MM': datePartGetterFactory(digitCondition('month', 2)),
'M': datePartGetterFactory(digitCondition('month', 1)),
'LLLL': datePartGetterFactory(nameCondition('month', 4)),
'L': datePartGetterFactory(nameCondition('month', 1)),
'dd': datePartGetterFactory(digitCondition('day', 2)),
'd': datePartGetterFactory(digitCondition('day', 1)),
'HH': digitModifier(hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), false)))),
'H': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), false))),
'hh': digitModifier(hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), true)))),
'h': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))),
'jj': datePartGetterFactory(digitCondition('hour', 2)),
'j': datePartGetterFactory(digitCondition('hour', 1)),
'mm': digitModifier(datePartGetterFactory(digitCondition('minute', 2))),
'm': datePartGetterFactory(digitCondition('minute', 1)),
'ss': digitModifier(datePartGetterFactory(digitCondition('second', 2))),
's': datePartGetterFactory(digitCondition('second', 1)),
// while ISO 8601 requires fractions to be prefixed with `.` or `,`
// we can be just safely rely on using `sss` since we currently don't support single or two digit
// fractions
'sss': datePartGetterFactory(digitCondition('second', 3)),
'EEEE': datePartGetterFactory(nameCondition('weekday', 4)),
'EEE': datePartGetterFactory(nameCondition('weekday', 3)),
'EE': datePartGetterFactory(nameCondition('weekday', 2)),
'E': datePartGetterFactory(nameCondition('weekday', 1)),
'a': hourClockExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))),
'Z': timeZoneGetter$1('short'),
'z': timeZoneGetter$1('long'),
'ww': datePartGetterFactory({}),
// Week of year, padded (00-53). Week 01 is the week with the
// first Thursday of the year. not support ?
'w': datePartGetterFactory({}),
// Week of year (0-53). Week 1 is the week with the first Thursday
// of the year not support ?
'G': datePartGetterFactory(nameCondition('era', 1)),
'GG': datePartGetterFactory(nameCondition('era', 2)),
'GGG': datePartGetterFactory(nameCondition('era', 3)),
'GGGG': datePartGetterFactory(nameCondition('era', 4))
};
/**
* @param {?} inner
* @return {?}
*/
function digitModifier(inner) {
return function (date, locale) {
var /** @type {?} */ result = inner(date, locale);
return result.length == 1 ? '0' + result : result;
};
}
/**
* @param {?} inner
* @return {?}
*/
function hourClockExtractor(inner) {
return function (date, locale) { return inner(date, locale).split(' ')[1]; };
}
/**
* @param {?} inner
* @return {?}
*/
function hourExtractor(inner) {
return function (date, locale) { return inner(date, locale).split(' ')[0]; };
}
/**
* @param {?} date
* @param {?} locale
* @param {?} options
* @return {?}
*/
function intlDateFormat(date, locale, options) {
return new Intl.DateTimeFormat(locale, options).format(date).replace(/[\u200e\u200f]/g, '');
}
/**
* @param {?} timezone
* @return {?}
*/
function timeZoneGetter$1(timezone) {
// To workaround `Intl` API restriction for single timezone let format with 24 hours
var /** @type {?} */ options = { hour: '2-digit', hour12: false, timeZoneName: timezone };
return function (date, locale) {
var /** @type {?} */ result = intlDateFormat(date, locale, options);
// Then extract first 3 letters that related to hours
return result ? result.substring(3) : '';
};
}
/**
* @param {?} options
* @param {?} value
* @return {?}
*/
function hour12Modify(options, value) {
options.hour12 = value;
return options;
}
/**
* @param {?} prop
* @param {?} len
* @return {?}
*/
function digitCondition(prop, len) {
var /** @type {?} */ result = {};
result[prop] = len === 2 ? '2-digit' : 'numeric';
return result;
}
/**
* @param {?} prop
* @param {?} len
* @return {?}
*/
function nameCondition(prop, len) {
var /** @type {?} */ result = {};
if (len < 4) {
result[prop] = len > 1 ? 'short' : 'narrow';
}
else {
result[prop] = 'long';
}
return result;
}
/**
* @param {?} options
* @return {?}
*/
function combine(options) {
return options.reduce(function (merged, opt) { return (Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __assign */])({}, merged, opt)); }, {});
}
/**
* @param {?} ret
* @return {?}
*/
function datePartGetterFactory(ret) {
return function (date, locale) { return intlDateFormat(date, locale, ret); };
}
var DATE_FORMATTER_CACHE = new Map();
/**
* @param {?} format
* @param {?} date
* @param {?} locale
* @return {?}
*/
function dateFormatter(format, date, locale) {
var /** @type {?} */ fn = PATTERN_ALIASES[format];
if (fn)
return fn(date, locale);
var /** @type {?} */ cacheKey = format;
var /** @type {?} */ parts = DATE_FORMATTER_CACHE.get(cacheKey);
if (!parts) {
parts = [];
var /** @type {?} */ match = void 0;
DATE_FORMATS_SPLIT$1.exec(format);
var /** @type {?} */ _format = format;
while (_format) {
match = DATE_FORMATS_SPLIT$1.exec(_format);
if (match) {
parts = parts.concat(match.slice(1));
_format = /** @type {?} */ ((parts.pop()));
}
else {
parts.push(_format);
_format = null;
}
}
DATE_FORMATTER_CACHE.set(cacheKey, parts);
}
return parts.reduce(function (text, part) {
var /** @type {?} */ fn = DATE_FORMATS$1[part];
return text + (fn ? fn(date, locale) : partToTime(part));
}, '');
}
/**
* @param {?} part
* @return {?}
*/
function partToTime(part) {
return part === '\'\'' ? '\'' : part.replace(/(^'|'$)/g, '').replace(/''/g, '\'');
}
var DateFormatter = (function () {
function DateFormatter() {
}
/**
* @param {?} date
* @param {?} locale
* @param {?} pattern
* @return {?}
*/
DateFormatter.format = /**
* @param {?} date
* @param {?} locale
* @param {?} pattern
* @return {?}
*/
function (date, locale, pattern) {
return dateFormatter(pattern, date, locale);
};
return DateFormatter;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* \@ngModule CommonModule
* \@whatItDoes Formats a date according to locale rules.
* \@howToUse `date_expression | date[:format]`
* \@description
*
* Where:
* - `expression` is a date object or a number (milliseconds since UTC epoch) or an ISO string
* (https://www.w3.org/TR/NOTE-datetime).
* - `format` indicates which date/time components to include. The format can be predefined as
* shown below or custom as shown in the table.
* - `'medium'`: equivalent to `'yMMMdjms'` (e.g. `Sep 3, 2010, 12:05:08 PM` for `en-US`)
* - `'short'`: equivalent to `'yMdjm'` (e.g. `9/3/2010, 12:05 PM` for `en-US`)
* - `'fullDate'`: equivalent to `'yMMMMEEEEd'` (e.g. `Friday, September 3, 2010` for `en-US`)
* - `'longDate'`: equivalent to `'yMMMMd'` (e.g. `September 3, 2010` for `en-US`)
* - `'mediumDate'`: equivalent to `'yMMMd'` (e.g. `Sep 3, 2010` for `en-US`)
* - `'shortDate'`: equivalent to `'yMd'` (e.g. `9/3/2010` for `en-US`)
* - `'mediumTime'`: equivalent to `'jms'` (e.g. `12:05:08 PM` for `en-US`)
* - `'shortTime'`: equivalent to `'jm'` (e.g. `12:05 PM` for `en-US`)
*
*
* | Component | Symbol | Narrow | Short Form | Long Form | Numeric | 2-digit |
* |-----------|:------:|--------|--------------|-------------------|-----------|-----------|
* | era | G | G (A) | GGG (AD) | GGGG (Anno Domini)| - | - |
* | year | y | - | - | - | y (2015) | yy (15) |
* | month | M | L (S) | MMM (Sep) | MMMM (September) | M (9) | MM (09) |
* | day | d | - | - | - | d (3) | dd (03) |
* | weekday | E | E (S) | EEE (Sun) | EEEE (Sunday) | - | - |
* | hour | j | - | - | - | j (13) | jj (13) |
* | hour12 | h | - | - | - | h (1 PM) | hh (01 PM)|
* | hour24 | H | - | - | - | H (13) | HH (13) |
* | minute | m | - | - | - | m (5) | mm (05) |
* | second | s | - | - | - | s (9) | ss (09) |
* | timezone | z | - | - | z (Pacific Standard Time)| - | - |
* | timezone | Z | - | Z (GMT-8:00) | - | - | - |
* | timezone | a | - | a (PM) | - | - | - |
*
* In javascript, only the components specified will be respected (not the ordering,
* punctuations, ...) and details of the formatting will be dependent on the locale.
*
* Timezone of the formatted text will be the local system timezone of the end-user's machine.
*
* When the expression is a ISO string without time (e.g. 2016-09-19) the time zone offset is not
* applied and the formatted text will have the same day, month and year of the expression.
*
* WARNINGS:
* - this pipe is marked as pure hence it will not be re-evaluated when the input is mutated.
* Instead users should treat the date as an immutable object and change the reference when the
* pipe needs to re-run (this is to avoid reformatting the date on every change detection run
* which would be an expensive operation).
* - this pipe uses the Internationalization API. Therefore it is only reliable in Chrome and Opera
* browsers.
*
* ### Examples
*
* Assuming `dateObj` is (year: 2010, month: 9, day: 3, hour: 12 PM, minute: 05, second: 08)
* in the _local_ time and locale is 'en-US':
*
* {\@example common/pipes/ts/date_pipe.ts region='DeprecatedDatePipe'}
*
* \@stable
*/
var DeprecatedDatePipe = (function () {
function DeprecatedDatePipe(_locale) {
this._locale = _locale;
}
/**
* @param {?} value
* @param {?=} pattern
* @return {?}
*/
DeprecatedDatePipe.prototype.transform = /**
* @param {?} value
* @param {?=} pattern
* @return {?}
*/
function (value, pattern) {
if (pattern === void 0) { pattern = 'mediumDate'; }
if (value == null || value === '' || value !== value)
return null;
var /** @type {?} */ date;
if (typeof value === 'string') {
value = value.trim();
}
if (isDate(value)) {
date = value;
}
else if (!isNaN(value - parseFloat(value))) {
date = new Date(parseFloat(value));
}
else if (typeof value === 'string' && /^(\d{4}-\d{1,2}-\d{1,2})$/.test(value)) {
/**
* For ISO Strings without time the day, month and year must be extracted from the ISO String
* before Date creation to avoid time offset and errors in the new Date.
* If we only replace '-' with ',' in the ISO String ("2015,01,01"), and try to create a new
* date, some browsers (e.g. IE 9) will throw an invalid Date error
* If we leave the '-' ("2015-01-01") and try to create a new Date("2015-01-01") the
* timeoffset
* is applied
* Note: ISO months are 0 for January, 1 for February, ...
*/
var _a = value.split('-').map(function (val) { return parseInt(val, 10); }), y = _a[0], m = _a[1], d = _a[2];
date = new Date(y, m - 1, d);
}
else {
date = new Date(value);
}
if (!isDate(date)) {
var /** @type {?} */ match = void 0;
if ((typeof value === 'string') && (match = value.match(ISO8601_DATE_REGEX))) {
date = isoStringToDate(match);
}
else {
throw invalidPipeArgumentError(DeprecatedDatePipe, value);
}
}
return DateFormatter.format(date, this._locale, DeprecatedDatePipe._ALIASES[pattern] || pattern);
};
/**
* \@internal
*/
DeprecatedDatePipe._ALIASES = {
'medium': 'yMMMdjms',
'short': 'yMdjm',
'fullDate': 'yMMMMEEEEd',
'longDate': 'yMMMMd',
'mediumDate': 'yMMMd',
'shortDate': 'yMd',
'mediumTime': 'jms',
'shortTime': 'jm'
};
DeprecatedDatePipe.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["S" /* Pipe */], args: [{ name: 'date', pure: true },] },
];
/** @nocollapse */
DeprecatedDatePipe.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["z" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["G" /* LOCALE_ID */],] },] },
]; };
return DeprecatedDatePipe;
}());
/**
* @param {?} value
* @return {?}
*/
function isDate(value) {
return value instanceof Date && !isNaN(value.valueOf());
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var NUMBER_FORMAT_REGEXP = /^(\d+)?\.((\d+)(-(\d+))?)?$/;
var MAX_DIGITS = 22;
var DECIMAL_SEP = '.';
var ZERO_CHAR = '0';
var PATTERN_SEP = ';';
var GROUP_SEP = ',';
var DIGIT_CHAR = '#';
var CURRENCY_CHAR = '¤';
var PERCENT_CHAR = '%';
/**
* Transform a number to a locale string based on a style and a format
*
* \@internal
* @param {?} value
* @param {?} locale
* @param {?} style
* @param {?=} digitsInfo
* @param {?=} currency
* @return {?}
*/
function formatNumber$1(value, locale, style, digitsInfo, currency) {
if (currency === void 0) { currency = null; }
var /** @type {?} */ res = { str: null };
var /** @type {?} */ format = getLocaleNumberFormat(locale, style);
var /** @type {?} */ num;
// Convert strings to numbers
if (typeof value === 'string' && !isNaN(+value - parseFloat(value))) {
num = +value;
}
else if (typeof value !== 'number') {
res.error = value + " is not a number";
return res;
}
else {
num = value;
}
if (style === NumberFormatStyle.Percent) {
num = num * 100;
}
var /** @type {?} */ numStr = Math.abs(num) + '';
var /** @type {?} */ pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
var /** @type {?} */ formattedText = '';
var /** @type {?} */ isZero = false;
if (!isFinite(num)) {
formattedText = getLocaleNumberSymbol(locale, NumberSymbol.Infinity);
}
else {
var /** @type {?} */ parsedNumber = parseNumber(numStr);
var /** @type {?} */ minInt = pattern.minInt;
var /** @type {?} */ minFraction = pattern.minFrac;
var /** @type {?} */ maxFraction = pattern.maxFrac;
if (digitsInfo) {
var /** @type {?} */ parts = digitsInfo.match(NUMBER_FORMAT_REGEXP);
if (parts === null) {
res.error = digitsInfo + " is not a valid digit info";
return res;
}
var /** @type {?} */ minIntPart = parts[1];
var /** @type {?} */ minFractionPart = parts[3];
var /** @type {?} */ maxFractionPart = parts[5];
if (minIntPart != null) {
minInt = parseIntAutoRadix(minIntPart);
}
if (minFractionPart != null) {
minFraction = parseIntAutoRadix(minFractionPart);
}
if (maxFractionPart != null) {
maxFraction = parseIntAutoRadix(maxFractionPart);
}
else if (minFractionPart != null && minFraction > maxFraction) {
maxFraction = minFraction;
}
}
roundNumber(parsedNumber, minFraction, maxFraction);
var /** @type {?} */ digits = parsedNumber.digits;
var /** @type {?} */ integerLen = parsedNumber.integerLen;
var /** @type {?} */ exponent = parsedNumber.exponent;
var /** @type {?} */ decimals = [];
isZero = digits.every(function (d) { return !d; });
// pad zeros for small numbers
for (; integerLen < minInt; integerLen++) {
digits.unshift(0);
}
// pad zeros for small numbers
for (; integerLen < 0; integerLen++) {
digits.unshift(0);
}
// extract decimals digits
if (integerLen > 0) {
decimals = digits.splice(integerLen, digits.length);
}
else {
decimals = digits;
digits = [0];
}
// format the integer digits with grouping separators
var /** @type {?} */ groups = [];
if (digits.length >= pattern.lgSize) {
groups.unshift(digits.splice(-pattern.lgSize, digits.length).join(''));
}
while (digits.length > pattern.gSize) {
groups.unshift(digits.splice(-pattern.gSize, digits.length).join(''));
}
if (digits.length) {
groups.unshift(digits.join(''));
}
var /** @type {?} */ groupSymbol = currency ? NumberSymbol.CurrencyGroup : NumberSymbol.Group;
formattedText = groups.join(getLocaleNumberSymbol(locale, groupSymbol));
// append the decimal digits
if (decimals.length) {
var /** @type {?} */ decimalSymbol = currency ? NumberSymbol.CurrencyDecimal : NumberSymbol.Decimal;
formattedText += getLocaleNumberSymbol(locale, decimalSymbol) + decimals.join('');
}
if (exponent) {
formattedText += getLocaleNumberSymbol(locale, NumberSymbol.Exponential) + '+' + exponent;
}
}
if (num < 0 && !isZero) {
formattedText = pattern.negPre + formattedText + pattern.negSuf;
}
else {
formattedText = pattern.posPre + formattedText + pattern.posSuf;
}
if (style === NumberFormatStyle.Currency && currency !== null) {
res.str = formattedText
.replace(CURRENCY_CHAR, currency)
.replace(CURRENCY_CHAR, '');
return res;
}
if (style === NumberFormatStyle.Percent) {
res.str = formattedText.replace(new RegExp(PERCENT_CHAR, 'g'), getLocaleNumberSymbol(locale, NumberSymbol.PercentSign));
return res;
}
res.str = formattedText;
return res;
}
/**
* @param {?} format
* @param {?=} minusSign
* @return {?}
*/
function parseNumberFormat(format, minusSign) {
if (minusSign === void 0) { minusSign = '-'; }
var /** @type {?} */ p = {
minInt: 1,
minFrac: 0,
maxFrac: 0,
posPre: '',
posSuf: '',
negPre: '',
negSuf: '',
gSize: 0,
lgSize: 0
};
var /** @type {?} */ patternParts = format.split(PATTERN_SEP);
var /** @type {?} */ positive = patternParts[0];
var /** @type {?} */ negative = patternParts[1];
var /** @type {?} */ positiveParts = positive.indexOf(DECIMAL_SEP) !== -1 ?
positive.split(DECIMAL_SEP) :
[
positive.substring(0, positive.lastIndexOf(ZERO_CHAR) + 1),
positive.substring(positive.lastIndexOf(ZERO_CHAR) + 1)
], /** @type {?} */
integer = positiveParts[0], /** @type {?} */ fraction = positiveParts[1] || '';
p.posPre = integer.substr(0, integer.indexOf(DIGIT_CHAR));
for (var /** @type {?} */ i = 0; i < fraction.length; i++) {
var /** @type {?} */ ch = fraction.charAt(i);
if (ch === ZERO_CHAR) {
p.minFrac = p.maxFrac = i + 1;
}
else if (ch === DIGIT_CHAR) {
p.maxFrac = i + 1;
}
else {
p.posSuf += ch;
}
}
var /** @type {?} */ groups = integer.split(GROUP_SEP);
p.gSize = groups[1] ? groups[1].length : 0;
p.lgSize = (groups[2] || groups[1]) ? (groups[2] || groups[1]).length : 0;
if (negative) {
var /** @type {?} */ trunkLen = positive.length - p.posPre.length - p.posSuf.length, /** @type {?} */
pos = negative.indexOf(DIGIT_CHAR);
p.negPre = negative.substr(0, pos).replace(/'/g, '');
p.negSuf = negative.substr(pos + trunkLen).replace(/'/g, '');
}
else {
p.negPre = minusSign + p.posPre;
p.negSuf = p.posSuf;
}
return p;
}
/**
* Parse a number (as a string)
* Significant bits of this parse algorithm came from https://github.com/MikeMcl/big.js/
* @param {?} numStr
* @return {?}
*/
function parseNumber(numStr) {
var /** @type {?} */ exponent = 0, /** @type {?} */ digits, /** @type {?} */ integerLen;
var /** @type {?} */ i, /** @type {?} */ j, /** @type {?} */ zeros;
// Decimal point?
if ((integerLen = numStr.indexOf(DECIMAL_SEP)) > -1) {
numStr = numStr.replace(DECIMAL_SEP, '');
}
// Exponential form?
if ((i = numStr.search(/e/i)) > 0) {
// Work out the exponent.
if (integerLen < 0)
integerLen = i;
integerLen += +numStr.slice(i + 1);
numStr = numStr.substring(0, i);
}
else if (integerLen < 0) {
// There was no decimal point or exponent so it is an integer.
integerLen = numStr.length;
}
// Count the number of leading zeros.
for (i = 0; numStr.charAt(i) === ZERO_CHAR; i++) {
/* empty */
}
if (i === (zeros = numStr.length)) {
// The digits are all zero.
digits = [0];
integerLen = 1;
}
else {
// Count the number of trailing zeros
zeros--;
while (numStr.charAt(zeros) === ZERO_CHAR)
zeros--;
// Trailing zeros are insignificant so ignore them
integerLen -= i;
digits = [];
// Convert string to array of digits without leading/trailing zeros.
for (j = 0; i <= zeros; i++, j++) {
digits[j] = +numStr.charAt(i);
}
}
// If the number overflows the maximum allowed digits then use an exponent.
if (integerLen > MAX_DIGITS) {
digits = digits.splice(0, MAX_DIGITS - 1);
exponent = integerLen - 1;
integerLen = 1;
}
return { digits: digits, exponent: exponent, integerLen: integerLen };
}
/**
* Round the parsed number to the specified number of decimal places
* This function changes the parsedNumber in-place
* @param {?} parsedNumber
* @param {?} minFrac
* @param {?} maxFrac
* @return {?}
*/
function roundNumber(parsedNumber, minFrac, maxFrac) {
if (minFrac > maxFrac) {
throw new Error("The minimum number of digits after fraction (" + minFrac + ") is higher than the maximum (" + maxFrac + ").");
}
var /** @type {?} */ digits = parsedNumber.digits;
var /** @type {?} */ fractionLen = digits.length - parsedNumber.integerLen;
var /** @type {?} */ fractionSize = Math.min(Math.max(minFrac, fractionLen), maxFrac);
// The index of the digit to where rounding is to occur
var /** @type {?} */ roundAt = fractionSize + parsedNumber.integerLen;
var /** @type {?} */ digit = digits[roundAt];
if (roundAt > 0) {
// Drop fractional digits beyond `roundAt`
digits.splice(Math.max(parsedNumber.integerLen, roundAt));
// Set non-fractional digits beyond `roundAt` to 0
for (var /** @type {?} */ j = roundAt; j < digits.length; j++) {
digits[j] = 0;
}
}
else {
// We rounded to zero so reset the parsedNumber
fractionLen = Math.max(0, fractionLen);
parsedNumber.integerLen = 1;
digits.length = Math.max(1, roundAt = fractionSize + 1);
digits[0] = 0;
for (var /** @type {?} */ i = 1; i < roundAt; i++)
digits[i] = 0;
}
if (digit >= 5) {
if (roundAt - 1 < 0) {
for (var /** @type {?} */ k = 0; k > roundAt; k--) {
digits.unshift(0);
parsedNumber.integerLen++;
}
digits.unshift(1);
parsedNumber.integerLen++;
}
else {
digits[roundAt - 1]++;
}
}
// Pad out with zeros to get the required fraction length
for (; fractionLen < Math.max(0, fractionSize); fractionLen++)
digits.push(0);
// Do any carrying, e.g. a digit was rounded up to 10
var /** @type {?} */ carry = digits.reduceRight(function (carry, d, i, digits) {
d = d + carry;
digits[i] = d % 10;
return Math.floor(d / 10);
}, 0);
if (carry) {
digits.unshift(carry);
parsedNumber.integerLen++;
}
}
/**
* \@internal
* @param {?} text
* @return {?}
*/
function parseIntAutoRadix(text) {
var /** @type {?} */ result = parseInt(text);
if (isNaN(result)) {
throw new Error('Invalid integer literal when parsing ' + text);
}
return result;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @param {?} pipe
* @param {?} locale
* @param {?} value
* @param {?} style
* @param {?=} digits
* @param {?=} currency
* @param {?=} currencyAsSymbol
* @return {?}
*/
function formatNumber(pipe, locale, value, style, digits, currency, currencyAsSymbol) {
if (currency === void 0) { currency = null; }
if (currencyAsSymbol === void 0) { currencyAsSymbol = false; }
if (value == null)
return null;
// Convert strings to numbers
value = typeof value === 'string' && !isNaN(+value - parseFloat(value)) ? +value : value;
if (typeof value !== 'number') {
throw invalidPipeArgumentError(pipe, value);
}
var /** @type {?} */ minInt;
var /** @type {?} */ minFraction;
var /** @type {?} */ maxFraction;
if (style !== NumberFormatStyle.Currency) {
// rely on Intl default for currency
minInt = 1;
minFraction = 0;
maxFraction = 3;
}
if (digits) {
var /** @type {?} */ parts = digits.match(NUMBER_FORMAT_REGEXP);
if (parts === null) {
throw new Error(digits + " is not a valid digit info for number pipes");
}
if (parts[1] != null) {
// min integer digits
minInt = parseIntAutoRadix(parts[1]);
}
if (parts[3] != null) {
// min fraction digits
minFraction = parseIntAutoRadix(parts[3]);
}
if (parts[5] != null) {
// max fraction digits
maxFraction = parseIntAutoRadix(parts[5]);
}
}
return NumberFormatter.format(/** @type {?} */ (value), locale, style, {
minimumIntegerDigits: minInt,
minimumFractionDigits: minFraction,
maximumFractionDigits: maxFraction,
currency: currency,
currencyAsSymbol: currencyAsSymbol,
});
}
/**
* \@ngModule CommonModule
* \@whatItDoes Formats a number according to locale rules.
* \@howToUse `number_expression | number[:digitInfo]`
*
* Formats a number as text. Group sizing and separator and other locale-specific
* configurations are based on the active locale.
*
* where `expression` is a number:
* - `digitInfo` is a `string` which has a following format: <br>
* <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>
* - `minIntegerDigits` is the minimum number of integer digits to use. Defaults to `1`.
* - `minFractionDigits` is the minimum number of digits after fraction. Defaults to `0`.
* - `maxFractionDigits` is the maximum number of digits after fraction. Defaults to `3`.
*
* For more information on the acceptable range for each of these numbers and other
* details see your native internationalization library.
*
* WARNING: this pipe uses the Internationalization API which is not yet available in all browsers
* and may require a polyfill. See [Browser Support](guide/browser-support) for details.
*
* ### Example
*
* {\@example common/pipes/ts/number_pipe.ts region='DeprecatedNumberPipe'}
*
* \@stable
*/
var DeprecatedDecimalPipe = (function () {
function DeprecatedDecimalPipe(_locale) {
this._locale = _locale;
}
/**
* @param {?} value
* @param {?=} digits
* @return {?}
*/
DeprecatedDecimalPipe.prototype.transform = /**
* @param {?} value
* @param {?=} digits
* @return {?}
*/
function (value, digits) {
return formatNumber(DeprecatedDecimalPipe, this._locale, value, NumberFormatStyle.Decimal, digits);
};
DeprecatedDecimalPipe.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["S" /* Pipe */], args: [{ name: 'number' },] },
];
/** @nocollapse */
DeprecatedDecimalPipe.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["z" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["G" /* LOCALE_ID */],] },] },
]; };
return DeprecatedDecimalPipe;
}());
/**
* \@ngModule CommonModule
* \@whatItDoes Formats a number as a percentage according to locale rules.
* \@howToUse `number_expression | percent[:digitInfo]`
*
* \@description
*
* Formats a number as percentage.
*
* - `digitInfo` See {\@link DecimalPipe} for detailed description.
*
* WARNING: this pipe uses the Internationalization API which is not yet available in all browsers
* and may require a polyfill. See [Browser Support](guide/browser-support) for details.
*
* ### Example
*
* {\@example common/pipes/ts/percent_pipe.ts region='DeprecatedPercentPipe'}
*
* \@stable
*/
var DeprecatedPercentPipe = (function () {
function DeprecatedPercentPipe(_locale) {
this._locale = _locale;
}
/**
* @param {?} value
* @param {?=} digits
* @return {?}
*/
DeprecatedPercentPipe.prototype.transform = /**
* @param {?} value
* @param {?=} digits
* @return {?}
*/
function (value, digits) {
return formatNumber(DeprecatedPercentPipe, this._locale, value, NumberFormatStyle.Percent, digits);
};
DeprecatedPercentPipe.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["S" /* Pipe */], args: [{ name: 'percent' },] },
];
/** @nocollapse */
DeprecatedPercentPipe.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["z" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["G" /* LOCALE_ID */],] },] },
]; };
return DeprecatedPercentPipe;
}());
/**
* \@ngModule CommonModule
* \@whatItDoes Formats a number as currency using locale rules.
* \@howToUse `number_expression | currency[:currencyCode[:symbolDisplay[:digitInfo]]]`
* \@description
*
* Use `currency` to format a number as currency.
*
* - `currencyCode` is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, such
* as `USD` for the US dollar and `EUR` for the euro.
* - `symbolDisplay` is a boolean indicating whether to use the currency symbol or code.
* - `true`: use symbol (e.g. `$`).
* - `false`(default): use code (e.g. `USD`).
* - `digitInfo` See {\@link DecimalPipe} for detailed description.
*
* WARNING: this pipe uses the Internationalization API which is not yet available in all browsers
* and may require a polyfill. See [Browser Support](guide/browser-support) for details.
*
* ### Example
*
* {\@example common/pipes/ts/currency_pipe.ts region='DeprecatedCurrencyPipe'}
*
* \@stable
*/
var DeprecatedCurrencyPipe = (function () {
function DeprecatedCurrencyPipe(_locale) {
this._locale = _locale;
}
/**
* @param {?} value
* @param {?=} currencyCode
* @param {?=} symbolDisplay
* @param {?=} digits
* @return {?}
*/
DeprecatedCurrencyPipe.prototype.transform = /**
* @param {?} value
* @param {?=} currencyCode
* @param {?=} symbolDisplay
* @param {?=} digits
* @return {?}
*/
function (value, currencyCode, symbolDisplay, digits) {
if (currencyCode === void 0) { currencyCode = 'USD'; }
if (symbolDisplay === void 0) { symbolDisplay = false; }
return formatNumber(DeprecatedCurrencyPipe, this._locale, value, NumberFormatStyle.Currency, digits, currencyCode, symbolDisplay);
};
DeprecatedCurrencyPipe.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["S" /* Pipe */], args: [{ name: 'currency' },] },
];
/** @nocollapse */
DeprecatedCurrencyPipe.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["z" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["G" /* LOCALE_ID */],] },] },
]; };
return DeprecatedCurrencyPipe;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* A collection of deprecated i18n pipes that require intl api
*
* @deprecated from v5
*/
var COMMON_DEPRECATED_I18N_PIPES = [DeprecatedDecimalPipe, DeprecatedPercentPipe, DeprecatedCurrencyPipe, DeprecatedDatePipe];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var ObservableStrategy = (function () {
function ObservableStrategy() {
}
/**
* @param {?} async
* @param {?} updateLatestValue
* @return {?}
*/
ObservableStrategy.prototype.createSubscription = /**
* @param {?} async
* @param {?} updateLatestValue
* @return {?}
*/
function (async, updateLatestValue) {
return async.subscribe({ next: updateLatestValue, error: function (e) { throw e; } });
};
/**
* @param {?} subscription
* @return {?}
*/
ObservableStrategy.prototype.dispose = /**
* @param {?} subscription
* @return {?}
*/
function (subscription) { subscription.unsubscribe(); };
/**
* @param {?} subscription
* @return {?}
*/
ObservableStrategy.prototype.onDestroy = /**
* @param {?} subscription
* @return {?}
*/
function (subscription) { subscription.unsubscribe(); };
return ObservableStrategy;
}());
var PromiseStrategy = (function () {
function PromiseStrategy() {
}
/**
* @param {?} async
* @param {?} updateLatestValue
* @return {?}
*/
PromiseStrategy.prototype.createSubscription = /**
* @param {?} async
* @param {?} updateLatestValue
* @return {?}
*/
function (async, updateLatestValue) {
return async.then(updateLatestValue, function (e) { throw e; });
};
/**
* @param {?} subscription
* @return {?}
*/
PromiseStrategy.prototype.dispose = /**
* @param {?} subscription
* @return {?}
*/
function (subscription) { };
/**
* @param {?} subscription
* @return {?}
*/
PromiseStrategy.prototype.onDestroy = /**
* @param {?} subscription
* @return {?}
*/
function (subscription) { };
return PromiseStrategy;
}());
var _promiseStrategy = new PromiseStrategy();
var _observableStrategy = new ObservableStrategy();
/**
* \@ngModule CommonModule
* \@whatItDoes Unwraps a value from an asynchronous primitive.
* \@howToUse `observable_or_promise_expression | async`
* \@description
* The `async` pipe subscribes to an `Observable` or `Promise` and returns the latest value it has
* emitted. When a new value is emitted, the `async` pipe marks the component to be checked for
* changes. When the component gets destroyed, the `async` pipe unsubscribes automatically to avoid
* potential memory leaks.
*
*
* ## Examples
*
* This example binds a `Promise` to the view. Clicking the `Resolve` button resolves the
* promise.
*
* {\@example common/pipes/ts/async_pipe.ts region='AsyncPipePromise'}
*
* It's also possible to use `async` with Observables. The example below binds the `time` Observable
* to the view. The Observable continuously updates the view with the current time.
*
* {\@example common/pipes/ts/async_pipe.ts region='AsyncPipeObservable'}
*
* \@stable
*/
var AsyncPipe = (function () {
function AsyncPipe(_ref) {
this._ref = _ref;
this._latestValue = null;
this._latestReturnedValue = null;
this._subscription = null;
this._obj = null;
this._strategy = /** @type {?} */ ((null));
}
/**
* @return {?}
*/
AsyncPipe.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
if (this._subscription) {
this._dispose();
}
};
/**
* @param {?} obj
* @return {?}
*/
AsyncPipe.prototype.transform = /**
* @param {?} obj
* @return {?}
*/
function (obj) {
if (!this._obj) {
if (obj) {
this._subscribe(obj);
}
this._latestReturnedValue = this._latestValue;
return this._latestValue;
}
if (obj !== this._obj) {
this._dispose();
return this.transform(/** @type {?} */ (obj));
}
if (this._latestValue === this._latestReturnedValue) {
return this._latestReturnedValue;
}
this._latestReturnedValue = this._latestValue;
return __WEBPACK_IMPORTED_MODULE_0__angular_core__["_12" /* WrappedValue */].wrap(this._latestValue);
};
/**
* @param {?} obj
* @return {?}
*/
AsyncPipe.prototype._subscribe = /**
* @param {?} obj
* @return {?}
*/
function (obj) {
var _this = this;
this._obj = obj;
this._strategy = this._selectStrategy(obj);
this._subscription = this._strategy.createSubscription(obj, function (value) { return _this._updateLatestValue(obj, value); });
};
/**
* @param {?} obj
* @return {?}
*/
AsyncPipe.prototype._selectStrategy = /**
* @param {?} obj
* @return {?}
*/
function (obj) {
if (Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_35" /* ɵisPromise */])(obj)) {
return _promiseStrategy;
}
if (Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_34" /* ɵisObservable */])(obj)) {
return _observableStrategy;
}
throw invalidPipeArgumentError(AsyncPipe, obj);
};
/**
* @return {?}
*/
AsyncPipe.prototype._dispose = /**
* @return {?}
*/
function () {
this._strategy.dispose(/** @type {?} */ ((this._subscription)));
this._latestValue = null;
this._latestReturnedValue = null;
this._subscription = null;
this._obj = null;
};
/**
* @param {?} async
* @param {?} value
* @return {?}
*/
AsyncPipe.prototype._updateLatestValue = /**
* @param {?} async
* @param {?} value
* @return {?}
*/
function (async, value) {
if (async === this._obj) {
this._latestValue = value;
this._ref.markForCheck();
}
};
AsyncPipe.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["S" /* Pipe */], args: [{ name: 'async', pure: false },] },
];
/** @nocollapse */
AsyncPipe.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["j" /* ChangeDetectorRef */], },
]; };
return AsyncPipe;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Transforms text to lowercase.
*
* {\@example common/pipes/ts/lowerupper_pipe.ts region='LowerUpperPipe' }
*
* \@stable
*/
var LowerCasePipe = (function () {
function LowerCasePipe() {
}
/**
* @param {?} value
* @return {?}
*/
LowerCasePipe.prototype.transform = /**
* @param {?} value
* @return {?}
*/
function (value) {
if (!value)
return value;
if (typeof value !== 'string') {
throw invalidPipeArgumentError(LowerCasePipe, value);
}
return value.toLowerCase();
};
LowerCasePipe.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["S" /* Pipe */], args: [{ name: 'lowercase' },] },
];
/** @nocollapse */
LowerCasePipe.ctorParameters = function () { return []; };
return LowerCasePipe;
}());
/**
* Helper method to transform a single word to titlecase.
*
* \@stable
* @param {?} word
* @return {?}
*/
function titleCaseWord(word) {
if (!word)
return word;
return word[0].toUpperCase() + word.substr(1).toLowerCase();
}
/**
* Transforms text to titlecase.
*
* \@stable
*/
var TitleCasePipe = (function () {
function TitleCasePipe() {
}
/**
* @param {?} value
* @return {?}
*/
TitleCasePipe.prototype.transform = /**
* @param {?} value
* @return {?}
*/
function (value) {
if (!value)
return value;
if (typeof value !== 'string') {
throw invalidPipeArgumentError(TitleCasePipe, value);
}
return value.split(/\b/g).map(function (word) { return titleCaseWord(word); }).join('');
};
TitleCasePipe.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["S" /* Pipe */], args: [{ name: 'titlecase' },] },
];
/** @nocollapse */
TitleCasePipe.ctorParameters = function () { return []; };
return TitleCasePipe;
}());
/**
* Transforms text to uppercase.
*
* \@stable
*/
var UpperCasePipe = (function () {
function UpperCasePipe() {
}
/**
* @param {?} value
* @return {?}
*/
UpperCasePipe.prototype.transform = /**
* @param {?} value
* @return {?}
*/
function (value) {
if (!value)
return value;
if (typeof value !== 'string') {
throw invalidPipeArgumentError(UpperCasePipe, value);
}
return value.toUpperCase();
};
UpperCasePipe.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["S" /* Pipe */], args: [{ name: 'uppercase' },] },
];
/** @nocollapse */
UpperCasePipe.ctorParameters = function () { return []; };
return UpperCasePipe;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var _INTERPOLATION_REGEXP = /#/g;
/**
* \@ngModule CommonModule
* \@whatItDoes Maps a value to a string that pluralizes the value according to locale rules.
* \@howToUse `expression | i18nPlural:mapping[:locale]`
* \@description
*
* Where:
* - `expression` is a number.
* - `mapping` is an object that mimics the ICU format, see
* http://userguide.icu-project.org/formatparse/messages
* - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by
* default)
*
* ## Example
*
* {\@example common/pipes/ts/i18n_pipe.ts region='I18nPluralPipeComponent'}
*
* \@experimental
*/
var I18nPluralPipe = (function () {
function I18nPluralPipe(_localization) {
this._localization = _localization;
}
/**
* @param {?} value
* @param {?} pluralMap
* @param {?=} locale
* @return {?}
*/
I18nPluralPipe.prototype.transform = /**
* @param {?} value
* @param {?} pluralMap
* @param {?=} locale
* @return {?}
*/
function (value, pluralMap, locale) {
if (value == null)
return '';
if (typeof pluralMap !== 'object' || pluralMap === null) {
throw invalidPipeArgumentError(I18nPluralPipe, pluralMap);
}
var /** @type {?} */ key = getPluralCategory(value, Object.keys(pluralMap), this._localization, locale);
return pluralMap[key].replace(_INTERPOLATION_REGEXP, value.toString());
};
I18nPluralPipe.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["S" /* Pipe */], args: [{ name: 'i18nPlural', pure: true },] },
];
/** @nocollapse */
I18nPluralPipe.ctorParameters = function () { return [
{ type: NgLocalization, },
]; };
return I18nPluralPipe;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* \@ngModule CommonModule
* \@whatItDoes Generic selector that displays the string that matches the current value.
* \@howToUse `expression | i18nSelect:mapping`
* \@description
*
* Where `mapping` is an object that indicates the text that should be displayed
* for different values of the provided `expression`.
* If none of the keys of the mapping match the value of the `expression`, then the content
* of the `other` key is returned when present, otherwise an empty string is returned.
*
* ## Example
*
* {\@example common/pipes/ts/i18n_pipe.ts region='I18nSelectPipeComponent'}
*
* \@experimental
*/
var I18nSelectPipe = (function () {
function I18nSelectPipe() {
}
/**
* @param {?} value
* @param {?} mapping
* @return {?}
*/
I18nSelectPipe.prototype.transform = /**
* @param {?} value
* @param {?} mapping
* @return {?}
*/
function (value, mapping) {
if (value == null)
return '';
if (typeof mapping !== 'object' || typeof value !== 'string') {
throw invalidPipeArgumentError(I18nSelectPipe, mapping);
}
if (mapping.hasOwnProperty(value)) {
return mapping[value];
}
if (mapping.hasOwnProperty('other')) {
return mapping['other'];
}
return '';
};
I18nSelectPipe.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["S" /* Pipe */], args: [{ name: 'i18nSelect', pure: true },] },
];
/** @nocollapse */
I18nSelectPipe.ctorParameters = function () { return []; };
return I18nSelectPipe;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* \@ngModule CommonModule
* \@whatItDoes Converts value into JSON string.
* \@howToUse `expression | json`
* \@description
*
* Converts value into string using `JSON.stringify`. Useful for debugging.
*
* ### Example
* {\@example common/pipes/ts/json_pipe.ts region='JsonPipe'}
*
* \@stable
*/
var JsonPipe = (function () {
function JsonPipe() {
}
/**
* @param {?} value
* @return {?}
*/
JsonPipe.prototype.transform = /**
* @param {?} value
* @return {?}
*/
function (value) { return JSON.stringify(value, null, 2); };
JsonPipe.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["S" /* Pipe */], args: [{ name: 'json', pure: false },] },
];
/** @nocollapse */
JsonPipe.ctorParameters = function () { return []; };
return JsonPipe;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* \@ngModule CommonModule
* \@whatItDoes Formats a number according to locale rules.
* \@howToUse `number_expression | number[:digitInfo[:locale]]`
*
* Formats a number as text. Group sizing and separator and other locale-specific
* configurations are based on the active locale.
*
* where `expression` is a number:
* - `digitInfo` is a `string` which has a following format: <br>
* <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>
* - `minIntegerDigits` is the minimum number of integer digits to use. Defaults to `1`.
* - `minFractionDigits` is the minimum number of digits after fraction. Defaults to `0`.
* - `maxFractionDigits` is the maximum number of digits after fraction. Defaults to `3`.
* - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by
* default)
*
* For more information on the acceptable range for each of these numbers and other
* details see your native internationalization library.
*
* ### Example
*
* {\@example common/pipes/ts/number_pipe.ts region='NumberPipe'}
*
* \@stable
*/
var DecimalPipe = (function () {
function DecimalPipe(_locale) {
this._locale = _locale;
}
/**
* @param {?} value
* @param {?=} digits
* @param {?=} locale
* @return {?}
*/
DecimalPipe.prototype.transform = /**
* @param {?} value
* @param {?=} digits
* @param {?=} locale
* @return {?}
*/
function (value, digits, locale) {
if (isEmpty(value))
return null;
locale = locale || this._locale;
var _a = formatNumber$1(value, locale, NumberFormatStyle.Decimal, digits), str = _a.str, error = _a.error;
if (error) {
throw invalidPipeArgumentError(DecimalPipe, error);
}
return str;
};
DecimalPipe.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["S" /* Pipe */], args: [{ name: 'number' },] },
];
/** @nocollapse */
DecimalPipe.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["z" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["G" /* LOCALE_ID */],] },] },
]; };
return DecimalPipe;
}());
/**
* \@ngModule CommonModule
* \@whatItDoes Formats a number as a percentage according to locale rules.
* \@howToUse `number_expression | percent[:digitInfo[:locale]]`
*
* \@description
*
* Formats a number as percentage.
*
* - `digitInfo` See {\@link DecimalPipe} for detailed description.
* - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by
* default)
*
* ### Example
*
* {\@example common/pipes/ts/percent_pipe.ts region='PercentPipe'}
*
* \@stable
*/
var PercentPipe = (function () {
function PercentPipe(_locale) {
this._locale = _locale;
}
/**
* @param {?} value
* @param {?=} digits
* @param {?=} locale
* @return {?}
*/
PercentPipe.prototype.transform = /**
* @param {?} value
* @param {?=} digits
* @param {?=} locale
* @return {?}
*/
function (value, digits, locale) {
if (isEmpty(value))
return null;
locale = locale || this._locale;
var _a = formatNumber$1(value, locale, NumberFormatStyle.Percent, digits), str = _a.str, error = _a.error;
if (error) {
throw invalidPipeArgumentError(PercentPipe, error);
}
return str;
};
PercentPipe.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["S" /* Pipe */], args: [{ name: 'percent' },] },
];
/** @nocollapse */
PercentPipe.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["z" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["G" /* LOCALE_ID */],] },] },
]; };
return PercentPipe;
}());
/**
* \@ngModule CommonModule
* \@whatItDoes Formats a number as currency using locale rules.
* \@howToUse `number_expression | currency[:currencyCode[:display[:digitInfo[:locale]]]]`
* \@description
*
* Use `currency` to format a number as currency.
*
* - `currencyCode` is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, such
* as `USD` for the US dollar and `EUR` for the euro.
* - `display` indicates whether to show the currency symbol or the code.
* - `code`: use code (e.g. `USD`).
* - `symbol`(default): use symbol (e.g. `$`).
* - `symbol-narrow`: some countries have two symbols for their currency, one regular and one
* narrow (e.g. the canadian dollar CAD has the symbol `CA$` and the symbol-narrow `$`).
* - boolean (deprecated from v5): `true` for symbol and false for `code`
* If there is no narrow symbol for the chosen currency, the regular symbol will be used.
* - `digitInfo` See {\@link DecimalPipe} for detailed description.
* - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by
* default)
*
* ### Example
*
* {\@example common/pipes/ts/currency_pipe.ts region='CurrencyPipe'}
*
* \@stable
*/
var CurrencyPipe = (function () {
function CurrencyPipe(_locale) {
this._locale = _locale;
}
/**
* @param {?} value
* @param {?=} currencyCode
* @param {?=} display
* @param {?=} digits
* @param {?=} locale
* @return {?}
*/
CurrencyPipe.prototype.transform = /**
* @param {?} value
* @param {?=} currencyCode
* @param {?=} display
* @param {?=} digits
* @param {?=} locale
* @return {?}
*/
function (value, currencyCode, display, digits, locale) {
if (display === void 0) { display = 'symbol'; }
if (isEmpty(value))
return null;
locale = locale || this._locale;
if (typeof display === 'boolean') {
if (/** @type {?} */ (console) && /** @type {?} */ (console.warn)) {
console.warn("Warning: the currency pipe has been changed in Angular v5. The symbolDisplay option (third parameter) is now a string instead of a boolean. The accepted values are \"code\", \"symbol\" or \"symbol-narrow\".");
}
display = display ? 'symbol' : 'code';
}
var /** @type {?} */ currency = currencyCode || 'USD';
if (display !== 'code') {
currency = findCurrencySymbol(currency, display === 'symbol' ? 'wide' : 'narrow');
}
var _a = formatNumber$1(value, locale, NumberFormatStyle.Currency, digits, currency), str = _a.str, error = _a.error;
if (error) {
throw invalidPipeArgumentError(CurrencyPipe, error);
}
return str;
};
CurrencyPipe.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["S" /* Pipe */], args: [{ name: 'currency' },] },
];
/** @nocollapse */
CurrencyPipe.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["z" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["G" /* LOCALE_ID */],] },] },
]; };
return CurrencyPipe;
}());
/**
* @param {?} value
* @return {?}
*/
function isEmpty(value) {
return value == null || value === '' || value !== value;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* \@ngModule CommonModule
* \@whatItDoes Creates a new List or String containing a subset (slice) of the elements.
* \@howToUse `array_or_string_expression | slice:start[:end]`
* \@description
*
* Where the input expression is a `List` or `String`, and:
* - `start`: The starting index of the subset to return.
* - **a positive integer**: return the item at `start` index and all items after
* in the list or string expression.
* - **a negative integer**: return the item at `start` index from the end and all items after
* in the list or string expression.
* - **if positive and greater than the size of the expression**: return an empty list or string.
* - **if negative and greater than the size of the expression**: return entire list or string.
* - `end`: The ending index of the subset to return.
* - **omitted**: return all items until the end.
* - **if positive**: return all items before `end` index of the list or string.
* - **if negative**: return all items before `end` index from the end of the list or string.
*
* All behavior is based on the expected behavior of the JavaScript API `Array.prototype.slice()`
* and `String.prototype.slice()`.
*
* When operating on a [List], the returned list is always a copy even when all
* the elements are being returned.
*
* When operating on a blank value, the pipe returns the blank value.
*
* ## List Example
*
* This `ngFor` example:
*
* {\@example common/pipes/ts/slice_pipe.ts region='SlicePipe_list'}
*
* produces the following:
*
* <li>b</li>
* <li>c</li>
*
* ## String Examples
*
* {\@example common/pipes/ts/slice_pipe.ts region='SlicePipe_string'}
*
* \@stable
*/
var SlicePipe = (function () {
function SlicePipe() {
}
/**
* @param {?} value
* @param {?} start
* @param {?=} end
* @return {?}
*/
SlicePipe.prototype.transform = /**
* @param {?} value
* @param {?} start
* @param {?=} end
* @return {?}
*/
function (value, start, end) {
if (value == null)
return value;
if (!this.supports(value)) {
throw invalidPipeArgumentError(SlicePipe, value);
}
return value.slice(start, end);
};
/**
* @param {?} obj
* @return {?}
*/
SlicePipe.prototype.supports = /**
* @param {?} obj
* @return {?}
*/
function (obj) { return typeof obj === 'string' || Array.isArray(obj); };
SlicePipe.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["S" /* Pipe */], args: [{ name: 'slice', pure: false },] },
];
/** @nocollapse */
SlicePipe.ctorParameters = function () { return []; };
return SlicePipe;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @module
* @description
* This module provides a set of common Pipes.
*/
/**
* A collection of Angular pipes that are likely to be used in each and every application.
*/
var COMMON_PIPES = [
AsyncPipe,
UpperCasePipe,
LowerCasePipe,
JsonPipe,
SlicePipe,
DecimalPipe,
PercentPipe,
TitleCasePipe,
CurrencyPipe,
DatePipe,
I18nPluralPipe,
I18nSelectPipe,
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* The module that includes all the basic Angular directives like {\@link NgIf}, {\@link NgForOf}, ...
*
* \@stable
*/
var CommonModule = (function () {
function CommonModule() {
}
CommonModule.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["I" /* NgModule */], args: [{
declarations: [COMMON_DIRECTIVES, COMMON_PIPES],
exports: [COMMON_DIRECTIVES, COMMON_PIPES],
providers: [
{ provide: NgLocalization, useClass: NgLocaleLocalization },
],
},] },
];
/** @nocollapse */
CommonModule.ctorParameters = function () { return []; };
return CommonModule;
}());
var ɵ0 = getPluralCase;
/**
* A module that contains the deprecated i18n pipes.
*
* @deprecated from v5
*/
var DeprecatedI18NPipesModule = (function () {
function DeprecatedI18NPipesModule() {
}
DeprecatedI18NPipesModule.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["I" /* NgModule */], args: [{
declarations: [COMMON_DEPRECATED_I18N_PIPES],
exports: [COMMON_DEPRECATED_I18N_PIPES],
providers: [{ provide: DEPRECATED_PLURAL_FN, useValue: ɵ0 }],
},] },
];
/** @nocollapse */
DeprecatedI18NPipesModule.ctorParameters = function () { return []; };
return DeprecatedI18NPipesModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* A DI Token representing the main rendering context. In a browser this is the DOM Document.
*
* Note: Document might not be available in the Application Context when Application and Rendering
* Contexts are not the same (e.g. when running the application into a Web Worker).
*
* \@stable
*/
var DOCUMENT = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["B" /* InjectionToken */]('DocumentToken');
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var PLATFORM_BROWSER_ID = 'browser';
var PLATFORM_SERVER_ID = 'server';
var PLATFORM_WORKER_APP_ID = 'browserWorkerApp';
var PLATFORM_WORKER_UI_ID = 'browserWorkerUi';
/**
* Returns whether a platform id represents a browser platform.
* \@experimental
* @param {?} platformId
* @return {?}
*/
function isPlatformBrowser(platformId) {
return platformId === PLATFORM_BROWSER_ID;
}
/**
* Returns whether a platform id represents a server platform.
* \@experimental
* @param {?} platformId
* @return {?}
*/
function isPlatformServer(platformId) {
return platformId === PLATFORM_SERVER_ID;
}
/**
* Returns whether a platform id represents a web worker app platform.
* \@experimental
* @param {?} platformId
* @return {?}
*/
function isPlatformWorkerApp(platformId) {
return platformId === PLATFORM_WORKER_APP_ID;
}
/**
* Returns whether a platform id represents a web worker UI platform.
* \@experimental
* @param {?} platformId
* @return {?}
*/
function isPlatformWorkerUi(platformId) {
return platformId === PLATFORM_WORKER_UI_ID;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @module
* @description
* Entry point for all public APIs of the common package.
*/
/**
* \@stable
*/
var VERSION = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["_7" /* Version */]('5.0.3');
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @module
* @description
* Entry point for all public APIs of the common package.
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @module
* @description
* Entry point for all public APIs of this package.
*/
// This file only reexports content of the `src` folder. Keep it that way.
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Generated bundle index. Do not edit.
*/
//# sourceMappingURL=common.js.map
/***/ }),
/* 44 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PORTAL_DEFAULT; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return PORTAL_MODAL; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return PORTAL_LOADING; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return PORTAL_TOAST; });
var PORTAL_DEFAULT = 1;
var PORTAL_MODAL = 2;
var PORTAL_LOADING = 3;
var PORTAL_TOAST = 4;
//# sourceMappingURL=app-constants.js.map
/***/ }),
/* 45 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Button; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ion__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_util__ = __webpack_require__(3);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name Button
* @module ionic
* @description
* Buttons are simple components in Ionic. They can consist of text and icons
* and be enhanced by a wide range of attributes.
*
* @usage
*
* ```html
*
* <!-- Colors -->
* <button ion-button>Default</button>
*
* <button ion-button color="secondary">Secondary</button>
*
* <button ion-button color="danger">Danger</button>
*
* <button ion-button color="light">Light</button>
*
* <button ion-button color="dark">Dark</button>
*
* <!-- Shapes -->
* <button ion-button full>Full Button</button>
*
* <button ion-button block>Block Button</button>
*
* <button ion-button round>Round Button</button>
*
* <!-- Outline -->
* <button ion-button full outline>Outline + Full</button>
*
* <button ion-button block outline>Outline + Block</button>
*
* <button ion-button round outline>Outline + Round</button>
*
* <!-- Icons -->
* <button ion-button icon-start>
* <ion-icon name="star"></ion-icon>
* Left Icon
* </button>
*
* <button ion-button icon-end>
* Right Icon
* <ion-icon name="star"></ion-icon>
* </button>
*
* <button ion-button icon-only>
* <ion-icon name="star"></ion-icon>
* </button>
*
* <!-- Sizes -->
* <button ion-button large>Large</button>
*
* <button ion-button>Default</button>
*
* <button ion-button small>Small</button>
* ```
*
* @advanced
*
* ```html
*
* <!-- Bind the color and outline inputs to an expression -->
* <button ion-button [color]="isDanger ? 'danger' : 'primary'" [outline]="isOutline">
* Danger (Solid)
* </button>
*
* <!-- Bind the color and round inputs to an expression -->
* <button ion-button [color]="myColor" [round]="isRound">
* Secondary (Round)
* </button>
*
* <!-- Bind the color and clear inputs to an expression -->
* <button ion-button [color]="isSecondary ? 'secondary' : 'primary'" [clear]="isClear">
* Primary (Clear)
* </button>
*
* <!-- Bind the color, outline and round inputs to an expression -->
* <button ion-button [color]="myColor2" [outline]="isOutline" [round]="isRound">
* Dark (Solid + Round)
* </button>
*
* <!-- Bind the click event to a method -->
* <button ion-button (click)="logEvent($event)">
* Click me!
* </button>
* ```
*
* ```ts
* @Component({
* templateUrl: 'main.html'
* })
* class E2EPage {
* isDanger: boolean = true;
* isSecondary: boolean = false;
* isRound: boolean = true;
* isOutline: boolean = false;
* isClear: boolean = true;
* myColor: string = 'secondary';
* myColor2: string = 'dark';
*
* logEvent(event) {
* console.log(event)
* }
* }
*
* ```
*
* @demo /docs/demos/src/button/
* @see {@link /docs/components#buttons Button Component Docs}
* @see {@link /docs/components#fabs FabButton Docs}
* @see {@link ../../fab/FabButton FabButton API Docs}
* @see {@link ../../fab/FabContainer FabContainer API Docs}
*/
var Button = (function (_super) {
__extends(Button, _super);
function Button(ionButton, config, elementRef, renderer) {
var _this = _super.call(this, config, elementRef, renderer) || this;
/** @hidden */
_this._role = 'button'; // bar-button
/** @hidden */
_this._style = 'default'; // outline/clear/solid
_this._mode = config.get('mode');
if (config.get('hoverCSS') === false) {
_this.setElementClass('disable-hover', true);
}
if (ionButton.trim().length > 0) {
_this.setRole(ionButton);
}
return _this;
}
Object.defineProperty(Button.prototype, "large", {
/**
* @input {boolean} If true, activates the large button size.
*/
set: function (val) {
this._attr('_size', 'large', val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Button.prototype, "small", {
/**
* @input {boolean} If true, activates the small button size.
*/
set: function (val) {
this._attr('_size', 'small', val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Button.prototype, "default", {
/**
* @input {boolean} If true, activates the default button size. Normally the default, useful for buttons in an item.
*/
set: function (val) {
this._attr('_size', 'default', val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Button.prototype, "outline", {
/**
* @input {boolean} If true, activates a transparent button style with a border.
*/
set: function (val) {
this._attr('_style', 'outline', val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Button.prototype, "clear", {
/**
* @input {boolean} If true, activates a transparent button style without a border.
*/
set: function (val) {
this._attr('_style', 'clear', val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Button.prototype, "solid", {
/**
* @input {boolean} If true, activates a solid button style. Normally the default, useful for buttons in a toolbar.
*/
set: function (val) {
this._attr('_style', 'solid', val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Button.prototype, "round", {
/**
* @input {boolean} If true, activates a button with rounded corners.
*/
set: function (val) {
this._attr('_shape', 'round', val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Button.prototype, "block", {
/**
* @input {boolean} If true, activates a button style that fills the available width.
*/
set: function (val) {
this._attr('_display', 'block', val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Button.prototype, "full", {
/**
* @input {boolean} If true, activates a button style that fills the available width without
* a left and right border.
*/
set: function (val) {
this._attr('_display', 'full', val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Button.prototype, "strong", {
/**
* @input {boolean} If true, activates a button with a heavier font weight.
*/
set: function (val) {
this._attr('_decorator', 'strong', val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Button.prototype, "mode", {
/**
* @input {string} The mode determines which platform styles to use.
* Possible values are: `"ios"`, `"md"`, or `"wp"`.
* For more information, see [Platform Styles](/docs/theming/platform-specific-styles).
*/
set: function (val) {
this._assignCss(false);
this._mode = val;
this._assignCss(true);
},
enumerable: true,
configurable: true
});
/** @hidden */
Button.prototype._attr = function (type, attrName, attrValue) {
if (type === '_style') {
this._updateColor(this._color, false);
}
this._setClass(this[type], false);
if (Object(__WEBPACK_IMPORTED_MODULE_3__util_util__["o" /* isTrueProperty */])(attrValue)) {
this[type] = attrName;
this._setClass(attrName, true);
}
else {
// Special handling for '_style' which defaults to 'default'.
this[type] = (type === '_style' ? 'default' : null);
this._setClass(this[type], true);
}
if (type === '_style') {
this._updateColor(this._color, true);
}
};
Object.defineProperty(Button.prototype, "color", {
/**
* @input {string} The color to use from your Sass `$colors` map.
* Default options are: `"primary"`, `"secondary"`, `"danger"`, `"light"`, and `"dark"`.
* For more information, see [Theming your App](/docs/theming/theming-your-app).
*/
set: function (val) {
this._updateColor(this._color, false);
this._updateColor(val, true);
this._color = val;
},
enumerable: true,
configurable: true
});
/** @hidden */
Button.prototype.ngAfterContentInit = function () {
this._init = true;
this._assignCss(true);
};
/**
* @hidden
*/
Button.prototype.setRole = function (val) {
this._assignCss(false);
this._role = val;
this._assignCss(true);
};
/**
* @hidden
*/
Button.prototype._assignCss = function (assignCssClass) {
var role = this._role;
if (role) {
this.setElementClass(role, assignCssClass); // button
this.setElementClass(role + "-" + this._mode, assignCssClass); // button
this._setClass(this._style, assignCssClass); // button-clear
this._setClass(this._shape, assignCssClass); // button-round
this._setClass(this._display, assignCssClass); // button-full
this._setClass(this._size, assignCssClass); // button-small
this._setClass(this._decorator, assignCssClass); // button-strong
this._updateColor(this._color, assignCssClass); // button-secondary, bar-button-secondary
}
};
/**
* @hidden
*/
Button.prototype._setClass = function (type, assignCssClass) {
if (type && this._init) {
type = type.toLocaleLowerCase();
this.setElementClass(this._role + "-" + type, assignCssClass);
this.setElementClass(this._role + "-" + type + "-" + this._mode, assignCssClass);
}
};
/**
* @hidden
*/
Button.prototype._updateColor = function (color, isAdd) {
if (color && this._init) {
// The class should begin with the button role
// button, bar-button
var className = this._role;
// If the role is not a bar-button, don't apply the solid style
var style = this._style;
style = (this._role !== 'bar-button' && style === 'solid' ? 'default' : style);
className += (style !== null && style !== '' && style !== 'default' ? '-' + style.toLowerCase() : '');
if (color !== null && color !== '') {
this.setElementClass(className + "-" + this._mode + "-" + color, isAdd);
}
}
};
Button.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: '[ion-button]',
template: '<span class="button-inner">' +
'<ng-content></ng-content>' +
'</span>' +
'<div class="button-effect"></div>',
changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* ChangeDetectionStrategy */].OnPush,
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
},] },
];
/** @nocollapse */
Button.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["g" /* Attribute */], args: ['ion-button',] },] },
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
]; };
Button.propDecorators = {
'large': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'small': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'default': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'outline': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'clear': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'solid': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'round': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'block': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'full': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'strong': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'mode': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'color': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
};
return Button;
}(__WEBPACK_IMPORTED_MODULE_2__ion__["a" /* Ion */]));
//# sourceMappingURL=button.js.map
/***/ }),
/* 46 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Keyboard; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__dom_controller__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_dom__ = __webpack_require__(14);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__key__ = __webpack_require__(23);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__platform__ = __webpack_require__(4);
/**
* @name Keyboard
* @description
* The `Keyboard` class allows you to work with the keyboard events provided
* by the Ionic keyboard plugin.
*
* @usage
* ```ts
* export class MyClass {
*
* constructor(public keyboard: Keyboard) { }
*
* }
* ```
*/
var Keyboard = (function () {
function Keyboard(config, _plt, _zone, _dom) {
this._plt = _plt;
this._zone = _zone;
this._dom = _dom;
this.willShow = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
this.willHide = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
this.didShow = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
this.didHide = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
this.eventsAvailable = false;
this.focusOutline(config.get('focusOutline'));
var win = _plt.win();
if (win.Ionic && win.Ionic.keyboardPlugin) {
this.listenV2(win);
}
else {
this.listenV1(win);
}
}
Keyboard.prototype.listenV2 = function (win) {
var _this = this;
var platform = this._plt;
platform.registerListener(win, 'keyboardWillShow', function (ev) {
_this._zone.run(function () {
_this.willShow.emit(ev.keyboardHeight);
});
}, { zone: false, passive: true });
platform.registerListener(win, 'keyboardWillHide', function () {
_this._zone.run(function () {
_this.willHide.emit();
});
}, { zone: false, passive: true });
platform.registerListener(win, 'keyboardDidShow', function (ev) {
_this._zone.run(function () {
_this.didShow.emit(ev.keyboardHeight);
});
}, { zone: false, passive: true });
platform.registerListener(win, 'keyboardDidHide', function () {
_this._zone.run(function () {
_this.didHide.emit();
});
}, { zone: false, passive: true });
this.eventsAvailable = true;
};
Keyboard.prototype.listenV1 = function (win) {
var _this = this;
var platform = this._plt;
platform.registerListener(win, 'native.keyboardhide', function () {
_this.blurActiveInput(true);
}, { zone: false, passive: true });
platform.registerListener(win, 'native.keyboardshow', function () {
_this.blurActiveInput(false);
}, { zone: false, passive: true });
};
Keyboard.prototype.blurActiveInput = function (shouldBlur) {
var _this = this;
var platform = this._plt;
platform.cancelTimeout(this._tmr);
if (shouldBlur) {
this._tmr = platform.timeout(function () {
// this custom cordova plugin event fires when the keyboard will hide
// useful when the virtual keyboard is closed natively
// https://github.com/ionic-team/ionic-plugin-keyboard
if (_this.isOpen()) {
platform.focusOutActiveElement();
}
}, 80);
}
};
/**
* Check to see if the keyboard is open or not.
*
* ```ts
* export class MyClass {
* constructor(public keyboard: Keyboard) {
*
* }
*
* keyboardCheck() {
* console.log('The keyboard is open:', this.keyboard.isOpen());
* }
* }
* ```
*
* @return {boolean} returns a true or false value if the keyboard is open or not.
*/
Keyboard.prototype.isOpen = function () {
return this.hasFocusedTextInput();
};
/**
* When the keyboard is closed, call any methods you want.
*
* ```ts
* export class MyClass {
* constructor(public keyboard: Keyboard) {
* this.keyboard.onClose(this.closeCallback);
* }
* closeCallback() {
* // call what ever functionality you want on keyboard close
* console.log('Closing time');
* }
* }
* ```
*
* @param {function} callback method you want to call when the keyboard has been closed.
* @return {function} returns a callback that gets fired when the keyboard is closed.
*/
Keyboard.prototype.onClose = function (callback, pollingInternval, pollingChecksMax) {
if (pollingInternval === void 0) { pollingInternval = KEYBOARD_CLOSE_POLLING; }
if (pollingChecksMax === void 0) { pollingChecksMax = KEYBOARD_POLLING_CHECKS_MAX; }
(void 0) /* console.debug */;
var self = this;
var checks = 0;
var promise = null;
if (!callback) {
// a callback wasn't provided, so let's return a promise instead
promise = new Promise(function (resolve) { callback = resolve; });
}
function checkKeyboard() {
(void 0) /* console.debug */;
if (!self.isOpen() || checks > pollingChecksMax) {
self._plt.timeout(function () {
self._zone.run(function () {
(void 0) /* console.debug */;
callback();
});
}, 400);
}
else {
self._plt.timeout(checkKeyboard, pollingInternval);
}
checks++;
}
self._plt.timeout(checkKeyboard, pollingInternval);
return promise;
};
/**
* Programmatically close the keyboard.
*/
Keyboard.prototype.close = function () {
var _this = this;
this._dom.read(function () {
if (_this.isOpen()) {
// only focus out when a text input has focus
(void 0) /* console.debug */;
_this._dom.write(function () {
_this._plt.focusOutActiveElement();
});
}
});
};
/**
* @hidden
*/
Keyboard.prototype.focusOutline = function (setting) {
/* Focus Outline
* --------------------------------------------------
* By default, when a keydown event happens from a tab key, then
* the 'focus-outline' css class is added to the body element
* so focusable elements have an outline. On a mousedown or
* touchstart event, then the 'focus-outline' css class is removed.
*
* Config default overrides:
* focusOutline: true - Always add the focus-outline
* focusOutline: false - Do not add the focus-outline
*/
var self = this;
var platform = self._plt;
var doc = platform.doc();
var isKeyInputEnabled = false;
var unRegMouse;
var unRegTouch;
var evOpts = { passive: true, zone: false };
function cssClass() {
self._dom.write(function () {
platform.doc().body.classList[isKeyInputEnabled ? 'add' : 'remove']('focus-outline');
});
}
if (setting === true) {
isKeyInputEnabled = true;
return cssClass();
}
else if (setting === false) {
return;
}
// default is to add the focus-outline when the tab key is used
function keyDown(ev) {
if (!isKeyInputEnabled && ev.keyCode === __WEBPACK_IMPORTED_MODULE_4__key__["g" /* KEY_TAB */]) {
isKeyInputEnabled = true;
enableKeyInput();
}
}
function pointerDown() {
isKeyInputEnabled = false;
enableKeyInput();
}
function enableKeyInput() {
cssClass();
unRegMouse && unRegMouse();
unRegTouch && unRegTouch();
if (isKeyInputEnabled) {
// listen for when a mousedown or touchstart event happens
unRegMouse = platform.registerListener(doc, 'mousedown', pointerDown, evOpts);
unRegTouch = platform.registerListener(doc, 'touchstart', pointerDown, evOpts);
}
}
// always listen for tab keydown events
platform.registerListener(platform.doc(), 'keydown', keyDown, evOpts);
};
Keyboard.prototype.hasFocusedTextInput = function () {
var activeEle = this._plt.getActiveElement();
if (Object(__WEBPACK_IMPORTED_MODULE_3__util_dom__["e" /* isTextInput */])(activeEle)) {
return (activeEle.parentElement.querySelector(':focus') === activeEle);
}
return false;
};
/**
* Set to true to hide the additional toolbar that is on top of the keyboard.
* This toolbar features the Prev, Next, and Done buttons.
* @param hidden
*/
Keyboard.prototype.hideFormAccessoryBar = function (hidden) {
var win = this._plt.win();
if (win && win.Keyboard && win.Keyboard.hideFormAccessoryBar) {
win.Keyboard.hideFormAccessoryBar(hidden);
}
};
Keyboard.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
Keyboard.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_5__platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["M" /* NgZone */], },
{ type: __WEBPACK_IMPORTED_MODULE_2__dom_controller__["a" /* DomController */], },
]; };
return Keyboard;
}());
var KEYBOARD_CLOSE_POLLING = 150;
var KEYBOARD_POLLING_CHECKS_MAX = 100;
//# sourceMappingURL=keyboard.js.map
/***/ }),
/* 47 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Haptic; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__platform_platform__ = __webpack_require__(4);
/**
* @name Haptic
* @description
* The `Haptic` class interacts with a haptic engine on the device, if
* available. Generally, Ionic components use this under the hood, but you're
* welcome to get a bit crazy with it if you fancy.
*
* Currently, this uses the Taptic engine on iOS.
*
* @usage
* ```ts
* export class MyClass {
*
* constructor(haptic: Haptic) {
* haptic.selection();
* }
* }
*
* ```
*/
var Haptic = (function () {
function Haptic(plt) {
var _this = this;
if (plt) {
plt.ready().then(function () {
_this._p = plt.win().TapticEngine;
});
}
}
/**
* Check to see if the Haptic Plugin is available
* @return {boolean} Returns true or false if the plugin is available
*
*/
Haptic.prototype.available = function () {
return !!this._p;
};
/**
* Trigger a selection changed haptic event. Good for one-time events
* (not for gestures)
*/
Haptic.prototype.selection = function () {
this._p && this._p.selection();
};
/**
* Tell the haptic engine that a gesture for a selection change is starting.
*/
Haptic.prototype.gestureSelectionStart = function () {
this._p && this._p.gestureSelectionStart();
};
/**
* Tell the haptic engine that a selection changed during a gesture.
*/
Haptic.prototype.gestureSelectionChanged = function () {
this._p && this._p.gestureSelectionChanged();
};
/**
* Tell the haptic engine we are done with a gesture. This needs to be
* called lest resources are not properly recycled.
*/
Haptic.prototype.gestureSelectionEnd = function () {
this._p && this._p.gestureSelectionEnd();
};
/**
* Use this to indicate success/failure/warning to the user.
* options should be of the type `{ type: 'success' }` (or `warning`/`error`)
*/
Haptic.prototype.notification = function (options) {
this._p && this._p.notification(options);
};
/**
* Use this to indicate success/failure/warning to the user.
* options should be of the type `{ style: 'light' }` (or `medium`/`heavy`)
*/
Haptic.prototype.impact = function (options) {
this._p && this._p.impact(options);
};
Haptic.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
Haptic.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__platform_platform__["a" /* Platform */], },
]; };
return Haptic;
}());
//# sourceMappingURL=haptic.js.map
/***/ }),
/* 48 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return RootNode; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return SplitPane; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__ion__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__platform_platform__ = __webpack_require__(4);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var QUERY = {
xs: '(min-width: 0px)',
sm: '(min-width: 576px)',
md: '(min-width: 768px)',
lg: '(min-width: 992px)',
xl: '(min-width: 1200px)',
never: ''
};
/**
* @hidden
*/
var RootNode = (function () {
function RootNode() {
}
return RootNode;
}());
/**
* @name SplitPane
*
* @description
* SplitPane is a component that makes it possible to create multi-view layout.
* Similar to iPad apps, SplitPane allows UI elements, like Menus, to be
* displayed as the viewport increases.
*
* If the devices screen size is below a certain size, the SplitPane will
* collapse and the menu will become hidden again. This is especially useful when
* creating an app that will be served over a browser or deployed through the app
* store to phones and tablets.
*
* @usage
* To use SplitPane, simply add the component around your root component.
* In this example, we'll be using a sidemenu layout, similar to what is
* provided from the sidemenu starter template.
*
* ```html
* <ion-split-pane>
* <!-- our side menu -->
* <ion-menu [content]="content">
* <ion-header>
* <ion-toolbar>
* <ion-title>Menu</ion-title>
* </ion-toolbar>
* </ion-header>
* </ion-menu>
*
* <!-- the main content -->
* <ion-nav [root]="root" main #content></ion-nav>
* </ion-split-pane>
* ```
*
* Here, SplitPane will look for the element with the `main` attribute and make
* that the central component on larger screens. The `main` component can be any
* Ionic component (`ion-nav` or `ion-tabs`) except `ion-menu`.
*
* ### Setting breakpoints
*
* By default, SplitPane will expand when the screen is larger than 768px.
* If you want to customize this, use the `when` input. The `when` input can
* accept any valid media query, as it uses `matchMedia()` underneath.
*
* ```
* <ion-split-pane when="(min-width: 475px)">
*
* <!-- our side menu -->
* <ion-menu [content]="content">
* ....
* </ion-menu>
*
* <!-- the main content -->
* <ion-nav [root]="root" main #content></ion-nav>
* </ion-split-pane>
* ```
*
* SplitPane also provides some predefined media queries that can be used.
*
* ```html
* <!-- could be "xs", "sm", "md", "lg", or "xl" -->
* <ion-split-pane when="lg">
* ...
* </ion-split-pane>
* ```
*
*
* | Size | Value | Description |
* |------|-----------------------|-----------------------------------------------------------------------|
* | `xs` | `(min-width: 0px)` | Show the split-pane when the min-width is 0px (meaning, always) |
* | `sm` | `(min-width: 576px)` | Show the split-pane when the min-width is 576px |
* | `md` | `(min-width: 768px)` | Show the split-pane when the min-width is 768px (default break point) |
* | `lg` | `(min-width: 992px)` | Show the split-pane when the min-width is 992px |
* | `xl` | `(min-width: 1200px)` | Show the split-pane when the min-width is 1200px |
*
* You can also pass in boolean values that will trigger SplitPane when the value
* or expression evaluates to true.
*
*
* ```html
* <ion-split-pane [when]="isLarge">
* ...
* </ion-split-pane>
* ```
*
* ```ts
* class MyClass {
* public isLarge = false;
* constructor(){}
* }
* ```
*
* Or
*
* ```html
* <ion-split-pane [when]="shouldShow()">
* ...
* </ion-split-pane>
* ```
*
* ```ts
* class MyClass {
* constructor(){}
* shouldShow(){
* if(conditionA){
* return true
* } else {
* return false
* }
* }
* }
* ```
*
*/
var SplitPane = (function (_super) {
__extends(SplitPane, _super);
function SplitPane(_zone, _plt, config, elementRef, renderer) {
var _this = _super.call(this, config, elementRef, renderer, 'split-pane') || this;
_this._zone = _zone;
_this._plt = _plt;
_this._init = false;
_this._visible = false;
_this._isEnabled = true;
_this._mediaQuery = QUERY['md'];
/**
* @hidden
*/
_this.sideContent = null;
/**
* @hidden
*/
_this.mainContent = null;
/**
* @output {any} Expression to be called when the split-pane visibility has changed
*/
_this.ionChange = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
return _this;
}
Object.defineProperty(SplitPane.prototype, "_setchildren", {
/**
* @hidden
*/
set: function (query) {
var _this = this;
var children = this._children = query.filter((function (child) { return child !== _this; }));
children.forEach(function (child) {
var isMain = child.initPane();
_this._setPaneCSSClass(child.getElementRef(), isMain);
});
},
enumerable: true,
configurable: true
});
Object.defineProperty(SplitPane.prototype, "when", {
get: function () {
return this._mediaQuery;
},
/**
* @input {string | boolean} When the split-pane should be shown.
* Can be a CSS media query expression, or a shortcut expression.
* Can also be a boolean expression.
*/
set: function (query) {
if (typeof query === 'boolean') {
this._mediaQuery = query;
}
else {
var defaultQuery = QUERY[query];
this._mediaQuery = (defaultQuery)
? defaultQuery
: query;
}
this._update();
},
enumerable: true,
configurable: true
});
Object.defineProperty(SplitPane.prototype, "enabled", {
get: function () {
return this._isEnabled;
},
/**
* @input {boolean} If `false`, the split-pane is disabled, ie. the side pane will
* never be displayed. Default `true`.
*/
set: function (val) {
this._isEnabled = Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["o" /* isTrueProperty */])(val);
this._update();
},
enumerable: true,
configurable: true
});
/**
* @hidden
*/
SplitPane.prototype._register = function (node, isMain, callback) {
if (this.getElementRef().nativeElement !== node.getElementRef().nativeElement.parentNode) {
return false;
}
this._setPaneCSSClass(node.getElementRef(), isMain);
if (callback) {
this.ionChange.subscribe(callback);
}
if (isMain) {
if (this.mainContent) {
console.error('split pane: main content was already set');
}
this.mainContent = node;
}
return true;
};
/**
* @hidden
*/
SplitPane.prototype.ngAfterViewInit = function () {
this._init = true;
this._update();
};
/**
* @hidden
*/
SplitPane.prototype._update = function () {
var _this = this;
if (!this._init) {
return;
}
// Unlisten
this._rmListener && this._rmListener();
this._rmListener = null;
// Check if the split-pane is disabled
if (!this._isEnabled) {
this._setVisible(false);
return;
}
var query = this._mediaQuery;
if (typeof query === 'boolean') {
this._setVisible(query);
return;
}
if (query && query.length > 0) {
// Listen
var callback_1 = function (query) { return _this._setVisible(query.matches); };
var mediaList_1 = this._plt.win().matchMedia(query);
mediaList_1.addListener(callback_1);
this._setVisible(mediaList_1.matches);
this._rmListener = function () {
mediaList_1.removeListener(callback_1);
};
}
else {
this._setVisible(false);
}
};
/**
* @hidden
*/
SplitPane.prototype._updateChildren = function () {
this.mainContent = null;
this.sideContent = null;
var visible = this._visible;
this._children.forEach(function (child) { return child.paneChanged && child.paneChanged(visible); });
};
/**
* @hidden
*/
SplitPane.prototype._setVisible = function (visible) {
var _this = this;
if (this._visible === visible) {
return;
}
this._visible = visible;
this.setElementClass('split-pane-visible', visible);
this._updateChildren();
this._zone.run(function () {
_this.ionChange.emit(_this);
});
};
/**
* @hidden
*/
SplitPane.prototype.isVisible = function () {
return this._visible;
};
/**
* @hidden
*/
SplitPane.prototype.setElementClass = function (className, add) {
this._renderer.setElementClass(this._elementRef.nativeElement, className, add);
};
/**
* @hidden
*/
SplitPane.prototype._setPaneCSSClass = function (elementRef, isMain) {
var ele = elementRef.nativeElement;
this._renderer.setElementClass(ele, 'split-pane-main', isMain);
this._renderer.setElementClass(ele, 'split-pane-side', !isMain);
};
/**
* @hidden
*/
SplitPane.prototype.ngOnDestroy = function () {
(void 0) /* assert */;
this._rmListener && this._rmListener();
this._rmListener = null;
};
/**
* @hidden
*/
SplitPane.prototype.initPane = function () {
return true;
};
SplitPane.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-split-pane',
providers: [{ provide: RootNode, useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_14" /* forwardRef */])(function () { return SplitPane; }) }]
},] },
];
/** @nocollapse */
SplitPane.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["M" /* NgZone */], },
{ type: __WEBPACK_IMPORTED_MODULE_4__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_3__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
]; };
SplitPane.propDecorators = {
'_setchildren': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["r" /* ContentChildren */], args: [RootNode, { descendants: false },] },],
'when': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'enabled': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'ionChange': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
};
return SplitPane;
}(__WEBPACK_IMPORTED_MODULE_1__ion__["a" /* Ion */]));
//# sourceMappingURL=split-pane.js.map
/***/ }),
/* 49 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Navbar; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__app_app__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__navigation_nav_controller__ = __webpack_require__(27);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__toolbar_base__ = __webpack_require__(171);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__navigation_view_controller__ = __webpack_require__(7);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name Navbar
* @description
* Navbar acts as the navigational toolbar, which also comes with a back
* button. A navbar can contain a `ion-title`, any number of buttons,
* a segment, or a searchbar. Navbars must be placed within an
* `<ion-header>` in order for them to be placed above the content.
* It's important to note that navbar's are part of the dynamic navigation
* stack. If you need a static toolbar, use ion-toolbar.
*
* @usage
* ```html
* <ion-header>
*
* <ion-navbar>
* <button ion-button icon-only menuToggle>
* <ion-icon name="menu"></ion-icon>
* </button>
*
* <ion-title>
* Page Title
* </ion-title>
*
* <ion-buttons end>
* <button ion-button icon-only (click)="openModal()">
* <ion-icon name="options"></ion-icon>
* </button>
* </ion-buttons>
* </ion-navbar>
*
* </ion-header>
* ```
*
* @demo /docs/demos/src/navbar/
* @see {@link ../../toolbar/Toolbar/ Toolbar API Docs}
*/
var Navbar = (function (_super) {
__extends(Navbar, _super);
function Navbar(_app, viewCtrl, navCtrl, config, elementRef, renderer) {
var _this = _super.call(this, config, elementRef, renderer) || this;
_this._app = _app;
_this.navCtrl = navCtrl;
/**
* @hidden
*/
_this._hidden = false;
/**
* @hidden
*/
_this._hideBb = false;
viewCtrl && viewCtrl._setNavbar(_this);
_this._bbIcon = config.get('backButtonIcon');
_this._sbPadding = config.getBoolean('statusbarPadding');
_this._backText = config.get('backButtonText', 'Back');
return _this;
}
Object.defineProperty(Navbar.prototype, "hideBackButton", {
/**
* @input {boolean} If true, the back button will be hidden.
*/
get: function () {
return this._hideBb;
},
set: function (val) {
this._hideBb = Object(__WEBPACK_IMPORTED_MODULE_3__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
Navbar.prototype.backButtonClick = function (ev) {
ev.preventDefault();
ev.stopPropagation();
this.navCtrl && this.navCtrl.pop(null, null);
};
/**
* Set the text of the Back Button in the Nav Bar. Defaults to "Back".
*/
Navbar.prototype.setBackButtonText = function (text) {
this._backText = text;
};
/**
* @hidden
*/
Navbar.prototype.didEnter = function () {
try {
this._app.setTitle(this.getTitleText());
}
catch (e) {
console.error(e);
}
};
/**
* @hidden
*/
Navbar.prototype.setHidden = function (isHidden) {
// used to display none/block the navbar
this._hidden = isHidden;
};
Navbar.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-navbar',
template: '<div class="toolbar-background" [ngClass]="\'toolbar-background-\' + _mode"></div>' +
'<button (click)="backButtonClick($event)" ion-button="bar-button" class="back-button" [ngClass]="\'back-button-\' + _mode" [hidden]="_hideBb">' +
'<ion-icon class="back-button-icon" [ngClass]="\'back-button-icon-\' + _mode" [name]="_bbIcon"></ion-icon>' +
'<span class="back-button-text" [ngClass]="\'back-button-text-\' + _mode">{{_backText}}</span>' +
'</button>' +
'<ng-content select="[menuToggle],ion-buttons[left]"></ng-content>' +
'<ng-content select="ion-buttons[start]"></ng-content>' +
'<ng-content select="ion-buttons[end],ion-buttons[right]"></ng-content>' +
'<div class="toolbar-content" [ngClass]="\'toolbar-content-\' + _mode">' +
'<ng-content></ng-content>' +
'</div>',
host: {
'[hidden]': '_hidden',
'class': 'toolbar',
'[class.statusbar-padding]': '_sbPadding'
}
},] },
];
/** @nocollapse */
Navbar.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__app_app__["a" /* App */], },
{ type: __WEBPACK_IMPORTED_MODULE_6__navigation_view_controller__["a" /* ViewController */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_4__navigation_nav_controller__["a" /* NavController */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_2__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
]; };
Navbar.propDecorators = {
'hideBackButton': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
};
return Navbar;
}(__WEBPACK_IMPORTED_MODULE_5__toolbar_base__["a" /* ToolbarBase */]));
//# sourceMappingURL=navbar.js.map
/***/ }),
/* 50 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var helpers = __webpack_require__(5);
function filterByPosition(array, position) {
return helpers.where(array, function(v) {
return v.position === position;
});
}
function sortByWeight(array, reverse) {
array.forEach(function(v, i) {
v._tmpIndex_ = i;
return v;
});
array.sort(function(a, b) {
var v0 = reverse ? b : a;
var v1 = reverse ? a : b;
return v0.weight === v1.weight ?
v0._tmpIndex_ - v1._tmpIndex_ :
v0.weight - v1.weight;
});
array.forEach(function(v) {
delete v._tmpIndex_;
});
}
/**
* @interface ILayoutItem
* @prop {String} position - The position of the item in the chart layout. Possible values are
* 'left', 'top', 'right', 'bottom', and 'chartArea'
* @prop {Number} weight - The weight used to sort the item. Higher weights are further away from the chart area
* @prop {Boolean} fullWidth - if true, and the item is horizontal, then push vertical boxes down
* @prop {Function} isHorizontal - returns true if the layout item is horizontal (ie. top or bottom)
* @prop {Function} update - Takes two parameters: width and height. Returns size of item
* @prop {Function} getPadding - Returns an object with padding on the edges
* @prop {Number} width - Width of item. Must be valid after update()
* @prop {Number} height - Height of item. Must be valid after update()
* @prop {Number} left - Left edge of the item. Set by layout system and cannot be used in update
* @prop {Number} top - Top edge of the item. Set by layout system and cannot be used in update
* @prop {Number} right - Right edge of the item. Set by layout system and cannot be used in update
* @prop {Number} bottom - Bottom edge of the item. Set by layout system and cannot be used in update
*/
// The layout service is very self explanatory. It's responsible for the layout within a chart.
// Scales, Legends and Plugins all rely on the layout service and can easily register to be placed anywhere they need
// It is this service's responsibility of carrying out that layout.
module.exports = {
defaults: {},
/**
* Register a box to a chart.
* A box is simply a reference to an object that requires layout. eg. Scales, Legend, Title.
* @param {Chart} chart - the chart to use
* @param {ILayoutItem} item - the item to add to be layed out
*/
addBox: function(chart, item) {
if (!chart.boxes) {
chart.boxes = [];
}
// initialize item with default values
item.fullWidth = item.fullWidth || false;
item.position = item.position || 'top';
item.weight = item.weight || 0;
chart.boxes.push(item);
},
/**
* Remove a layoutItem from a chart
* @param {Chart} chart - the chart to remove the box from
* @param {Object} layoutItem - the item to remove from the layout
*/
removeBox: function(chart, layoutItem) {
var index = chart.boxes ? chart.boxes.indexOf(layoutItem) : -1;
if (index !== -1) {
chart.boxes.splice(index, 1);
}
},
/**
* Sets (or updates) options on the given `item`.
* @param {Chart} chart - the chart in which the item lives (or will be added to)
* @param {Object} item - the item to configure with the given options
* @param {Object} options - the new item options.
*/
configure: function(chart, item, options) {
var props = ['fullWidth', 'position', 'weight'];
var ilen = props.length;
var i = 0;
var prop;
for (; i < ilen; ++i) {
prop = props[i];
if (options.hasOwnProperty(prop)) {
item[prop] = options[prop];
}
}
},
/**
* Fits boxes of the given chart into the given size by having each box measure itself
* then running a fitting algorithm
* @param {Chart} chart - the chart
* @param {Number} width - the width to fit into
* @param {Number} height - the height to fit into
*/
update: function(chart, width, height) {
if (!chart) {
return;
}
var layoutOptions = chart.options.layout || {};
var padding = helpers.options.toPadding(layoutOptions.padding);
var leftPadding = padding.left;
var rightPadding = padding.right;
var topPadding = padding.top;
var bottomPadding = padding.bottom;
var leftBoxes = filterByPosition(chart.boxes, 'left');
var rightBoxes = filterByPosition(chart.boxes, 'right');
var topBoxes = filterByPosition(chart.boxes, 'top');
var bottomBoxes = filterByPosition(chart.boxes, 'bottom');
var chartAreaBoxes = filterByPosition(chart.boxes, 'chartArea');
// Sort boxes by weight. A higher weight is further away from the chart area
sortByWeight(leftBoxes, true);
sortByWeight(rightBoxes, false);
sortByWeight(topBoxes, true);
sortByWeight(bottomBoxes, false);
// Essentially we now have any number of boxes on each of the 4 sides.
// Our canvas looks like the following.
// The areas L1 and L2 are the left axes. R1 is the right axis, T1 is the top axis and
// B1 is the bottom axis
// There are also 4 quadrant-like locations (left to right instead of clockwise) reserved for chart overlays
// These locations are single-box locations only, when trying to register a chartArea location that is already taken,
// an error will be thrown.
//
// |----------------------------------------------------|
// | T1 (Full Width) |
// |----------------------------------------------------|
// | | | T2 | |
// | |----|-------------------------------------|----|
// | | | C1 | | C2 | |
// | | |----| |----| |
// | | | | |
// | L1 | L2 | ChartArea (C0) | R1 |
// | | | | |
// | | |----| |----| |
// | | | C3 | | C4 | |
// | |----|-------------------------------------|----|
// | | | B1 | |
// |----------------------------------------------------|
// | B2 (Full Width) |
// |----------------------------------------------------|
//
// What we do to find the best sizing, we do the following
// 1. Determine the minimum size of the chart area.
// 2. Split the remaining width equally between each vertical axis
// 3. Split the remaining height equally between each horizontal axis
// 4. Give each layout the maximum size it can be. The layout will return it's minimum size
// 5. Adjust the sizes of each axis based on it's minimum reported size.
// 6. Refit each axis
// 7. Position each axis in the final location
// 8. Tell the chart the final location of the chart area
// 9. Tell any axes that overlay the chart area the positions of the chart area
// Step 1
var chartWidth = width - leftPadding - rightPadding;
var chartHeight = height - topPadding - bottomPadding;
var chartAreaWidth = chartWidth / 2; // min 50%
var chartAreaHeight = chartHeight / 2; // min 50%
// Step 2
var verticalBoxWidth = (width - chartAreaWidth) / (leftBoxes.length + rightBoxes.length);
// Step 3
var horizontalBoxHeight = (height - chartAreaHeight) / (topBoxes.length + bottomBoxes.length);
// Step 4
var maxChartAreaWidth = chartWidth;
var maxChartAreaHeight = chartHeight;
var minBoxSizes = [];
function getMinimumBoxSize(box) {
var minSize;
var isHorizontal = box.isHorizontal();
if (isHorizontal) {
minSize = box.update(box.fullWidth ? chartWidth : maxChartAreaWidth, horizontalBoxHeight);
maxChartAreaHeight -= minSize.height;
} else {
minSize = box.update(verticalBoxWidth, maxChartAreaHeight);
maxChartAreaWidth -= minSize.width;
}
minBoxSizes.push({
horizontal: isHorizontal,
minSize: minSize,
box: box,
});
}
helpers.each(leftBoxes.concat(rightBoxes, topBoxes, bottomBoxes), getMinimumBoxSize);
// If a horizontal box has padding, we move the left boxes over to avoid ugly charts (see issue #2478)
var maxHorizontalLeftPadding = 0;
var maxHorizontalRightPadding = 0;
var maxVerticalTopPadding = 0;
var maxVerticalBottomPadding = 0;
helpers.each(topBoxes.concat(bottomBoxes), function(horizontalBox) {
if (horizontalBox.getPadding) {
var boxPadding = horizontalBox.getPadding();
maxHorizontalLeftPadding = Math.max(maxHorizontalLeftPadding, boxPadding.left);
maxHorizontalRightPadding = Math.max(maxHorizontalRightPadding, boxPadding.right);
}
});
helpers.each(leftBoxes.concat(rightBoxes), function(verticalBox) {
if (verticalBox.getPadding) {
var boxPadding = verticalBox.getPadding();
maxVerticalTopPadding = Math.max(maxVerticalTopPadding, boxPadding.top);
maxVerticalBottomPadding = Math.max(maxVerticalBottomPadding, boxPadding.bottom);
}
});
// At this point, maxChartAreaHeight and maxChartAreaWidth are the size the chart area could
// be if the axes are drawn at their minimum sizes.
// Steps 5 & 6
var totalLeftBoxesWidth = leftPadding;
var totalRightBoxesWidth = rightPadding;
var totalTopBoxesHeight = topPadding;
var totalBottomBoxesHeight = bottomPadding;
// Function to fit a box
function fitBox(box) {
var minBoxSize = helpers.findNextWhere(minBoxSizes, function(minBox) {
return minBox.box === box;
});
if (minBoxSize) {
if (box.isHorizontal()) {
var scaleMargin = {
left: Math.max(totalLeftBoxesWidth, maxHorizontalLeftPadding),
right: Math.max(totalRightBoxesWidth, maxHorizontalRightPadding),
top: 0,
bottom: 0
};
// Don't use min size here because of label rotation. When the labels are rotated, their rotation highly depends
// on the margin. Sometimes they need to increase in size slightly
box.update(box.fullWidth ? chartWidth : maxChartAreaWidth, chartHeight / 2, scaleMargin);
} else {
box.update(minBoxSize.minSize.width, maxChartAreaHeight);
}
}
}
// Update, and calculate the left and right margins for the horizontal boxes
helpers.each(leftBoxes.concat(rightBoxes), fitBox);
helpers.each(leftBoxes, function(box) {
totalLeftBoxesWidth += box.width;
});
helpers.each(rightBoxes, function(box) {
totalRightBoxesWidth += box.width;
});
// Set the Left and Right margins for the horizontal boxes
helpers.each(topBoxes.concat(bottomBoxes), fitBox);
// Figure out how much margin is on the top and bottom of the vertical boxes
helpers.each(topBoxes, function(box) {
totalTopBoxesHeight += box.height;
});
helpers.each(bottomBoxes, function(box) {
totalBottomBoxesHeight += box.height;
});
function finalFitVerticalBox(box) {
var minBoxSize = helpers.findNextWhere(minBoxSizes, function(minSize) {
return minSize.box === box;
});
var scaleMargin = {
left: 0,
right: 0,
top: totalTopBoxesHeight,
bottom: totalBottomBoxesHeight
};
if (minBoxSize) {
box.update(minBoxSize.minSize.width, maxChartAreaHeight, scaleMargin);
}
}
// Let the left layout know the final margin
helpers.each(leftBoxes.concat(rightBoxes), finalFitVerticalBox);
// Recalculate because the size of each layout might have changed slightly due to the margins (label rotation for instance)
totalLeftBoxesWidth = leftPadding;
totalRightBoxesWidth = rightPadding;
totalTopBoxesHeight = topPadding;
totalBottomBoxesHeight = bottomPadding;
helpers.each(leftBoxes, function(box) {
totalLeftBoxesWidth += box.width;
});
helpers.each(rightBoxes, function(box) {
totalRightBoxesWidth += box.width;
});
helpers.each(topBoxes, function(box) {
totalTopBoxesHeight += box.height;
});
helpers.each(bottomBoxes, function(box) {
totalBottomBoxesHeight += box.height;
});
// We may be adding some padding to account for rotated x axis labels
var leftPaddingAddition = Math.max(maxHorizontalLeftPadding - totalLeftBoxesWidth, 0);
totalLeftBoxesWidth += leftPaddingAddition;
totalRightBoxesWidth += Math.max(maxHorizontalRightPadding - totalRightBoxesWidth, 0);
var topPaddingAddition = Math.max(maxVerticalTopPadding - totalTopBoxesHeight, 0);
totalTopBoxesHeight += topPaddingAddition;
totalBottomBoxesHeight += Math.max(maxVerticalBottomPadding - totalBottomBoxesHeight, 0);
// Figure out if our chart area changed. This would occur if the dataset layout label rotation
// changed due to the application of the margins in step 6. Since we can only get bigger, this is safe to do
// without calling `fit` again
var newMaxChartAreaHeight = height - totalTopBoxesHeight - totalBottomBoxesHeight;
var newMaxChartAreaWidth = width - totalLeftBoxesWidth - totalRightBoxesWidth;
if (newMaxChartAreaWidth !== maxChartAreaWidth || newMaxChartAreaHeight !== maxChartAreaHeight) {
helpers.each(leftBoxes, function(box) {
box.height = newMaxChartAreaHeight;
});
helpers.each(rightBoxes, function(box) {
box.height = newMaxChartAreaHeight;
});
helpers.each(topBoxes, function(box) {
if (!box.fullWidth) {
box.width = newMaxChartAreaWidth;
}
});
helpers.each(bottomBoxes, function(box) {
if (!box.fullWidth) {
box.width = newMaxChartAreaWidth;
}
});
maxChartAreaHeight = newMaxChartAreaHeight;
maxChartAreaWidth = newMaxChartAreaWidth;
}
// Step 7 - Position the boxes
var left = leftPadding + leftPaddingAddition;
var top = topPadding + topPaddingAddition;
function placeBox(box) {
if (box.isHorizontal()) {
box.left = box.fullWidth ? leftPadding : totalLeftBoxesWidth;
box.right = box.fullWidth ? width - rightPadding : totalLeftBoxesWidth + maxChartAreaWidth;
box.top = top;
box.bottom = top + box.height;
// Move to next point
top = box.bottom;
} else {
box.left = left;
box.right = left + box.width;
box.top = totalTopBoxesHeight;
box.bottom = totalTopBoxesHeight + maxChartAreaHeight;
// Move to next point
left = box.right;
}
}
helpers.each(leftBoxes.concat(topBoxes), placeBox);
// Account for chart width and height
left += maxChartAreaWidth;
top += maxChartAreaHeight;
helpers.each(rightBoxes, placeBox);
helpers.each(bottomBoxes, placeBox);
// Step 8
chart.chartArea = {
left: totalLeftBoxesWidth,
top: totalTopBoxesHeight,
right: totalLeftBoxesWidth + maxChartAreaWidth,
bottom: totalTopBoxesHeight + maxChartAreaHeight
};
// Step 9
helpers.each(chartAreaBoxes, function(box) {
box.left = chart.chartArea.left;
box.top = chart.chartArea.top;
box.right = chart.chartArea.right;
box.bottom = chart.chartArea.bottom;
box.update(maxChartAreaWidth, maxChartAreaHeight);
});
}
};
/***/ }),
/* 51 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var helpers = __webpack_require__(5);
/**
* Namespace to hold static tick generation functions
* @namespace Chart.Ticks
*/
module.exports = {
/**
* Namespace to hold formatters for different types of ticks
* @namespace Chart.Ticks.formatters
*/
formatters: {
/**
* Formatter for value labels
* @method Chart.Ticks.formatters.values
* @param value the value to display
* @return {String|Array} the label to display
*/
values: function(value) {
return helpers.isArray(value) ? value : '' + value;
},
/**
* Formatter for linear numeric ticks
* @method Chart.Ticks.formatters.linear
* @param tickValue {Number} the value to be formatted
* @param index {Number} the position of the tickValue parameter in the ticks array
* @param ticks {Array<Number>} the list of ticks being converted
* @return {String} string representation of the tickValue parameter
*/
linear: function(tickValue, index, ticks) {
// If we have lots of ticks, don't use the ones
var delta = ticks.length > 3 ? ticks[2] - ticks[1] : ticks[1] - ticks[0];
// If we have a number like 2.5 as the delta, figure out how many decimal places we need
if (Math.abs(delta) > 1) {
if (tickValue !== Math.floor(tickValue)) {
// not an integer
delta = tickValue - Math.floor(tickValue);
}
}
var logDelta = helpers.log10(Math.abs(delta));
var tickString = '';
if (tickValue !== 0) {
var numDecimal = -1 * Math.floor(logDelta);
numDecimal = Math.max(Math.min(numDecimal, 20), 0); // toFixed has a max of 20 decimal places
tickString = tickValue.toFixed(numDecimal);
} else {
tickString = '0'; // never show decimal places for 0
}
return tickString;
},
logarithmic: function(tickValue, index, ticks) {
var remain = tickValue / (Math.pow(10, Math.floor(helpers.log10(tickValue))));
if (tickValue === 0) {
return '0';
} else if (remain === 1 || remain === 2 || remain === 5 || index === 0 || index === ticks.length - 1) {
return tickValue.toExponential();
}
return '';
}
}
};
/***/ }),
/* 52 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return UrlSerializer; });
/* harmony export (immutable) */ __webpack_exports__["c"] = formatUrlPart;
/* unused harmony export isPartMatch */
/* unused harmony export createMatchedData */
/* unused harmony export findLinkByComponentData */
/* unused harmony export normalizeLinks */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DeepLinkConfigToken; });
/* harmony export (immutable) */ __webpack_exports__["d"] = setupUrlSerializer;
/* unused harmony export navGroupStringtoObjects */
/* unused harmony export urlToNavGroupStrings */
/* unused harmony export convertUrlToSegments */
/* unused harmony export convertUrlToDehydratedSegments */
/* unused harmony export hydrateSegmentsWithNav */
/* unused harmony export getNavFromNavGroup */
/* unused harmony export getSegmentsFromNavGroups */
/* unused harmony export getSegmentsFromUrlPieces */
/* unused harmony export hydrateSegment */
/* unused harmony export getNonHydratedSegmentIfLinkAndUrlMatch */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_util__ = __webpack_require__(3);
/**
* @hidden
*/
var UrlSerializer = (function () {
function UrlSerializer(_app, config) {
this._app = _app;
if (config && Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["e" /* isArray */])(config.links)) {
this.links = normalizeLinks(config.links);
}
else {
this.links = [];
}
}
/**
* Parse the URL into a Path, which is made up of multiple NavSegments.
* Match which components belong to each segment.
*/
UrlSerializer.prototype.parse = function (browserUrl) {
if (browserUrl.charAt(0) === '/') {
browserUrl = browserUrl.substr(1);
}
// trim off data after ? and #
browserUrl = browserUrl.split('?')[0].split('#')[0];
return convertUrlToSegments(this._app, browserUrl, this.links);
};
UrlSerializer.prototype.createSegmentFromName = function (navContainer, nameOrComponent) {
var configLink = this.getLinkFromName(nameOrComponent);
if (configLink) {
return this._createSegment(this._app, navContainer, configLink, null);
}
return null;
};
UrlSerializer.prototype.getLinkFromName = function (nameOrComponent) {
return this.links.find(function (link) {
return (link.component === nameOrComponent) ||
(link.name === nameOrComponent);
});
};
/**
* Serialize a path, which is made up of multiple NavSegments,
* into a URL string. Turn each segment into a string and concat them to a URL.
*/
UrlSerializer.prototype.serialize = function (segments) {
if (!segments || !segments.length) {
return '/';
}
var sections = segments.map(function (segment) {
if (segment.type === 'tabs') {
if (segment.requiresExplicitNavPrefix) {
return "/" + segment.type + "/" + segment.navId + "/" + segment.secondaryId + "/" + segment.id;
}
return "/" + segment.secondaryId + "/" + segment.id;
}
// it's a nav
if (segment.requiresExplicitNavPrefix) {
return "/" + segment.type + "/" + segment.navId + "/" + segment.id;
}
return "/" + segment.id;
});
return sections.join('');
};
/**
* Serializes a component and its data into a NavSegment.
*/
UrlSerializer.prototype.serializeComponent = function (navContainer, component, data) {
if (component) {
var link = findLinkByComponentData(this.links, component, data);
if (link) {
return this._createSegment(this._app, navContainer, link, data);
}
}
return null;
};
/**
* @internal
*/
UrlSerializer.prototype._createSegment = function (app, navContainer, configLink, data) {
var urlParts = configLink.segmentParts;
if (Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["l" /* isPresent */])(data)) {
// create a copy of the original parts in the link config
urlParts = urlParts.slice();
// loop through all the data and convert it to a string
var keys = Object.keys(data);
var keysLength = keys.length;
if (keysLength) {
for (var i = 0; i < urlParts.length; i++) {
if (urlParts[i].charAt(0) === ':') {
for (var j = 0; j < keysLength; j++) {
if (urlParts[i] === ":" + keys[j]) {
// this data goes into the URL part (between slashes)
urlParts[i] = encodeURIComponent(data[keys[j]]);
break;
}
}
}
}
}
}
var requiresExplicitPrefix = true;
if (navContainer.parent) {
requiresExplicitPrefix = navContainer.parent && navContainer.parent.getAllChildNavs().length > 1;
}
else {
// if it's a root nav, and there are multiple root navs, we need an explicit prefix
requiresExplicitPrefix = app.getRootNavById(navContainer.id) && app.getRootNavs().length > 1;
}
return {
id: urlParts.join('/'),
name: configLink.name,
component: configLink.component,
loadChildren: configLink.loadChildren,
data: data,
defaultHistory: configLink.defaultHistory,
navId: navContainer.name || navContainer.id,
type: navContainer.getType(),
secondaryId: navContainer.getSecondaryIdentifier(),
requiresExplicitNavPrefix: requiresExplicitPrefix
};
};
return UrlSerializer;
}());
function formatUrlPart(name) {
name = name.replace(URL_REPLACE_REG, '-');
name = name.charAt(0).toLowerCase() + name.substring(1).replace(/[A-Z]/g, function (match) {
return '-' + match.toLowerCase();
});
while (name.indexOf('--') > -1) {
name = name.replace('--', '-');
}
if (name.charAt(0) === '-') {
name = name.substring(1);
}
if (name.substring(name.length - 1) === '-') {
name = name.substring(0, name.length - 1);
}
return encodeURIComponent(name);
}
var isPartMatch = function (urlPart, configLinkPart) {
if (Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["l" /* isPresent */])(urlPart) && Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["l" /* isPresent */])(configLinkPart)) {
if (configLinkPart.charAt(0) === ':') {
return true;
}
return (urlPart === configLinkPart);
}
return false;
};
var createMatchedData = function (matchedUrlParts, link) {
var data = null;
for (var i = 0; i < link.segmentPartsLen; i++) {
if (link.segmentParts[i].charAt(0) === ':') {
data = data || {};
data[link.segmentParts[i].substring(1)] = decodeURIComponent(matchedUrlParts[i]);
}
}
return data;
};
var findLinkByComponentData = function (links, component, instanceData) {
var foundLink = null;
var foundLinkDataMatches = -1;
for (var i = 0; i < links.length; i++) {
var link = links[i];
if (link.component === component) {
// ok, so the component matched, but multiple links can point
// to the same component, so let's make sure this is the right link
var dataMatches = 0;
if (instanceData) {
var instanceDataKeys = Object.keys(instanceData);
// this link has data
for (var j = 0; j < instanceDataKeys.length; j++) {
if (Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["l" /* isPresent */])(link.dataKeys[instanceDataKeys[j]])) {
dataMatches++;
}
}
}
else if (link.dataLen) {
// this component does not have data but the link does
continue;
}
if (dataMatches >= foundLinkDataMatches) {
foundLink = link;
foundLinkDataMatches = dataMatches;
}
}
}
return foundLink;
};
var normalizeLinks = function (links) {
for (var i = 0, ilen = links.length; i < ilen; i++) {
var link = links[i];
if (Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["f" /* isBlank */])(link.segment)) {
link.segment = link.name;
}
link.dataKeys = {};
link.segmentParts = link.segment.split('/');
link.segmentPartsLen = link.segmentParts.length;
// used for sorting
link.staticLen = link.dataLen = 0;
var stillCountingStatic = true;
for (var j = 0; j < link.segmentPartsLen; j++) {
if (link.segmentParts[j].charAt(0) === ':') {
link.dataLen++;
stillCountingStatic = false;
link.dataKeys[link.segmentParts[j].substring(1)] = true;
}
else if (stillCountingStatic) {
link.staticLen++;
}
}
}
// sort by the number of parts, with the links
// with the most parts first
return links.sort(sortConfigLinks);
};
function sortConfigLinks(a, b) {
// sort by the number of parts
if (a.segmentPartsLen > b.segmentPartsLen) {
return -1;
}
if (a.segmentPartsLen < b.segmentPartsLen) {
return 1;
}
// sort by the number of static parts in a row
if (a.staticLen > b.staticLen) {
return -1;
}
if (a.staticLen < b.staticLen) {
return 1;
}
// sort by the number of total data parts
if (a.dataLen < b.dataLen) {
return -1;
}
if (a.dataLen > b.dataLen) {
return 1;
}
return 0;
}
var URL_REPLACE_REG = /\s+|\?|\!|\$|\,|\.|\+|\"|\'|\*|\^|\||\/|\\|\[|\]|#|%|`|>|<|;|:|@|&|=/g;
/**
* @hidden
*/
var DeepLinkConfigToken = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["B" /* InjectionToken */]('USERLINKS');
function setupUrlSerializer(app, userDeepLinkConfig) {
return new UrlSerializer(app, userDeepLinkConfig);
}
function navGroupStringtoObjects(navGroupStrings) {
// each string has a known format-ish, convert it to it
return navGroupStrings.map(function (navGroupString) {
var sections = navGroupString.split('/');
if (sections[0] === 'nav') {
return {
type: 'nav',
navId: sections[1],
niceId: sections[1],
secondaryId: null,
segmentPieces: sections.splice(2)
};
}
else if (sections[0] === 'tabs') {
return {
type: 'tabs',
navId: sections[1],
niceId: sections[1],
secondaryId: sections[2],
segmentPieces: sections.splice(3)
};
}
return {
type: null,
navId: null,
niceId: null,
secondaryId: null,
segmentPieces: sections
};
});
}
function urlToNavGroupStrings(url) {
var tokens = url.split('/');
var keywordIndexes = [];
for (var i = 0; i < tokens.length; i++) {
if (i !== 0 && (tokens[i] === 'nav' || tokens[i] === 'tabs')) {
keywordIndexes.push(i);
}
}
// append the last index + 1 to the list no matter what
keywordIndexes.push(tokens.length);
var groupings = [];
var activeKeywordIndex = 0;
var tmpArray = [];
for (var i = 0; i < tokens.length; i++) {
if (i >= keywordIndexes[activeKeywordIndex]) {
groupings.push(tmpArray.join('/'));
tmpArray = [];
activeKeywordIndex++;
}
tmpArray.push(tokens[i]);
}
// okay, after the loop we've gotta push one more time just to be safe
groupings.push(tmpArray.join('/'));
return groupings;
}
function convertUrlToSegments(app, url, navLinks) {
var pairs = convertUrlToDehydratedSegments(url, navLinks);
return hydrateSegmentsWithNav(app, pairs);
}
function convertUrlToDehydratedSegments(url, navLinks) {
var navGroupStrings = urlToNavGroupStrings(url);
var navGroups = navGroupStringtoObjects(navGroupStrings);
return getSegmentsFromNavGroups(navGroups, navLinks);
}
function hydrateSegmentsWithNav(app, dehydratedSegmentPairs) {
var segments = [];
for (var i = 0; i < dehydratedSegmentPairs.length; i++) {
var navs = getNavFromNavGroup(dehydratedSegmentPairs[i].navGroup, app);
// okay, cool, let's walk through the segments and hydrate them
for (var _i = 0, _a = dehydratedSegmentPairs[i].segments; _i < _a.length; _i++) {
var dehydratedSegment = _a[_i];
if (navs.length === 1) {
segments.push(hydrateSegment(dehydratedSegment, navs[0]));
navs = navs[0].getActiveChildNavs();
}
else if (navs.length > 1) {
// this is almost certainly an async race condition bug in userland
// if you're in this state, it would be nice to just bail here
// but alas we must perservere and handle the issue
// the simple solution is to just use the last child
// because that is probably what the user wants anyway
// remember, do not harm, even if it makes our shizzle ugly
segments.push(hydrateSegment(dehydratedSegment, navs[navs.length - 1]));
navs = navs[navs.length - 1].getActiveChildNavs();
}
else {
break;
}
}
}
return segments;
}
function getNavFromNavGroup(navGroup, app) {
if (navGroup.navId) {
var rootNav = app.getNavByIdOrName(navGroup.navId);
if (rootNav) {
return [rootNav];
}
return [];
}
// we don't know what nav to use, so just use the root nav.
// if there is more than one root nav, throw an error
return app.getRootNavs();
}
/*
* Let's face the facts: Getting a dehydrated segment from the url is really hard
* because we need to do a ton of crazy looping
* the are chunks of a url that are totally irrelevant at this stage, such as the secondary identifier
* stating which tab is selected, etc.
* but is necessary.
* We look at segment pieces in reverse order to try to build segments
* as in, if you had an array like this
* ['my', 'super', 'cool', 'url']
* we want to look at the pieces in reverse order:
* url
* cool url
* super cool url
* my super cool url
* cool
* super cool
* my super cool
* super
* my super
* my
**/
function getSegmentsFromNavGroups(navGroups, navLinks) {
var pairs = [];
var usedNavLinks = new Set();
for (var _i = 0, navGroups_1 = navGroups; _i < navGroups_1.length; _i++) {
var navGroup = navGroups_1[_i];
var segments = [];
var segmentPieces = navGroup.segmentPieces.concat([]);
for (var i = segmentPieces.length; i >= 0; i--) {
var created = false;
for (var j = 0; j < i; j++) {
var startIndex = i - j - 1;
var endIndex = i;
var subsetOfUrl = segmentPieces.slice(startIndex, endIndex);
for (var _a = 0, navLinks_1 = navLinks; _a < navLinks_1.length; _a++) {
var navLink = navLinks_1[_a];
if (!usedNavLinks.has(navLink.name)) {
var segment = getSegmentsFromUrlPieces(subsetOfUrl, navLink);
if (segment) {
i = startIndex + 1;
usedNavLinks.add(navLink.name);
created = true;
// sweet, we found a segment
segments.push(segment);
// now we want to null out the url subsection in the segmentPieces
for (var k = startIndex; k < endIndex; k++) {
segmentPieces[k] = null;
}
break;
}
}
}
if (created) {
break;
}
}
if (!created && segmentPieces[i - 1]) {
// this is very likely a tab's secondary identifier
segments.push({
id: null,
name: null,
secondaryId: segmentPieces[i - 1],
component: null,
loadChildren: null,
data: null,
defaultHistory: null
});
}
}
// since we're getting segments in from right-to-left in the url, reverse them
// so they're in the correct order. Also filter out and bogus segments
var orderedSegments = segments.reverse();
// okay, this is the lazy persons approach here.
// so here's the deal! Right now if section of the url is not a part of a segment
// it is almost certainly the secondaryId for a tabs component
// basically, knowing the segment for the `tab` itself is good, but we also need to know
// which tab is selected, so we have an identifer in the url that is associated with the tabs component
// telling us which tab is selected. With that in mind, we are going to go through and find the segments with only secondary identifiers,
// and simply add the secondaryId to the next segment, and then remove the empty segment from the list
for (var i = 0; i < orderedSegments.length; i++) {
if (orderedSegments[i].secondaryId && !orderedSegments[i].id && ((i + 1) <= orderedSegments.length - 1)) {
orderedSegments[i + 1].secondaryId = orderedSegments[i].secondaryId;
orderedSegments[i] = null;
}
}
var cleanedSegments = segments.filter(function (segment) { return !!segment; });
// if the nav group has a secondary id, make sure the first segment also has it set
if (navGroup.secondaryId && segments.length) {
cleanedSegments[0].secondaryId = navGroup.secondaryId;
}
pairs.push({
navGroup: navGroup,
segments: cleanedSegments
});
}
return pairs;
}
function getSegmentsFromUrlPieces(urlSections, navLink) {
if (navLink.segmentPartsLen !== urlSections.length) {
return null;
}
for (var i = 0; i < urlSections.length; i++) {
if (!isPartMatch(urlSections[i], navLink.segmentParts[i])) {
// just return an empty array if the part doesn't match
return null;
}
}
return {
id: urlSections.join('/'),
name: navLink.name,
component: navLink.component,
loadChildren: navLink.loadChildren,
data: createMatchedData(urlSections, navLink),
defaultHistory: navLink.defaultHistory
};
}
function hydrateSegment(segment, nav) {
var hydratedSegment = Object.assign({}, segment);
hydratedSegment.type = nav.getType();
hydratedSegment.navId = nav.name || nav.id;
// secondaryId is set on an empty dehydrated segment in the case of tabs to identify which tab is selected
hydratedSegment.secondaryId = segment.secondaryId;
return hydratedSegment;
}
function getNonHydratedSegmentIfLinkAndUrlMatch(urlChunks, navLink) {
var allSegmentsMatch = true;
for (var i = 0; i < urlChunks.length; i++) {
if (!isPartMatch(urlChunks[i], navLink.segmentParts[i])) {
allSegmentsMatch = false;
break;
}
}
if (allSegmentsMatch) {
return {
id: navLink.segmentParts.join('/'),
name: navLink.name,
component: navLink.component,
loadChildren: navLink.loadChildren,
data: createMatchedData(urlChunks, navLink),
defaultHistory: navLink.defaultHistory
};
}
return null;
}
//# sourceMappingURL=url-serializer.js.map
/***/ }),
/* 53 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NavControllerBase; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__nav_util__ = __webpack_require__(26);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__view_controller__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__components_ion__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__nav_controller__ = __webpack_require__(27);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__nav_params__ = __webpack_require__(18);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__swipe_back__ = __webpack_require__(386);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
* This class is for internal use only. It is not exported publicly.
*/
var NavControllerBase = (function (_super) {
__extends(NavControllerBase, _super);
function NavControllerBase(parent, _app, config, plt, elementRef, _zone, renderer, _cfr, _gestureCtrl, _trnsCtrl, _linker, _domCtrl, _errHandler) {
var _this = _super.call(this, config, elementRef, renderer) || this;
_this.parent = parent;
_this._app = _app;
_this.config = config;
_this.plt = plt;
_this._zone = _zone;
_this._cfr = _cfr;
_this._gestureCtrl = _gestureCtrl;
_this._trnsCtrl = _trnsCtrl;
_this._linker = _linker;
_this._domCtrl = _domCtrl;
_this._errHandler = _errHandler;
_this._ids = -1;
_this._init = false;
_this._queue = [];
_this._trnsId = null;
_this._trnsTm = false;
_this._views = [];
_this._zIndexOffset = 0;
_this.viewDidLoad = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
_this.viewWillEnter = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
_this.viewDidEnter = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
_this.viewWillLeave = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
_this.viewDidLeave = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
_this.viewWillUnload = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
_this._sbEnabled = config.getBoolean('swipeBackEnabled');
_this._children = [];
_this.id = 'n' + (++ctrlIds);
_this._destroyed = false;
return _this;
}
Object.defineProperty(NavControllerBase.prototype, "swipeBackEnabled", {
get: function () {
return this._sbEnabled;
},
set: function (val) {
this._sbEnabled = Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["o" /* isTrueProperty */])(val);
this._swipeBackCheck();
},
enumerable: true,
configurable: true
});
NavControllerBase.prototype.push = function (page, params, opts, done) {
return this._queueTrns({
insertStart: -1,
insertViews: [{ page: page, params: params }],
opts: opts,
}, done);
};
NavControllerBase.prototype.insert = function (insertIndex, page, params, opts, done) {
return this._queueTrns({
insertStart: insertIndex,
insertViews: [{ page: page, params: params }],
opts: opts,
}, done);
};
NavControllerBase.prototype.insertPages = function (insertIndex, insertPages, opts, done) {
return this._queueTrns({
insertStart: insertIndex,
insertViews: insertPages,
opts: opts,
}, done);
};
NavControllerBase.prototype.pop = function (opts, done) {
return this._queueTrns({
removeStart: -1,
removeCount: 1,
opts: opts,
}, done);
};
NavControllerBase.prototype.popTo = function (indexOrViewCtrl, opts, done) {
var config = {
removeStart: -1,
removeCount: -1,
opts: opts
};
if (Object(__WEBPACK_IMPORTED_MODULE_3__view_controller__["b" /* isViewController */])(indexOrViewCtrl)) {
config.removeView = indexOrViewCtrl;
config.removeStart = 1;
}
else if (Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["j" /* isNumber */])(indexOrViewCtrl)) {
config.removeStart = indexOrViewCtrl + 1;
}
return this._queueTrns(config, done);
};
NavControllerBase.prototype.popToRoot = function (opts, done) {
return this._queueTrns({
removeStart: 1,
removeCount: -1,
opts: opts,
}, done);
};
NavControllerBase.prototype.popAll = function () {
var promises = [];
for (var i = this._views.length - 1; i >= 0; i--) {
promises.push(this.pop(null));
}
return Promise.all(promises);
};
NavControllerBase.prototype.remove = function (startIndex, removeCount, opts, done) {
if (removeCount === void 0) { removeCount = 1; }
return this._queueTrns({
removeStart: startIndex,
removeCount: removeCount,
opts: opts,
}, done);
};
NavControllerBase.prototype.removeView = function (viewController, opts, done) {
return this._queueTrns({
removeView: viewController,
removeStart: 0,
removeCount: 1,
opts: opts,
}, done);
};
NavControllerBase.prototype.setRoot = function (pageOrViewCtrl, params, opts, done) {
return this.setPages([{ page: pageOrViewCtrl, params: params }], opts, done);
};
NavControllerBase.prototype.setPages = function (viewControllers, opts, done) {
if (Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["f" /* isBlank */])(opts)) {
opts = {};
}
// if animation wasn't set to true then default it to NOT animate
if (opts.animate !== true) {
opts.animate = false;
}
return this._queueTrns({
insertStart: 0,
insertViews: viewControllers,
removeStart: 0,
removeCount: -1,
opts: opts
}, done);
};
// _queueTrns() adds a navigation stack change to the queue and schedules it to run:
// 1. _nextTrns(): consumes the next transition in the queue
// 2. _viewInit(): initializes enteringView if required
// 3. _viewTest(): ensures canLeave/canEnter returns true, so the operation can continue
// 4. _postViewInit(): add/remove the views from the navigation stack
// 5. _transitionInit(): initializes the visual transition if required and schedules it to run
// 6. _viewAttachToDOM(): attaches the enteringView to the DOM
// 7. _transitionStart(): called once the transition actually starts, it initializes the Animation underneath.
// 8. _transitionFinish(): called once the transition finishes
// 9. _cleanup(): syncs the navigation internal state with the DOM. For example it removes the pages from the DOM or hides/show them.
NavControllerBase.prototype._queueTrns = function (ti, done) {
var promise = new Promise(function (resolve, reject) {
ti.resolve = resolve;
ti.reject = reject;
});
ti.done = done;
// Normalize empty
if (ti.insertViews && ti.insertViews.length === 0) {
ti.insertViews = undefined;
}
// Enqueue transition instruction
this._queue.push(ti);
// if there isn't a transition already happening
// then this will kick off this transition
this._nextTrns();
return promise;
};
NavControllerBase.prototype._success = function (result, ti) {
if (this._queue === null) {
this._fireError('nav controller was destroyed', ti);
return;
}
this._init = true;
this._trnsId = null;
// ensure we're not transitioning here
this.setTransitioning(false);
this._swipeBackCheck();
// let's see if there's another to kick off
this._nextTrns();
if (ti.done) {
ti.done(result.hasCompleted, result.requiresTransition, result.enteringName, result.leavingName, result.direction);
}
ti.resolve(result.hasCompleted);
};
NavControllerBase.prototype._failed = function (rejectReason, ti) {
if (this._queue === null) {
this._fireError('nav controller was destroyed', ti);
return;
}
this._trnsId = null;
this._queue.length = 0;
// let's see if there's another to kick off
this.setTransitioning(false);
this._swipeBackCheck();
this._nextTrns();
this._fireError(rejectReason, ti);
};
NavControllerBase.prototype._fireError = function (rejectReason, ti) {
if (ti.done) {
ti.done(false, false, rejectReason);
}
if (ti.reject && !this._destroyed) {
ti.reject(rejectReason);
}
else {
ti.resolve(false);
}
};
NavControllerBase.prototype._nextTrns = function () {
var _this = this;
// this is the framework's bread 'n butta function
// only one transition is allowed at any given time
if (this.isTransitioning()) {
return false;
}
// there is no transition happening right now
// get the next instruction
var ti = this._queue.shift();
if (!ti) {
return false;
}
// set that this nav is actively transitioning
var enteringView;
var leavingView;
this._startTI(ti)
.then(function () { return _this._loadLazyLoading(ti); })
.then(function () {
leavingView = _this.getActive();
enteringView = _this._getEnteringView(ti, leavingView);
if (!leavingView && !enteringView) {
throw 'no views in the stack to be removed';
}
if (enteringView && enteringView._state === __WEBPACK_IMPORTED_MODULE_1__nav_util__["h" /* STATE_NEW */]) {
_this._viewInit(enteringView);
}
// Needs transition?
ti.requiresTransition = (ti.enteringRequiresTransition || ti.leavingRequiresTransition) && enteringView !== leavingView;
})
.then(function () { return _this._viewTest(enteringView, leavingView, ti); })
.then(function () { return _this._postViewInit(enteringView, leavingView, ti); })
.then(function () { return _this._transition(enteringView, leavingView, ti); })
.then(function (result) { return _this._success(result, ti); })
.catch(function (rejectReason) { return _this._failed(rejectReason, ti); });
return true;
};
NavControllerBase.prototype._startTI = function (ti) {
var viewsLength = this._views.length;
if (Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["l" /* isPresent */])(ti.removeView)) {
(void 0) /* assert */;
(void 0) /* assert */;
var index = this.indexOf(ti.removeView);
if (index < 0) {
return Promise.reject('removeView was not found');
}
ti.removeStart += index;
}
if (Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["l" /* isPresent */])(ti.removeStart)) {
if (ti.removeStart < 0) {
ti.removeStart = (viewsLength - 1);
}
if (ti.removeCount < 0) {
ti.removeCount = (viewsLength - ti.removeStart);
}
ti.leavingRequiresTransition = (ti.removeCount > 0) && ((ti.removeStart + ti.removeCount) === viewsLength);
}
if (ti.insertViews) {
// allow -1 to be passed in to auto push it on the end
// and clean up the index if it's larger then the size of the stack
if (ti.insertStart < 0 || ti.insertStart > viewsLength) {
ti.insertStart = viewsLength;
}
ti.enteringRequiresTransition = (ti.insertStart === viewsLength);
}
this.setTransitioning(true);
return Promise.resolve();
};
NavControllerBase.prototype._loadLazyLoading = function (ti) {
var _this = this;
var insertViews = ti.insertViews;
if (insertViews) {
(void 0) /* assert */;
return Object(__WEBPACK_IMPORTED_MODULE_1__nav_util__["i" /* convertToViews */])(this._linker, insertViews).then(function (viewControllers) {
(void 0) /* assert */;
viewControllers = viewControllers.filter(function (v) { return v !== null; });
if (viewControllers.length === 0) {
throw 'invalid views to insert';
}
// Check all the inserted view are correct
for (var i = 0; i < viewControllers.length; i++) {
var view = viewControllers[i];
var nav = view._nav;
if (nav && nav !== _this) {
throw 'inserted view was already inserted';
}
if (view._state === __WEBPACK_IMPORTED_MODULE_1__nav_util__["f" /* STATE_DESTROYED */]) {
throw 'inserted view was already destroyed';
}
}
ti.insertViews = viewControllers;
});
}
return Promise.resolve();
};
NavControllerBase.prototype._getEnteringView = function (ti, leavingView) {
var insertViews = ti.insertViews;
if (insertViews) {
// grab the very last view of the views to be inserted
// and initialize it as the new entering view
return insertViews[insertViews.length - 1];
}
var removeStart = ti.removeStart;
if (Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["l" /* isPresent */])(removeStart)) {
var views = this._views;
var removeEnd = removeStart + ti.removeCount;
var i;
var view;
for (i = views.length - 1; i >= 0; i--) {
view = views[i];
if ((i < removeStart || i >= removeEnd) && view !== leavingView) {
return view;
}
}
}
return null;
};
NavControllerBase.prototype._postViewInit = function (enteringView, leavingView, ti) {
var _this = this;
(void 0) /* assert */;
(void 0) /* assert */;
(void 0) /* assert */;
var opts = ti.opts || {};
var insertViews = ti.insertViews;
var removeStart = ti.removeStart;
var removeCount = ti.removeCount;
var view;
var i;
var destroyQueue;
// there are views to remove
if (Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["l" /* isPresent */])(removeStart)) {
(void 0) /* assert */;
(void 0) /* assert */;
destroyQueue = [];
for (i = 0; i < removeCount; i++) {
view = this._views[i + removeStart];
if (view && view !== enteringView && view !== leavingView) {
destroyQueue.push(view);
}
}
// default the direction to "back"
opts.direction = opts.direction || __WEBPACK_IMPORTED_MODULE_1__nav_util__["a" /* DIRECTION_BACK */];
}
var finalBalance = this._views.length + (insertViews ? insertViews.length : 0) - (removeCount ? removeCount : 0);
(void 0) /* assert */;
if (finalBalance === 0 && !this._isPortal) {
console.warn("You can't remove all the pages in the navigation stack. nav.pop() is probably called too many times.", this, this.getNativeElement());
throw 'navigation stack needs at least one root page';
}
// At this point the transition can not be rejected, any throw should be an error
// there are views to insert
if (insertViews) {
// manually set the new view's id if an id was passed in the options
if (Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["l" /* isPresent */])(opts.id)) {
enteringView.id = opts.id;
}
// add the views to the
for (i = 0; i < insertViews.length; i++) {
view = insertViews[i];
this._insertViewAt(view, ti.insertStart + i);
}
if (ti.enteringRequiresTransition) {
// default to forward if not already set
opts.direction = opts.direction || __WEBPACK_IMPORTED_MODULE_1__nav_util__["b" /* DIRECTION_FORWARD */];
}
}
// if the views to be removed are in the beginning or middle
// and there is not a view that needs to visually transition out
// then just destroy them and don't transition anything
// batch all of lifecycles together
// let's make sure, callbacks are zoned
if (destroyQueue && destroyQueue.length > 0) {
this._zone.run(function () {
for (i = 0; i < destroyQueue.length; i++) {
view = destroyQueue[i];
_this._willLeave(view, true);
_this._didLeave(view);
_this._willUnload(view);
}
});
// once all lifecycle events has been delivered, we can safely detroy the views
for (i = 0; i < destroyQueue.length; i++) {
this._destroyView(destroyQueue[i]);
}
}
// set which animation it should use if it wasn't set yet
if (ti.requiresTransition && !opts.animation) {
if (Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["l" /* isPresent */])(ti.removeStart)) {
opts.animation = (leavingView || enteringView).getTransitionName(opts.direction);
}
else {
opts.animation = (enteringView || leavingView).getTransitionName(opts.direction);
}
}
ti.opts = opts;
};
/**
* DOM WRITE
*/
NavControllerBase.prototype._viewInit = function (enteringView) {
(void 0) /* assert */;
(void 0) /* assert */;
// render the entering view, and all child navs and views
// entering view has not been initialized yet
var componentProviders = __WEBPACK_IMPORTED_MODULE_0__angular_core__["U" /* ReflectiveInjector */].resolve([
{ provide: __WEBPACK_IMPORTED_MODULE_5__nav_controller__["a" /* NavController */], useValue: this },
{ provide: __WEBPACK_IMPORTED_MODULE_3__view_controller__["a" /* ViewController */], useValue: enteringView },
{ provide: __WEBPACK_IMPORTED_MODULE_6__nav_params__["a" /* NavParams */], useValue: enteringView.getNavParams() }
]);
var componentFactory = this._linker.resolveComponent(enteringView.component);
var childInjector = __WEBPACK_IMPORTED_MODULE_0__angular_core__["U" /* ReflectiveInjector */].fromResolvedProviders(componentProviders, this._viewport.parentInjector);
// create ComponentRef and set it to the entering view
enteringView.init(componentFactory.create(childInjector, []));
enteringView._state = __WEBPACK_IMPORTED_MODULE_1__nav_util__["g" /* STATE_INITIALIZED */];
this._preLoad(enteringView);
};
NavControllerBase.prototype._viewAttachToDOM = function (view, componentRef, viewport) {
(void 0) /* assert */;
(void 0) /* assert */;
// fire willLoad before change detection runs
this._willLoad(view);
// render the component ref instance to the DOM
// ******** DOM WRITE ****************
viewport.insert(componentRef.hostView, viewport.length);
view._state = __WEBPACK_IMPORTED_MODULE_1__nav_util__["e" /* STATE_ATTACHED */];
if (view._cssClass) {
// the ElementRef of the actual ion-page created
var pageElement = componentRef.location.nativeElement;
// ******** DOM WRITE ****************
this._renderer.setElementClass(pageElement, view._cssClass, true);
}
componentRef.changeDetectorRef.detectChanges();
// successfully finished loading the entering view
// fire off the "didLoad" lifecycle events
this._zone.run(this._didLoad.bind(this, view));
};
NavControllerBase.prototype._viewTest = function (enteringView, leavingView, ti) {
// Only test canLeave/canEnter if there is transition
if (!ti.requiresTransition) {
return Promise.resolve();
}
var promises = [];
if (leavingView) {
promises.push(leavingView._lifecycleTest('Leave'));
}
if (enteringView) {
promises.push(enteringView._lifecycleTest('Enter'));
}
if (promises.length === 0) {
return Promise.resolve();
}
// darn, async promises, gotta wait for them to resolve
return Promise.all(promises).then(function (values) {
if (values.some(function (result) { return result === false; })) {
throw 'canEnter/Leave returned false';
}
}).catch(function (reason) {
// Do not
ti.reject = null;
throw reason;
});
};
NavControllerBase.prototype._transition = function (enteringView, leavingView, ti) {
var _this = this;
if (!ti.requiresTransition) {
// transition is not required, so we are already done!
// they're inserting/removing the views somewhere in the middle or
// beginning, so visually nothing needs to animate/transition
// resolve immediately because there's no animation that's happening
return Promise.resolve({
hasCompleted: true,
requiresTransition: false
});
}
var opts = ti.opts;
// figure out if this transition is the root one or a
// child of a parent nav that has the root transition
this._trnsId = this._trnsCtrl.getRootTrnsId(this);
if (this._trnsId === null) {
// this is the root transition, meaning all child navs and their views
// should be added as a child transition to this one
this._trnsId = this._trnsCtrl.nextId();
}
// create the transition options
var animationOpts = {
animation: opts.animation,
direction: opts.direction,
duration: (opts.animate === false ? 0 : opts.duration),
easing: opts.easing,
isRTL: this._config.plt.isRTL,
ev: opts.ev,
};
// create the transition animation from the TransitionController
// this will either create the root transition, or add it as a child transition
var transition = this._trnsCtrl.get(this._trnsId, enteringView, leavingView, animationOpts);
// ensure any swipeback transitions are cleared out
this._sbTrns && this._sbTrns.destroy();
this._sbTrns = null;
// swipe to go back root transition
if (transition.isRoot() && opts.progressAnimation) {
this._sbTrns = transition;
}
// transition start has to be registered before attaching the view to the DOM!
var promise = new Promise(function (resolve) { return transition.registerStart(resolve); }).then(function () {
return _this._transitionStart(transition, enteringView, leavingView, opts);
});
if (enteringView && (enteringView._state === __WEBPACK_IMPORTED_MODULE_1__nav_util__["g" /* STATE_INITIALIZED */])) {
// render the entering component in the DOM
// this would also render new child navs/views
// which may have their very own async canEnter/Leave tests
// ******** DOM WRITE ****************
this._viewAttachToDOM(enteringView, enteringView._cmp, this._viewport);
}
if (!transition.hasChildren) {
// lowest level transition, so kick it off and let it bubble up to start all of them
transition.start();
}
return promise;
};
NavControllerBase.prototype._transitionStart = function (transition, enteringView, leavingView, opts) {
var _this = this;
(void 0) /* assert */;
this._trnsId = null;
// set the correct zIndex for the entering and leaving views
// ******** DOM WRITE ****************
Object(__WEBPACK_IMPORTED_MODULE_1__nav_util__["n" /* setZIndex */])(this, enteringView, leavingView, opts.direction, this._renderer);
// always ensure the entering view is viewable
// ******** DOM WRITE ****************
enteringView && enteringView._domShow(true, this._renderer);
// always ensure the leaving view is viewable
// ******** DOM WRITE ****************
leavingView && leavingView._domShow(true, this._renderer);
// initialize the transition
transition.init();
// we should animate (duration > 0) if the pushed page is not the first one (startup)
// or if it is a portal (modal, actionsheet, etc.)
var isFirstPage = !this._init && this._views.length === 1;
var shouldNotAnimate = isFirstPage && !this._isPortal;
var canNotAnimate = this._config.get('animate') === false;
if (shouldNotAnimate || canNotAnimate) {
opts.animate = false;
}
if (opts.animate === false) {
// if it was somehow set to not animation, then make the duration zero
transition.duration(0);
}
// create a callback that needs to run within zone
// that will fire off the willEnter/Leave lifecycle events at the right time
transition.beforeAddRead(this._viewsWillLifecycles.bind(this, enteringView, leavingView));
// get the set duration of this transition
var duration = transition.getDuration();
// create a callback for when the animation is done
var promise = new Promise(function (resolve) {
transition.onFinish(resolve);
});
if (transition.isRoot()) {
// this is the top most, or only active transition, so disable the app
// add XXms to the duration the app is disabled when the keyboard is open
if (duration > DISABLE_APP_MINIMUM_DURATION && opts.disableApp !== false) {
// if this transition has a duration and this is the root transition
// then set that the app is actively disabled
this._app.setEnabled(false, duration + ACTIVE_TRANSITION_OFFSET, opts.minClickBlockDuration);
}
else {
(void 0) /* console.debug */;
}
// cool, let's do this, start the transition
if (opts.progressAnimation) {
// this is a swipe to go back, just get the transition progress ready
// kick off the swipe animation start
transition.progressStart();
}
else {
// only the top level transition should actually start "play"
// kick it off and let it play through
// ******** DOM WRITE ****************
transition.play();
}
}
return promise.then(function () { return _this._zone.run(function () {
return _this._transitionFinish(transition, opts);
}); });
};
NavControllerBase.prototype._transitionFinish = function (transition, opts) {
var hasCompleted = transition.hasCompleted;
var enteringView = transition.enteringView;
var leavingView = transition.leavingView;
// mainly for testing
var enteringName;
var leavingName;
if (hasCompleted) {
// transition has completed (went from 0 to 1)
if (enteringView) {
enteringName = enteringView.name;
this._didEnter(enteringView);
}
if (leavingView) {
leavingName = leavingView.name;
this._didLeave(leavingView);
}
this._cleanup(enteringView);
}
else {
// If transition does not complete, we have to cleanup anyway, because
// previous pages in the stack are not hidden probably.
this._cleanup(leavingView);
}
if (transition.isRoot()) {
// this is the root transition
// it's safe to destroy this transition
this._trnsCtrl.destroy(transition.trnsId);
// it's safe to enable the app again
this._app.setEnabled(true);
// mark ourselves as not transitioning - `deepLinker navchange` requires this
// TODO - probably could be resolved in a better way
this.setTransitioning(false);
if (!this.hasChildren() && opts.updateUrl !== false) {
// notify deep linker of the nav change
// if a direction was provided and should update url
this._linker.navChange(opts.direction);
}
if (opts.keyboardClose !== false) {
// the keyboard is still open!
// no problem, let's just close for them
this.plt.focusOutActiveElement();
}
}
return {
hasCompleted: hasCompleted,
requiresTransition: true,
enteringName: enteringName,
leavingName: leavingName,
direction: opts.direction
};
};
NavControllerBase.prototype._viewsWillLifecycles = function (enteringView, leavingView) {
var _this = this;
if (enteringView || leavingView) {
this._zone.run(function () {
// Here, the order is important. WillLeave must be called before WillEnter.
if (leavingView) {
var willUnload = enteringView ? leavingView.index > enteringView.index : true;
_this._willLeave(leavingView, willUnload);
}
enteringView && _this._willEnter(enteringView);
});
}
};
NavControllerBase.prototype._insertViewAt = function (view, index) {
var existingIndex = this._views.indexOf(view);
if (existingIndex > -1) {
// this view is already in the stack!!
// move it to its new location
(void 0) /* assert */;
this._views.splice(index, 0, this._views.splice(existingIndex, 1)[0]);
}
else {
(void 0) /* assert */;
// this is a new view to add to the stack
// create the new entering view
view._setNav(this);
// give this inserted view an ID
this._ids++;
if (!view.id) {
view.id = this.id + "-" + this._ids;
}
// insert the entering view into the correct index in the stack
this._views.splice(index, 0, view);
}
};
NavControllerBase.prototype._removeView = function (view) {
(void 0) /* assert */;
var views = this._views;
var index = views.indexOf(view);
(void 0) /* assert */;
if (index >= 0) {
views.splice(index, 1);
}
};
NavControllerBase.prototype._destroyView = function (view) {
view._destroy(this._renderer);
this._removeView(view);
};
/**
* DOM WRITE
*/
NavControllerBase.prototype._cleanup = function (activeView) {
// ok, cleanup time!! Destroy all of the views that are
// INACTIVE and come after the active view
// only do this if the views exist, though
if (!this._destroyed) {
var activeViewIndex = this._views.indexOf(activeView);
var views = this._views;
var reorderZIndexes = false;
var view = void 0;
var i = void 0;
for (i = views.length - 1; i >= 0; i--) {
view = views[i];
if (i > activeViewIndex) {
// this view comes after the active view
// let's unload it
this._willUnload(view);
this._destroyView(view);
}
else if (i < activeViewIndex && !this._isPortal) {
// this view comes before the active view
// and it is not a portal then ensure it is hidden
view._domShow(false, this._renderer);
}
if (view._zIndex <= 0) {
reorderZIndexes = true;
}
}
if (!this._isPortal && reorderZIndexes) {
for (i = 0; i < views.length; i++) {
view = views[i];
// ******** DOM WRITE ****************
view._setZIndex(view._zIndex + __WEBPACK_IMPORTED_MODULE_1__nav_util__["d" /* INIT_ZINDEX */] + 1, this._renderer);
}
}
}
};
NavControllerBase.prototype._preLoad = function (view) {
(void 0) /* assert */;
view._preLoad();
};
NavControllerBase.prototype._willLoad = function (view) {
(void 0) /* assert */;
try {
view._willLoad();
}
catch (e) {
this._errHandler && this._errHandler.handleError(e);
}
};
NavControllerBase.prototype._didLoad = function (view) {
(void 0) /* assert */;
(void 0) /* assert */;
try {
view._didLoad();
this.viewDidLoad.emit(view);
this._app.viewDidLoad.emit(view);
}
catch (e) {
this._errHandler && this._errHandler.handleError(e);
}
};
NavControllerBase.prototype._willEnter = function (view) {
(void 0) /* assert */;
(void 0) /* assert */;
try {
view._willEnter();
this.viewWillEnter.emit(view);
this._app.viewWillEnter.emit(view);
}
catch (e) {
this._errHandler && this._errHandler.handleError(e);
}
};
NavControllerBase.prototype._didEnter = function (view) {
(void 0) /* assert */;
(void 0) /* assert */;
try {
view._didEnter();
this.viewDidEnter.emit(view);
this._app.viewDidEnter.emit(view);
}
catch (e) {
this._errHandler && this._errHandler.handleError(e);
}
};
NavControllerBase.prototype._willLeave = function (view, willUnload) {
(void 0) /* assert */;
(void 0) /* assert */;
try {
view._willLeave(willUnload);
this.viewWillLeave.emit(view);
this._app.viewWillLeave.emit(view);
}
catch (e) {
this._errHandler && this._errHandler.handleError(e);
}
};
NavControllerBase.prototype._didLeave = function (view) {
(void 0) /* assert */;
(void 0) /* assert */;
try {
view._didLeave();
this.viewDidLeave.emit(view);
this._app.viewDidLeave.emit(view);
}
catch (e) {
this._errHandler && this._errHandler.handleError(e);
}
};
NavControllerBase.prototype._willUnload = function (view) {
(void 0) /* assert */;
(void 0) /* assert */;
try {
view._willUnload();
this.viewWillUnload.emit(view);
this._app.viewWillUnload.emit(view);
}
catch (e) {
this._errHandler && this._errHandler.handleError(e);
}
};
NavControllerBase.prototype.hasChildren = function () {
return this._children && this._children.length > 0;
};
NavControllerBase.prototype.getActiveChildNavs = function () {
return this._children;
};
NavControllerBase.prototype.getAllChildNavs = function () {
return this._children;
};
NavControllerBase.prototype.registerChildNav = function (container) {
this._children.push(container);
};
NavControllerBase.prototype.unregisterChildNav = function (nav) {
this._children = this._children.filter(function (child) { return child !== nav; });
};
NavControllerBase.prototype.destroy = function () {
var views = this._views;
var view;
for (var i = 0; i < views.length; i++) {
view = views[i];
view._willUnload();
view._destroy(this._renderer);
}
// release swipe back gesture and transition
this._sbGesture && this._sbGesture.destroy();
this._sbTrns && this._sbTrns.destroy();
this._queue = this._views = this._sbGesture = this._sbTrns = null;
// Unregister navcontroller
if (this.parent && this.parent.unregisterChildNav) {
this.parent.unregisterChildNav(this);
}
else if (this._app) {
this._app.unregisterRootNav(this);
}
this._destroyed = true;
};
NavControllerBase.prototype.swipeBackStart = function () {
if (this.isTransitioning() || this._queue.length > 0) {
return;
}
// default the direction to "back";
var opts = {
direction: __WEBPACK_IMPORTED_MODULE_1__nav_util__["a" /* DIRECTION_BACK */],
progressAnimation: true
};
this._queueTrns({
removeStart: -1,
removeCount: 1,
opts: opts,
}, null);
};
NavControllerBase.prototype.swipeBackProgress = function (stepValue) {
if (this._sbTrns && this._sbGesture) {
// continue to disable the app while actively dragging
this._app.setEnabled(false, ACTIVE_TRANSITION_DEFAULT);
this.setTransitioning(true);
// set the transition animation's progress
this._sbTrns.progressStep(stepValue);
}
};
NavControllerBase.prototype.swipeBackEnd = function (shouldComplete, currentStepValue, velocity) {
if (this._sbTrns && this._sbGesture) {
// the swipe back gesture has ended
var dur = this._sbTrns.getDuration() / (Math.abs(velocity) + 1);
this._sbTrns.progressEnd(shouldComplete, currentStepValue, dur);
}
};
NavControllerBase.prototype._swipeBackCheck = function () {
if (this.canSwipeBack()) {
if (!this._sbGesture) {
this._sbGesture = new __WEBPACK_IMPORTED_MODULE_7__swipe_back__["a" /* SwipeBackGesture */](this.plt, this, this._gestureCtrl, this._domCtrl);
}
this._sbGesture.listen();
}
else if (this._sbGesture) {
this._sbGesture.unlisten();
}
};
NavControllerBase.prototype.canSwipeBack = function () {
return (this._sbEnabled &&
!this._isPortal &&
!this._children.length &&
!this.isTransitioning() &&
this._app.isEnabled() &&
this.canGoBack());
};
NavControllerBase.prototype.canGoBack = function () {
var activeView = this.getActive();
return !!(activeView && activeView.enableBack());
};
NavControllerBase.prototype.isTransitioning = function () {
return this._trnsTm;
};
NavControllerBase.prototype.setTransitioning = function (isTransitioning) {
this._trnsTm = isTransitioning;
};
NavControllerBase.prototype.getActive = function () {
return this._views[this._views.length - 1];
};
NavControllerBase.prototype.isActive = function (view) {
return (view === this.getActive());
};
NavControllerBase.prototype.getByIndex = function (index) {
return this._views[index];
};
NavControllerBase.prototype.getPrevious = function (view) {
// returns the view controller which is before the given view controller.
if (!view) {
view = this.getActive();
}
var views = this._views;
var index = views.indexOf(view);
return (index > 0) ? views[index - 1] : null;
};
NavControllerBase.prototype.first = function () {
// returns the first view controller in this nav controller's stack.
return this._views[0];
};
NavControllerBase.prototype.last = function () {
// returns the last page in this nav controller's stack.
var views = this._views;
return views[views.length - 1];
};
NavControllerBase.prototype.indexOf = function (view) {
// returns the index number of the given view controller.
return this._views.indexOf(view);
};
NavControllerBase.prototype.length = function () {
return this._views.length;
};
NavControllerBase.prototype.getViews = function () {
return this._views;
};
/**
* Return a view controller
*/
NavControllerBase.prototype.getViewById = function (id) {
for (var _i = 0, _a = this._views; _i < _a.length; _i++) {
var vc = _a[_i];
if (vc && vc.id === id) {
return vc;
}
}
return null;
};
NavControllerBase.prototype.isSwipeBackEnabled = function () {
return this._sbEnabled;
};
NavControllerBase.prototype.dismissPageChangeViews = function () {
for (var _i = 0, _a = this._views; _i < _a.length; _i++) {
var view = _a[_i];
if (view.data && view.data.dismissOnPageChange) {
view.dismiss().catch(function () { });
}
}
};
NavControllerBase.prototype.setViewport = function (val) {
this._viewport = val;
};
NavControllerBase.prototype.resize = function () {
var active = this.getActive();
if (!active) {
return;
}
var content = active.getIONContent();
content && content.resize();
};
NavControllerBase.prototype.goToRoot = function (_opts) {
return Promise.reject(new Error('goToRoot needs to be implemented by child class'));
};
/*
* @private
*/
NavControllerBase.prototype.getType = function () {
return 'nav';
};
/*
* @private
*/
NavControllerBase.prototype.getSecondaryIdentifier = function () {
return null;
};
/**
* Returns the active child navigation.
*/
NavControllerBase.prototype.getActiveChildNav = function () {
console.warn('(getActiveChildNav) is deprecated and will be removed in the next major release. Use getActiveChildNavs instead.');
return this._children[this._children.length - 1];
};
NavControllerBase.propDecorators = {
'swipeBackEnabled': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
};
return NavControllerBase;
}(__WEBPACK_IMPORTED_MODULE_4__components_ion__["a" /* Ion */]));
var ctrlIds = -1;
var DISABLE_APP_MINIMUM_DURATION = 64;
var ACTIVE_TRANSITION_DEFAULT = 5000;
var ACTIVE_TRANSITION_OFFSET = 2000;
//# sourceMappingURL=nav-controller-base.js.map
/***/ }),
/* 54 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PanGesture; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__recognizers__ = __webpack_require__(387);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_dom__ = __webpack_require__(14);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__ui_event_manager__ = __webpack_require__(28);
/**
* @hidden
*/
var PanGesture = (function () {
function PanGesture(plt, element, opts) {
if (opts === void 0) { opts = {}; }
this.plt = plt;
this.element = element;
Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["d" /* defaults */])(opts, {
threshold: 20,
maxAngle: 40,
direction: 'x',
zone: true,
capture: false,
passive: false,
});
this.events = new __WEBPACK_IMPORTED_MODULE_3__ui_event_manager__["a" /* UIEventManager */](plt);
if (opts.domController) {
this.debouncer = opts.domController.debouncer();
}
this.gestute = opts.gesture;
this.direction = opts.direction;
this.eventsConfig = {
element: this.element,
pointerDown: this.pointerDown.bind(this),
pointerMove: this.pointerMove.bind(this),
pointerUp: this.pointerUp.bind(this),
zone: opts.zone,
capture: opts.capture,
passive: opts.passive
};
if (opts.threshold > 0) {
this.detector = new __WEBPACK_IMPORTED_MODULE_1__recognizers__["a" /* PanRecognizer */](opts.direction, opts.threshold, opts.maxAngle);
}
}
PanGesture.prototype.listen = function () {
if (!this.isListening) {
this.pointerEvents = this.events.pointerEvents(this.eventsConfig);
this.isListening = true;
}
};
PanGesture.prototype.unlisten = function () {
if (this.isListening) {
this.gestute && this.gestute.release();
this.events.unlistenAll();
this.isListening = false;
}
};
PanGesture.prototype.destroy = function () {
this.gestute && this.gestute.destroy();
this.gestute = null;
this.unlisten();
this.events.destroy();
this.events = this.element = this.gestute = null;
};
PanGesture.prototype.pointerDown = function (ev) {
if (this.started) {
return;
}
if (!this.canStart(ev)) {
return false;
}
if (this.gestute) {
// Release fallback
this.gestute.release();
// Start gesture
if (!this.gestute.start()) {
return false;
}
}
this.started = true;
this.captured = false;
var coord = Object(__WEBPACK_IMPORTED_MODULE_2__util_dom__["f" /* pointerCoord */])(ev);
if (this.detector) {
this.detector.start(coord);
}
else {
if (!this.tryToCapture(ev)) {
this.started = false;
this.captured = false;
this.gestute.release();
return false;
}
}
return true;
};
PanGesture.prototype.pointerMove = function (ev) {
var _this = this;
(void 0) /* assert */;
if (this.captured) {
this.debouncer.write(function () {
_this.onDragMove(ev);
});
return;
}
(void 0) /* assert */;
var coord = Object(__WEBPACK_IMPORTED_MODULE_2__util_dom__["f" /* pointerCoord */])(ev);
if (this.detector.detect(coord)) {
if (this.detector.pan() !== 0) {
if (!this.tryToCapture(ev)) {
this.abort(ev);
}
}
}
};
PanGesture.prototype.pointerUp = function (ev) {
(void 0) /* assert */;
this.debouncer.cancel();
this.gestute && this.gestute.release();
if (this.captured) {
this.onDragEnd(ev);
}
else {
this.notCaptured(ev);
}
this.captured = false;
this.started = false;
};
PanGesture.prototype.tryToCapture = function (ev) {
(void 0) /* assert */;
(void 0) /* assert */;
if (this.gestute && !this.gestute.capture()) {
return false;
}
this.onDragStart(ev);
this.captured = true;
return true;
};
PanGesture.prototype.abort = function (ev) {
this.started = false;
this.captured = false;
this.gestute.release();
this.pointerEvents.stop();
this.notCaptured(ev);
};
PanGesture.prototype.getNativeElement = function () {
return this.element;
};
// Implemented in a subclass
PanGesture.prototype.canStart = function (_ev) { return true; };
PanGesture.prototype.onDragStart = function (_ev) { };
PanGesture.prototype.onDragMove = function (_ev) { };
PanGesture.prototype.onDragEnd = function (_ev) { };
PanGesture.prototype.notCaptured = function (_ev) { };
return PanGesture;
}());
//# sourceMappingURL=pan-gesture.js.map
/***/ }),
/* 55 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TransitionController; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__platform_platform__ = __webpack_require__(4);
/**
* @hidden
*/
var TransitionController = (function () {
function TransitionController(plt, _config) {
this.plt = plt;
this._config = _config;
this._ids = 0;
this._trns = {};
}
TransitionController.prototype.getRootTrnsId = function (nav) {
nav = nav.parent;
while (nav) {
if (Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["l" /* isPresent */])(nav._trnsId)) {
return nav._trnsId;
}
nav = nav.parent;
}
return null;
};
TransitionController.prototype.nextId = function () {
return this._ids++;
};
TransitionController.prototype.get = function (trnsId, enteringView, leavingView, opts) {
var TransitionClass = this._config.getTransition(opts.animation);
if (!TransitionClass) {
// didn't find a transition animation, default to ios-transition
TransitionClass = this._config.getTransition('ios-transition');
}
var trns = new TransitionClass(this.plt, enteringView, leavingView, opts);
trns.trnsId = trnsId;
if (!this._trns[trnsId]) {
// we haven't created the root transition yet
this._trns[trnsId] = trns;
}
else {
// we already have a root transition created
// add this new transition as a child to the root
this._trns[trnsId].add(trns);
}
return trns;
};
TransitionController.prototype.destroy = function (trnsId) {
var trans = this._trns[trnsId];
if (trans) {
trans.destroy();
delete this._trns[trnsId];
}
};
TransitionController.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
TransitionController.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_3__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
]; };
return TransitionController;
}());
//# sourceMappingURL=transition-controller.js.map
/***/ }),
/* 56 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FabButton; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ion__ = __webpack_require__(6);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name FabButton
* @module ionic
*
* @description
* FABs (Floating Action Buttons) are standard material design components. They are shaped as a circle that represents a promoted action. When pressed, it may contain more related actions.
* FABs as its name suggests are floating over the content in a fixed position. This is not achieved exclusively with `<button ion-fab>Button</button>` but it has to wrapped with the `<ion-fab>` component, like this:
*
* ```html
* <ion-content>
* <!-- Real floating action button, fixed. It will not scroll with the content -->
* <ion-fab>
* <button ion-fab>Button</button>
* </ion-fab>
*
* <!-- Button shaped as a circle that just like a normal button scrolls with the content -->
* <button ion-fab>Button</button>
* </ion-content>
*
* ```
*
* In case the button is not wrapped with `<ion-fab>`, the fab button will behave like a normal button, scrolling with the content.
*
* See [ion-fab] to learn more information about how to position the fab button.
*
* @property [mini] - Makes a fab button with a reduced size.
*
* @usage
*
* ```html
*
* <!-- Colors -->
* <ion-fab>
* <button ion-fab color="primary">Button</button>
* </ion-fab>
*
* <!-- Mini -->
* <ion-fab>
* <button ion-fab mini>Small</button>
* </ion-fab>
* ```
*
* @demo /docs/demos/src/fab/
* @see {@link /docs/components#fabs FAB Component Docs}
*/
var FabButton = (function (_super) {
__extends(FabButton, _super);
function FabButton(config, elementRef, renderer) {
return _super.call(this, config, elementRef, renderer, 'fab') || this;
}
/**
* @hidden
*/
FabButton.prototype.setActiveClose = function (closeVisible) {
this.setElementClass('fab-close-active', closeVisible);
};
FabButton.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: '[ion-fab]',
template: '<ion-icon name="close" class="fab-close-icon"></ion-icon>' +
'<span class="button-inner">' +
'<ng-content></ng-content>' +
'</span>' +
'<div class="button-effect"></div>',
changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* ChangeDetectionStrategy */].OnPush,
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
},] },
];
/** @nocollapse */
FabButton.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
]; };
return FabButton;
}(__WEBPACK_IMPORTED_MODULE_2__ion__["a" /* Ion */]));
//# sourceMappingURL=fab.js.map
/***/ }),
/* 57 */,
/* 58 */,
/* 59 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__plugin__ = __webpack_require__(178);
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "f", function() { return __WEBPACK_IMPORTED_MODULE_0__plugin__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__decorators__ = __webpack_require__(413);
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_1__decorators__["a"]; });
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_1__decorators__["b"]; });
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_1__decorators__["c"]; });
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "e", function() { return __WEBPACK_IMPORTED_MODULE_1__decorators__["d"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util__ = __webpack_require__(98);
/* unused harmony namespace reexport */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__ionic_native_plugin__ = __webpack_require__(416);
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_3__ionic_native_plugin__["a"]; });
//# sourceMappingURL=index.js.map
/***/ }),
/* 60 */,
/* 61 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* @namespace Chart.helpers
*/
var helpers = {
/**
* An empty function that can be used, for example, for optional callback.
*/
noop: function() {},
/**
* Returns a unique id, sequentially generated from a global variable.
* @returns {Number}
* @function
*/
uid: (function() {
var id = 0;
return function() {
return id++;
};
}()),
/**
* Returns true if `value` is neither null nor undefined, else returns false.
* @param {*} value - The value to test.
* @returns {Boolean}
* @since 2.7.0
*/
isNullOrUndef: function(value) {
return value === null || typeof value === 'undefined';
},
/**
* Returns true if `value` is an array, else returns false.
* @param {*} value - The value to test.
* @returns {Boolean}
* @function
*/
isArray: Array.isArray ? Array.isArray : function(value) {
return Object.prototype.toString.call(value) === '[object Array]';
},
/**
* Returns true if `value` is an object (excluding null), else returns false.
* @param {*} value - The value to test.
* @returns {Boolean}
* @since 2.7.0
*/
isObject: function(value) {
return value !== null && Object.prototype.toString.call(value) === '[object Object]';
},
/**
* Returns `value` if defined, else returns `defaultValue`.
* @param {*} value - The value to return if defined.
* @param {*} defaultValue - The value to return if `value` is undefined.
* @returns {*}
*/
valueOrDefault: function(value, defaultValue) {
return typeof value === 'undefined' ? defaultValue : value;
},
/**
* Returns value at the given `index` in array if defined, else returns `defaultValue`.
* @param {Array} value - The array to lookup for value at `index`.
* @param {Number} index - The index in `value` to lookup for value.
* @param {*} defaultValue - The value to return if `value[index]` is undefined.
* @returns {*}
*/
valueAtIndexOrDefault: function(value, index, defaultValue) {
return helpers.valueOrDefault(helpers.isArray(value) ? value[index] : value, defaultValue);
},
/**
* Calls `fn` with the given `args` in the scope defined by `thisArg` and returns the
* value returned by `fn`. If `fn` is not a function, this method returns undefined.
* @param {Function} fn - The function to call.
* @param {Array|undefined|null} args - The arguments with which `fn` should be called.
* @param {Object} [thisArg] - The value of `this` provided for the call to `fn`.
* @returns {*}
*/
callback: function(fn, args, thisArg) {
if (fn && typeof fn.call === 'function') {
return fn.apply(thisArg, args);
}
},
/**
* Note(SB) for performance sake, this method should only be used when loopable type
* is unknown or in none intensive code (not called often and small loopable). Else
* it's preferable to use a regular for() loop and save extra function calls.
* @param {Object|Array} loopable - The object or array to be iterated.
* @param {Function} fn - The function to call for each item.
* @param {Object} [thisArg] - The value of `this` provided for the call to `fn`.
* @param {Boolean} [reverse] - If true, iterates backward on the loopable.
*/
each: function(loopable, fn, thisArg, reverse) {
var i, len, keys;
if (helpers.isArray(loopable)) {
len = loopable.length;
if (reverse) {
for (i = len - 1; i >= 0; i--) {
fn.call(thisArg, loopable[i], i);
}
} else {
for (i = 0; i < len; i++) {
fn.call(thisArg, loopable[i], i);
}
}
} else if (helpers.isObject(loopable)) {
keys = Object.keys(loopable);
len = keys.length;
for (i = 0; i < len; i++) {
fn.call(thisArg, loopable[keys[i]], keys[i]);
}
}
},
/**
* Returns true if the `a0` and `a1` arrays have the same content, else returns false.
* @see http://stackoverflow.com/a/14853974
* @param {Array} a0 - The array to compare
* @param {Array} a1 - The array to compare
* @returns {Boolean}
*/
arrayEquals: function(a0, a1) {
var i, ilen, v0, v1;
if (!a0 || !a1 || a0.length !== a1.length) {
return false;
}
for (i = 0, ilen = a0.length; i < ilen; ++i) {
v0 = a0[i];
v1 = a1[i];
if (v0 instanceof Array && v1 instanceof Array) {
if (!helpers.arrayEquals(v0, v1)) {
return false;
}
} else if (v0 !== v1) {
// NOTE: two different object instances will never be equal: {x:20} != {x:20}
return false;
}
}
return true;
},
/**
* Returns a deep copy of `source` without keeping references on objects and arrays.
* @param {*} source - The value to clone.
* @returns {*}
*/
clone: function(source) {
if (helpers.isArray(source)) {
return source.map(helpers.clone);
}
if (helpers.isObject(source)) {
var target = {};
var keys = Object.keys(source);
var klen = keys.length;
var k = 0;
for (; k < klen; ++k) {
target[keys[k]] = helpers.clone(source[keys[k]]);
}
return target;
}
return source;
},
/**
* The default merger when Chart.helpers.merge is called without merger option.
* Note(SB): this method is also used by configMerge and scaleMerge as fallback.
* @private
*/
_merger: function(key, target, source, options) {
var tval = target[key];
var sval = source[key];
if (helpers.isObject(tval) && helpers.isObject(sval)) {
helpers.merge(tval, sval, options);
} else {
target[key] = helpers.clone(sval);
}
},
/**
* Merges source[key] in target[key] only if target[key] is undefined.
* @private
*/
_mergerIf: function(key, target, source) {
var tval = target[key];
var sval = source[key];
if (helpers.isObject(tval) && helpers.isObject(sval)) {
helpers.mergeIf(tval, sval);
} else if (!target.hasOwnProperty(key)) {
target[key] = helpers.clone(sval);
}
},
/**
* Recursively deep copies `source` properties into `target` with the given `options`.
* IMPORTANT: `target` is not cloned and will be updated with `source` properties.
* @param {Object} target - The target object in which all sources are merged into.
* @param {Object|Array(Object)} source - Object(s) to merge into `target`.
* @param {Object} [options] - Merging options:
* @param {Function} [options.merger] - The merge method (key, target, source, options)
* @returns {Object} The `target` object.
*/
merge: function(target, source, options) {
var sources = helpers.isArray(source) ? source : [source];
var ilen = sources.length;
var merge, i, keys, klen, k;
if (!helpers.isObject(target)) {
return target;
}
options = options || {};
merge = options.merger || helpers._merger;
for (i = 0; i < ilen; ++i) {
source = sources[i];
if (!helpers.isObject(source)) {
continue;
}
keys = Object.keys(source);
for (k = 0, klen = keys.length; k < klen; ++k) {
merge(keys[k], target, source, options);
}
}
return target;
},
/**
* Recursively deep copies `source` properties into `target` *only* if not defined in target.
* IMPORTANT: `target` is not cloned and will be updated with `source` properties.
* @param {Object} target - The target object in which all sources are merged into.
* @param {Object|Array(Object)} source - Object(s) to merge into `target`.
* @returns {Object} The `target` object.
*/
mergeIf: function(target, source) {
return helpers.merge(target, source, {merger: helpers._mergerIf});
},
/**
* Applies the contents of two or more objects together into the first object.
* @param {Object} target - The target object in which all objects are merged into.
* @param {Object} arg1 - Object containing additional properties to merge in target.
* @param {Object} argN - Additional objects containing properties to merge in target.
* @returns {Object} The `target` object.
*/
extend: function(target) {
var setFn = function(value, key) {
target[key] = value;
};
for (var i = 1, ilen = arguments.length; i < ilen; ++i) {
helpers.each(arguments[i], setFn);
}
return target;
},
/**
* Basic javascript inheritance based on the model created in Backbone.js
*/
inherits: function(extensions) {
var me = this;
var ChartElement = (extensions && extensions.hasOwnProperty('constructor')) ? extensions.constructor : function() {
return me.apply(this, arguments);
};
var Surrogate = function() {
this.constructor = ChartElement;
};
Surrogate.prototype = me.prototype;
ChartElement.prototype = new Surrogate();
ChartElement.extend = helpers.inherits;
if (extensions) {
helpers.extend(ChartElement.prototype, extensions);
}
ChartElement.__super__ = me.prototype;
return ChartElement;
}
};
module.exports = helpers;
// DEPRECATIONS
/**
* Provided for backward compatibility, use Chart.helpers.callback instead.
* @function Chart.helpers.callCallback
* @deprecated since version 2.6.0
* @todo remove at version 3
* @private
*/
helpers.callCallback = helpers.callback;
/**
* Provided for backward compatibility, use Array.prototype.indexOf instead.
* Array.prototype.indexOf compatibility: Chrome, Opera, Safari, FF1.5+, IE9+
* @function Chart.helpers.indexOf
* @deprecated since version 2.7.0
* @todo remove at version 3
* @private
*/
helpers.indexOf = function(array, item, fromIndex) {
return Array.prototype.indexOf.call(array, item, fromIndex);
};
/**
* Provided for backward compatibility, use Chart.helpers.valueOrDefault instead.
* @function Chart.helpers.getValueOrDefault
* @deprecated since version 2.7.0
* @todo remove at version 3
* @private
*/
helpers.getValueOrDefault = helpers.valueOrDefault;
/**
* Provided for backward compatibility, use Chart.helpers.valueAtIndexOrDefault instead.
* @function Chart.helpers.getValueAtIndexOrDefault
* @deprecated since version 2.7.0
* @todo remove at version 3
* @private
*/
helpers.getValueAtIndexOrDefault = helpers.valueAtIndexOrDefault;
/***/ }),
/* 62 */,
/* 63 */,
/* 64 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (immutable) */ __webpack_exports__["d"] = initSwiper;
/* harmony export (immutable) */ __webpack_exports__["l"] = startAutoplay;
/* harmony export (immutable) */ __webpack_exports__["m"] = stopAutoplay;
/* harmony export (immutable) */ __webpack_exports__["g"] = pauseAutoplay;
/* harmony export (immutable) */ __webpack_exports__["o"] = updateAutoHeight;
/* harmony export (immutable) */ __webpack_exports__["p"] = updateContainerSize;
/* harmony export (immutable) */ __webpack_exports__["q"] = updateSlidesSize;
/* harmony export (immutable) */ __webpack_exports__["a"] = currentSlidesPerView;
/* harmony export (immutable) */ __webpack_exports__["n"] = update;
/* harmony export (immutable) */ __webpack_exports__["c"] = fixLoop;
/* harmony export (immutable) */ __webpack_exports__["k"] = slideTo;
/* harmony export (immutable) */ __webpack_exports__["f"] = onTransitionStart;
/* harmony export (immutable) */ __webpack_exports__["e"] = onTransitionEnd;
/* harmony export (immutable) */ __webpack_exports__["h"] = slideNext;
/* harmony export (immutable) */ __webpack_exports__["i"] = slidePrev;
/* harmony export (immutable) */ __webpack_exports__["j"] = slideReset;
/* unused harmony export disableTouchControl */
/* unused harmony export enableTouchControl */
/* harmony export (immutable) */ __webpack_exports__["b"] = destroySwiper;
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__swiper_utils__ = __webpack_require__(17);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__swiper_transition__ = __webpack_require__(112);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__swiper_progress__ = __webpack_require__(65);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__swiper_classes__ = __webpack_require__(113);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__swiper_parallax__ = __webpack_require__(329);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__swiper_index__ = __webpack_require__(66);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__swiper_effects__ = __webpack_require__(115);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__swiper_pagination__ = __webpack_require__(114);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__swiper_zoom__ = __webpack_require__(331);
/**
* Adopted from Swiper
* Most modern mobile touch slider and framework with hardware
* accelerated transitions.
*
* http://www.idangero.us/swiper/
*
* Copyright 2016, Vladimir Kharlampidi
* The iDangero.us
* http://www.idangero.us/
*
* Licensed under MIT
*/
function initSwiper(s, plt) {
// Classname
s._classNames = [];
/*=========================
Preparation - Define Container, Wrapper and Pagination
===========================*/
if (!s.container) {
return;
}
// Save instance in container HTML Element and in data
s.container.swiper = s;
var containerModifierClass = __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].containerModifier;
s._classNames.push(containerModifierClass + s.direction);
if (s.freeMode) {
s._classNames.push(containerModifierClass + 'free-mode');
}
if (s.autoHeight) {
s._classNames.push(containerModifierClass + 'autoheight');
}
// Enable slides progress when required
if (s.parallax || s.watchSlidesVisibility) {
s.watchSlidesProgress = true;
}
// Max resistance when touchReleaseOnEdges
if (s.touchReleaseOnEdges) {
s.resistanceRatio = 0;
}
var effect = s.effect;
// Coverflow / 3D
if (['cube', 'coverflow', 'flip'].indexOf(effect) >= 0) {
s.watchSlidesProgress = true;
s._classNames.push(containerModifierClass + '3d');
}
if (effect !== 'slide') {
s._classNames.push(containerModifierClass + effect);
}
if (effect === 'cube') {
s.resistanceRatio = 0;
s.slidesPerView = 1;
s.slidesPerColumn = 1;
s.slidesPerGroup = 1;
s.centeredSlides = false;
s.spaceBetween = 0;
s.virtualTranslate = true;
s.setWrapperSize = false;
}
if (effect === 'fade' || effect === 'flip') {
s.slidesPerView = 1;
s.slidesPerColumn = 1;
s.slidesPerGroup = 1;
s.watchSlidesProgress = true;
s.spaceBetween = 0;
s.setWrapperSize = false;
s.virtualTranslate = true;
}
// Wrapper
s._wrapper = s.container.querySelector('.' + __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].wrapper);
// Pagination
if (s.paginationType) {
s._paginationContainer = s.container.querySelector('.swiper-pagination');
if (s.paginationType === 'bullets') {
s._paginationContainer.classList.add(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].paginationModifier + 'clickable');
}
s._paginationContainer.classList.add(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].paginationModifier + s.paginationType);
}
// Next/Prev Buttons
// if (s.nextButton || s.prevButton) {
// if (s.nextButton) {
// s.nextButton = <any>s.container.closest('ion-content').querySelector(s.nextButton);
// }
// if (s.prevButton) {
// s.prevButton = <any>s.container.closest('ion-content').querySelector(s.prevButton);
// }
// }
// RTL
s._rtl = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) && (s.container.dir.toLowerCase() === 'rtl' || s.container.style.direction === 'rtl');
if (s._rtl) {
s._classNames.push(containerModifierClass + 'rtl');
}
// Columns
if (s.slidesPerColumn > 1) {
s._classNames.push(containerModifierClass + 'multirow');
}
// Check for Android
if (plt.is('android')) {
s._classNames.push(containerModifierClass + 'android');
}
// Add classes
s._classNames.forEach(function (clsName) {
s.container.classList.add(clsName);
});
// Translate
s._translate = 0;
// Progress
s.progress = 0;
// Velocity
s.velocity = 0;
/*=========================
Autoplay
===========================*/
s._autoplayTimeoutId = undefined;
s._autoplaying = false;
s._autoplayPaused = false;
s._allowClick = true;
// Animating Flag
s._animating = false;
// Touches information
s._touches = {
startX: 0,
startY: 0,
currentX: 0,
currentY: 0,
diff: 0
};
if (s.loop) {
createLoop(s);
}
updateContainerSize(s, plt);
updateSlidesSize(s, plt);
Object(__WEBPACK_IMPORTED_MODULE_7__swiper_pagination__["a" /* updatePagination */])(s);
if (effect !== 'slide' && __WEBPACK_IMPORTED_MODULE_6__swiper_effects__["a" /* SWIPER_EFFECTS */][effect]) {
if (!s.loop) {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper_progress__["a" /* updateProgress */])(s);
}
__WEBPACK_IMPORTED_MODULE_6__swiper_effects__["a" /* SWIPER_EFFECTS */][effect].setTranslate(s, plt);
}
if (s.loop) {
slideTo(s, plt, s.initialSlide + s.loopedSlides, 0, s.runCallbacksOnInit);
}
else {
slideTo(s, plt, s.initialSlide, 0, s.runCallbacksOnInit);
if (s.initialSlide === 0) {
Object(__WEBPACK_IMPORTED_MODULE_4__swiper_parallax__["b" /* parallaxSetTranslate */])(s);
}
}
if (s.autoplay) {
startAutoplay(s, plt);
}
}
/*=========================
Autoplay
===========================*/
function autoplay(s, plt) {
var autoplayDelay = s.autoplay;
var activeSlide = s._slides[s._activeIndex];
if (activeSlide.hasAttribute('data-swiper-autoplay')) {
autoplayDelay = (activeSlide.getAttribute('data-swiper-autoplay') || s.autoplay);
}
s._autoplayTimeoutId = plt.timeout(function () {
s._zone.run(function () {
if (s.loop) {
fixLoop(s, plt);
slideNext(s, plt, true, undefined, true);
s.ionSlideAutoplay.emit(s);
}
else {
if (!s._isEnd) {
slideNext(s, plt, true, undefined, true);
s.ionSlideAutoplay.emit(s);
}
else {
if (!s.autoplayStopOnLast) {
slideTo(s, plt, 0);
s.ionSlideAutoplay.emit(s);
}
else {
stopAutoplay(s);
}
}
}
});
}, autoplayDelay);
}
function startAutoplay(s, plt) {
if (typeof s._autoplayTimeoutId !== 'undefined')
return false;
if (!s.autoplay || s._autoplaying) {
return false;
}
s._autoplaying = true;
s._zone.run(function () {
s.ionSlideAutoplayStart.emit(s);
});
autoplay(s, plt);
}
function stopAutoplay(s) {
if (!s._autoplayTimeoutId)
return;
if (s._autoplayTimeoutId)
clearTimeout(s._autoplayTimeoutId);
s._autoplaying = false;
s._autoplayTimeoutId = undefined;
s._zone.run(function () {
s.ionSlideAutoplayStop.emit(s);
});
}
function pauseAutoplay(s, plt, speed) {
if (s._autoplayPaused)
return;
if (s._autoplayTimeoutId)
clearTimeout(s._autoplayTimeoutId);
s._autoplayPaused = true;
if (speed === 0) {
s._autoplayPaused = false;
autoplay(s, plt);
}
else {
plt.transitionEnd(s._wrapper, function () {
if (!s)
return;
s._autoplayPaused = false;
if (!s._autoplaying) {
stopAutoplay(s);
}
else {
autoplay(s, plt);
}
});
}
}
/*=========================
Slider/slides sizes
===========================*/
function updateAutoHeight(s) {
var activeSlides = [];
var newHeight = 0;
var i;
// Find slides currently in view
if (s.slidesPerView !== 'auto' && s.slidesPerView > 1) {
for (i = 0; i < Math.ceil(s.slidesPerView); i++) {
var index = s._activeIndex + i;
if (index > s._slides.length)
break;
activeSlides.push(s._slides[index]);
}
}
else {
activeSlides.push(s._slides[s._activeIndex]);
}
// Find new height from heighest slide in view
for (i = 0; i < activeSlides.length; i++) {
if (typeof activeSlides[i] !== 'undefined') {
var height = activeSlides[i].offsetHeight;
newHeight = height > newHeight ? height : newHeight;
}
}
// Update Height
if (newHeight) {
s._wrapper.style.height = newHeight + 'px';
}
}
function updateContainerSize(s, plt) {
var container = s.container;
var width;
var height;
if (typeof s.width !== 'undefined') {
// manually assign user width
width = s.width;
}
else {
width = container.clientWidth;
}
if (typeof s.renderedHeight !== 'undefined') {
// manually assign user height
height = s.renderedHeight;
}
else {
height = container.clientHeight;
}
if (width === 0 && Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) || height === 0 && !Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s)) {
return;
}
// Subtract paddings
var containerStyles = plt.getElementComputedStyle(container);
width = width - parseInt(containerStyles.paddingLeft, 10) - parseInt(containerStyles.paddingRight, 10);
height = height - parseInt(containerStyles.paddingTop, 10) - parseInt(containerStyles.paddingBottom, 10);
// Store values
s.renderedWidth = width;
s.renderedHeight = height;
s._renderedSize = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? width : height;
}
function updateSlidesSize(s, plt) {
s._slides = s._wrapper.querySelectorAll('.' + __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].slide);
s._snapGrid = [];
s._slidesGrid = [];
s._slidesSizesGrid = [];
var spaceBetween = s.spaceBetween;
var slidePosition = -s.slidesOffsetBefore;
var i;
var prevSlideSize = 0;
var index = 0;
if (typeof s._renderedSize === 'undefined')
return;
if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * s._renderedSize;
}
s._virtualSize = -spaceBetween;
// reset margins
if (s._rtl) {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["e" /* inlineStyle */])(s._slides, { marginLeft: '', marginTop: '' });
}
else {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["e" /* inlineStyle */])(s._slides, { marginRight: '', marginBottom: '' });
}
var slidesNumberEvenToRows;
if (s.slidesPerColumn > 1) {
if (Math.floor(s._slides.length / s.slidesPerColumn) === s._slides.length / s.slidesPerColumn) {
slidesNumberEvenToRows = s._slides.length;
}
else {
slidesNumberEvenToRows = Math.ceil(s._slides.length / s.slidesPerColumn) * s.slidesPerColumn;
}
if (s.slidesPerView !== 'auto' && s.slidesPerColumnFill === 'row') {
slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, s.slidesPerView * s.slidesPerColumn);
}
}
// Calc slides
var slideSize;
var slidesPerColumn = s.slidesPerColumn;
var slidesPerRow = slidesNumberEvenToRows / slidesPerColumn;
var numFullColumns = slidesPerRow - (s.slidesPerColumn * slidesPerRow - s._slides.length);
for (i = 0; i < s._slides.length; i++) {
slideSize = 0;
var slide = s._slides[i];
if (s.slidesPerColumn > 1) {
// Set slides order
var newSlideOrderIndex;
var column;
var row;
if (s.slidesPerColumnFill === 'column') {
column = Math.floor(i / slidesPerColumn);
row = i - column * slidesPerColumn;
if (column > numFullColumns || (column === numFullColumns && row === slidesPerColumn - 1)) {
if (++row >= slidesPerColumn) {
row = 0;
column++;
}
}
newSlideOrderIndex = column + row * slidesNumberEvenToRows / slidesPerColumn;
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["e" /* inlineStyle */])(slide, {
'-webkit-box-ordinal-group': newSlideOrderIndex,
'-moz-box-ordinal-group': newSlideOrderIndex,
'-ms-flex-order': newSlideOrderIndex,
'-webkit-order': newSlideOrderIndex,
'order': newSlideOrderIndex
});
}
else {
row = Math.floor(i / slidesPerRow);
column = i - row * slidesPerRow;
}
var cssVal = (row !== 0 && s.spaceBetween) && (s.spaceBetween + 'px');
var cssObj = {};
if (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s)) {
cssObj['marginTop'] = cssVal;
}
else {
cssObj['marginLeft'] = cssVal;
}
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["e" /* inlineStyle */])(slide, cssObj);
slide.setAttribute('data-swiper-column', column);
slide.setAttribute('data-swiper-row', row);
}
if (slide.style.display === 'none') {
continue;
}
if (s.slidesPerView === 'auto') {
var styles = plt.getElementComputedStyle(slide);
if (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s)) {
slideSize = slide.offsetWidth + parseFloat(styles.marginRight) + parseFloat(styles.marginLeft);
}
else {
slideSize = slide.offsetHeight + parseFloat(styles.marginTop) + parseFloat(styles.marginBottom);
}
if (s.roundLengths)
slideSize = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["m" /* round */])(slideSize);
}
else {
slideSize = (s._renderedSize - (s.slidesPerView - 1) * spaceBetween) / s.slidesPerView;
if (s.roundLengths)
slideSize = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["m" /* round */])(slideSize);
if (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s)) {
s._slides[i].style.width = slideSize + 'px';
}
else {
s._slides[i].style.height = slideSize + 'px';
}
}
s._slides[i].swiperSlideSize = slideSize;
s._slidesSizesGrid.push(slideSize);
if (s.centeredSlides) {
slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween;
if (i === 0)
slidePosition = slidePosition - s._renderedSize / 2 - spaceBetween;
if (Math.abs(slidePosition) < 1 / 1000)
slidePosition = 0;
if ((index) % s.slidesPerGroup === 0)
s._snapGrid.push(slidePosition);
s._slidesGrid.push(slidePosition);
}
else {
if ((index) % s.slidesPerGroup === 0)
s._snapGrid.push(slidePosition);
s._slidesGrid.push(slidePosition);
slidePosition = slidePosition + slideSize + spaceBetween;
}
s._virtualSize += slideSize + spaceBetween;
prevSlideSize = slideSize;
index++;
}
s._virtualSize = Math.max(s._virtualSize, s._renderedSize) + s.slidesOffsetAfter;
var newSlidesGrid;
if (s._rtl && (s.effect === 'slide' || s.effect === 'coverflow')) {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["e" /* inlineStyle */])(s._wrapper, { width: s._virtualSize + s.spaceBetween + 'px' });
}
if (s.setWrapperSize) {
if (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s)) {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["e" /* inlineStyle */])(s._wrapper, { width: s._virtualSize + s.spaceBetween + 'px' });
}
else {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["e" /* inlineStyle */])(s._wrapper, { height: s._virtualSize + s.spaceBetween + 'px' });
}
}
if (s.slidesPerColumn > 1) {
s._virtualSize = (slideSize + s.spaceBetween) * slidesNumberEvenToRows;
s._virtualSize = Math.ceil(s._virtualSize / s.slidesPerColumn) - s.spaceBetween;
if (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s)) {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["e" /* inlineStyle */])(s._wrapper, { width: s._virtualSize + s.spaceBetween + 'px' });
}
else {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["e" /* inlineStyle */])(s._wrapper, { height: s._virtualSize + s.spaceBetween + 'px' });
}
if (s.centeredSlides) {
newSlidesGrid = [];
for (i = 0; i < s._snapGrid.length; i++) {
if (s._snapGrid[i] < s._virtualSize + s._snapGrid[0])
newSlidesGrid.push(s._snapGrid[i]);
}
s._snapGrid = newSlidesGrid;
}
}
// Remove last grid elements depending on width
if (!s.centeredSlides) {
newSlidesGrid = [];
for (i = 0; i < s._snapGrid.length; i++) {
if (s._snapGrid[i] <= s._virtualSize - s._renderedSize) {
newSlidesGrid.push(s._snapGrid[i]);
}
}
s._snapGrid = newSlidesGrid;
if (Math.floor(s._virtualSize - s._renderedSize) - Math.floor(s._snapGrid[s._snapGrid.length - 1]) > 1) {
s._snapGrid.push(s._virtualSize - s._renderedSize);
}
}
if (s._snapGrid.length === 0)
s._snapGrid = [0];
if (s.spaceBetween !== 0) {
if (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s)) {
if (s._rtl) {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["e" /* inlineStyle */])(s._slides, { marginLeft: spaceBetween + 'px' });
}
else {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["e" /* inlineStyle */])(s._slides, { marginRight: spaceBetween + 'px' });
}
}
else {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["e" /* inlineStyle */])(s._slides, { marginBottom: spaceBetween + 'px' });
}
}
if (s.watchSlidesProgress) {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["q" /* updateSlidesOffset */])(s);
}
}
/*=========================
Dynamic Slides Per View
===========================*/
function currentSlidesPerView(s) {
var spv = 1;
var i;
var j;
if (s.centeredSlides) {
var size = s._slides[s._activeIndex].swiperSlideSize;
var breakLoop;
for (i = s._activeIndex + 1; i < s._slides.length; i++) {
if (s._slides[i] && !breakLoop) {
size += s._slides[i].swiperSlideSize;
spv++;
if (size > s._renderedSize)
breakLoop = true;
}
}
for (j = s._activeIndex - 1; j >= 0; j--) {
if (s._slides[j] && !breakLoop) {
size += s._slides[j].swiperSlideSize;
spv++;
if (size > s._renderedSize)
breakLoop = true;
}
}
}
else {
for (i = s._activeIndex + 1; i < s._slides.length; i++) {
if (s._slidesGrid[i] - s._slidesGrid[s._activeIndex] < s._renderedSize) {
spv++;
}
}
}
return spv;
}
/*=========================
Common update method
===========================*/
function update(s, plt, updateTranslate) {
if (!s)
return;
updateContainerSize(s, plt);
updateSlidesSize(s, plt);
Object(__WEBPACK_IMPORTED_MODULE_2__swiper_progress__["a" /* updateProgress */])(s);
Object(__WEBPACK_IMPORTED_MODULE_7__swiper_pagination__["a" /* updatePagination */])(s);
Object(__WEBPACK_IMPORTED_MODULE_3__swiper_classes__["a" /* updateClasses */])(s);
if (s.zoom) {
Object(__WEBPACK_IMPORTED_MODULE_8__swiper_zoom__["b" /* resetZoomEvents */])(s, plt);
}
var translated;
var newTranslate;
function forceSetTranslate() {
newTranslate = Math.min(Math.max(s._translate, Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["h" /* maxTranslate */])(s)), Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["i" /* minTranslate */])(s));
Object(__WEBPACK_IMPORTED_MODULE_1__swiper_transition__["d" /* setWrapperTranslate */])(s, plt, newTranslate);
Object(__WEBPACK_IMPORTED_MODULE_5__swiper_index__["a" /* updateActiveIndex */])(s);
Object(__WEBPACK_IMPORTED_MODULE_3__swiper_classes__["a" /* updateClasses */])(s);
}
if (updateTranslate) {
if (s._spline) {
s._spline = undefined;
}
if (s.freeMode) {
forceSetTranslate();
if (s.autoHeight) {
updateAutoHeight(s);
}
}
else {
if ((s.slidesPerView === 'auto' || s.slidesPerView > 1) && s._isEnd && !s.centeredSlides) {
translated = slideTo(s, plt, s._slides.length - 1, 0, false, true);
}
else {
translated = slideTo(s, plt, s._activeIndex, 0, false, true);
}
if (!translated) {
forceSetTranslate();
}
}
}
else if (s.autoHeight) {
updateAutoHeight(s);
}
}
/*=========================
Loop
===========================*/
// Create looped slides
function createLoop(s) {
// Remove duplicated slides
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["c" /* eachChild */])(s._wrapper, '.' + __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].slide + '.' + __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].slideDuplicate, function (ele) {
ele.parentElement.removeChild(ele);
});
var slides = s._wrapper.querySelectorAll('.' + __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].slide);
if (s.slidesPerView === 'auto' && !s.loopedSlides) {
s.loopedSlides = slides.length;
}
s.loopedSlides = parseInt((s.loopedSlides || s.slidesPerView), 10);
s.loopedSlides = s.loopedSlides + s.loopAdditionalSlides;
if (s.loopedSlides > slides.length) {
s.loopedSlides = slides.length;
}
var prependSlides = [];
var appendSlides = [];
for (var i = 0; i < slides.length; i++) {
var slide = slides[i];
if (i < s.loopedSlides)
appendSlides.push(slide);
if (i < slides.length && i >= slides.length - s.loopedSlides)
prependSlides.push(slide);
slide.setAttribute('data-swiper-slide-index', i);
}
for (i = 0; i < appendSlides.length; i++) {
var appendClone = appendSlides[i].cloneNode(true);
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["b" /* addClass */])(appendClone, __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].slideDuplicate);
s._wrapper.appendChild(appendClone);
}
for (i = prependSlides.length - 1; i >= 0; i--) {
var prependClone = prependSlides[i].cloneNode(true);
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["b" /* addClass */])(prependClone, __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].slideDuplicate);
s._wrapper.insertBefore(prependClone, s._wrapper.firstElementChild);
}
}
function destroyLoop(s) {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["c" /* eachChild */])(s._wrapper, '.' + __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].slide + '.' + __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].slideDuplicate, function (ele) {
ele.parentElement.removeChild(ele);
});
if (s._slides) {
for (var i = 0; i < s._slides.length; i++) {
s._slides[i].removeAttribute('data-swiper-slide-index');
}
}
}
function fixLoop(s, plt) {
var newIndex;
if (s._activeIndex < s.loopedSlides) {
// Fix For Negative Oversliding
newIndex = s._slides.length - s.loopedSlides * 3 + s._activeIndex;
newIndex = newIndex + s.loopedSlides;
slideTo(s, plt, newIndex, 0, false, true);
}
else if ((s.slidesPerView === 'auto' && s._activeIndex >= s.loopedSlides * 2) || (s._activeIndex > s._slides.length - s.slidesPerView * 2)) {
// Fix For Positive Oversliding
newIndex = -s._slides.length + s._activeIndex + s.loopedSlides;
newIndex = newIndex + s.loopedSlides;
slideTo(s, plt, newIndex, 0, false, true);
}
}
/*=========================
Transitions
===========================*/
function slideTo(s, plt, slideIndex, speed, runCallbacks, internal) {
if (runCallbacks === void 0) { runCallbacks = true; }
if (typeof slideIndex === 'undefined')
slideIndex = 0;
if (slideIndex < 0)
slideIndex = 0;
s._snapIndex = Math.floor(slideIndex / s.slidesPerGroup);
if (s._snapIndex >= s._snapGrid.length)
s._snapIndex = s._snapGrid.length - 1;
var translate = -s._snapGrid[s._snapIndex];
// Stop autoplay
if (s.autoplay && s._autoplaying) {
if (internal || !s.autoplayDisableOnInteraction) {
pauseAutoplay(s, plt, speed);
}
else {
stopAutoplay(s);
}
}
// Update progress
Object(__WEBPACK_IMPORTED_MODULE_2__swiper_progress__["a" /* updateProgress */])(s, translate);
// Directions locks
if (!s._allowSwipeToNext && translate < s._translate && translate < Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["i" /* minTranslate */])(s)) {
return false;
}
if (!s._allowSwipeToPrev && translate > s._translate && translate > Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["h" /* maxTranslate */])(s)) {
if ((s._activeIndex || 0) !== slideIndex)
return false;
}
// Update Index
if (typeof speed === 'undefined')
speed = s.speed;
s._previousIndex = s._activeIndex || 0;
s._activeIndex = slideIndex;
Object(__WEBPACK_IMPORTED_MODULE_5__swiper_index__["b" /* updateRealIndex */])(s);
if ((s._rtl && -translate === s._translate) || (!s._rtl && translate === s._translate)) {
// Update Height
if (s.autoHeight) {
updateAutoHeight(s);
}
Object(__WEBPACK_IMPORTED_MODULE_3__swiper_classes__["a" /* updateClasses */])(s);
if (s.effect !== 'slide') {
Object(__WEBPACK_IMPORTED_MODULE_1__swiper_transition__["d" /* setWrapperTranslate */])(s, plt, translate);
}
return false;
}
Object(__WEBPACK_IMPORTED_MODULE_3__swiper_classes__["a" /* updateClasses */])(s);
onTransitionStart(s, runCallbacks);
if (speed === 0) {
Object(__WEBPACK_IMPORTED_MODULE_1__swiper_transition__["d" /* setWrapperTranslate */])(s, plt, translate);
Object(__WEBPACK_IMPORTED_MODULE_1__swiper_transition__["c" /* setWrapperTransition */])(s, plt, 0);
onTransitionEnd(s, plt, runCallbacks);
}
else {
Object(__WEBPACK_IMPORTED_MODULE_1__swiper_transition__["d" /* setWrapperTranslate */])(s, plt, translate);
Object(__WEBPACK_IMPORTED_MODULE_1__swiper_transition__["c" /* setWrapperTransition */])(s, plt, speed);
if (!s._animating) {
s._animating = true;
plt.transitionEnd(s._wrapper, function () {
if (!s)
return;
onTransitionEnd(s, plt, runCallbacks);
});
}
}
return true;
}
function onTransitionStart(s, runCallbacks) {
if (runCallbacks === void 0) { runCallbacks = true; }
if (s.autoHeight) {
updateAutoHeight(s);
}
if (runCallbacks) {
s._zone.run(function () {
s.ionSlideTransitionStart.emit(s);
if (s._activeIndex !== s._previousIndex) {
s.ionSlideWillChange.emit(s);
if (s._activeIndex > s._previousIndex) {
s.ionSlideNextStart.emit(s);
}
else {
s.ionSlidePrevStart.emit(s);
}
}
});
}
}
function onTransitionEnd(s, plt, runCallbacks) {
if (runCallbacks === void 0) { runCallbacks = true; }
s._animating = false;
Object(__WEBPACK_IMPORTED_MODULE_1__swiper_transition__["c" /* setWrapperTransition */])(s, plt, 0);
if (runCallbacks) {
s._zone.run(function () {
s.ionSlideTransitionEnd.emit(s);
if (s._activeIndex !== s._previousIndex) {
s.ionSlideDidChange.emit(s);
if (s._activeIndex > s._previousIndex) {
s.ionSlideNextEnd.emit(s);
}
else {
s.ionSlidePrevEnd.emit(s);
}
}
});
}
}
function slideNext(s, plt, runCallbacks, speed, internal) {
if (s.loop) {
if (s._animating)
return false;
fixLoop(s, plt);
s.container.clientLeft;
return slideTo(s, plt, s._activeIndex + s.slidesPerGroup, speed, runCallbacks, internal);
}
var nextSlide = s._activeIndex + s.slidesPerGroup;
if (nextSlide < s._slides.length) {
return slideTo(s, plt, nextSlide, speed, runCallbacks, internal);
}
return false;
}
function slidePrev(s, plt, runCallbacks, speed, internal) {
if (s.loop) {
if (s._animating)
return false;
fixLoop(s, plt);
s.container.clientLeft;
return slideTo(s, plt, s._activeIndex - 1, speed, runCallbacks, internal);
}
var previousSlide = s._activeIndex - 1;
if (previousSlide >= 0) {
return slideTo(s, plt, s._activeIndex - 1, speed, runCallbacks, internal);
}
return false;
}
function slideReset(s, plt, runCallbacks, speed) {
return slideTo(s, plt, s._activeIndex, speed, runCallbacks, true);
}
function disableTouchControl(s) {
s.onlyExternal = true;
return true;
}
function enableTouchControl(s) {
s.onlyExternal = false;
return true;
}
/*=========================
Translate/transition helpers
===========================*/
// Cleanup dynamic styles
function cleanupStyles(s) {
if (!s.container || !s._wrapper) {
// fix #10830
return;
}
// Container
if (s.container) {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["l" /* removeClass */])(s.container, s._classNames);
s.container.removeAttribute('style');
}
// Wrapper
s._wrapper.removeAttribute('style');
// Slides
if (s._slides && s._slides.length) {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["l" /* removeClass */])(s._slides, [
__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].slideVisible,
__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].slideActive,
__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].slideNext,
__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].slidePrev
]);
for (var i = 0; i < s._slides.length; i++) {
var slide = s._slides[i];
slide.removeAttribute('style');
slide.removeAttribute('data-swiper-column');
slide.removeAttribute('data-swiper-row');
}
}
// Pagination/Bullets
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["l" /* removeClass */])(s._bullets, __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].bulletActive);
// Buttons
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["l" /* removeClass */])(s.prevButton, __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].buttonDisabled);
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["l" /* removeClass */])(s.nextButton, __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].buttonDisabled);
}
// Destroy
function destroySwiper(s) {
// Stop autoplay
stopAutoplay(s);
// Destroy loop
if (s.loop) {
destroyLoop(s);
}
// Cleanup styles
cleanupStyles(s);
}
//# sourceMappingURL=swiper.js.map
/***/ }),
/* 65 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (immutable) */ __webpack_exports__["a"] = updateProgress;
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__swiper_utils__ = __webpack_require__(17);
function updateProgress(s, translate) {
if (typeof translate === 'undefined') {
translate = s._translate || 0;
}
var translatesDiff = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["h" /* maxTranslate */])(s) - Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["i" /* minTranslate */])(s);
var wasBeginning = s._isBeginning;
var wasEnd = s._isEnd;
if (translatesDiff === 0) {
s.progress = 0;
s._isBeginning = s._isEnd = true;
}
else {
s.progress = (translate - Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["i" /* minTranslate */])(s)) / (translatesDiff);
s._isBeginning = s.progress <= 0;
s._isEnd = s.progress >= 1;
}
s._zone.run(function () {
if (s._isBeginning && !wasBeginning) {
s.ionSlideReachStart.emit();
}
if (s._isEnd && !wasEnd) {
s.ionSlideReachEnd.emit();
}
if (s.watchSlidesProgress) {
updateSlidesProgress(s, translate);
}
s.ionSlideProgress.emit(s.progress);
});
}
function updateSlidesProgress(s, translate) {
if (typeof translate === 'undefined') {
translate = s._translate || 0;
}
if (s._slides.length === 0)
return;
if (typeof s._slides[0].swiperSlideOffset === 'undefined') {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["q" /* updateSlidesOffset */])(s);
}
var offsetCenter = -translate;
if (s._rtl)
offsetCenter = translate;
// Visible Slides
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["l" /* removeClass */])(s._slides, __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].slideVisible);
for (var i = 0; i < s._slides.length; i++) {
var slide = s._slides[i];
var slideProgress = (offsetCenter + (s.centeredSlides ? Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["i" /* minTranslate */])(s) : 0) - slide.swiperSlideOffset) / (slide.swiperSlideSize + s.spaceBetween);
if (s.watchSlidesVisibility) {
var slideBefore = -(offsetCenter - slide.swiperSlideOffset);
var slideAfter = slideBefore + s._slidesSizesGrid[i];
var isVisible = (slideBefore >= 0 && slideBefore < s._renderedSize) ||
(slideAfter > 0 && slideAfter <= s._renderedSize) ||
(slideBefore <= 0 && slideAfter >= s._renderedSize);
if (isVisible) {
s._slides[i].classList.add(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].slideVisible);
}
}
slide.progress = s._rtl ? -slideProgress : slideProgress;
}
}
//# sourceMappingURL=swiper-progress.js.map
/***/ }),
/* 66 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (immutable) */ __webpack_exports__["a"] = updateActiveIndex;
/* harmony export (immutable) */ __webpack_exports__["b"] = updateRealIndex;
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__swiper_classes__ = __webpack_require__(113);
function updateActiveIndex(s) {
var translate = s._rtl ? s._translate : -s._translate;
var newActiveIndex;
var i;
var snapIndex;
for (i = 0; i < s._slidesGrid.length; i++) {
if (typeof s._slidesGrid[i + 1] !== 'undefined') {
if (translate >= s._slidesGrid[i] && translate < s._slidesGrid[i + 1] - (s._slidesGrid[i + 1] - s._slidesGrid[i]) / 2) {
newActiveIndex = i;
}
else if (translate >= s._slidesGrid[i] && translate < s._slidesGrid[i + 1]) {
newActiveIndex = i + 1;
}
}
else {
if (translate >= s._slidesGrid[i]) {
newActiveIndex = i;
}
}
}
snapIndex = Math.floor(newActiveIndex / s.slidesPerGroup);
if (snapIndex >= s._snapGrid.length)
snapIndex = s._snapGrid.length - 1;
if (newActiveIndex === s._activeIndex) {
return;
}
s._snapIndex = snapIndex;
s._previousIndex = s._activeIndex;
s._activeIndex = newActiveIndex;
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_classes__["a" /* updateClasses */])(s);
updateRealIndex(s);
}
function updateRealIndex(s) {
var activeSlide = s._slides[s._activeIndex];
if (activeSlide) {
s.realIndex = parseInt(activeSlide.getAttribute('data-swiper-slide-index') || s._activeIndex, 10);
}
}
//# sourceMappingURL=swiper-index.js.map
/***/ }),
/* 67 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Toolbar; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__toolbar_base__ = __webpack_require__(171);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name Toolbar
* @description
* A Toolbar is a generic bar that is positioned above or below content.
* Unlike a [Navbar](../Navbar/), a toolbar can be used as a subheader.
* When toolbars are placed within an `<ion-header>` or `<ion-footer>`,
* the toolbars stay fixed in their respective location. When placed within
* `<ion-content>`, toolbars will scroll with the content.
*
*
* ### Buttons in a Toolbar
* Buttons placed in a toolbar should be placed inside of the `<ion-buttons>`
* element. An exception to this is a [menuToggle](../../menu/MenuToggle) button.
* It should not be placed inside of the `<ion-buttons>` element. Both the
* `<ion-buttons>` element and the `menuToggle` can be positioned inside of the
* toolbar using different properties. The below chart has a description of each
* property.
*
* | Property | Description |
* |-------------|-----------------------------------------------------------------------------------------------------------------------|
* | `start` | Positions element to the left of the content in `ios` mode, and directly to the right in `md` and `wp` mode. |
* | `end` | Positions element to the right of the content in `ios` mode, and to the far right in `md` and `wp` mode. |
* | `left` | Positions element to the left of all other elements. |
* | `right` | Positions element to the right of all other elements. |
*
*
* ### Header / Footer Box Shadow and Border
* In `md` mode, the `<ion-header>` will receive a box-shadow on the bottom, and the
* `<ion-footer>` will receive a box-shadow on the top. In `ios` mode, the `<ion-header>`
* will receive a border on the bottom, and the `<ion-footer>` will receive a border on the
* top. Both the `md` box-shadow and the `ios` border can be removed by adding the `no-border`
* attribute to the element.
*
* ```html
* <ion-header no-border>
* <ion-toolbar>
* <ion-title>Header</ion-title>
* </ion-toolbar>
* </ion-header>
*
* <ion-content>
* </ion-content>
*
* <ion-footer no-border>
* <ion-toolbar>
* <ion-title>Footer</ion-title>
* </ion-toolbar>
* </ion-footer>
* ```
*
* @usage
*
* ```html
*
* <ion-header no-border>
*
* <ion-toolbar>
* <ion-title>My Toolbar Title</ion-title>
* </ion-toolbar>
*
* <ion-toolbar>
* <ion-title>I'm a subheader</ion-title>
* </ion-toolbar>
*
* <ion-header>
*
*
* <ion-content>
*
* <ion-toolbar>
* <ion-title>Scrolls with the content</ion-title>
* </ion-toolbar>
*
* </ion-content>
*
*
* <ion-footer no-border>
*
* <ion-toolbar>
* <ion-title>I'm a footer</ion-title>
* </ion-toolbar>
*
* </ion-footer>
* ```
*
* @demo /docs/demos/src/toolbar/
* @see {@link ../Navbar/ Navbar API Docs}
*/
var Toolbar = (function (_super) {
__extends(Toolbar, _super);
function Toolbar(config, elementRef, renderer) {
var _this = _super.call(this, config, elementRef, renderer) || this;
_this._sbPadding = config.getBoolean('statusbarPadding');
return _this;
}
Toolbar.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-toolbar',
template: '<div class="toolbar-background" [ngClass]="\'toolbar-background-\' + _mode"></div>' +
'<ng-content select="[menuToggle],ion-buttons[left]"></ng-content>' +
'<ng-content select="ion-buttons[start]"></ng-content>' +
'<ng-content select="ion-buttons[end],ion-buttons[right]"></ng-content>' +
'<div class="toolbar-content" [ngClass]="\'toolbar-content-\' + _mode">' +
'<ng-content></ng-content>' +
'</div>',
host: {
'class': 'toolbar',
'[class.statusbar-padding]': '_sbPadding'
},
changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* ChangeDetectionStrategy */].OnPush,
},] },
];
/** @nocollapse */
Toolbar.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
]; };
return Toolbar;
}(__WEBPACK_IMPORTED_MODULE_2__toolbar_base__["a" /* ToolbarBase */]));
//# sourceMappingURL=toolbar.js.map
/***/ }),
/* 68 */
/***/ (function(module, exports) {
var g;
// This works in non-strict mode
g = (function() {
return this;
})();
try {
// This works if eval is allowed (see CSP)
g = g || Function("return this")() || (1,eval)("this");
} catch(e) {
// This works if the window reference is available
if(typeof window === "object")
g = window;
}
// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}
module.exports = g;
/***/ }),
/* 69 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function isFunction(x) {
return typeof x === 'function';
}
exports.isFunction = isFunction;
//# sourceMappingURL=isFunction.js.map
/***/ }),
/* 70 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.isArray = Array.isArray || (function (x) { return x && typeof x.length === 'number'; });
//# sourceMappingURL=isArray.js.map
/***/ }),
/* 71 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// typeof any so that it we don't have to cast when comparing a result to the error object
exports.errorObject = { e: {} };
//# sourceMappingURL=errorObject.js.map
/***/ }),
/* 72 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var root_1 = __webpack_require__(32);
var Symbol = root_1.root.Symbol;
exports.rxSubscriber = (typeof Symbol === 'function' && typeof Symbol.for === 'function') ?
Symbol.for('rxSubscriber') : '@@rxSubscriber';
/**
* @deprecated use rxSubscriber instead
*/
exports.$$rxSubscriber = exports.rxSubscriber;
//# sourceMappingURL=rxSubscriber.js.map
/***/ }),
/* 73 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var root_1 = __webpack_require__(32);
var isArrayLike_1 = __webpack_require__(365);
var isPromise_1 = __webpack_require__(366);
var isObject_1 = __webpack_require__(123);
var Observable_1 = __webpack_require__(9);
var iterator_1 = __webpack_require__(367);
var InnerSubscriber_1 = __webpack_require__(368);
var observable_1 = __webpack_require__(126);
function subscribeToResult(outerSubscriber, result, outerValue, outerIndex) {
var destination = new InnerSubscriber_1.InnerSubscriber(outerSubscriber, outerValue, outerIndex);
if (destination.closed) {
return null;
}
if (result instanceof Observable_1.Observable) {
if (result._isScalar) {
destination.next(result.value);
destination.complete();
return null;
}
else {
destination.syncErrorThrowable = true;
return result.subscribe(destination);
}
}
else if (isArrayLike_1.isArrayLike(result)) {
for (var i = 0, len = result.length; i < len && !destination.closed; i++) {
destination.next(result[i]);
}
if (!destination.closed) {
destination.complete();
}
}
else if (isPromise_1.isPromise(result)) {
result.then(function (value) {
if (!destination.closed) {
destination.next(value);
destination.complete();
}
}, function (err) { return destination.error(err); })
.then(null, function (err) {
// Escaping the Promise trap: globally throw unhandled errors
root_1.root.setTimeout(function () { throw err; });
});
return destination;
}
else if (result && typeof result[iterator_1.iterator] === 'function') {
var iterator = result[iterator_1.iterator]();
do {
var item = iterator.next();
if (item.done) {
destination.complete();
break;
}
destination.next(item.value);
if (destination.closed) {
break;
}
} while (true);
}
else if (result && typeof result[observable_1.observable] === 'function') {
var obs = result[observable_1.observable]();
if (typeof obs.subscribe !== 'function') {
destination.error(new TypeError('Provided object does not correctly implement Symbol.observable'));
}
else {
return obs.subscribe(new InnerSubscriber_1.InnerSubscriber(outerSubscriber, outerValue, outerIndex));
}
}
else {
var value = isObject_1.isObject(result) ? 'an invalid object' : "'" + result + "'";
var msg = ("You provided " + value + " where a stream was expected.")
+ ' You can provide an Observable, Promise, Array, or Iterable.';
destination.error(new TypeError(msg));
}
return null;
}
exports.subscribeToResult = subscribeToResult;
//# sourceMappingURL=subscribeToResult.js.map
/***/ }),
/* 74 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Subscriber_1 = __webpack_require__(25);
/**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
var OuterSubscriber = (function (_super) {
__extends(OuterSubscriber, _super);
function OuterSubscriber() {
_super.apply(this, arguments);
}
OuterSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
this.destination.next(innerValue);
};
OuterSubscriber.prototype.notifyError = function (error, innerSub) {
this.destination.error(error);
};
OuterSubscriber.prototype.notifyComplete = function (innerSub) {
this.destination.complete();
};
return OuterSubscriber;
}(Subscriber_1.Subscriber));
exports.OuterSubscriber = OuterSubscriber;
//# sourceMappingURL=OuterSubscriber.js.map
/***/ }),
/* 75 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AppRootToken; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return IonicApp; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__app__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__ion__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__overlay_portal__ = __webpack_require__(135);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__platform_platform__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__app_constants__ = __webpack_require__(44);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var AppRootToken = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["B" /* InjectionToken */]('USERROOT');
/**
* @hidden
*/
var IonicApp = (function (_super) {
__extends(IonicApp, _super);
function IonicApp(_userCmp, _cfr, elementRef, renderer, config, _plt, app) {
var _this = _super.call(this, config, elementRef, renderer, 'app-root') || this;
_this._userCmp = _userCmp;
_this._cfr = _cfr;
_this._plt = _plt;
// register with App that this is Ionic's appRoot component. tada!
app._appRoot = _this;
_this._stopScrollPlugin = window['IonicStopScroll'];
return _this;
}
IonicApp.prototype.ngOnInit = function () {
var _this = this;
// load the user root component
// into Ionic's root component
var factory = this._cfr.resolveComponentFactory(this._userCmp);
var componentRef = this._viewport.createComponent(factory);
this._renderer.setElementClass(componentRef.location.nativeElement, 'app-root', true);
componentRef.changeDetectorRef.detectChanges();
// set the mode class name
// ios/md/wp
this.setElementClass(this._config.get('mode'), true);
var versions = this._plt.versions();
this._plt.platforms().forEach(function (platformName) {
// platform-ios
var platformClass = 'platform-' + platformName;
_this.setElementClass(platformClass, true);
var platformVersion = versions[platformName];
if (platformVersion) {
// platform-ios9
platformClass += platformVersion.major;
_this.setElementClass(platformClass, true);
// platform-ios9_3
_this.setElementClass(platformClass + '_' + platformVersion.minor, true);
}
});
// touch devices should not use :hover CSS pseudo
// enable :hover CSS when the "hoverCSS" setting is not false
if (this._config.getBoolean('hoverCSS', true)) {
this.setElementClass('enable-hover', true);
}
// sweet, the app root has loaded!
// which means angular and ionic has fully loaded!
// fire off the platform prepare ready, which could
// have been switched out by any of the platform engines
this._plt.prepareReady();
};
/**
* @hidden
*/
IonicApp.prototype._getPortal = function (portal) {
if (portal === __WEBPACK_IMPORTED_MODULE_6__app_constants__["b" /* PORTAL_LOADING */]) {
return this._loadingPortal;
}
if (portal === __WEBPACK_IMPORTED_MODULE_6__app_constants__["d" /* PORTAL_TOAST */]) {
return this._toastPortal;
}
// Modals need their own overlay becuase we don't want an ActionSheet
// or Alert to trigger lifecycle events inside a modal
if (portal === __WEBPACK_IMPORTED_MODULE_6__app_constants__["c" /* PORTAL_MODAL */]) {
return this._modalPortal;
}
return this._overlayPortal;
};
IonicApp.prototype._getActivePortal = function () {
var defaultPortal = this._overlayPortal;
var modalPortal = this._modalPortal;
var hasModal = modalPortal.length() > 0;
var hasDefault = defaultPortal.length() > 0;
if (!hasModal && !hasDefault) {
return null;
}
else if (hasModal && hasDefault) {
var defaultIndex = defaultPortal.getActive().getZIndex();
var modalIndex = modalPortal.getActive().getZIndex();
if (defaultIndex > modalIndex) {
return defaultPortal;
}
else {
(void 0) /* assert */;
return modalPortal;
}
}
if (hasModal) {
return modalPortal;
}
else if (hasDefault) {
return defaultPortal;
}
};
IonicApp.prototype._disableScroll = function (shouldDisableScroll) {
var _this = this;
if (shouldDisableScroll) {
this.stopScroll().then(function () {
_this._tmr = _this._plt.timeout(function () {
(void 0) /* console.debug */;
_this.setElementClass('disable-scroll', true);
}, 32);
});
}
else {
var plugin = this._stopScrollPlugin;
if (plugin && plugin.cancel) {
plugin.cancel();
}
clearTimeout(this._tmr);
(void 0) /* console.debug */;
this.setElementClass('disable-scroll', false);
}
};
IonicApp.prototype.stopScroll = function () {
var _this = this;
if (this._stopScrollPlugin) {
return new Promise(function (resolve) {
_this._stopScrollPlugin.stop(function () { return resolve(true); });
});
}
else {
return Promise.resolve(false);
}
};
IonicApp.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-app',
template: '<div #viewport app-viewport></div>' +
'<div #modalPortal overlay-portal></div>' +
'<div #overlayPortal overlay-portal></div>' +
'<div #loadingPortal class="loading-portal" overlay-portal></div>' +
'<div #toastPortal class="toast-portal" [overlay-portal]="10000"></div>' +
'<div class="click-block"></div>'
},] },
];
/** @nocollapse */
IonicApp.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["z" /* Inject */], args: [AppRootToken,] },] },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["o" /* ComponentFactoryResolver */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_2__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_5__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__app__["a" /* App */], },
]; };
IonicApp.propDecorators = {
'_viewport': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_8" /* ViewChild */], args: ['viewport', { read: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_10" /* ViewContainerRef */] },] },],
'_modalPortal': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_8" /* ViewChild */], args: ['modalPortal', { read: __WEBPACK_IMPORTED_MODULE_4__overlay_portal__["a" /* OverlayPortal */] },] },],
'_overlayPortal': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_8" /* ViewChild */], args: ['overlayPortal', { read: __WEBPACK_IMPORTED_MODULE_4__overlay_portal__["a" /* OverlayPortal */] },] },],
'_loadingPortal': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_8" /* ViewChild */], args: ['loadingPortal', { read: __WEBPACK_IMPORTED_MODULE_4__overlay_portal__["a" /* OverlayPortal */] },] },],
'_toastPortal': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_8" /* ViewChild */], args: ['toastPortal', { read: __WEBPACK_IMPORTED_MODULE_4__overlay_portal__["a" /* OverlayPortal */] },] },],
};
return IonicApp;
}(__WEBPACK_IMPORTED_MODULE_3__ion__["a" /* Ion */]));
//# sourceMappingURL=app-root.js.map
/***/ }),
/* 76 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SlideEdgeGesture; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__slide_gesture__ = __webpack_require__(136);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_dom__ = __webpack_require__(14);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
*/
var SlideEdgeGesture = (function (_super) {
__extends(SlideEdgeGesture, _super);
function SlideEdgeGesture(plt, element, opts) {
if (opts === void 0) { opts = {}; }
var _this = this;
Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["d" /* defaults */])(opts, {
edge: 'start',
maxEdgeStart: 50
});
_this = _super.call(this, plt, element, opts) || this;
// Can check corners through use of eg 'left top'
_this.setEdges(opts.edge);
_this.maxEdgeStart = opts.maxEdgeStart;
return _this;
}
SlideEdgeGesture.prototype.setEdges = function (edges) {
var isRTL = this.plt.isRTL;
this.edges = edges.split(' ').map(function (value) {
switch (value) {
case 'start': return isRTL ? 'right' : 'left';
case 'end': return isRTL ? 'left' : 'right';
default: return value;
}
});
};
SlideEdgeGesture.prototype.canStart = function (ev) {
var _this = this;
var coord = Object(__WEBPACK_IMPORTED_MODULE_2__util_dom__["f" /* pointerCoord */])(ev);
this._d = this.getContainerDimensions();
return this.edges.every(function (edge) { return _this._checkEdge(edge, coord); });
};
SlideEdgeGesture.prototype.getContainerDimensions = function () {
var plt = this.plt;
return {
left: 0,
top: 0,
width: plt.width(),
height: plt.height()
};
};
SlideEdgeGesture.prototype._checkEdge = function (edge, pos) {
var data = this._d;
var maxEdgeStart = this.maxEdgeStart;
switch (edge) {
case 'left': return pos.x <= data.left + maxEdgeStart;
case 'right': return pos.x >= data.width - maxEdgeStart;
case 'top': return pos.y <= data.top + maxEdgeStart;
case 'bottom': return pos.y >= data.height - maxEdgeStart;
}
return false;
};
return SlideEdgeGesture;
}(__WEBPACK_IMPORTED_MODULE_0__slide_gesture__["a" /* SlideGesture */]));
//# sourceMappingURL=slide-edge-gesture.js.map
/***/ }),
/* 77 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ActionSheet; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__action_sheet_component__ = __webpack_require__(78);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__action_sheet_transitions__ = __webpack_require__(388);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__navigation_view_controller__ = __webpack_require__(7);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
*/
var ActionSheet = (function (_super) {
__extends(ActionSheet, _super);
function ActionSheet(app, opts, config) {
var _this = this;
opts.buttons = opts.buttons || [];
opts.enableBackdropDismiss = Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["l" /* isPresent */])(opts.enableBackdropDismiss) ? !!opts.enableBackdropDismiss : true;
_this = _super.call(this, __WEBPACK_IMPORTED_MODULE_0__action_sheet_component__["a" /* ActionSheetCmp */], opts, null) || this;
_this._app = app;
_this.isOverlay = true;
config.setTransition('action-sheet-slide-in', __WEBPACK_IMPORTED_MODULE_1__action_sheet_transitions__["c" /* ActionSheetSlideIn */]);
config.setTransition('action-sheet-slide-out', __WEBPACK_IMPORTED_MODULE_1__action_sheet_transitions__["d" /* ActionSheetSlideOut */]);
config.setTransition('action-sheet-md-slide-in', __WEBPACK_IMPORTED_MODULE_1__action_sheet_transitions__["a" /* ActionSheetMdSlideIn */]);
config.setTransition('action-sheet-md-slide-out', __WEBPACK_IMPORTED_MODULE_1__action_sheet_transitions__["b" /* ActionSheetMdSlideOut */]);
config.setTransition('action-sheet-wp-slide-in', __WEBPACK_IMPORTED_MODULE_1__action_sheet_transitions__["e" /* ActionSheetWpSlideIn */]);
config.setTransition('action-sheet-wp-slide-out', __WEBPACK_IMPORTED_MODULE_1__action_sheet_transitions__["f" /* ActionSheetWpSlideOut */]);
return _this;
}
/**
* @hidden
*/
ActionSheet.prototype.getTransitionName = function (direction) {
var key = 'actionSheet' + (direction === 'back' ? 'Leave' : 'Enter');
return this._nav && this._nav.config.get(key);
};
/**
* @param {string} title Action sheet title
*/
ActionSheet.prototype.setTitle = function (title) {
this.data.title = title;
return this;
};
/**
* @param {string} subTitle Action sheet subtitle
*/
ActionSheet.prototype.setSubTitle = function (subTitle) {
this.data.subTitle = subTitle;
return this;
};
/**
* @param {object} button Action sheet button
*/
ActionSheet.prototype.addButton = function (button) {
this.data.buttons.push(button);
return this;
};
/**
* Present the action sheet instance.
*
* @param {NavOptions} [navOptions={}] Nav options to go with this transition.
* @returns {Promise} Returns a promise which is resolved when the transition has completed.
*/
ActionSheet.prototype.present = function (navOptions) {
if (navOptions === void 0) { navOptions = {}; }
navOptions.minClickBlockDuration = navOptions.minClickBlockDuration || 400;
return this._app.present(this, navOptions);
};
return ActionSheet;
}(__WEBPACK_IMPORTED_MODULE_3__navigation_view_controller__["a" /* ViewController */]));
//# sourceMappingURL=action-sheet.js.map
/***/ }),
/* 78 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ActionSheetCmp; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__gestures_gesture_controller__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__platform_key__ = __webpack_require__(23);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__navigation_nav_params__ = __webpack_require__(18);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__navigation_view_controller__ = __webpack_require__(7);
/**
* @hidden
*/
var ActionSheetCmp = (function () {
function ActionSheetCmp(_viewCtrl, config, _elementRef, gestureCtrl, params, renderer) {
this._viewCtrl = _viewCtrl;
this._elementRef = _elementRef;
this.gestureBlocker = gestureCtrl.createBlocker(__WEBPACK_IMPORTED_MODULE_1__gestures_gesture_controller__["a" /* BLOCK_ALL */]);
this.d = params.data;
this.mode = config.get('mode');
renderer.setElementClass(_elementRef.nativeElement, "action-sheet-" + this.mode, true);
if (this.d.cssClass) {
this.d.cssClass.split(' ').forEach(function (cssClass) {
// Make sure the class isn't whitespace, otherwise it throws exceptions
if (cssClass.trim() !== '')
renderer.setElementClass(_elementRef.nativeElement, cssClass, true);
});
}
this.id = (++actionSheetIds);
if (this.d.title) {
this.hdrId = 'acst-hdr-' + this.id;
}
if (this.d.subTitle) {
this.descId = 'acst-subhdr-' + this.id;
}
}
ActionSheetCmp.prototype.ionViewDidLoad = function () {
var _this = this;
// normalize the data
this.d.buttons = this.d.buttons.map(function (button) {
if (typeof button === 'string') {
button = { text: button };
}
if (!button.cssClass) {
button.cssClass = '';
}
switch (button.role) {
case 'cancel':
_this.cancelButton = button;
return null;
case 'destructive':
button.cssClass = (button.cssClass + ' ' || '') + 'action-sheet-destructive';
break;
case 'selected':
button.cssClass = (button.cssClass + ' ' || '') + 'action-sheet-selected';
break;
}
return button;
}).filter(function (button) { return button !== null; });
};
ActionSheetCmp.prototype.ionViewWillEnter = function () {
this.gestureBlocker.block();
};
ActionSheetCmp.prototype.ionViewDidLeave = function () {
this.gestureBlocker.unblock();
};
ActionSheetCmp.prototype.ionViewDidEnter = function () {
var focusableEle = this._elementRef.nativeElement.querySelector('button');
if (focusableEle) {
focusableEle.focus();
}
this.enabled = true;
};
ActionSheetCmp.prototype.keyUp = function (ev) {
if (this.enabled && ev.keyCode === __WEBPACK_IMPORTED_MODULE_3__platform_key__["c" /* KEY_ESCAPE */] && this._viewCtrl.isLast()) {
(void 0) /* console.debug */;
this.bdClick();
}
};
ActionSheetCmp.prototype.click = function (button) {
if (!this.enabled) {
return;
}
var shouldDismiss = true;
if (button.handler) {
// a handler has been provided, execute it
if (button.handler() === false) {
// if the return value of the handler is false then do not dismiss
shouldDismiss = false;
}
}
if (shouldDismiss) {
this.dismiss(button.role);
}
};
ActionSheetCmp.prototype.bdClick = function () {
if (this.enabled && this.d.enableBackdropDismiss) {
if (this.cancelButton) {
this.click(this.cancelButton);
}
else {
this.dismiss('backdrop');
}
}
};
ActionSheetCmp.prototype.dismiss = function (role) {
var opts = {
minClickBlockDuration: 400
};
return this._viewCtrl.dismiss(null, role, opts);
};
ActionSheetCmp.prototype.ngOnDestroy = function () {
(void 0) /* assert */;
this.d = this.cancelButton = null;
this.gestureBlocker.destroy();
};
ActionSheetCmp.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-action-sheet',
template: '<ion-backdrop (click)="bdClick()" [class.backdrop-no-tappable]="!d.enableBackdropDismiss"></ion-backdrop>' +
'<div class="action-sheet-wrapper">' +
'<div class="action-sheet-container">' +
'<div class="action-sheet-group">' +
'<div class="action-sheet-title" id="{{hdrId}}" *ngIf="d.title">{{d.title}}</div>' +
'<div class="action-sheet-sub-title" id="{{descId}}" *ngIf="d.subTitle">{{d.subTitle}}</div>' +
'<button ion-button="action-sheet-button" (click)="click(b)" *ngFor="let b of d.buttons" class="disable-hover" [attr.icon-start]="b.icon ? \'\' : null" [ngClass]="b.cssClass">' +
'<ion-icon [name]="b.icon" *ngIf="b.icon" class="action-sheet-icon"></ion-icon>' +
'{{b.text}}' +
'</button>' +
'</div>' +
'<div class="action-sheet-group action-sheet-group-cancel" *ngIf="cancelButton">' +
'<button ion-button="action-sheet-button" (click)="click(cancelButton)" class="action-sheet-cancel disable-hover" [attr.icon-start]="cancelButton.icon ? \'\' : null" [ngClass]="cancelButton.cssClass">' +
'<ion-icon [name]="cancelButton.icon" *ngIf="cancelButton.icon" class="action-sheet-icon"></ion-icon>' +
'{{cancelButton.text}}' +
'</button>' +
'</div>' +
'</div>' +
'</div>',
host: {
'role': 'dialog',
'[attr.aria-labelledby]': 'hdrId',
'[attr.aria-describedby]': 'descId'
},
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
},] },
];
/** @nocollapse */
ActionSheetCmp.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_5__navigation_view_controller__["a" /* ViewController */], },
{ type: __WEBPACK_IMPORTED_MODULE_2__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__gestures_gesture_controller__["l" /* GestureController */], },
{ type: __WEBPACK_IMPORTED_MODULE_4__navigation_nav_params__["a" /* NavParams */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
]; };
ActionSheetCmp.propDecorators = {
'keyUp': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* HostListener */], args: ['body:keyup', ['$event'],] },],
};
return ActionSheetCmp;
}());
var actionSheetIds = -1;
//# sourceMappingURL=action-sheet-component.js.map
/***/ }),
/* 79 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Alert; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__alert_component__ = __webpack_require__(80);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__alert_transitions__ = __webpack_require__(389);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__navigation_view_controller__ = __webpack_require__(7);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
*/
var Alert = (function (_super) {
__extends(Alert, _super);
function Alert(app, opts, config) {
if (opts === void 0) { opts = {}; }
var _this = this;
opts.inputs = opts.inputs || [];
opts.buttons = opts.buttons || [];
opts.enableBackdropDismiss = Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["l" /* isPresent */])(opts.enableBackdropDismiss) ? !!opts.enableBackdropDismiss : true;
_this = _super.call(this, __WEBPACK_IMPORTED_MODULE_0__alert_component__["a" /* AlertCmp */], opts, null) || this;
_this._app = app;
_this.isOverlay = true;
config.setTransition('alert-pop-in', __WEBPACK_IMPORTED_MODULE_1__alert_transitions__["c" /* AlertPopIn */]);
config.setTransition('alert-pop-out', __WEBPACK_IMPORTED_MODULE_1__alert_transitions__["d" /* AlertPopOut */]);
config.setTransition('alert-md-pop-in', __WEBPACK_IMPORTED_MODULE_1__alert_transitions__["a" /* AlertMdPopIn */]);
config.setTransition('alert-md-pop-out', __WEBPACK_IMPORTED_MODULE_1__alert_transitions__["b" /* AlertMdPopOut */]);
config.setTransition('alert-wp-pop-in', __WEBPACK_IMPORTED_MODULE_1__alert_transitions__["e" /* AlertWpPopIn */]);
config.setTransition('alert-wp-pop-out', __WEBPACK_IMPORTED_MODULE_1__alert_transitions__["f" /* AlertWpPopOut */]);
return _this;
}
/**
* @hidden
*/
Alert.prototype.getTransitionName = function (direction) {
var key = (direction === 'back' ? 'alertLeave' : 'alertEnter');
return this._nav && this._nav.config.get(key);
};
/**
* @param {string} title Alert title
*/
Alert.prototype.setTitle = function (title) {
this.data.title = title;
return this;
};
/**
* @param {string} subTitle Alert subtitle
*/
Alert.prototype.setSubTitle = function (subTitle) {
this.data.subTitle = subTitle;
return this;
};
/**
* @param {string} message Alert message content
*/
Alert.prototype.setMessage = function (message) {
this.data.message = message;
return this;
};
/**
* @param {object} input Alert input
*/
Alert.prototype.addInput = function (input) {
this.data.inputs.push(input);
return this;
};
/**
* @param {any} button Alert button
*/
Alert.prototype.addButton = function (button) {
this.data.buttons.push(button);
return this;
};
/**
* @param {string} cssClass Set the CSS class names on the alert's outer wrapper.
*/
Alert.prototype.setCssClass = function (cssClass) {
this.data.cssClass = cssClass;
return this;
};
/**
* @param {string} mode Set the mode of the alert (ios, md, wp).
*/
Alert.prototype.setMode = function (mode) {
this.data.mode = mode;
};
/**
* Present the alert instance.
*
* @param {NavOptions} [navOptions={}] Nav options to go with this transition.
* @returns {Promise} Returns a promise which is resolved when the transition has completed.
*/
Alert.prototype.present = function (navOptions) {
if (navOptions === void 0) { navOptions = {}; }
navOptions.minClickBlockDuration = navOptions.minClickBlockDuration || 400;
return this._app.present(this, navOptions);
};
return Alert;
}(__WEBPACK_IMPORTED_MODULE_3__navigation_view_controller__["a" /* ViewController */]));
//# sourceMappingURL=alert.js.map
/***/ }),
/* 80 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AlertCmp; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_dom__ = __webpack_require__(14);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__gestures_gesture_controller__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__platform_key__ = __webpack_require__(23);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__navigation_nav_params__ = __webpack_require__(18);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__platform_platform__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__navigation_view_controller__ = __webpack_require__(7);
/**
* @hidden
*/
var AlertCmp = (function () {
function AlertCmp(_viewCtrl, _elementRef, config, gestureCtrl, params, _renderer, _plt) {
this._viewCtrl = _viewCtrl;
this._elementRef = _elementRef;
this._renderer = _renderer;
this._plt = _plt;
// gesture blocker is used to disable gestures dynamically
this.gestureBlocker = gestureCtrl.createBlocker(__WEBPACK_IMPORTED_MODULE_3__gestures_gesture_controller__["a" /* BLOCK_ALL */]);
this.d = params.data;
this.mode = this.d.mode || config.get('mode');
this.keyboardResizes = config.getBoolean('keyboardResizes', false);
_renderer.setElementClass(_elementRef.nativeElement, "alert-" + this.mode, true);
if (this.d.cssClass) {
this.d.cssClass.split(' ').forEach(function (cssClass) {
// Make sure the class isn't whitespace, otherwise it throws exceptions
if (cssClass.trim() !== '')
_renderer.setElementClass(_elementRef.nativeElement, cssClass, true);
});
}
this.id = (++alertIds);
this.descId = '';
this.hdrId = 'alert-hdr-' + this.id;
this.subHdrId = 'alert-subhdr-' + this.id;
this.msgId = 'alert-msg-' + this.id;
this.activeId = '';
this.lastClick = 0;
if (this.d.message) {
this.descId = this.msgId;
}
else if (this.d.subTitle) {
this.descId = this.subHdrId;
}
if (!this.d.message) {
this.d.message = '';
}
}
AlertCmp.prototype.ionViewDidLoad = function () {
var _this = this;
// normalize the data
var data = this.d;
data.buttons = data.buttons.map(function (button) {
if (typeof button === 'string') {
return { text: button };
}
return button;
});
data.inputs = data.inputs.map(function (input, index) {
var r = {
type: input.type || 'text',
name: Object(__WEBPACK_IMPORTED_MODULE_4__util_util__["l" /* isPresent */])(input.name) ? input.name : index + '',
placeholder: Object(__WEBPACK_IMPORTED_MODULE_4__util_util__["l" /* isPresent */])(input.placeholder) ? input.placeholder : '',
value: Object(__WEBPACK_IMPORTED_MODULE_4__util_util__["l" /* isPresent */])(input.value) ? input.value : '',
label: input.label,
checked: !!input.checked,
disabled: !!input.disabled,
id: Object(__WEBPACK_IMPORTED_MODULE_4__util_util__["l" /* isPresent */])(input.id) ? input.id : "alert-input-" + _this.id + "-" + index,
handler: Object(__WEBPACK_IMPORTED_MODULE_4__util_util__["l" /* isPresent */])(input.handler) ? input.handler : null,
min: Object(__WEBPACK_IMPORTED_MODULE_4__util_util__["l" /* isPresent */])(input.min) ? input.min : null,
max: Object(__WEBPACK_IMPORTED_MODULE_4__util_util__["l" /* isPresent */])(input.max) ? input.max : null
};
return r;
});
// An alert can be created with several different inputs. Radios,
// checkboxes and inputs are all accepted, but they cannot be mixed.
var inputTypes = [];
data.inputs.forEach(function (input) {
if (inputTypes.indexOf(input.type) < 0) {
inputTypes.push(input.type);
}
});
if (inputTypes.length > 1 && (inputTypes.indexOf('checkbox') > -1 || inputTypes.indexOf('radio') > -1)) {
console.warn("Alert cannot mix input types: " + (inputTypes.join('/')) + ". Please see alert docs for more info.");
}
this.inputType = inputTypes.length ? inputTypes[0] : null;
var checkedInput = this.d.inputs.find(function (input) { return input.checked; });
if (checkedInput) {
this.activeId = checkedInput.id;
}
var hasTextInput = (this.d.inputs.length && this.d.inputs.some(function (i) { return !(__WEBPACK_IMPORTED_MODULE_2__util_dom__["a" /* NON_TEXT_INPUT_REGEX */].test(i.type)); }));
if (!this.keyboardResizes && hasTextInput && this._plt.is('mobile')) {
// this alert has a text input and it's on a mobile device so we should align
// the alert up high because we need to leave space for the virtual keboard
// this also helps prevent the layout getting all messed up from
// the browser trying to scroll the input into a safe area
this._renderer.setElementClass(this._elementRef.nativeElement, 'alert-top', true);
}
};
AlertCmp.prototype.ionViewWillEnter = function () {
this.gestureBlocker.block();
};
AlertCmp.prototype.ionViewDidLeave = function () {
this.gestureBlocker.unblock();
};
AlertCmp.prototype.ionViewDidEnter = function () {
// set focus on the first input or button in the alert
// note that this does not always work and bring up the keyboard on
// devices since the focus command must come from the user's touch event
// and ionViewDidEnter is not in the same callstack as the touch event :(
var focusableEle = this._elementRef.nativeElement.querySelector('input,button');
if (focusableEle) {
setTimeout(function () { return focusableEle.focus(); });
}
this.enabled = true;
};
AlertCmp.prototype.keyUp = function (ev) {
if (this.enabled && this._viewCtrl.isLast()) {
if (ev.keyCode === __WEBPACK_IMPORTED_MODULE_5__platform_key__["b" /* KEY_ENTER */]) {
if (this.lastClick + 1000 < Date.now()) {
// do not fire this click if there recently was already a click
// this can happen when the button has focus and used the enter
// key to click the button. However, both the click handler and
// this keyup event will fire, so only allow one of them to go.
(void 0) /* console.debug */;
var button = this.d.buttons[this.d.buttons.length - 1];
this.btnClick(button);
}
}
else if (ev.keyCode === __WEBPACK_IMPORTED_MODULE_5__platform_key__["c" /* KEY_ESCAPE */]) {
(void 0) /* console.debug */;
this.bdClick();
}
}
};
AlertCmp.prototype.btnClick = function (button) {
if (!this.enabled) {
return;
}
// keep the time of the most recent button click
this.lastClick = Date.now();
var shouldDismiss = true;
if (button.handler) {
// a handler has been provided, execute it
// pass the handler the values from the inputs
if (button.handler(this.getValues()) === false) {
// if the return value of the handler is false then do not dismiss
shouldDismiss = false;
}
}
if (shouldDismiss) {
this.dismiss(button.role);
}
};
AlertCmp.prototype.rbClick = function (checkedInput) {
if (this.enabled) {
this.d.inputs.forEach(function (input) {
input.checked = (checkedInput === input);
});
this.activeId = checkedInput.id;
if (checkedInput.handler) {
checkedInput.handler(checkedInput);
}
}
};
AlertCmp.prototype.cbClick = function (checkedInput) {
if (this.enabled) {
checkedInput.checked = !checkedInput.checked;
if (checkedInput.handler) {
checkedInput.handler(checkedInput);
}
}
};
AlertCmp.prototype.bdClick = function () {
if (this.enabled && this.d.enableBackdropDismiss) {
var cancelBtn = this.d.buttons.find(function (b) { return b.role === 'cancel'; });
if (cancelBtn) {
this.btnClick(cancelBtn);
}
else {
this.dismiss('backdrop');
}
}
};
AlertCmp.prototype.dismiss = function (role) {
var opts = {
minClickBlockDuration: 400
};
return this._viewCtrl.dismiss(this.getValues(), role, opts);
};
AlertCmp.prototype.getValues = function () {
if (this.inputType === 'radio') {
// this is an alert with radio buttons (single value select)
// return the one value which is checked, otherwise undefined
var checkedInput = this.d.inputs.find(function (i) { return i.checked; });
return checkedInput ? checkedInput.value : undefined;
}
if (this.inputType === 'checkbox') {
// this is an alert with checkboxes (multiple value select)
// return an array of all the checked values
return this.d.inputs.filter(function (i) { return i.checked; }).map(function (i) { return i.value; });
}
if (this.d.inputs.length === 0) {
// this is an alert without any options/inputs at all
return undefined;
}
// this is an alert with text inputs
// return an object of all the values with the input name as the key
var values = {};
this.d.inputs.forEach(function (i) {
values[i.name] = i.value;
});
return values;
};
AlertCmp.prototype.ngOnDestroy = function () {
(void 0) /* assert */;
this.gestureBlocker.destroy();
};
AlertCmp.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-alert',
template: '<ion-backdrop (click)="bdClick()" [class.backdrop-no-tappable]="!d.enableBackdropDismiss"></ion-backdrop>' +
'<div class="alert-wrapper">' +
'<div class="alert-head">' +
'<h2 id="{{hdrId}}" class="alert-title" *ngIf="d.title" [innerHTML]="d.title"></h2>' +
'<h3 id="{{subHdrId}}" class="alert-sub-title" *ngIf="d.subTitle" [innerHTML]="d.subTitle"></h3>' +
'</div>' +
'<div id="{{msgId}}" class="alert-message" [innerHTML]="d.message"></div>' +
'<div *ngIf="d.inputs.length" [ngSwitch]="inputType">' +
'<ng-template ngSwitchCase="radio">' +
'<div class="alert-radio-group" role="radiogroup" [attr.aria-labelledby]="hdrId" [attr.aria-activedescendant]="activeId">' +
'<button ion-button="alert-radio-button" *ngFor="let i of d.inputs" (click)="rbClick(i)" [attr.aria-checked]="i.checked" [disabled]="i.disabled" [attr.id]="i.id" class="alert-tappable alert-radio" role="radio">' +
'<div class="alert-radio-icon"><div class="alert-radio-inner"></div></div>' +
'<div class="alert-radio-label">' +
'{{i.label}}' +
'</div>' +
'</button>' +
'</div>' +
'</ng-template>' +
'<ng-template ngSwitchCase="checkbox">' +
'<div class="alert-checkbox-group">' +
'<button ion-button="alert-checkbox-button" *ngFor="let i of d.inputs" (click)="cbClick(i)" [attr.aria-checked]="i.checked" [attr.id]="i.id" [disabled]="i.disabled" class="alert-tappable alert-checkbox" role="checkbox">' +
'<div class="alert-checkbox-icon"><div class="alert-checkbox-inner"></div></div>' +
'<div class="alert-checkbox-label">' +
'{{i.label}}' +
'</div>' +
'</button>' +
'</div>' +
'</ng-template>' +
'<ng-template ngSwitchDefault>' +
'<div class="alert-input-group">' +
'<div *ngFor="let i of d.inputs" class="alert-input-wrapper">' +
'<input [placeholder]="i.placeholder" [(ngModel)]="i.value" [type]="i.type" dir="auto" [min]="i.min" [max]="i.max" [attr.id]="i.id" class="alert-input">' +
'</div>' +
'</div>' +
'</ng-template>' +
'</div>' +
'<div class="alert-button-group" [ngClass]="{\'alert-button-group-vertical\':d.buttons.length>2}">' +
'<button ion-button="alert-button" *ngFor="let b of d.buttons" (click)="btnClick(b)" [ngClass]="b.cssClass">' +
'{{b.text}}' +
'</button>' +
'</div>' +
'</div>',
host: {
'role': 'dialog',
'[attr.aria-labelledby]': 'hdrId',
'[attr.aria-describedby]': 'descId'
},
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
},] },
];
/** @nocollapse */
AlertCmp.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_8__navigation_view_controller__["a" /* ViewController */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_3__gestures_gesture_controller__["l" /* GestureController */], },
{ type: __WEBPACK_IMPORTED_MODULE_6__navigation_nav_params__["a" /* NavParams */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_7__platform_platform__["a" /* Platform */], },
]; };
AlertCmp.propDecorators = {
'keyUp': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* HostListener */], args: ['body:keyup', ['$event'],] },],
};
return AlertCmp;
}());
var alertIds = -1;
//# sourceMappingURL=alert-component.js.map
/***/ }),
/* 81 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Backdrop; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/**
* @hidden
*/
var Backdrop = (function () {
function Backdrop(_elementRef, _renderer) {
this._elementRef = _elementRef;
this._renderer = _renderer;
}
Backdrop.prototype.getNativeElement = function () {
return this._elementRef.nativeElement;
};
Backdrop.prototype.setElementClass = function (className, add) {
this._renderer.setElementClass(this._elementRef.nativeElement, className, add);
};
Backdrop.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-backdrop',
host: {
'role': 'presentation',
'tappable': '',
'disable-activated': ''
},
},] },
];
/** @nocollapse */
Backdrop.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
]; };
return Backdrop;
}());
//# sourceMappingURL=backdrop.js.map
/***/ }),
/* 82 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Icon; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__ion__ = __webpack_require__(6);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name Icon
* @description
* Icons can be used on their own, or inside of a number of Ionic components.
* For a full list of available icons, check out the
* [Ionicons docs](../../../../ionicons).
*
* One feature of Ionicons in Ionic is when icon names are set, the actual icon
* which is rendered can change slightly depending on the mode the app is
* running from. For example, by setting the icon name of `alarm`, on iOS the
* icon will automatically apply `ios-alarm`, and on Material Design it will
* automatically apply `md-alarm`. This allows the developer to write the
* markup once while Ionic applies the appropriate icon based on the mode.
*
* @usage
* ```html
* <!-- automatically uses the correct "star" icon depending on the mode -->
* <ion-icon name="star"></ion-icon>
*
* <!-- explicity set the icon for each mode -->
* <ion-icon ios="ios-home" md="md-home"></ion-icon>
*
* <!-- always use the same icon, no matter what the mode -->
* <ion-icon name="ios-clock"></ion-icon>
* <ion-icon name="logo-twitter"></ion-icon>
* ```
*
* @demo /docs/demos/src/icon/
* @see {@link /docs/components#icons Icon Component Docs}
*
*/
var Icon = (function (_super) {
__extends(Icon, _super);
function Icon(config, elementRef, renderer) {
var _this = _super.call(this, config, elementRef, renderer, 'icon') || this;
/** @hidden */
_this._isActive = true;
/** @hidden */
_this._name = '';
/** @hidden */
_this._ios = '';
/** @hidden */
_this._md = '';
/** @hidden */
_this._css = '';
/**
* @hidden
*/
_this._hidden = false;
_this._iconMode = config.get('iconMode');
return _this;
}
/**
* @hidden
*/
Icon.prototype.ngOnDestroy = function () {
if (this._css) {
this.setElementClass(this._css, false);
}
};
Object.defineProperty(Icon.prototype, "name", {
/**
* @input {string} Specifies which icon to use. The appropriate icon will be used based on the mode.
* For more information, see [Ionicons](/docs/ionicons/).
*/
get: function () {
return this._name;
},
set: function (val) {
if (!(/^md-|^ios-|^logo-/.test(val))) {
// this does not have one of the defaults
// so lets auto add in the mode prefix for them
this._name = this._iconMode + '-' + val;
}
else {
this._name = val;
}
this.update();
},
enumerable: true,
configurable: true
});
Object.defineProperty(Icon.prototype, "ios", {
/**
* @input {string} Specifies which icon to use on `ios` mode.
*/
get: function () {
return this._ios;
},
set: function (val) {
this._ios = val;
this.update();
},
enumerable: true,
configurable: true
});
Object.defineProperty(Icon.prototype, "md", {
/**
* @input {string} Specifies which icon to use on `md` mode.
*/
get: function () {
return this._md;
},
set: function (val) {
this._md = val;
this.update();
},
enumerable: true,
configurable: true
});
Object.defineProperty(Icon.prototype, "isActive", {
/**
* @input {boolean} If true, the icon is styled with an "active" appearance.
* An active icon is filled in, and an inactive icon is the outline of the icon.
* The `isActive` property is largely used by the tabbar. Only affects `ios` icons.
*/
get: function () {
return this._isActive;
},
set: function (val) {
this._isActive = Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["o" /* isTrueProperty */])(val);
this.update();
},
enumerable: true,
configurable: true
});
/**
* @hidden
*/
Icon.prototype.update = function () {
var iconName;
if (this._ios && this._iconMode === 'ios') {
iconName = this._ios;
}
else if (this._md && this._iconMode === 'md') {
iconName = this._md;
}
else {
iconName = this._name;
}
var hidden = this._hidden = (iconName === null);
if (hidden) {
return;
}
var iconMode = iconName.split('-', 2)[0];
if (iconMode === 'ios' &&
!this._isActive &&
iconName.indexOf('logo-') < 0 &&
iconName.indexOf('-outline') < 0) {
iconName += '-outline';
}
var css = 'ion-' + iconName;
if (this._css === css) {
return;
}
if (this._css) {
this.setElementClass(this._css, false);
}
this._css = css;
this.setElementClass(css, true);
var label = iconName
.replace('ios-', '')
.replace('md-', '')
.replace('-', ' ');
this.setElementAttribute('aria-label', label);
};
Icon.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-icon',
host: {
'role': 'img'
}
},] },
];
/** @nocollapse */
Icon.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_2__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
]; };
Icon.propDecorators = {
'name': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'ios': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'md': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'isActive': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'_hidden': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["x" /* HostBinding */], args: ['class.hide',] },],
};
return Icon;
}(__WEBPACK_IMPORTED_MODULE_3__ion__["a" /* Ion */]));
//# sourceMappingURL=icon.js.map
/***/ }),
/* 83 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Label; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ion__ = __webpack_require__(6);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name Label
* @description
* Labels are placed inside of an `ion-item` element and can be used
* to describe an `ion-input`, `ion-toggle`, `ion-checkbox`, and more.
*
* @property [fixed] - A persistent label that sits next the input.
* @property [floating] - A label that will float above the input if the input is empty or loses focus.
* @property [stacked] - A stacked label will always appear on top of the input.
*
* @usage
* ```html
* <ion-item>
* <ion-label>Username</ion-label>
* <ion-input></ion-input>
* </ion-item>
*
* <ion-item>
* <ion-label fixed>Website</ion-label>
* <ion-input type="url"></ion-input>
* </ion-item>
*
* <ion-item>
* <ion-label floating>Email</ion-label>
* <ion-input type="email"></ion-input>
* </ion-item>
*
* <ion-item>
* <ion-label stacked>Phone</ion-label>
* <ion-input type="tel"></ion-input>
* </ion-item>
*
* <ion-item>
* <ion-label>Toggle</ion-label>
* <ion-toggle></ion-toggle>
* </ion-item>
*
* <ion-item>
* <ion-label>Checkbox</ion-label>
* <ion-checkbox></ion-checkbox>
* </ion-item>
* ```
*
* @demo /docs/demos/src/label/
* @see {@link ../../../../components#inputs Input Component Docs}
* @see {@link ../../input/Input Input API Docs}
*
*/
var Label = (function (_super) {
__extends(Label, _super);
function Label(config, elementRef, renderer, isFloating, isStacked, isFixed, isInset) {
var _this = _super.call(this, config, elementRef, renderer, 'label') || this;
_this.type = (isFloating === '' ? 'floating' : (isStacked === '' ? 'stacked' : (isFixed === '' ? 'fixed' : (isInset === '' ? 'inset' : null))));
return _this;
}
Object.defineProperty(Label.prototype, "id", {
/**
* @hidden
*/
get: function () {
return this._id;
},
set: function (val) {
this._id = val;
if (val) {
this.setElementAttribute('id', val);
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(Label.prototype, "text", {
/**
* @hidden
*/
get: function () {
return this.getNativeElement().textContent || '';
},
enumerable: true,
configurable: true
});
Label.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-label'
},] },
];
/** @nocollapse */
Label.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["g" /* Attribute */], args: ['floating',] },] },
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["g" /* Attribute */], args: ['stacked',] },] },
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["g" /* Attribute */], args: ['fixed',] },] },
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["g" /* Attribute */], args: ['inset',] },] },
]; };
Label.propDecorators = {
'id': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
};
return Label;
}(__WEBPACK_IMPORTED_MODULE_2__ion__["a" /* Ion */]));
//# sourceMappingURL=label.js.map
/***/ }),
/* 84 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export ReorderIndexes */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ItemReorder; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__content_content__ = __webpack_require__(24);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__platform_dom_controller__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__item_reorder_gesture__ = __webpack_require__(390);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__platform_platform__ = __webpack_require__(4);
var ReorderIndexes = (function () {
function ReorderIndexes(from, to) {
this.from = from;
this.to = to;
}
ReorderIndexes.prototype.applyTo = function (array) {
Object(__WEBPACK_IMPORTED_MODULE_3__util_util__["r" /* reorderArray */])(array, this);
};
return ReorderIndexes;
}());
/**
* @name ItemReorder
* @description
* Item reorder adds the ability to change an item's order in a group.
* It can be used within an `ion-list` or `ion-item-group` to provide a
* visual drag and drop interface.
*
* ## Grouping Items
*
* All reorderable items must be grouped in the same element. If an item
* should not be reordered, it shouldn't be included in this group. For
* example, the following code works because the items are grouped in the
* `<ion-list>`:
*
* ```html
* <ion-list reorder="true">
* <ion-item *ngFor="let item of items">{% raw %}{{ item }}{% endraw %}</ion-item>
* </ion-list>
* ```
*
* However, the below list includes a header that shouldn't be reordered:
*
* ```html
* <ion-list reorder="true">
* <ion-list-header>Header</ion-list-header>
* <ion-item *ngFor="let item of items">{% raw %}{{ item }}{% endraw %}</ion-item>
* </ion-list>
* ```
*
* In order to mix different sets of items, `ion-item-group` should be used to
* group the reorderable items:
*
* ```html
* <ion-list>
* <ion-list-header>Header</ion-list-header>
* <ion-item-group reorder="true">
* <ion-item *ngFor="let item of items">{% raw %}{{ item }}{% endraw %}</ion-item>
* </ion-item-group>
* </ion-list>
* ```
*
* It's important to note that in this example, the `[reorder]` directive is applied to
* the `<ion-item-group>` instead of the `<ion-list>`. This way makes it possible to
* mix items that should and shouldn't be reordered.
*
*
* ## Implementing the Reorder Function
*
* When the item is dragged and dropped into the new position, the `(ionItemReorder)` event is
* emitted. This event provides the initial index (from) and the new index (to) of the reordered
* item. For example, if the first item is dragged to the fifth position, the event will emit
* `{from: 0, to: 4}`. Note that the index starts at zero.
*
* A function should be called when the event is emitted that handles the reordering of the items.
* See [usage](#usage) below for some examples.
*
*
* @usage
*
* ```html
* <ion-list>
* <ion-list-header>Header</ion-list-header>
* <ion-item-group reorder="true" (ionItemReorder)="reorderItems($event)">
* <ion-item *ngFor="let item of items">{% raw %}{{ item }}{% endraw %}</ion-item>
* </ion-item-group>
* </ion-list>
* ```
*
* ```ts
* class MyComponent {
* items = [];
*
* constructor() {
* for (let x = 0; x < 5; x++) {
* this.items.push(x);
* }
* }
*
* reorderItems(indexes) {
* let element = this.items[indexes.from];
* this.items.splice(indexes.from, 1);
* this.items.splice(indexes.to, 0, element);
* }
* }
* ```
*
* Ionic also provides a helper function called `reorderArray` to
* reorder the array of items. This can be used instead:
*
* ```ts
* import { reorderArray } from 'ionic-angular';
*
* class MyComponent {
* items = [];
*
* constructor() {
* for (let x = 0; x < 5; x++) {
* this.items.push(x);
* }
* }
*
* reorderItems(indexes) {
* this.items = reorderArray(this.items, indexes);
* }
* }
* ```
* Alternatevely you can execute helper function inside template:
*
* ```html
* <ion-list>
* <ion-list-header>Header</ion-list-header>
* <ion-item-group reorder="true" (ionItemReorder)="$event.applyTo(items)">
* <ion-item *ngFor="let item of items">{% raw %}{{ item }}{% endraw %}</ion-item>
* </ion-item-group>
* </ion-list>
* ```
*
* @demo /docs/demos/src/item-reorder/
* @see {@link /docs/components#lists List Component Docs}
* @see {@link ../../list/List List API Docs}
* @see {@link ../Item Item API Docs}
*/
var ItemReorder = (function () {
function ItemReorder(_plt, _dom, elementRef, _rendered, _zone, _content) {
this._plt = _plt;
this._dom = _dom;
this._rendered = _rendered;
this._zone = _zone;
this._content = _content;
this._enableReorder = false;
this._visibleReorder = false;
this._isStart = false;
this._lastToIndex = -1;
/**
* @output {object} Emitted when the item is reordered. Emits an object
* with `from` and `to` properties.
*/
this.ionItemReorder = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
this._element = elementRef.nativeElement;
}
Object.defineProperty(ItemReorder.prototype, "side", {
/**
* @input {string} Which side of the view the ion-reorder should be placed. Default `"end"`.
*/
set: function (side) {
this._isStart = side === 'start';
},
enumerable: true,
configurable: true
});
/**
* @hidden
*/
ItemReorder.prototype.ngOnDestroy = function () {
this._element = null;
this._reorderGesture && this._reorderGesture.destroy();
};
Object.defineProperty(ItemReorder.prototype, "reorder", {
/**
* @hidden
*/
get: function () {
return this._enableReorder;
},
set: function (val) {
var _this = this;
var enabled = Object(__WEBPACK_IMPORTED_MODULE_3__util_util__["o" /* isTrueProperty */])(val);
if (!enabled && this._reorderGesture) {
this._reorderGesture.destroy();
this._reorderGesture = null;
this._visibleReorder = false;
setTimeout(function () { return _this._enableReorder = false; }, 400);
}
else if (enabled && !this._reorderGesture) {
(void 0) /* console.debug */;
this._reorderGesture = new __WEBPACK_IMPORTED_MODULE_4__item_reorder_gesture__["a" /* ItemReorderGesture */](this._plt, this);
this._enableReorder = true;
this._dom.write(function () {
_this._zone.run(function () {
_this._visibleReorder = true;
});
}, 16);
}
},
enumerable: true,
configurable: true
});
ItemReorder.prototype._reorderPrepare = function () {
var ele = this._element;
var children = ele.children;
for (var i = 0, ilen = children.length; i < ilen; i++) {
var child = children[i];
child.$ionIndex = i;
child.$ionReorderList = ele;
}
};
ItemReorder.prototype._reorderStart = function () {
this.setElementClass('reorder-list-active', true);
};
ItemReorder.prototype._reorderEmit = function (fromIndex, toIndex) {
var _this = this;
this._reorderReset();
if (fromIndex !== toIndex) {
this._zone.run(function () {
var indexes = new ReorderIndexes(fromIndex, toIndex);
_this.ionItemReorder.emit(indexes);
});
}
};
ItemReorder.prototype._scrollContent = function (scroll) {
var scrollTop = this._content.scrollTop + scroll;
if (scroll !== 0) {
this._content.scrollTo(0, scrollTop, 0);
}
return scrollTop;
};
ItemReorder.prototype._reorderReset = function () {
var children = this._element.children;
var len = children.length;
this.setElementClass('reorder-list-active', false);
var transform = this._plt.Css.transform;
for (var i = 0; i < len; i++) {
children[i].style[transform] = '';
}
this._lastToIndex = -1;
};
ItemReorder.prototype._reorderMove = function (fromIndex, toIndex, itemHeight) {
if (this._lastToIndex === -1) {
this._lastToIndex = fromIndex;
}
var lastToIndex = this._lastToIndex;
this._lastToIndex = toIndex;
// TODO: I think both loops can be merged into a single one
// but I had no luck last time I tried
/********* DOM READ ********** */
var children = this._element.children;
/********* DOM WRITE ********* */
var transform = this._plt.Css.transform;
if (toIndex >= lastToIndex) {
for (var i = lastToIndex; i <= toIndex; i++) {
if (i !== fromIndex) {
children[i].style[transform] = (i > fromIndex)
? "translateY(" + -itemHeight + "px)" : '';
}
}
}
if (toIndex <= lastToIndex) {
for (var i = toIndex; i <= lastToIndex; i++) {
if (i !== fromIndex) {
children[i].style[transform] = (i < fromIndex)
? "translateY(" + itemHeight + "px)" : '';
}
}
}
};
/**
* @hidden
*/
ItemReorder.prototype.setElementClass = function (classname, add) {
this._rendered.setElementClass(this._element, classname, add);
};
/**
* @hidden
*/
ItemReorder.prototype.getNativeElement = function () {
return this._element;
};
ItemReorder.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-list[reorder],ion-item-group[reorder]',
host: {
'[class.reorder-enabled]': '_enableReorder',
'[class.reorder-visible]': '_visibleReorder',
'[class.reorder-side-start]': '_isStart'
}
},] },
];
/** @nocollapse */
ItemReorder.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_5__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_2__platform_dom_controller__["a" /* DomController */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["M" /* NgZone */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__content_content__["a" /* Content */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
]; };
ItemReorder.propDecorators = {
'ionItemReorder': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'side': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */], args: ['side',] },],
'reorder': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
};
return ItemReorder;
}());
//# sourceMappingURL=item-reorder.js.map
/***/ }),
/* 85 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PickerController; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__app_app__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__picker__ = __webpack_require__(152);
/**
* @hidden
* @name PickerController
* @description
*
*/
var PickerController = (function () {
function PickerController(_app, config) {
this._app = _app;
this.config = config;
}
/**
* Open a picker.
*/
PickerController.prototype.create = function (opts) {
if (opts === void 0) { opts = {}; }
return new __WEBPACK_IMPORTED_MODULE_3__picker__["a" /* Picker */](this._app, opts, this.config);
};
PickerController.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
PickerController.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__app_app__["a" /* App */], },
{ type: __WEBPACK_IMPORTED_MODULE_2__config_config__["a" /* Config */], },
]; };
return PickerController;
}());
//# sourceMappingURL=picker-controller.js.map
/***/ }),
/* 86 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PickerCmp; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__gestures_gesture_controller__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__platform_key__ = __webpack_require__(23);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__navigation_nav_params__ = __webpack_require__(18);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__navigation_view_controller__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__picker_column__ = __webpack_require__(87);
/**
* @hidden
*/
var PickerCmp = (function () {
function PickerCmp(_viewCtrl, _elementRef, config, gestureCtrl, params, renderer) {
this._viewCtrl = _viewCtrl;
this._elementRef = _elementRef;
this._gestureBlocker = gestureCtrl.createBlocker(__WEBPACK_IMPORTED_MODULE_3__gestures_gesture_controller__["a" /* BLOCK_ALL */]);
this.d = params.data;
this.mode = config.get('mode');
renderer.setElementClass(_elementRef.nativeElement, "picker-" + this.mode, true);
if (this.d.cssClass) {
this.d.cssClass.split(' ').forEach(function (cssClass) {
renderer.setElementClass(_elementRef.nativeElement, cssClass, true);
});
}
this.id = (++pickerIds);
this.lastClick = 0;
}
PickerCmp.prototype.ionViewWillLoad = function () {
// normalize the data
var data = this.d;
data.buttons = data.buttons.map(function (button) {
if (Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["n" /* isString */])(button)) {
return { text: button };
}
if (button.role) {
button.cssRole = "picker-toolbar-" + button.role;
}
return button;
});
// clean up dat data
data.columns = data.columns.map(function (column) {
if (!Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["l" /* isPresent */])(column.options)) {
column.options = [];
}
column.selectedIndex = column.selectedIndex || 0;
column.options = column.options.map(function (inputOpt) {
var opt = {
text: '',
value: '',
disabled: inputOpt.disabled,
};
if (Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["l" /* isPresent */])(inputOpt)) {
if (Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["n" /* isString */])(inputOpt) || Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["j" /* isNumber */])(inputOpt)) {
opt.text = inputOpt.toString();
opt.value = inputOpt;
}
else {
opt.text = Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["l" /* isPresent */])(inputOpt.text) ? inputOpt.text : inputOpt.value;
opt.value = Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["l" /* isPresent */])(inputOpt.value) ? inputOpt.value : inputOpt.text;
}
}
return opt;
});
return column;
});
};
PickerCmp.prototype.ionViewDidLoad = function () {
this.refresh();
};
PickerCmp.prototype.ionViewWillEnter = function () {
this._gestureBlocker.block();
};
PickerCmp.prototype.ionViewDidLeave = function () {
this._gestureBlocker.unblock();
};
PickerCmp.prototype.refresh = function () {
this._cols.forEach(function (column) { return column.refresh(); });
};
PickerCmp.prototype._colChange = function () {
// one of the columns has changed its selected index
var picker = this._viewCtrl;
picker.ionChange.emit(this.getSelected());
};
PickerCmp.prototype._keyUp = function (ev) {
if (this.enabled && this._viewCtrl.isLast()) {
if (ev.keyCode === __WEBPACK_IMPORTED_MODULE_4__platform_key__["b" /* KEY_ENTER */]) {
if (this.lastClick + 1000 < Date.now()) {
// do not fire this click if there recently was already a click
// this can happen when the button has focus and used the enter
// key to click the button. However, both the click handler and
// this keyup event will fire, so only allow one of them to go.
(void 0) /* console.debug */;
var button = this.d.buttons[this.d.buttons.length - 1];
this.btnClick(button);
}
}
else if (ev.keyCode === __WEBPACK_IMPORTED_MODULE_4__platform_key__["c" /* KEY_ESCAPE */]) {
(void 0) /* console.debug */;
this.bdClick();
}
}
};
PickerCmp.prototype.ionViewDidEnter = function () {
var focusableEle = this._elementRef.nativeElement.querySelector('button');
if (focusableEle) {
focusableEle.focus();
}
this.enabled = true;
};
PickerCmp.prototype.btnClick = function (button) {
if (!this.enabled) {
return;
}
// keep the time of the most recent button click
this.lastClick = Date.now();
var shouldDismiss = true;
if (button.handler) {
// a handler has been provided, execute it
// pass the handler the values from the inputs
if (button.handler(this.getSelected()) === false) {
// if the return value of the handler is false then do not dismiss
shouldDismiss = false;
}
}
if (shouldDismiss) {
this.dismiss(button.role);
}
};
PickerCmp.prototype.bdClick = function () {
if (this.enabled && this.d.enableBackdropDismiss) {
var cancelBtn = this.d.buttons.find(function (b) { return b.role === 'cancel'; });
if (cancelBtn) {
this.btnClick(cancelBtn);
}
else {
this.dismiss('backdrop');
}
}
};
PickerCmp.prototype.dismiss = function (role) {
return this._viewCtrl.dismiss(this.getSelected(), role);
};
PickerCmp.prototype.getSelected = function () {
var selected = {};
this.d.columns.forEach(function (col, index) {
var selectedColumn = col.options[col.selectedIndex];
selected[col.name] = {
text: selectedColumn ? selectedColumn.text : null,
value: selectedColumn ? selectedColumn.value : null,
columnIndex: index,
};
});
return selected;
};
PickerCmp.prototype.ngOnDestroy = function () {
(void 0) /* assert */;
this._gestureBlocker.destroy();
};
PickerCmp.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-picker-cmp',
template: "\n <ion-backdrop (click)=\"bdClick()\"></ion-backdrop>\n <div class=\"picker-wrapper\">\n <div class=\"picker-toolbar\">\n <div *ngFor=\"let b of d.buttons\" class=\"picker-toolbar-button\" [ngClass]=\"b.cssRole\">\n <button ion-button (click)=\"btnClick(b)\" [ngClass]=\"b.cssClass\" class=\"picker-button\" clear>\n {{b.text}}\n </button>\n </div>\n </div>\n <div class=\"picker-columns\">\n <div class=\"picker-above-highlight\"></div>\n <div *ngFor=\"let c of d.columns\" [col]=\"c\" class=\"picker-col\" (ionChange)=\"_colChange($event)\"></div>\n <div class=\"picker-below-highlight\"></div>\n </div>\n </div>\n ",
host: {
'role': 'dialog'
},
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
},] },
];
/** @nocollapse */
PickerCmp.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_6__navigation_view_controller__["a" /* ViewController */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_2__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_3__gestures_gesture_controller__["l" /* GestureController */], },
{ type: __WEBPACK_IMPORTED_MODULE_5__navigation_nav_params__["a" /* NavParams */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
]; };
PickerCmp.propDecorators = {
'_cols': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_9" /* ViewChildren */], args: [__WEBPACK_IMPORTED_MODULE_7__picker_column__["a" /* PickerColumnCmp */],] },],
'_keyUp': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* HostListener */], args: ['body:keyup', ['$event'],] },],
};
return PickerCmp;
}());
var pickerIds = -1;
//# sourceMappingURL=picker-component.js.map
/***/ }),
/* 87 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PickerColumnCmp; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__platform_dom_controller__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__tap_click_haptic__ = __webpack_require__(47);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__picker_options__ = __webpack_require__(391);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__platform_platform__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__util_dom__ = __webpack_require__(14);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__gestures_ui_event_manager__ = __webpack_require__(28);
/**
* @hidden
*/
var PickerColumnCmp = (function () {
function PickerColumnCmp(config, _plt, elementRef, _zone, _haptic, plt, domCtrl) {
this._plt = _plt;
this.elementRef = elementRef;
this._zone = _zone;
this._haptic = _haptic;
this.y = 0;
this.pos = [];
this.startY = null;
this.ionChange = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
this.events = new __WEBPACK_IMPORTED_MODULE_8__gestures_ui_event_manager__["a" /* UIEventManager */](plt);
this.rotateFactor = config.getNumber('pickerRotateFactor', 0);
this.scaleFactor = config.getNumber('pickerScaleFactor', 1);
this.decelerateFunc = this.decelerate.bind(this);
this.debouncer = domCtrl.debouncer();
}
PickerColumnCmp.prototype.ngAfterViewInit = function () {
// get the scrollable element within the column
var colEle = this.colEle.nativeElement;
this.colHeight = colEle.clientHeight;
// get the height of one option
this.optHeight = (colEle.firstElementChild ? colEle.firstElementChild.clientHeight : 0);
// Listening for pointer events
this.events.pointerEvents({
element: this.elementRef.nativeElement,
pointerDown: this.pointerStart.bind(this),
pointerMove: this.pointerMove.bind(this),
pointerUp: this.pointerEnd.bind(this),
capture: true,
zone: false
});
};
PickerColumnCmp.prototype.ngOnDestroy = function () {
this._plt.cancelRaf(this.rafId);
this.events.destroy();
};
PickerColumnCmp.prototype.pointerStart = function (ev) {
(void 0) /* console.debug */;
this._haptic.gestureSelectionStart();
// We have to prevent default in order to block scrolling under the picker
// but we DO NOT have to stop propagation, since we still want
// some "click" events to capture
ev.preventDefault();
// cancel any previous raf's that haven't fired yet
this._plt.cancelRaf(this.rafId);
// remember where the pointer started from`
this.startY = Object(__WEBPACK_IMPORTED_MODULE_7__util_dom__["f" /* pointerCoord */])(ev).y;
// reset everything
this.velocity = 0;
this.pos.length = 0;
this.pos.push(this.startY, Date.now());
var options = this.col.options;
var minY = (options.length - 1);
var maxY = 0;
for (var i = 0; i < options.length; i++) {
if (!options[i].disabled) {
minY = Math.min(minY, i);
maxY = Math.max(maxY, i);
}
}
this.minY = (minY * this.optHeight * -1);
this.maxY = (maxY * this.optHeight * -1);
return true;
};
PickerColumnCmp.prototype.pointerMove = function (ev) {
var _this = this;
ev.preventDefault();
ev.stopPropagation();
var currentY = Object(__WEBPACK_IMPORTED_MODULE_7__util_dom__["f" /* pointerCoord */])(ev).y;
this.pos.push(currentY, Date.now());
this.debouncer.write(function () {
if (_this.startY === null) {
return;
}
// update the scroll position relative to pointer start position
var y = _this.y + (currentY - _this.startY);
if (y > _this.minY) {
// scrolling up higher than scroll area
y = Math.pow(y, 0.8);
_this.bounceFrom = y;
}
else if (y < _this.maxY) {
// scrolling down below scroll area
y += Math.pow(_this.maxY - y, 0.9);
_this.bounceFrom = y;
}
else {
_this.bounceFrom = 0;
}
_this.update(y, 0, false, false);
var currentIndex = Math.max(Math.abs(Math.round(y / _this.optHeight)), 0);
if (currentIndex !== _this.lastTempIndex) {
// Trigger a haptic event for physical feedback that the index has changed
_this._haptic.gestureSelectionChanged();
_this.lastTempIndex = currentIndex;
}
});
};
PickerColumnCmp.prototype.pointerEnd = function (ev) {
ev.preventDefault();
this.debouncer.cancel();
if (this.startY === null) {
return;
}
(void 0) /* console.debug */;
this.velocity = 0;
if (this.bounceFrom > 0) {
// bounce back up
this.update(this.minY, 100, true, true);
return;
}
else if (this.bounceFrom < 0) {
// bounce back down
this.update(this.maxY, 100, true, true);
return;
}
var endY = Object(__WEBPACK_IMPORTED_MODULE_7__util_dom__["f" /* pointerCoord */])(ev).y;
this.pos.push(endY, Date.now());
var endPos = (this.pos.length - 1);
var startPos = endPos;
var timeRange = (Date.now() - 100);
// move pointer to position measured 100ms ago
for (var i = endPos; i > 0 && this.pos[i] > timeRange; i -= 2) {
startPos = i;
}
if (startPos !== endPos) {
// compute relative movement between these two points
var timeOffset = (this.pos[endPos] - this.pos[startPos]);
var movedTop = (this.pos[startPos - 1] - this.pos[endPos - 1]);
// based on XXms compute the movement to apply for each render step
var velocity = ((movedTop / timeOffset) * __WEBPACK_IMPORTED_MODULE_5__picker_options__["b" /* FRAME_MS */]);
this.velocity = Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["a" /* clamp */])(-__WEBPACK_IMPORTED_MODULE_5__picker_options__["c" /* MAX_PICKER_SPEED */], velocity, __WEBPACK_IMPORTED_MODULE_5__picker_options__["c" /* MAX_PICKER_SPEED */]);
}
if (Math.abs(endY - this.startY) > 3) {
var y = this.y + (endY - this.startY);
this.update(y, 0, true, true);
}
this.startY = null;
this.decelerate();
};
PickerColumnCmp.prototype.decelerate = function () {
var y = 0;
if (isNaN(this.y) || !this.optHeight) {
// fallback in case numbers get outta wack
this.update(y, 0, true, true);
this._haptic.gestureSelectionEnd();
}
else if (Math.abs(this.velocity) > 0) {
// still decelerating
this.velocity *= __WEBPACK_IMPORTED_MODULE_5__picker_options__["a" /* DECELERATION_FRICTION */];
// do not let it go slower than a velocity of 1
this.velocity = (this.velocity > 0)
? Math.max(this.velocity, 1)
: Math.min(this.velocity, -1);
y = Math.round(this.y - this.velocity);
if (y > this.minY) {
// whoops, it's trying to scroll up farther than the options we have!
y = this.minY;
this.velocity = 0;
}
else if (y < this.maxY) {
// gahh, it's trying to scroll down farther than we can!
y = this.maxY;
this.velocity = 0;
}
var notLockedIn = (y % this.optHeight !== 0 || Math.abs(this.velocity) > 1);
this.update(y, 0, true, !notLockedIn);
if (notLockedIn) {
// isn't locked in yet, keep decelerating until it is
this.rafId = this._plt.raf(this.decelerateFunc);
}
}
else if (this.y % this.optHeight !== 0) {
// needs to still get locked into a position so options line up
var currentPos = Math.abs(this.y % this.optHeight);
// create a velocity in the direction it needs to scroll
this.velocity = (currentPos > (this.optHeight / 2) ? 1 : -1);
this._haptic.gestureSelectionEnd();
this.decelerate();
}
var currentIndex = Math.max(Math.abs(Math.round(y / this.optHeight)), 0);
if (currentIndex !== this.lastTempIndex) {
// Trigger a haptic event for physical feedback that the index has changed
this._haptic.gestureSelectionChanged();
}
this.lastTempIndex = currentIndex;
};
PickerColumnCmp.prototype.optClick = function (ev, index) {
if (!this.velocity) {
ev.preventDefault();
ev.stopPropagation();
this.setSelected(index, 150);
}
};
PickerColumnCmp.prototype.setSelected = function (selectedIndex, duration) {
// if there is a selected index, then figure out it's y position
// if there isn't a selected index, then just use the top y position
var y = (selectedIndex > -1) ? ((selectedIndex * this.optHeight) * -1) : 0;
this._plt.cancelRaf(this.rafId);
this.velocity = 0;
// so what y position we're at
this.update(y, duration, true, true);
};
PickerColumnCmp.prototype.update = function (y, duration, saveY, emitChange) {
// ensure we've got a good round number :)
y = Math.round(y);
var i;
var button;
var opt;
var optOffset;
var visible;
var translateX;
var translateY;
var translateZ;
var rotateX;
var transform;
var selected;
var parent = this.colEle.nativeElement;
var children = parent.children;
var length = children.length;
var selectedIndex = this.col.selectedIndex = Math.min(Math.max(Math.round(-y / this.optHeight), 0), length - 1);
var durationStr = (duration === 0) ? null : duration + 'ms';
var scaleStr = "scale(" + this.scaleFactor + ")";
for (i = 0; i < length; i++) {
button = children[i];
opt = this.col.options[i];
optOffset = (i * this.optHeight) + y;
visible = true;
transform = '';
if (this.rotateFactor !== 0) {
rotateX = optOffset * this.rotateFactor;
if (Math.abs(rotateX) > 90) {
visible = false;
}
else {
translateX = 0;
translateY = 0;
translateZ = 90;
transform = "rotateX(" + rotateX + "deg) ";
}
}
else {
translateX = 0;
translateZ = 0;
translateY = optOffset;
if (Math.abs(translateY) > 170) {
visible = false;
}
}
selected = selectedIndex === i;
if (visible) {
transform += "translate3d(0px," + translateY + "px," + translateZ + "px) ";
if (this.scaleFactor !== 1 && !selected) {
transform += scaleStr;
}
}
else {
transform = 'translate3d(-9999px,0px,0px)';
}
// Update transition duration
if (duration !== opt._dur) {
opt._dur = duration;
button.style[this._plt.Css.transitionDuration] = durationStr;
}
// Update transform
if (transform !== opt._trans) {
opt._trans = transform;
button.style[this._plt.Css.transform] = transform;
}
// Update selected item
if (selected !== opt._selected) {
opt._selected = selected;
if (selected) {
button.classList.add(__WEBPACK_IMPORTED_MODULE_5__picker_options__["d" /* PICKER_OPT_SELECTED */]);
}
else {
button.classList.remove(__WEBPACK_IMPORTED_MODULE_5__picker_options__["d" /* PICKER_OPT_SELECTED */]);
}
}
}
this.col.prevSelected = selectedIndex;
if (saveY) {
this.y = y;
}
if (emitChange) {
if (this.lastIndex === undefined) {
// have not set a last index yet
this.lastIndex = this.col.selectedIndex;
}
else if (this.lastIndex !== this.col.selectedIndex) {
// new selected index has changed from the last index
// update the lastIndex and emit that it has changed
this.lastIndex = this.col.selectedIndex;
var ionChange = this.ionChange;
if (ionChange.observers.length > 0) {
this._zone.run(ionChange.emit.bind(ionChange, this.col.options[this.col.selectedIndex]));
}
}
}
};
PickerColumnCmp.prototype.refresh = function () {
var min = this.col.options.length - 1;
var max = 0;
var options = this.col.options;
for (var i = 0; i < options.length; i++) {
if (!options[i].disabled) {
min = Math.min(min, i);
max = Math.max(max, i);
}
}
var selectedIndex = Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["a" /* clamp */])(min, this.col.selectedIndex, max);
if (this.col.prevSelected !== selectedIndex) {
var y = (selectedIndex * this.optHeight) * -1;
this._plt.cancelRaf(this.rafId);
this.velocity = 0;
this.update(y, 150, true, false);
}
};
PickerColumnCmp.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: '.picker-col',
template: '<div *ngIf="col.prefix" class="picker-prefix" [style.width]="col.prefixWidth">{{col.prefix}}</div>' +
'<div class="picker-opts" #colEle [style.max-width]="col.optionsWidth">' +
'<button *ngFor="let o of col.options; let i=index"' +
'[class.picker-opt-disabled]="o.disabled" ' +
'class="picker-opt" disable-activated (click)="optClick($event, i)">' +
'{{o.text}}' +
'</button>' +
'</div>' +
'<div *ngIf="col.suffix" class="picker-suffix" [style.width]="col.suffixWidth">{{col.suffix}}</div>',
host: {
'[style.max-width]': 'col.columnWidth',
'[class.picker-opts-left]': 'col.align=="left"',
'[class.picker-opts-right]': 'col.align=="right"',
}
},] },
];
/** @nocollapse */
PickerColumnCmp.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_2__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_6__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["M" /* NgZone */], },
{ type: __WEBPACK_IMPORTED_MODULE_4__tap_click_haptic__["a" /* Haptic */], },
{ type: __WEBPACK_IMPORTED_MODULE_6__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_3__platform_dom_controller__["a" /* DomController */], },
]; };
PickerColumnCmp.propDecorators = {
'colEle': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_8" /* ViewChild */], args: ['colEle',] },],
'col': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'ionChange': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
};
return PickerColumnCmp;
}());
//# sourceMappingURL=picker-column.js.map
/***/ }),
/* 88 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FabList; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__platform_platform__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__fab__ = __webpack_require__(56);
/**
* @name FabList
* @description
* `ion-fab-list` is a container for multiple FAB buttons. They are components of `ion-fab` and allow you to specificy the buttons position, left, right, top, bottom.
* @usage
*
* ```html
* <ion-fab bottom right >
* <button ion-fab>Share</button>
* <ion-fab-list side="top">
* <button ion-fab>Facebook</button>
* <button ion-fab>Twitter</button>
* <button ion-fab>Youtube</button>
* </ion-fab-list>
* <ion-fab-list side="left">
* <button ion-fab>Vimeo</button>
* </ion-fab-list>
* </ion-fab>
* ```
* @module ionic
*
* @demo /docs/demos/src/fab/
* @see {@link /docs/components#fab Fab Component Docs}
*/
var FabList = (function () {
function FabList(_elementRef, _renderer, config, _plt) {
this._elementRef = _elementRef;
this._renderer = _renderer;
this._plt = _plt;
this._visible = false;
this._fabs = [];
this._mode = config.get('mode');
}
Object.defineProperty(FabList.prototype, "_setbuttons", {
set: function (query) {
var fabs = this._fabs = query.toArray();
var className = "fab-" + this._mode + "-in-list";
for (var _i = 0, fabs_1 = fabs; _i < fabs_1.length; _i++) {
var fab = fabs_1[_i];
fab.setElementClass('fab-in-list', true);
fab.setElementClass(className, true);
}
},
enumerable: true,
configurable: true
});
/**
* @hidden
*/
FabList.prototype.setVisible = function (val) {
var _this = this;
var visible = Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["o" /* isTrueProperty */])(val);
if (visible === this._visible) {
return;
}
this._visible = visible;
var fabs = this._fabs;
var i = 1;
if (visible) {
fabs.forEach(function (fab) {
_this._plt.timeout(function () { return fab.setElementClass('show', true); }, i * 30);
i++;
});
}
else {
fabs.forEach(function (fab) { return fab.setElementClass('show', false); });
}
this.setElementClass('fab-list-active', visible);
};
/**
* @internal
*/
FabList.prototype.setElementClass = function (className, add) {
this._renderer.setElementClass(this._elementRef.nativeElement, className, add);
};
FabList.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-fab-list',
},] },
];
/** @nocollapse */
FabList.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_3__platform_platform__["a" /* Platform */], },
]; };
FabList.propDecorators = {
'_setbuttons': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["r" /* ContentChildren */], args: [__WEBPACK_IMPORTED_MODULE_4__fab__["a" /* FabButton */],] },],
};
return FabList;
}());
//# sourceMappingURL=fab-list.js.map
/***/ }),
/* 89 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return InfiniteScroll; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__content_content__ = __webpack_require__(24);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__platform_dom_controller__ = __webpack_require__(12);
/**
* @name InfiniteScroll
* @description
* The Infinite Scroll allows you to perform an action when the user
* scrolls a specified distance from the bottom or top of the page.
*
* The expression assigned to the `infinite` event is called when
* the user scrolls to the specified distance. When this expression
* has finished its tasks, it should call the `complete()` method
* on the infinite scroll instance.
*
* @usage
* ```html
* <ion-content>
*
* <ion-list>
* <ion-item *ngFor="let i of items">{% raw %}{{i}}{% endraw %}</ion-item>
* </ion-list>
*
* <ion-infinite-scroll (ionInfinite)="doInfinite($event)">
* <ion-infinite-scroll-content></ion-infinite-scroll-content>
* </ion-infinite-scroll>
*
* </ion-content>
* ```
*
* ```ts
* @Component({...})
* export class NewsFeedPage {
* items = [];
*
* constructor() {
* for (let i = 0; i < 30; i++) {
* this.items.push( this.items.length );
* }
* }
*
* doInfinite(infiniteScroll) {
* console.log('Begin async operation');
*
* setTimeout(() => {
* for (let i = 0; i < 30; i++) {
* this.items.push( this.items.length );
* }
*
* console.log('Async operation has ended');
* infiniteScroll.complete();
* }, 500);
* }
*
* }
* ```
*
* ## `waitFor` method of InfiniteScroll
*
* In case if your async operation returns promise you can utilize
* `waitFor` method inside your template.
*
* ```html
* <ion-content>
*
* <ion-list>
* <ion-item *ngFor="let item of items">{{item}}</ion-item>
* </ion-list>
*
* <ion-infinite-scroll (ionInfinite)="$event.waitFor(doInfinite())">
* <ion-infinite-scroll-content></ion-infinite-scroll-content>
* </ion-infinite-scroll>
*
* </ion-content>
* ```
*
* ```ts
* @Component({...})
* export class NewsFeedPage {
* items = [];
*
* constructor() {
* for (var i = 0; i < 30; i++) {
* this.items.push( this.items.length );
* }
* }
*
* doInfinite(): Promise<any> {
* console.log('Begin async operation');
*
* return new Promise((resolve) => {
* setTimeout(() => {
* for (var i = 0; i < 30; i++) {
* this.items.push( this.items.length );
* }
*
* console.log('Async operation has ended');
* resolve();
* }, 500);
* })
* }
* }
* ```
*
* ## Infinite Scroll Content
*
* By default, Ionic uses the infinite scroll spinner that looks
* best for the platform the user is on. However, you can change the
* default spinner or add text by adding properties to the
* `ion-infinite-scroll-content` component.
*
* ```html
* <ion-content>
*
* <ion-infinite-scroll (ionInfinite)="doInfinite($event)">
* <ion-infinite-scroll-content
* loadingSpinner="bubbles"
* loadingText="Loading more data...">
* </ion-infinite-scroll-content>
* </ion-infinite-scroll>
*
* </ion-content>
* ```
*
*
* ## Further Customizing Infinite Scroll Content
*
* The `ion-infinite-scroll` component holds the infinite scroll logic.
* It requires a child component in order to display the content.
* Ionic uses `ion-infinite-scroll-content` by default. This component
* displays the infinite scroll and changes the look depending
* on the infinite scroll's state. Separating these components allows
* developers to create their own infinite scroll content components.
* You could replace our default content with custom SVG or CSS animations.
*
* @demo /docs/demos/src/infinite-scroll/
*
*/
var InfiniteScroll = (function () {
function InfiniteScroll(_content, _zone, _elementRef, _dom) {
this._content = _content;
this._zone = _zone;
this._elementRef = _elementRef;
this._dom = _dom;
this._lastCheck = 0;
this._highestY = 0;
this._thr = '15%';
this._thrPx = 0;
this._thrPc = 0.15;
this._position = POSITION_BOTTOM;
this._init = false;
/**
* @internal
*/
this.state = STATE_ENABLED;
/**
* @output {event} Emitted when the scroll reaches
* the threshold distance. From within your infinite handler,
* you must call the infinite scroll's `complete()` method when
* your async operation has completed.
*/
this.ionInfinite = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
_content.setElementClass('has-infinite-scroll', true);
}
Object.defineProperty(InfiniteScroll.prototype, "threshold", {
/**
* @input {string} The threshold distance from the bottom
* of the content to call the `infinite` output event when scrolled.
* The threshold value can be either a percent, or
* in pixels. For example, use the value of `10%` for the `infinite`
* output event to get called when the user has scrolled 10%
* from the bottom of the page. Use the value `100px` when the
* scroll is within 100 pixels from the bottom of the page.
* Default is `15%`.
*/
get: function () {
return this._thr;
},
set: function (val) {
this._thr = val;
if (val.indexOf('%') > -1) {
this._thrPx = 0;
this._thrPc = (parseFloat(val) / 100);
}
else {
this._thrPx = parseFloat(val);
this._thrPc = 0;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(InfiniteScroll.prototype, "enabled", {
/**
* @input {boolean} If true, Whether or not the infinite scroll should be
* enabled or not. Setting to `false` will remove scroll event listeners
* and hide the display.
*/
set: function (shouldEnable) {
this.enable(shouldEnable);
},
enumerable: true,
configurable: true
});
Object.defineProperty(InfiniteScroll.prototype, "position", {
/**
* @input {string} The position of the infinite scroll element.
* The value can be either `top` or `bottom`.
* Default is `bottom`.
*/
get: function () {
return this._position;
},
set: function (val) {
if (val === POSITION_TOP || val === POSITION_BOTTOM) {
this._position = val;
}
else {
console.error("Invalid value for ion-infinite-scroll's position input. Its value should be '" + POSITION_BOTTOM + "' or '" + POSITION_TOP + "'.");
}
},
enumerable: true,
configurable: true
});
InfiniteScroll.prototype._onScroll = function (ev) {
var _this = this;
if (this.state === STATE_LOADING || this.state === STATE_DISABLED) {
return 1;
}
if (this._lastCheck + 32 > ev.timeStamp) {
// no need to check less than every XXms
return 2;
}
this._lastCheck = ev.timeStamp;
// ******** DOM READ ****************
var infiniteHeight = this._elementRef.nativeElement.scrollHeight;
if (!infiniteHeight) {
// if there is no height of this element then do nothing
return 3;
}
// ******** DOM READ ****************
var d = this._content.getContentDimensions();
var height = d.contentHeight;
var threshold = this._thrPc ? (height * this._thrPc) : this._thrPx;
// ******** DOM READS ABOVE / DOM WRITES BELOW ****************
var distanceFromInfinite;
if (this._position === POSITION_BOTTOM) {
distanceFromInfinite = d.scrollHeight - infiniteHeight - d.scrollTop - height - threshold;
}
else {
(void 0) /* assert */;
distanceFromInfinite = d.scrollTop - infiniteHeight - threshold;
}
if (distanceFromInfinite < 0) {
// ******** DOM WRITE ****************
this._dom.write(function () {
_this._zone.run(function () {
if (_this.state !== STATE_LOADING && _this.state !== STATE_DISABLED) {
_this.state = STATE_LOADING;
_this.ionInfinite.emit(_this);
}
});
});
return 5;
}
return 6;
};
/**
* Call `complete()` within the `infinite` output event handler when
* your async operation has completed. For example, the `loading`
* state is while the app is performing an asynchronous operation,
* such as receiving more data from an AJAX request to add more items
* to a data list. Once the data has been received and UI updated, you
* then call this method to signify that the loading has completed.
* This method will change the infinite scroll's state from `loading`
* to `enabled`.
*/
InfiniteScroll.prototype.complete = function () {
var _this = this;
if (this.state !== STATE_LOADING) {
return;
}
if (this._position === POSITION_BOTTOM) {
this.state = STATE_ENABLED;
return;
}
(void 0) /* assert */;
/* New content is being added at the top, but the scrollTop position stays the same,
which causes a scroll jump visually. This algorithm makes sure to prevent this.
(Frame 1)
complete() is called, but the UI hasn't had time to update yet.
Save the current content dimensions.
Wait for the next frame using _dom.read, so the UI will be updated.
(Frame 2)
Read the new content dimensions.
Calculate the height difference and the new scroll position.
Delay the scroll position change until other possible dom reads are done using _dom.write to be performant.
(Still frame 2, if I'm correct)
Change the scroll position (= visually maintain the scroll position).
Change the state to re-enable the InfiniteScroll. This should be after changing the scroll position, or it could cause the InfiniteScroll to be triggered again immediately.
(Frame 3)
Done.
*/
// ******** DOM READ ****************
// Save the current content dimensions before the UI updates
var prevDim = this._content.getContentDimensions();
// ******** DOM READ ****************
this._dom.read(function () {
// UI has updated, save the new content dimensions
var newDim = _this._content.getContentDimensions();
// New content was added on top, so the scroll position should be changed immediately to prevent it from jumping around
var newScrollTop = newDim.scrollHeight - (prevDim.scrollHeight - prevDim.scrollTop);
// ******** DOM WRITE ****************
_this._dom.write(function () {
_this._content.scrollTop = newScrollTop;
_this.state = STATE_ENABLED;
});
});
};
/**
* Pass a promise inside `waitFor()` within the `infinite` output event handler in order to
* change state of infiniteScroll to "complete"
*/
InfiniteScroll.prototype.waitFor = function (action) {
var enable = this.complete.bind(this);
action.then(enable, enable);
};
/**
* Call `enable(false)` to disable the infinite scroll from actively
* trying to receive new data while scrolling. This method is useful
* when it is known that there is no more data that can be added, and
* the infinite scroll is no longer needed.
* @param {boolean} shouldEnable If the infinite scroll should be
* enabled or not. Setting to `false` will remove scroll event listeners
* and hide the display.
*/
InfiniteScroll.prototype.enable = function (shouldEnable) {
this.state = (shouldEnable ? STATE_ENABLED : STATE_DISABLED);
this._setListeners(shouldEnable);
};
/**
* @hidden
*/
InfiniteScroll.prototype._setListeners = function (shouldListen) {
if (this._init) {
if (shouldListen) {
if (!this._scLsn) {
this._scLsn = this._content.ionScroll.subscribe(this._onScroll.bind(this));
}
}
else {
this._scLsn && this._scLsn.unsubscribe();
this._scLsn = null;
}
}
};
/**
* @hidden
*/
InfiniteScroll.prototype.ngAfterContentInit = function () {
this._init = true;
this._setListeners(this.state !== STATE_DISABLED);
if (this._position === POSITION_TOP) {
this._content.scrollDownOnLoad = true;
}
};
/**
* @hidden
*/
InfiniteScroll.prototype.ngOnDestroy = function () {
this._setListeners(false);
};
InfiniteScroll.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-infinite-scroll'
},] },
];
/** @nocollapse */
InfiniteScroll.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__content_content__["a" /* Content */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["M" /* NgZone */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_2__platform_dom_controller__["a" /* DomController */], },
]; };
InfiniteScroll.propDecorators = {
'threshold': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'enabled': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'position': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'ionInfinite': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
};
return InfiniteScroll;
}());
var STATE_ENABLED = 'enabled';
var STATE_DISABLED = 'disabled';
var STATE_LOADING = 'loading';
var POSITION_TOP = 'top';
var POSITION_BOTTOM = 'bottom';
//# sourceMappingURL=infinite-scroll.js.map
/***/ }),
/* 90 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ItemOptions; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__platform_platform__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_util__ = __webpack_require__(3);
/**
* @name ItemOptions
* @description
* The option buttons for an `ion-item-sliding`. These buttons can be placed either on the left or right side.
* You can combine the `(ionSwipe)` event plus the `expandable` directive to create a full swipe action for the item.
*
* @usage
*
* ```html
* <ion-item-sliding>
* <ion-item>
* Item 1
* </ion-item>
* <ion-item-options side="right" (ionSwipe)="saveItem(item)">
* <button ion-button expandable (click)="saveItem(item)">
* <ion-icon name="star"></ion-icon>
* </button>
* </ion-item-options>
* </ion-item-sliding>
*```
*/
var ItemOptions = (function () {
function ItemOptions(_elementRef, _plt) {
this._elementRef = _elementRef;
this._plt = _plt;
/**
* @output {event} Emitted when the item has been fully swiped.
*/
this.ionSwipe = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
}
/**
* @hidden
*/
ItemOptions.prototype.isRightSide = function () {
return Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["m" /* isRightSide */])(this.side, this._plt.isRTL, true);
};
/**
* @hidden
*/
ItemOptions.prototype.width = function () {
return this._elementRef.nativeElement.offsetWidth;
};
ItemOptions.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-item-options',
},] },
];
/** @nocollapse */
ItemOptions.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__platform_platform__["a" /* Platform */], },
]; };
ItemOptions.propDecorators = {
'side': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'ionSwipe': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
};
return ItemOptions;
}());
//# sourceMappingURL=item-options.js.map
/***/ }),
/* 91 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return List; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__platform_dom_controller__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__gestures_gesture_controller__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__ion__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__item_item_sliding_gesture__ = __webpack_require__(396);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__platform_platform__ = __webpack_require__(4);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* The List is a widely used interface element in almost any mobile app,
* and can include content ranging from basic text all the way to
* buttons, toggles, icons, and thumbnails.
*
* Both the list, which contains items, and the list items themselves
* can be any HTML element.
*
* Using the List and Item components make it easy to support various
* interaction modes such as swipe to edit, drag to reorder, and
* removing items.
*
* @demo /docs/demos/src/list/
* @see {@link /docs/components#lists List Component Docs}
* @advanced
*
* Enable the sliding items.
*
* ```ts
* import { Component, ViewChild } from '@angular/core';
* import { List } from 'ionic-angular';
*
* @Component({...})
* export class MyClass {
* @ViewChild(List) list: List;
*
* constructor() { }
*
* stopSliding() {
* this.list.enableSlidingItems(false);
* }
* }
* ```
*
*/
var List = (function (_super) {
__extends(List, _super);
function List(config, elementRef, renderer, _plt, _gestureCtrl, _domCtrl) {
var _this = _super.call(this, config, elementRef, renderer, 'list') || this;
_this._plt = _plt;
_this._gestureCtrl = _gestureCtrl;
_this._domCtrl = _domCtrl;
_this._enableSliding = true;
_this._containsSlidingItems = false;
return _this;
}
Object.defineProperty(List.prototype, "sliding", {
/**
* @input {boolean} If true, the sliding items will be enabled.
*/
get: function () {
return this._enableSliding;
},
set: function (val) {
this._enableSliding = Object(__WEBPACK_IMPORTED_MODULE_5__util_util__["o" /* isTrueProperty */])(val);
this._updateSlidingState();
},
enumerable: true,
configurable: true
});
/**
* @hidden
*/
List.prototype.containsSlidingItem = function (contains) {
this._containsSlidingItems = contains;
this._updateSlidingState();
};
List.prototype._updateSlidingState = function () {
var shouldSlide = this._enableSliding && this._containsSlidingItems;
if (!shouldSlide) {
this._slidingGesture && this._slidingGesture.destroy();
this._slidingGesture = null;
}
else if (!this._slidingGesture) {
(void 0) /* console.debug */;
this._slidingGesture = new __WEBPACK_IMPORTED_MODULE_6__item_item_sliding_gesture__["a" /* ItemSlidingGesture */](this._plt, this, this._gestureCtrl, this._domCtrl);
this._slidingGesture.listen();
}
};
/**
* Close any sliding items that are open.
*/
List.prototype.closeSlidingItems = function () {
this._slidingGesture && this._slidingGesture.closeOpened();
};
/**
* @hidden
*/
List.prototype.destroy = function () {
this._slidingGesture && this._slidingGesture.destroy();
};
List.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-list',
},] },
];
/** @nocollapse */
List.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_7__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_3__gestures_gesture_controller__["l" /* GestureController */], },
{ type: __WEBPACK_IMPORTED_MODULE_2__platform_dom_controller__["a" /* DomController */], },
]; };
List.propDecorators = {
'sliding': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
};
return List;
}(__WEBPACK_IMPORTED_MODULE_4__ion__["a" /* Ion */]));
//# sourceMappingURL=list.js.map
/***/ }),
/* 92 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ListHeader; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ion__ = __webpack_require__(6);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
*/
var ListHeader = (function (_super) {
__extends(ListHeader, _super);
function ListHeader(config, renderer, elementRef, _id) {
var _this = _super.call(this, config, elementRef, renderer, 'list-header') || this;
_this._id = _id;
return _this;
}
Object.defineProperty(ListHeader.prototype, "id", {
get: function () {
return this._id;
},
set: function (val) {
this._id = val;
this.setElementAttribute('id', val);
},
enumerable: true,
configurable: true
});
ListHeader.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-list-header'
},] },
];
/** @nocollapse */
ListHeader.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["g" /* Attribute */], args: ['id',] },] },
]; };
return ListHeader;
}(__WEBPACK_IMPORTED_MODULE_2__ion__["a" /* Ion */]));
//# sourceMappingURL=list-header.js.map
/***/ }),
/* 93 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return LoadingCmp; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__gestures_gesture_controller__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__platform_key__ = __webpack_require__(23);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__navigation_nav_params__ = __webpack_require__(18);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__navigation_view_controller__ = __webpack_require__(7);
/**
* @hidden
*/
var LoadingCmp = (function () {
function LoadingCmp(_viewCtrl, _config, _elementRef, gestureCtrl, params, renderer) {
this._viewCtrl = _viewCtrl;
this._config = _config;
(void 0) /* assert */;
this.gestureBlocker = gestureCtrl.createBlocker(__WEBPACK_IMPORTED_MODULE_2__gestures_gesture_controller__["a" /* BLOCK_ALL */]);
this.d = params.data;
renderer.setElementClass(_elementRef.nativeElement, "loading-" + _config.get('mode'), true);
if (this.d.cssClass) {
this.d.cssClass.split(' ').forEach(function (cssClass) {
// Make sure the class isn't whitespace, otherwise it throws exceptions
if (cssClass.trim() !== '')
renderer.setElementClass(_elementRef.nativeElement, cssClass, true);
});
}
this.id = (++loadingIds);
}
LoadingCmp.prototype.ngOnInit = function () {
// If no spinner was passed in loading options we need to fall back
// to the loadingSpinner in the app's config, then the mode spinner
if (Object(__WEBPACK_IMPORTED_MODULE_3__util_util__["p" /* isUndefined */])(this.d.spinner)) {
this.d.spinner = this._config.get('loadingSpinner', this._config.get('spinner', 'ios'));
}
// If the user passed hide to the spinner we don't want to show it
this.showSpinner = Object(__WEBPACK_IMPORTED_MODULE_3__util_util__["h" /* isDefined */])(this.d.spinner) && this.d.spinner !== 'hide';
};
LoadingCmp.prototype.ionViewWillEnter = function () {
this.gestureBlocker.block();
};
LoadingCmp.prototype.ionViewDidLeave = function () {
this.gestureBlocker.unblock();
};
LoadingCmp.prototype.ionViewDidEnter = function () {
var _this = this;
// If there is a duration, dismiss after that amount of time
if (this.d && this.d.duration) {
this.durationTimeout = setTimeout(function () { return _this.dismiss('backdrop'); }, this.d.duration);
}
};
LoadingCmp.prototype.keyUp = function (ev) {
if (this._viewCtrl.isLast() && ev.keyCode === __WEBPACK_IMPORTED_MODULE_4__platform_key__["c" /* KEY_ESCAPE */]) {
this.bdClick();
}
};
LoadingCmp.prototype.bdClick = function () {
if (this.d.enableBackdropDismiss) {
this.dismiss('backdrop');
}
};
LoadingCmp.prototype.dismiss = function (role) {
if (this.durationTimeout) {
clearTimeout(this.durationTimeout);
}
return this._viewCtrl.dismiss(null, role);
};
LoadingCmp.prototype.ngOnDestroy = function () {
(void 0) /* assert */;
this.gestureBlocker.destroy();
};
LoadingCmp.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-loading',
template: '<ion-backdrop [hidden]="!d.showBackdrop" (click)="bdClick()" [class.backdrop-no-tappable]="!d.enableBackdropDismiss"></ion-backdrop>' +
'<div class="loading-wrapper">' +
'<div *ngIf="showSpinner" class="loading-spinner">' +
'<ion-spinner [name]="d.spinner"></ion-spinner>' +
'</div>' +
'<div *ngIf="d.content" [innerHTML]="d.content" class="loading-content"></div>' +
'</div>',
host: {
'role': 'dialog'
},
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
},] },
];
/** @nocollapse */
LoadingCmp.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_6__navigation_view_controller__["a" /* ViewController */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_2__gestures_gesture_controller__["l" /* GestureController */], },
{ type: __WEBPACK_IMPORTED_MODULE_5__navigation_nav_params__["a" /* NavParams */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
]; };
LoadingCmp.propDecorators = {
'keyUp': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* HostListener */], args: ['body:keyup', ['$event'],] },],
};
return LoadingCmp;
}());
var loadingIds = -1;
//# sourceMappingURL=loading-component.js.map
/***/ }),
/* 94 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Nav; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__app_app__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__navigation_deep_linker__ = __webpack_require__(19);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__platform_dom_controller__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__gestures_gesture_controller__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__navigation_nav_controller__ = __webpack_require__(27);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__navigation_nav_controller_base__ = __webpack_require__(53);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__platform_platform__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__transitions_transition_controller__ = __webpack_require__(55);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__navigation_view_controller__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__split_pane_split_pane__ = __webpack_require__(48);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name Nav
* @description
*
* `ion-nav` is the declarative component for a [NavController](../../../navigation/NavController/).
*
* For more information on using nav controllers like Nav or [Tab](../../Tabs/Tab/),
* take a look at the [NavController API Docs](../../../navigation/NavController/).
*
*
* @usage
* You must set a root page to be loaded initially by any Nav you create, using
* the 'root' property:
*
* ```ts
* import { Component } from '@angular/core';
* import { GettingStartedPage } from './getting-started';
*
* @Component({
* template: `<ion-nav [root]="root"></ion-nav>`
* })
* class MyApp {
* root = GettingStartedPage;
*
* constructor(){
* }
* }
* ```
*
* @demo /docs/demos/src/navigation/
* @see {@link /docs/components#navigation Navigation Component Docs}
*/
var Nav = (function (_super) {
__extends(Nav, _super);
function Nav(viewCtrl, parent, app, config, plt, elementRef, zone, renderer, cfr, gestureCtrl, transCtrl, linker, domCtrl, errHandler) {
var _this = _super.call(this, parent, app, config, plt, elementRef, zone, renderer, cfr, gestureCtrl, transCtrl, linker, domCtrl, errHandler) || this;
_this._hasInit = false;
if (viewCtrl) {
// an ion-nav can also act as an ion-page within a parent ion-nav
// this would happen when an ion-nav nests a child ion-nav.
viewCtrl._setContent(_this);
}
if (parent) {
// this Nav has a parent Nav
parent.registerChildNav(_this);
}
else if (viewCtrl && viewCtrl.getNav()) {
// this Nav was opened from a modal
_this.parent = viewCtrl.getNav();
_this.parent.registerChildNav(_this);
}
else if (app && !app.getRootNavById(_this.id)) {
// a root nav has not been registered yet with the app
// this is the root navcontroller for the entire app
app.registerRootNav(_this);
}
return _this;
}
Object.defineProperty(Nav.prototype, "_vp", {
/**
* @hidden
*/
set: function (val) {
this.setViewport(val);
},
enumerable: true,
configurable: true
});
Nav.prototype.ngAfterViewInit = function () {
var _this = this;
this._hasInit = true;
var segment = this._linker.getSegmentByNavIdOrName(this.id, this.name);
if (segment && (segment.component || segment.loadChildren)) {
return this._linker.initViews(segment).then(function (views) {
return _this.setPages(views, null, null);
});
}
else if (this._root) {
// no segment match, so use the root property but don't set the url I guess
var setUrl = segment ? false : true;
return this.push(this._root, this.rootParams, {
isNavRoot: (this._app.getRootNavById(this.id) === this),
updateUrl: setUrl
}, null);
}
};
Object.defineProperty(Nav.prototype, "root", {
/**
* @input {Page} The Page component to load as the root page within this nav.
*/
get: function () {
return this._root;
},
set: function (page) {
this._root = page;
if (this._hasInit) {
this.setRoot(page);
}
},
enumerable: true,
configurable: true
});
/**
* @hidden
*/
Nav.prototype.ngOnDestroy = function () {
this.destroy();
};
Nav.prototype.initPane = function () {
var isMain = this._elementRef.nativeElement.hasAttribute('main');
return isMain;
};
Nav.prototype.paneChanged = function (isPane) {
if (isPane) {
this.resize();
}
};
Nav.prototype.goToRoot = function (opts) {
return this.setRoot(this._root, this.rootParams, opts, null);
};
/*
* @private
*/
Nav.prototype.getType = function () {
return 'nav';
};
/*
* @private
*/
Nav.prototype.getSecondaryIdentifier = function () {
return null;
};
Nav.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-nav',
template: '<div #viewport nav-viewport></div>' +
'<div class="nav-decor"></div>',
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
providers: [{ provide: __WEBPACK_IMPORTED_MODULE_11__split_pane_split_pane__["a" /* RootNode */], useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_14" /* forwardRef */])(function () { return Nav; }) }]
},] },
];
/** @nocollapse */
Nav.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_10__navigation_view_controller__["a" /* ViewController */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_6__navigation_nav_controller__["a" /* NavController */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_1__app_app__["a" /* App */], },
{ type: __WEBPACK_IMPORTED_MODULE_2__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_8__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["M" /* NgZone */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["o" /* ComponentFactoryResolver */], },
{ type: __WEBPACK_IMPORTED_MODULE_5__gestures_gesture_controller__["l" /* GestureController */], },
{ type: __WEBPACK_IMPORTED_MODULE_9__transitions_transition_controller__["a" /* TransitionController */], },
{ type: __WEBPACK_IMPORTED_MODULE_3__navigation_deep_linker__["a" /* DeepLinker */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_4__platform_dom_controller__["a" /* DomController */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["u" /* ErrorHandler */], },
]; };
Nav.propDecorators = {
'_vp': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_8" /* ViewChild */], args: ['viewport', { read: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_10" /* ViewContainerRef */] },] },],
'root': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'rootParams': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'name': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
};
return Nav;
}(__WEBPACK_IMPORTED_MODULE_7__navigation_nav_controller_base__["a" /* NavControllerBase */]));
//# sourceMappingURL=nav.js.map
/***/ }),
/* 95 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ModalCmp; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__platform_key__ = __webpack_require__(23);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__navigation_nav_params__ = __webpack_require__(18);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__navigation_view_controller__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__gestures_gesture_controller__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__util_module_loader__ = __webpack_require__(96);
/**
* @hidden
*/
var ModalCmp = (function () {
function ModalCmp(_cfr, _renderer, _elementRef, _navParams, _viewCtrl, gestureCtrl, moduleLoader) {
this._cfr = _cfr;
this._renderer = _renderer;
this._elementRef = _elementRef;
this._navParams = _navParams;
this._viewCtrl = _viewCtrl;
this.moduleLoader = moduleLoader;
var opts = _navParams.get('opts');
(void 0) /* assert */;
this._gestureBlocker = gestureCtrl.createBlocker({
disable: [__WEBPACK_IMPORTED_MODULE_4__gestures_gesture_controller__["d" /* GESTURE_MENU_SWIPE */], __WEBPACK_IMPORTED_MODULE_4__gestures_gesture_controller__["b" /* GESTURE_GO_BACK_SWIPE */]]
});
this._bdDismiss = opts.enableBackdropDismiss;
if (opts.cssClass) {
opts.cssClass.split(' ').forEach(function (cssClass) {
// Make sure the class isn't whitespace, otherwise it throws exceptions
if (cssClass.trim() !== '')
_renderer.setElementClass(_elementRef.nativeElement, cssClass, true);
});
}
}
ModalCmp.prototype.ionViewPreLoad = function () {
var component = this._navParams.data.component;
if (!component) {
console.warn('modal\'s page was not defined');
return;
}
var cfr = this.moduleLoader.getComponentFactoryResolver(component);
if (!cfr) {
cfr = this._cfr;
}
var componentFactory = cfr.resolveComponentFactory(component);
// ******** DOM WRITE ****************
var componentRef = this._viewport.createComponent(componentFactory, this._viewport.length, this._viewport.parentInjector, []);
this._setCssClass(componentRef, 'ion-page');
this._setCssClass(componentRef, 'show-page');
// Change the viewcontroller's instance to point the user provided page
// Lifecycle events will be sent to the new instance, instead of the modal's component
// we need to manually subscribe to them
this._viewCtrl._setInstance(componentRef.instance);
this._viewCtrl.willEnter.subscribe(this._viewWillEnter.bind(this));
this._viewCtrl.didLeave.subscribe(this._viewDidLeave.bind(this));
this._enabled = true;
};
ModalCmp.prototype._viewWillEnter = function () {
this._gestureBlocker.block();
};
ModalCmp.prototype._viewDidLeave = function () {
this._gestureBlocker.unblock();
};
ModalCmp.prototype._setCssClass = function (componentRef, className) {
this._renderer.setElementClass(componentRef.location.nativeElement, className, true);
};
ModalCmp.prototype._bdClick = function () {
if (this._enabled && this._bdDismiss) {
var opts = {
minClickBlockDuration: 400
};
return this._viewCtrl.dismiss(null, 'backdrop', opts);
}
};
ModalCmp.prototype._keyUp = function (ev) {
if (this._enabled && this._viewCtrl.isLast() && ev.keyCode === __WEBPACK_IMPORTED_MODULE_1__platform_key__["c" /* KEY_ESCAPE */]) {
this._bdClick();
}
};
ModalCmp.prototype.ngOnDestroy = function () {
(void 0) /* assert */;
this._gestureBlocker.destroy();
};
ModalCmp.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-modal',
template: '<ion-backdrop (click)="_bdClick()" [class.backdrop-no-tappable]="!_bdDismiss"></ion-backdrop>' +
'<div class="modal-wrapper">' +
'<div #viewport nav-viewport></div>' +
'</div>'
},] },
];
/** @nocollapse */
ModalCmp.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["o" /* ComponentFactoryResolver */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_2__navigation_nav_params__["a" /* NavParams */], },
{ type: __WEBPACK_IMPORTED_MODULE_3__navigation_view_controller__["a" /* ViewController */], },
{ type: __WEBPACK_IMPORTED_MODULE_4__gestures_gesture_controller__["l" /* GestureController */], },
{ type: __WEBPACK_IMPORTED_MODULE_5__util_module_loader__["b" /* ModuleLoader */], },
]; };
ModalCmp.propDecorators = {
'_viewport': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_8" /* ViewChild */], args: ['viewport', { read: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_10" /* ViewContainerRef */] },] },],
'_keyUp': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* HostListener */], args: ['body:keyup', ['$event'],] },],
};
return ModalCmp;
}());
//# sourceMappingURL=modal-component.js.map
/***/ }),
/* 96 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return LAZY_LOADED_TOKEN; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ModuleLoader; });
/* harmony export (immutable) */ __webpack_exports__["c"] = provideModuleLoader;
/* unused harmony export setupPreloadingImplementation */
/* harmony export (immutable) */ __webpack_exports__["d"] = setupPreloading;
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__ng_module_loader__ = __webpack_require__(174);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util__ = __webpack_require__(3);
var LAZY_LOADED_TOKEN = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["B" /* InjectionToken */]('LZYCMP');
/**
* @hidden
*/
var ModuleLoader = (function () {
function ModuleLoader(_ngModuleLoader, _injector) {
this._ngModuleLoader = _ngModuleLoader;
this._injector = _injector;
/** @internal */
this._cfrMap = new Map();
this._promiseMap = new Map();
}
ModuleLoader.prototype.load = function (modulePath) {
var _this = this;
(void 0) /* console.time */;
var splitString = modulePath.split(SPLITTER);
var promise = this._promiseMap.get(modulePath);
if (!promise) {
promise = this._ngModuleLoader.load(splitString[0], splitString[1]);
this._promiseMap.set(modulePath, promise);
}
return promise.then(function (loadedModule) {
(void 0) /* console.timeEnd */;
var ref = loadedModule.create(_this._injector);
var component = ref.injector.get(LAZY_LOADED_TOKEN);
_this._cfrMap.set(component, ref.componentFactoryResolver);
return {
componentFactoryResolver: ref.componentFactoryResolver,
component: component
};
});
};
ModuleLoader.prototype.getComponentFactoryResolver = function (component) {
return this._cfrMap.get(component);
};
ModuleLoader.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
ModuleLoader.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__ng_module_loader__["a" /* NgModuleLoader */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["C" /* Injector */], },
]; };
return ModuleLoader;
}());
var SPLITTER = '#';
/**
* @hidden
*/
function provideModuleLoader(ngModuleLoader, injector) {
return new ModuleLoader(ngModuleLoader, injector);
}
/**
* @hidden
*/
function setupPreloadingImplementation(config, deepLinkConfig, moduleLoader) {
if (!deepLinkConfig || !deepLinkConfig.links || !config.getBoolean('preloadModules')) {
return Promise.resolve();
}
var linksToLoad = deepLinkConfig.links.filter(function (link) { return !!link.loadChildren && link.priority !== 'off'; });
// Load the high priority modules first
var highPriorityPromises = linksToLoad
.filter(function (link) { return link.priority === 'high'; })
.map(function (link) { return moduleLoader.load(link.loadChildren); });
return Promise.all(highPriorityPromises).then(function () {
// Load the low priority modules after the high priority are done
var lowPriorityPromises = linksToLoad
.filter(function (link) { return link.priority === 'low'; })
.map(function (link) { return moduleLoader.load(link.loadChildren); });
return Promise.all(lowPriorityPromises);
}).catch(function (err) {
console.error(err.message);
});
}
/**
* @hidden
*/
function setupPreloading(config, deepLinkConfig, moduleLoader, ngZone) {
return function () {
Object(__WEBPACK_IMPORTED_MODULE_2__util__["s" /* requestIonicCallback */])(function () {
ngZone.runOutsideAngular(function () {
setupPreloadingImplementation(config, deepLinkConfig, moduleLoader);
});
});
};
}
//# sourceMappingURL=module-loader.js.map
/***/ }),
/* 97 */,
/* 98 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export get */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getPromise; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getPlugin; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return pluginWarn; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return cordovaWarn; });
/**
* @private
*/
var get = function (element, path) {
var paths = path.split('.');
var obj = element;
for (var i = 0; i < paths.length; i++) {
if (!obj) {
return null;
}
obj = obj[paths[i]];
}
return obj;
};
/**
* @private
*/
var getPromise = function (callback) {
var tryNativePromise = function () {
if (window.Promise) {
return new Promise(function (resolve, reject) {
callback(resolve, reject);
});
}
else {
console.error('No Promise support or polyfill found. To enable Ionic Native support, please add the es6-promise polyfill before this script, or run with a library like Angular or on a recent browser.');
}
};
return tryNativePromise();
};
/**
* @private
* @param pluginRef
* @returns {null|*}
*/
var getPlugin = function (pluginRef) {
return get(window, pluginRef);
};
/**
* @private
*/
var pluginWarn = function (pluginName, plugin, method) {
if (method) {
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but the ' + pluginName + ' plugin is not installed.');
}
else {
console.warn('Native: tried accessing the ' + pluginName + ' plugin but it\'s not installed.');
}
if (plugin) {
console.warn('Install the ' + pluginName + ' plugin: \'ionic cordova plugin add ' + plugin + '\'');
}
};
/**
* @private
* @param pluginName
* @param method
*/
var cordovaWarn = function (pluginName, method) {
if (method) {
console.warn('Native: tried calling ' + pluginName + '.' + method + ', but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
}
else {
console.warn('Native: tried accessing the ' + pluginName + ' plugin but Cordova is not available. Make sure to include cordova.js or run in a device/simulator');
}
};
//# sourceMappingURL=util.js.map
/***/ }),
/* 99 */,
/* 100 */,
/* 101 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NavPop; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__navigation_nav_controller__ = __webpack_require__(27);
/**
* @name NavPop
* @description
* Directive to declaratively pop the current page off from the
* navigation stack.
*
* @usage
* ```html
* <ion-content>
*
* <button ion-button navPop>Go Back</button>
*
* </ion-content>
* ```
*
* Similar to {@link /docs/api/components/nav/NavPush/ `NavPush` }
* @demo /docs/demos/src/navigation/
* @see {@link /docs/components#navigation Navigation Component Docs}
* @see {@link ../NavPush NavPush API Docs}
*/
var NavPop = (function () {
function NavPop(_nav) {
this._nav = _nav;
if (!_nav) {
console.error('navPop must be within a NavController');
}
}
/**
* @hidden
*/
NavPop.prototype.onClick = function () {
// If no target, or if target is _self, prevent default browser behavior
if (this._nav) {
this._nav.pop().catch(function () {
(void 0) /* console.debug */;
});
return false;
}
return true;
};
NavPop.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: '[navPop]'
},] },
];
/** @nocollapse */
NavPop.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__navigation_nav_controller__["a" /* NavController */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
]; };
NavPop.propDecorators = {
'onClick': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* HostListener */], args: ['click',] },],
};
return NavPop;
}());
//# sourceMappingURL=nav-pop.js.map
/***/ }),
/* 102 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NavPush; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__navigation_nav_controller__ = __webpack_require__(27);
/**
* @name NavPush
* @description
* Directive to declaratively push a new page to the current nav
* stack.
*
* @usage
* ```html
* <button ion-button [navPush]="pushPage"></button>
* ```
*
* To specify parameters you can use array syntax or the `navParams`
* property:
*
* ```html
* <button ion-button [navPush]="pushPage" [navParams]="params">Go</button>
* ```
*
* Where `pushPage` and `params` are specified in your component,
* and `pushPage` contains a reference to a
* component you would like to push:
*
* ```ts
* import { LoginPage } from './login';
*
* @Component({
* template: `<button ion-button [navPush]="pushPage" [navParams]="params">Go</button>`
* })
* class MyPage {
* pushPage: any;
* params: Object;
* constructor(){
* this.pushPage = LoginPage;
* this.params = { id: 42 };
* }
* }
* ```
*
* @demo /docs/demos/src/navigation/
* @see {@link /docs/components#navigation Navigation Component Docs}
* @see {@link ../NavPop NavPop API Docs}
*
*/
var NavPush = (function () {
function NavPush(_nav) {
this._nav = _nav;
if (!_nav) {
console.error('navPush must be within a NavController');
}
}
/**
* @hidden
*/
NavPush.prototype.onClick = function () {
if (this._nav && this.navPush) {
this._nav.push(this.navPush, this.navParams);
return false;
}
return true;
};
NavPush.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: '[navPush]'
},] },
];
/** @nocollapse */
NavPush.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__navigation_nav_controller__["a" /* NavController */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
]; };
NavPush.propDecorators = {
'navPush': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'navParams': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'onClick': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* HostListener */], args: ['click',] },],
};
return NavPush;
}());
//# sourceMappingURL=nav-push.js.map
/***/ }),
/* 103 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Option; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_util__ = __webpack_require__(3);
/**
* @name Option
* @description
* `ion-option` is a child component of `ion-select`. Similar to the native option element, `ion-option` can take a value and a selected property.
*
* @demo /docs/demos/src/select/
*/
var Option = (function () {
function Option(_elementRef) {
this._elementRef = _elementRef;
this._selected = false;
this._disabled = false;
/**
* @output {any} Event to evaluate when option is selected.
*/
this.ionSelect = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
}
Object.defineProperty(Option.prototype, "disabled", {
/**
* @input {boolean} If true, the user cannot interact with this element.
*/
get: function () {
return this._disabled;
},
set: function (val) {
this._disabled = Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Option.prototype, "selected", {
/**
* @input {boolean} If true, the element is selected.
*/
get: function () {
return this._selected;
},
set: function (val) {
this._selected = Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Option.prototype, "value", {
/**
* @input {any} The value of the option.
*/
get: function () {
if (Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["l" /* isPresent */])(this._value)) {
return this._value;
}
return this.text;
},
set: function (val) {
this._value = val;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Option.prototype, "text", {
/**
* @hidden
*/
get: function () {
return this._elementRef.nativeElement.textContent;
},
enumerable: true,
configurable: true
});
Option.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-option'
},] },
];
/** @nocollapse */
Option.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
]; };
Option.propDecorators = {
'disabled': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'selected': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'value': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'ionSelect': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
};
return Option;
}());
//# sourceMappingURL=option.js.map
/***/ }),
/* 104 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Popover; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__navigation_overlay_proxy__ = __webpack_require__(173);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__popover_impl__ = __webpack_require__(476);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
*/
var Popover = (function (_super) {
__extends(Popover, _super);
function Popover(app, component, data, opts, config, deepLinker) {
if (opts === void 0) { opts = {}; }
var _this = _super.call(this, app, component, config, deepLinker) || this;
_this.data = data;
_this.opts = opts;
_this.isOverlay = true;
return _this;
}
Popover.prototype.getImplementation = function () {
return new __WEBPACK_IMPORTED_MODULE_1__popover_impl__["a" /* PopoverImpl */](this._app, this._component, this.data, this.opts, this._config);
};
return Popover;
}(__WEBPACK_IMPORTED_MODULE_0__navigation_overlay_proxy__["a" /* OverlayProxy */]));
//# sourceMappingURL=popover.js.map
/***/ }),
/* 105 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PopoverCmp; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__platform_key__ = __webpack_require__(23);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__navigation_nav_params__ = __webpack_require__(18);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__navigation_view_controller__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__gestures_gesture_controller__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__util_module_loader__ = __webpack_require__(96);
/**
* @hidden
*/
var PopoverCmp = (function () {
function PopoverCmp(_cfr, _elementRef, _renderer, _config, _navParams, _viewCtrl, gestureCtrl, moduleLoader) {
this._cfr = _cfr;
this._elementRef = _elementRef;
this._renderer = _renderer;
this._config = _config;
this._navParams = _navParams;
this._viewCtrl = _viewCtrl;
this.moduleLoader = moduleLoader;
this._gestureBlocker = gestureCtrl.createBlocker(__WEBPACK_IMPORTED_MODULE_5__gestures_gesture_controller__["a" /* BLOCK_ALL */]);
this.d = _navParams.data.opts;
_renderer.setElementClass(_elementRef.nativeElement, "popover-" + _config.get('mode'), true);
if (this.d.cssClass) {
this.d.cssClass.split(' ').forEach(function (cssClass) {
// Make sure the class isn't whitespace, otherwise it throws exceptions
if (cssClass.trim() !== '')
_renderer.setElementClass(_elementRef.nativeElement, cssClass, true);
});
}
this.id = (++popoverIds);
}
PopoverCmp.prototype.ionViewPreLoad = function () {
this._load(this._navParams.data.component);
};
PopoverCmp.prototype._load = function (component) {
if (component) {
var cfr = this.moduleLoader.getComponentFactoryResolver(component);
if (!cfr) {
cfr = this._cfr;
}
var componentFactory = cfr.resolveComponentFactory(component);
// ******** DOM WRITE ****************
var componentRef = this._viewport.createComponent(componentFactory, this._viewport.length, this._viewport.parentInjector, []);
this._viewCtrl._setInstance(componentRef.instance);
this._enabled = true;
// Subscribe to events in order to block gestures
// TODO, should we unsubscribe? memory leak?
this._viewCtrl.willEnter.subscribe(this._viewWillEnter.bind(this));
this._viewCtrl.didLeave.subscribe(this._viewDidLeave.bind(this));
}
};
PopoverCmp.prototype._viewWillEnter = function () {
this._gestureBlocker.block();
};
PopoverCmp.prototype._viewDidLeave = function () {
this._gestureBlocker.unblock();
};
PopoverCmp.prototype._setCssClass = function (componentRef, className) {
this._renderer.setElementClass(componentRef.location.nativeElement, className, true);
};
PopoverCmp.prototype._bdClick = function () {
if (this._enabled && this.d.enableBackdropDismiss) {
return this._viewCtrl.dismiss(null, 'backdrop');
}
};
PopoverCmp.prototype._keyUp = function (ev) {
if (this._enabled && ev.keyCode === __WEBPACK_IMPORTED_MODULE_2__platform_key__["c" /* KEY_ESCAPE */] && this._viewCtrl.isLast()) {
this._bdClick();
}
};
PopoverCmp.prototype.ngOnDestroy = function () {
(void 0) /* assert */;
this._gestureBlocker.destroy();
};
PopoverCmp.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-popover',
template: '<ion-backdrop (click)="_bdClick()" [hidden]="!d.showBackdrop"></ion-backdrop>' +
'<div class="popover-wrapper">' +
'<div class="popover-arrow"></div>' +
'<div class="popover-content">' +
'<div class="popover-viewport">' +
'<div #viewport nav-viewport></div>' +
'</div>' +
'</div>' +
'</div>'
},] },
];
/** @nocollapse */
PopoverCmp.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["o" /* ComponentFactoryResolver */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_3__navigation_nav_params__["a" /* NavParams */], },
{ type: __WEBPACK_IMPORTED_MODULE_4__navigation_view_controller__["a" /* ViewController */], },
{ type: __WEBPACK_IMPORTED_MODULE_5__gestures_gesture_controller__["l" /* GestureController */], },
{ type: __WEBPACK_IMPORTED_MODULE_6__util_module_loader__["b" /* ModuleLoader */], },
]; };
PopoverCmp.propDecorators = {
'_viewport': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_8" /* ViewChild */], args: ['viewport', { read: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_10" /* ViewContainerRef */] },] },],
'_keyUp': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* HostListener */], args: ['body:keyup', ['$event'],] },],
};
return PopoverCmp;
}());
var popoverIds = -1;
//# sourceMappingURL=popover-component.js.map
/***/ }),
/* 106 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return RadioGroup; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_forms__ = __webpack_require__(16);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__list_list_header__ = __webpack_require__(92);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_util__ = __webpack_require__(3);
/**
* @name RadioGroup
* @description
* A radio group is a group of [radio buttons](../RadioButton). It allows
* a user to select at most one radio button from a set. Checking one radio
* button that belongs to a radio group unchecks any previous checked
* radio button within the same group.
*
* See the [Angular Forms Docs](https://angular.io/docs/ts/latest/guide/forms.html)
* for more information on forms and inputs.
*
* @usage
* ```html
* <ion-list radio-group [(ngModel)]="autoManufacturers">
*
* <ion-list-header>
* Auto Manufacturers
* </ion-list-header>
*
* <ion-item>
* <ion-label>Cord</ion-label>
* <ion-radio value="cord"></ion-radio>
* </ion-item>
*
* <ion-item>
* <ion-label>Duesenberg</ion-label>
* <ion-radio value="duesenberg"></ion-radio>
* </ion-item>
*
* <ion-item>
* <ion-label>Hudson</ion-label>
* <ion-radio value="hudson"></ion-radio>
* </ion-item>
*
* <ion-item>
* <ion-label>Packard</ion-label>
* <ion-radio value="packard"></ion-radio>
* </ion-item>
*
* <ion-item>
* <ion-label>Studebaker</ion-label>
* <ion-radio value="studebaker"></ion-radio>
* </ion-item>
*
* </ion-list>
* ```
*
* @demo /docs/demos/src/radio/
* @see {@link /docs/components#radio Radio Component Docs}
* @see {@link ../RadioButton RadioButton API Docs}
*/
var RadioGroup = (function () {
function RadioGroup(_renderer, _elementRef, _cd) {
this._renderer = _renderer;
this._elementRef = _elementRef;
this._cd = _cd;
/**
* @internal
*/
this._disabled = false;
/**
* @hidden
*/
this._btns = [];
/**
* @hidden
*/
this._ids = -1;
/**
* @hidden
*/
this._init = false;
/**
* @output {any} Emitted when the selected button has changed.
*/
this.ionChange = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
this.id = ++radioGroupIds;
}
Object.defineProperty(RadioGroup.prototype, "disabled", {
/**
* @input {boolean} If true, the user cannot interact with any of the buttons in the group.
*/
get: function () {
return this._disabled;
},
set: function (val) {
this._disabled = Object(__WEBPACK_IMPORTED_MODULE_3__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
/**
* @hidden
*/
RadioGroup.prototype.ngAfterContentInit = function () {
var activeButton = this._btns.find(function (b) { return b.checked; });
if (activeButton) {
this._setActive(activeButton);
}
};
/**
* @hidden
*/
RadioGroup.prototype.writeValue = function (val) {
(void 0) /* console.debug */;
this.value = val;
if (this._init) {
this._update();
this.onTouched();
this.ionChange.emit(val);
}
this._init = true;
};
/**
* @hidden
*/
RadioGroup.prototype.registerOnChange = function (fn) {
var _this = this;
this._fn = fn;
this.onChange = function (val) {
// onChange used when there's an formControlName
(void 0) /* console.debug */;
fn(val);
_this.value = val;
_this._update();
_this.onTouched();
_this.ionChange.emit(val);
};
};
/**
* @hidden
*/
RadioGroup.prototype.registerOnTouched = function (fn) { this.onTouched = fn; };
/**
* @hidden
*/
RadioGroup.prototype._update = function () {
var _this = this;
// loop through each of the radiobuttons
var hasChecked = false;
this._btns.forEach(function (radioButton) {
// check this radiobutton if its value is
// the same as the radiogroups value
radioButton.checked = Object(__WEBPACK_IMPORTED_MODULE_3__util_util__["g" /* isCheckedProperty */])(_this.value, radioButton.value) && !hasChecked;
if (radioButton.checked) {
// if this button is checked, then set it as
// the radiogroup's active descendant
_this._setActive(radioButton);
hasChecked = true;
}
});
};
/**
* @hidden
*/
RadioGroup.prototype._setActive = function (radioButton) {
this._renderer.setElementAttribute(this._elementRef.nativeElement, 'aria-activedescendant', radioButton.id);
};
/**
* @hidden
*/
RadioGroup.prototype.add = function (button) {
var _this = this;
this._btns.push(button);
// listen for radiobutton select events
button.ionSelect.subscribe(function (val) {
// this radiobutton has been selected
_this.onChange(val);
});
return this.id + '-' + (++this._ids);
};
/**
* @hidden
*/
RadioGroup.prototype.remove = function (button) {
var index = this._btns.indexOf(button);
if (index > -1) {
if (button.value === this.value) {
this.value = null;
}
this._btns.splice(index, 1);
}
};
Object.defineProperty(RadioGroup.prototype, "_header", {
/**
* @hidden
*/
set: function (header) {
if (header) {
if (!header.id) {
header.id = 'rg-hdr-' + this.id;
}
this._renderer.setElementAttribute(this._elementRef.nativeElement, 'aria-describedby', header.id);
}
},
enumerable: true,
configurable: true
});
/**
* @hidden
*/
RadioGroup.prototype.onChange = function (val) {
// onChange used when there is not an formControlName
(void 0) /* console.debug */;
this.value = val;
this._update();
this.onTouched();
this.ionChange.emit(val);
this._cd.detectChanges();
};
/**
* @hidden
*/
RadioGroup.prototype.onTouched = function () { };
/**
* @hidden
*/
RadioGroup.prototype.setDisabledState = function (isDisabled) {
this.disabled = isDisabled;
};
RadioGroup.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: '[radio-group]',
host: {
'role': 'radiogroup'
},
providers: [{ provide: __WEBPACK_IMPORTED_MODULE_1__angular_forms__["c" /* NG_VALUE_ACCESSOR */], useExisting: RadioGroup, multi: true }],
},] },
];
/** @nocollapse */
RadioGroup.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["j" /* ChangeDetectorRef */], },
]; };
RadioGroup.propDecorators = {
'disabled': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'ionChange': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'_header': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* ContentChild */], args: [__WEBPACK_IMPORTED_MODULE_2__list_list_header__["a" /* ListHeader */],] },],
};
return RadioGroup;
}());
var radioGroupIds = -1;
//# sourceMappingURL=radio-group.js.map
/***/ }),
/* 107 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Refresher; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__content_content__ = __webpack_require__(24);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__gestures_gesture_controller__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__platform_platform__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__util_dom__ = __webpack_require__(14);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__gestures_ui_event_manager__ = __webpack_require__(28);
/**
* @name Refresher
* @description
* The Refresher provides pull-to-refresh functionality on a content component.
* Place the `ion-refresher` as the first child of your `ion-content` element.
*
* Pages can then listen to the refresher's various output events. The
* `refresh` output event is fired when the user has pulled down far
* enough to kick off the refreshing process. Once the async operation
* has completed and the refreshing should end, call `complete()`.
*
* Note: Do not wrap the `ion-refresher` in a `*ngIf`. It will not render
* properly this way. Please use the `enabled` property instead to
* display or hide the refresher.
*
* @usage
* ```html
* <ion-content>
*
* <ion-refresher (ionRefresh)="doRefresh($event)">
* <ion-refresher-content></ion-refresher-content>
* </ion-refresher>
*
* </ion-content>
* ```
*
* ```ts
* @Component({...})
* export class NewsFeedPage {
*
* doRefresh(refresher) {
* console.log('Begin async operation', refresher);
*
* setTimeout(() => {
* console.log('Async operation has ended');
* refresher.complete();
* }, 2000);
* }
*
* }
* ```
*
*
* ## Refresher Content
*
* By default, Ionic provides the pulling icon and refreshing spinner that
* looks best for the platform the user is on. However, you can change the
* default icon and spinner, along with adding text for each state by
* adding properties to the child `ion-refresher-content` component.
*
* ```html
* <ion-content>
*
* <ion-refresher (ionRefresh)="doRefresh($event)">
* <ion-refresher-content
* pullingIcon="arrow-dropdown"
* pullingText="Pull to refresh"
* refreshingSpinner="circles"
* refreshingText="Refreshing...">
* </ion-refresher-content>
* </ion-refresher>
*
* </ion-content>
* ```
*
*
* ## Further Customizing Refresher Content
*
* The `ion-refresher` component holds the refresh logic.
* It requires a child component in order to display the content.
* Ionic uses `ion-refresher-content` by default. This component
* displays the refresher and changes the look depending
* on the refresher's state. Separating these components
* allows developers to create their own refresher content
* components. You could replace our default content with
* custom SVG or CSS animations.
*
* @demo /docs/demos/src/refresher/
*
*/
var Refresher = (function () {
function Refresher(_plt, _content, _zone, gestureCtrl) {
this._plt = _plt;
this._content = _content;
this._zone = _zone;
this._appliedStyles = false;
this._lastCheck = 0;
this._isEnabled = true;
this._top = '';
/**
* The current state which the refresher is in. The refresher's states include:
*
* - `inactive` - The refresher is not being pulled down or refreshing and is currently hidden.
* - `pulling` - The user is actively pulling down the refresher, but has not reached the point yet that if the user lets go, it'll refresh.
* - `cancelling` - The user pulled down the refresher and let go, but did not pull down far enough to kick off the `refreshing` state. After letting go, the refresher is in the `cancelling` state while it is closing, and will go back to the `inactive` state once closed.
* - `ready` - The user has pulled down the refresher far enough that if they let go, it'll begin the `refreshing` state.
* - `refreshing` - The refresher is actively waiting on the async operation to end. Once the refresh handler calls `complete()` it will begin the `completing` state.
* - `completing` - The `refreshing` state has finished and the refresher is in the process of closing itself. Once closed, the refresher will go back to the `inactive` state.
*/
this.state = STATE_INACTIVE;
/**
* The Y coordinate of where the user started to the pull down the content.
*/
this.startY = null;
/**
* The current touch or mouse event's Y coordinate.
*/
this.currentY = null;
/**
* The distance between the start of the pull and the current touch or
* mouse event's Y coordinate.
*/
this.deltaY = null;
/**
* A number representing how far down the user has pulled.
* The number `0` represents the user hasn't pulled down at all. The
* number `1`, and anything greater than `1`, represents that the user
* has pulled far enough down that when they let go then the refresh will
* happen. If they let go and the number is less than `1`, then the
* refresh will not happen, and the content will return to it's original
* position.
*/
this.progress = 0;
/**
* @input {number} The min distance the user must pull down until the
* refresher can go into the `refreshing` state. Default is `60`.
*/
this.pullMin = 60;
/**
* @input {number} The maximum distance of the pull until the refresher
* will automatically go into the `refreshing` state. By default, the pull
* maximum will be the result of `pullMin + 60`.
*/
this.pullMax = this.pullMin + 60;
/**
* @input {number} How many milliseconds it takes to close the refresher. Default is `280`.
*/
this.closeDuration = 280;
/**
* @input {number} How many milliseconds it takes the refresher to to snap back to the `refreshing` state. Default is `280`.
*/
this.snapbackDuration = 280;
/**
* @output {event} Emitted when the user lets go and has pulled down
* far enough, which would be farther than the `pullMin`, then your refresh hander if
* fired and the state is updated to `refreshing`. From within your refresh handler,
* you must call the `complete()` method when your async operation has completed.
*/
this.ionRefresh = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* @output {event} Emitted while the user is pulling down the content and exposing the refresher.
*/
this.ionPull = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* @output {event} Emitted when the user begins to start pulling down.
*/
this.ionStart = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
this._events = new __WEBPACK_IMPORTED_MODULE_6__gestures_ui_event_manager__["a" /* UIEventManager */](_plt);
_content._hasRefresher = true;
this._gesture = gestureCtrl.createGesture({
name: __WEBPACK_IMPORTED_MODULE_2__gestures_gesture_controller__["j" /* GESTURE_REFRESHER */],
priority: __WEBPACK_IMPORTED_MODULE_2__gestures_gesture_controller__["g" /* GESTURE_PRIORITY_REFRESHER */]
});
}
Object.defineProperty(Refresher.prototype, "enabled", {
/**
* @input {boolean} If the refresher is enabled or not. This should be used in place of an `ngIf`. Default is `true`.
*/
get: function () {
return this._isEnabled;
},
set: function (val) {
this._isEnabled = Object(__WEBPACK_IMPORTED_MODULE_3__util_util__["o" /* isTrueProperty */])(val);
this._setListeners(this._isEnabled);
},
enumerable: true,
configurable: true
});
Refresher.prototype._onStart = function (ev) {
// if multitouch then get out immediately
if (ev.touches && ev.touches.length > 1) {
return false;
}
if (this.state !== STATE_INACTIVE) {
return false;
}
var scrollHostScrollTop = this._content.getContentDimensions().scrollTop;
// if the scrollTop is greater than zero then it's
// not possible to pull the content down yet
if (scrollHostScrollTop > 0) {
return false;
}
if (!this._gesture.canStart()) {
return false;
}
var coord = Object(__WEBPACK_IMPORTED_MODULE_5__util_dom__["f" /* pointerCoord */])(ev);
(void 0) /* console.debug */;
if (this._content.contentTop > 0) {
var newTop = this._content.contentTop + 'px';
if (this._top !== newTop) {
this._top = newTop;
}
}
this.startY = this.currentY = coord.y;
this.progress = 0;
this.state = STATE_INACTIVE;
return true;
};
Refresher.prototype._onMove = function (ev) {
// this method can get called like a bazillion times per second,
// so it's built to be as efficient as possible, and does its
// best to do any DOM read/writes only when absolutely necessary
var _this = this;
// if multitouch then get out immediately
if (ev.touches && ev.touches.length > 1) {
return 1;
}
if (!this._gesture.canStart()) {
return 0;
}
// do nothing if it's actively refreshing
// or it's in the process of closing
// or this was never a startY
if (this.startY === null || this.state === STATE_REFRESHING || this.state === STATE_CANCELLING || this.state === STATE_COMPLETING) {
return 2;
}
// if we just updated stuff less than 16ms ago
// then don't check again, just chillout plz
var now = Date.now();
if (this._lastCheck + 16 > now) {
return 3;
}
// remember the last time we checked all this
this._lastCheck = now;
// get the current pointer coordinates
var coord = Object(__WEBPACK_IMPORTED_MODULE_5__util_dom__["f" /* pointerCoord */])(ev);
this.currentY = coord.y;
// it's now possible they could be pulling down the content
// how far have they pulled so far?
this.deltaY = (coord.y - this.startY);
// don't bother if they're scrolling up
// and have not already started dragging
if (this.deltaY <= 0) {
// the current Y is higher than the starting Y
// so they scrolled up enough to be ignored
this.progress = 0;
if (this.state !== STATE_INACTIVE) {
this._zone.run(function () {
_this.state = STATE_INACTIVE;
});
}
if (this._appliedStyles) {
// reset the styles only if they were applied
this._setCss(0, '', false, '');
return 5;
}
return 6;
}
if (this.state === STATE_INACTIVE) {
// this refresh is not already actively pulling down
// get the content's scrollTop
var scrollHostScrollTop = this._content.getContentDimensions().scrollTop;
// if the scrollTop is greater than zero then it's
// not possible to pull the content down yet
if (scrollHostScrollTop > 0) {
this.progress = 0;
this.startY = null;
return 7;
}
// content scrolled all the way to the top, and dragging down
this.state = STATE_PULLING;
}
// prevent native scroll events
ev.preventDefault();
// the refresher is actively pulling at this point
// move the scroll element within the content element
this._setCss(this.deltaY, '0ms', true, '');
if (!this.deltaY) {
// don't continue if there's no delta yet
this.progress = 0;
return 8;
}
// so far so good, let's run this all back within zone now
this._zone.run(function () {
_this._onMoveInZone();
});
};
Refresher.prototype._onMoveInZone = function () {
// set pull progress
this.progress = (this.deltaY / this.pullMin);
// emit "start" if it hasn't started yet
if (!this._didStart) {
this._didStart = true;
this.ionStart.emit(this);
}
// emit "pulling" on every move
this.ionPull.emit(this);
// do nothing if the delta is less than the pull threshold
if (this.deltaY < this.pullMin) {
// ensure it stays in the pulling state, cuz its not ready yet
this.state = STATE_PULLING;
return 2;
}
if (this.deltaY > this.pullMax) {
// they pulled farther than the max, so kick off the refresh
this._beginRefresh();
return 3;
}
// pulled farther than the pull min!!
// it is now in the `ready` state!!
// if they let go then it'll refresh, kerpow!!
this.state = STATE_READY;
return 4;
};
Refresher.prototype._onEnd = function () {
// only run in a zone when absolutely necessary
var _this = this;
if (this.state === STATE_READY) {
this._zone.run(function () {
// they pulled down far enough, so it's ready to refresh
_this._beginRefresh();
});
}
else if (this.state === STATE_PULLING) {
this._zone.run(function () {
// they were pulling down, but didn't pull down far enough
// set the content back to it's original location
// and close the refresher
// set that the refresh is actively cancelling
_this.cancel();
});
}
// reset on any touchend/mouseup
this.startY = null;
};
Refresher.prototype._beginRefresh = function () {
// assumes we're already back in a zone
// they pulled down far enough, so it's ready to refresh
this.state = STATE_REFRESHING;
// place the content in a hangout position while it thinks
this._setCss(this.pullMin, (this.snapbackDuration + 'ms'), true, '');
// emit "refresh" because it was pulled down far enough
// and they let go to begin refreshing
this.ionRefresh.emit(this);
};
/**
* Call `complete()` when your async operation has completed.
* For example, the `refreshing` state is while the app is performing
* an asynchronous operation, such as receiving more data from an
* AJAX request. Once the data has been received, you then call this
* method to signify that the refreshing has completed and to close
* the refresher. This method also changes the refresher's state from
* `refreshing` to `completing`.
*/
Refresher.prototype.complete = function () {
this._close(STATE_COMPLETING, '120ms');
};
/**
* Changes the refresher's state from `refreshing` to `cancelling`.
*/
Refresher.prototype.cancel = function () {
this._close(STATE_CANCELLING, '');
};
Refresher.prototype._close = function (state, delay) {
var timer;
function close(ev) {
// closing is done, return to inactive state
if (ev) {
clearTimeout(timer);
}
this.state = STATE_INACTIVE;
this.progress = 0;
this._didStart = this.startY = this.currentY = this.deltaY = null;
this._setCss(0, '0ms', false, '');
}
// create fallback timer incase something goes wrong with transitionEnd event
timer = setTimeout(close.bind(this), 600);
// create transition end event on the content's scroll element
this._content.onScrollElementTransitionEnd(close.bind(this));
// reset set the styles on the scroll element
// set that the refresh is actively cancelling/completing
this.state = state;
this._setCss(0, '', true, delay);
if (this._pointerEvents) {
this._pointerEvents.stop();
}
};
Refresher.prototype._setCss = function (y, duration, overflowVisible, delay) {
this._appliedStyles = (y > 0);
var content = this._content;
var Css = this._plt.Css;
content.setScrollElementStyle(Css.transform, ((y > 0) ? 'translateY(' + y + 'px) translateZ(0px)' : 'translateZ(0px)'));
content.setScrollElementStyle(Css.transitionDuration, duration);
content.setScrollElementStyle(Css.transitionDelay, delay);
content.setScrollElementStyle('overflow', (overflowVisible ? 'hidden' : ''));
};
Refresher.prototype._setListeners = function (shouldListen) {
this._events.unlistenAll();
this._pointerEvents = null;
if (shouldListen) {
this._pointerEvents = this._events.pointerEvents({
element: this._content.getScrollElement(),
pointerDown: this._onStart.bind(this),
pointerMove: this._onMove.bind(this),
pointerUp: this._onEnd.bind(this),
zone: false
});
}
};
/**
* @hidden
*/
Refresher.prototype.ngOnInit = function () {
// bind event listeners
// save the unregister listener functions to use onDestroy
this._setListeners(this._isEnabled);
};
/**
* @hidden
*/
Refresher.prototype.ngOnDestroy = function () {
this._setListeners(false);
this._events.destroy();
this._gesture.destroy();
};
Refresher.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-refresher',
host: {
'[class.refresher-active]': 'state !== "inactive"',
'[style.top]': '_top'
}
},] },
];
/** @nocollapse */
Refresher.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_4__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__content_content__["a" /* Content */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["w" /* Host */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["M" /* NgZone */], },
{ type: __WEBPACK_IMPORTED_MODULE_2__gestures_gesture_controller__["l" /* GestureController */], },
]; };
Refresher.propDecorators = {
'pullMin': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'pullMax': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'closeDuration': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'snapbackDuration': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'enabled': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'ionRefresh': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'ionPull': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'ionStart': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
};
return Refresher;
}());
var STATE_INACTIVE = 'inactive';
var STATE_PULLING = 'pulling';
var STATE_READY = 'ready';
var STATE_REFRESHING = 'refreshing';
var STATE_CANCELLING = 'cancelling';
var STATE_COMPLETING = 'completing';
//# sourceMappingURL=refresher.js.map
/***/ }),
/* 108 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SegmentButton; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_util__ = __webpack_require__(3);
/**
* @name SegmentButton
* @description
* The child buttons of the `ion-segment` component. Each `ion-segment-button` must have a value.
*
* @usage
*
* ```html
* <ion-content>
* <!-- Segment buttons with icons -->
* <ion-segment [(ngModel)]="icons" color="secondary">
* <ion-segment-button value="camera">
* <ion-icon name="camera"></ion-icon>
* </ion-segment-button>
* <ion-segment-button value="bookmark">
* <ion-icon name="bookmark"></ion-icon>
* </ion-segment-button>
* </ion-segment>
*
* <!-- Segment buttons with text -->
* <ion-segment [(ngModel)]="relationship" color="primary">
* <ion-segment-button value="friends" (ionSelect)="selectedFriends()">
* Friends
* </ion-segment-button>
* <ion-segment-button value="enemies" (ionSelect)="selectedEnemies()">
* Enemies
* </ion-segment-button>
* </ion-segment>
* </ion-content>
* ```
*
*
* @demo /docs/demos/src/segment/
* @see {@link /docs/components#segment Segment Component Docs}
* @see {@link /docs/api/components/segment/Segment/ Segment API Docs}
*/
var SegmentButton = (function () {
function SegmentButton() {
this.isActive = false;
this._disabled = false;
/**
* @output {SegmentButton} Emitted when a segment button has been clicked.
*/
this.ionSelect = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
}
Object.defineProperty(SegmentButton.prototype, "disabled", {
/**
* @input {boolean} If true, the user cannot interact with this element.
*/
get: function () {
return this._disabled;
},
set: function (val) {
this._disabled = Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
/**
* @hidden
* On click of a SegmentButton
*/
SegmentButton.prototype.onClick = function () {
(void 0) /* console.debug */;
this.ionSelect.emit(this);
};
/**
* @hidden
*/
SegmentButton.prototype.ngOnInit = function () {
if (!Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["l" /* isPresent */])(this.value)) {
console.warn('<ion-segment-button> requires a "value" attribute');
}
};
SegmentButton.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-segment-button',
template: '<ng-content></ng-content>' +
'<div class="button-effect"></div>',
host: {
'tappable': '',
'class': 'segment-button',
'role': 'button',
'[class.segment-button-disabled]': '_disabled',
'[class.segment-activated]': 'isActive',
'[attr.aria-pressed]': 'isActive'
},
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
},] },
];
/** @nocollapse */
SegmentButton.ctorParameters = function () { return []; };
SegmentButton.propDecorators = {
'value': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'ionSelect': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'disabled': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'onClick': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* HostListener */], args: ['click',] },],
};
return SegmentButton;
}());
//# sourceMappingURL=segment-button.js.map
/***/ }),
/* 109 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SelectPopover; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__navigation_nav_params__ = __webpack_require__(18);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__navigation_view_controller__ = __webpack_require__(7);
/** @hidden */
var SelectPopover = (function () {
function SelectPopover(navParams, viewController) {
this.navParams = navParams;
this.viewController = viewController;
}
Object.defineProperty(SelectPopover.prototype, "value", {
get: function () {
var checkedOption = this.options.find(function (option) { return option.checked; });
return checkedOption ? checkedOption.value : undefined;
},
set: function (value) {
var checkedOption = this.options.find(function (option) { return option.value === value; });
if (checkedOption && checkedOption.handler) {
checkedOption.handler();
}
this.viewController.dismiss(value);
},
enumerable: true,
configurable: true
});
SelectPopover.prototype.ngOnInit = function () {
this.options = this.navParams.data.options;
};
SelectPopover.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
template: "\n <ion-list radio-group [(ngModel)]=\"value\">\n <ion-item *ngFor=\"let option of options\">\n <ion-label>{{option.text}}</ion-label>\n <ion-radio [checked]=\"option.checked\" [value]=\"option.value\" [disabled]=\"option.disabled\"></ion-radio>\n </ion-item>\n </ion-list>\n "
},] },
];
/** @nocollapse */
SelectPopover.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__navigation_nav_params__["a" /* NavParams */], },
{ type: __WEBPACK_IMPORTED_MODULE_2__navigation_view_controller__["a" /* ViewController */], },
]; };
return SelectPopover;
}());
//# sourceMappingURL=select-popover-component.js.map
/***/ }),
/* 110 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DisplayWhen; });
/**
* @hidden
*/
var DisplayWhen = (function () {
function DisplayWhen(conditions, _plt, zone) {
this._plt = _plt;
this.zone = zone;
this.isMatch = false;
if (!conditions)
return;
this.conditions = conditions.replace(/\s/g, '').split(',');
// check if its one of the matching platforms first
// a platform does not change during the life of an app
for (var i = 0; i < this.conditions.length; i++) {
if (this.conditions[i] && _plt.is(this.conditions[i])) {
this.isMatch = true;
return;
}
}
if (this.orientation()) {
// add window resize listener
this.resizeObs = _plt.resize.subscribe(this.orientation.bind(this));
}
}
DisplayWhen.prototype.orientation = function () {
for (var i = 0; i < this.conditions.length; i++) {
if (this.conditions[i] === 'portrait') {
this.isMatch = this._plt.isPortrait();
return true;
}
if (this.conditions[i] === 'landscape') {
this.isMatch = this._plt.isLandscape();
return true;
}
}
return false;
};
DisplayWhen.prototype.ngOnDestroy = function () {
this.resizeObs && this.resizeObs.unsubscribe();
this.resizeObs = null;
};
return DisplayWhen;
}());
//# sourceMappingURL=display-when.js.map
/***/ }),
/* 111 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Slides; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__swiper_swiper_keyboard__ = __webpack_require__(478);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__ion__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__swiper_swiper_events__ = __webpack_require__(481);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__swiper_swiper_zoom__ = __webpack_require__(331);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__platform_platform__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__swiper_swiper__ = __webpack_require__(64);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__swiper_swiper_effects__ = __webpack_require__(115);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__navigation_view_controller__ = __webpack_require__(7);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name Slides
* @description
* The Slides component is a multi-section container. Each section can be swiped
* or dragged between. It contains any number of [Slide](../Slide) components.
*
*
* ### Creating
* You should use a template to create slides and listen to slide events. The template
* should contain the slide container, an `<ion-slides>` element, and any number of
* [Slide](../Slide) components, written as `<ion-slide>`. Basic configuration
* values can be set as input properties, which are listed below. Slides events
* can also be listened to such as the slide changing by placing the event on the
* `<ion-slides>` element. See [Usage](#usage) below for more information.
*
*
* ### Navigating
* After creating and configuring the slides, you can navigate between them
* by swiping or calling methods on the `Slides` instance. You can call `slideTo()` to
* navigate to a specific slide, or `slideNext()` to change to the slide that follows
* the active slide. All of the [methods](#instance-members) provided by the `Slides`
* instance are listed below. See [Usage](#usage) below for more information on
* navigating between slides.
*
*
* @usage
*
* You can add slides to a `@Component` using the following template:
*
* ```html
* <ion-slides>
* <ion-slide>
* <h1>Slide 1</h1>
* </ion-slide>
* <ion-slide>
* <h1>Slide 2</h1>
* </ion-slide>
* <ion-slide>
* <h1>Slide 3</h1>
* </ion-slide>
* </ion-slides>
* ```
*
* Next, we can use `ViewChild` to assign the Slides instance to
* your `slides` property. Now we can call any of the `Slides`
* [methods](#instance-members), for example we can use the Slide's
* `slideTo()` method in order to navigate to a specific slide on
* a button click. Below we call the `goToSlide()` method and it
* navigates to the 3rd slide:
*
* ```ts
* import { ViewChild } from '@angular/core';
* import { Slides } from 'ionic-angular';
*
* class MyPage {
* @ViewChild(Slides) slides: Slides;
*
* goToSlide() {
* this.slides.slideTo(2, 500);
* }
* }
* ```
*
* We can also add events to listen to on the `<ion-slides>` element.
* Let's add the `ionSlideDidChange` event and call a method when the slide changes:
*
* ```html
* <ion-slides (ionSlideDidChange)="slideChanged()">
* ```
*
* In our class, we add the `slideChanged()` method which gets the active
* index and prints it:
*
* ```ts
* class MyPage {
* ...
*
* slideChanged() {
* let currentIndex = this.slides.getActiveIndex();
* console.log('Current index is', currentIndex);
* }
* }
* ```
*
* ### Zooming
* If your slides contain images, you can enable zooming on them by setting `zoom="true" and
* wrapping each image in a `div` with the class `swiper-zoom-container`. Zoom supports
* `img`, `svg`, `canvas`, and `ion-img`.
*
* ```html
* <ion-slides zoom="true">
* <ion-slide>
* <div class="swiper-zoom-container">
* <img src="assets/img/dog.jpg">
* </div>
* <ion-label>Woof</ion-label>
* </ion-slide>
* <ion-slide>
* <div class="swiper-zoom-container">
* <img src="assets/img/cat.jpg">
* </div>
* <ion-label>Meow</ion-label>
* </ion-slide>
* <ion-slide>
* <div class="swiper-zoom-container">
* <img src="assets/img/fish.jpg">
* </div>
* <ion-label>Just keep swimming</ion-label>
* </ion-slide>
* </ion-slides>
* ```
*
* @advanced
*
* There are several options available to create customized slides. Ionic exposes
* the most commonly used options as [inputs](http://learnangular2.com/inputs/).
* In order to use an option that isn't exposed as an input the following code
* should be used, where `freeMode` is the option to change:
*
* ```ts
* import { ViewChild } from '@angular/core';
* import { Slides } from 'ionic-angular';
* class MyPage {
* @ViewChild(Slides) slides: Slides;
*
* ngAfterViewInit() {
* this.slides.freeMode = true;
* }
* }
*
* ```
*
* To see all of the available options, take a look at the
* [source for slides](https://github.com/ionic-team/ionic/blob/master/src/components/slides/slides.ts).
*
* @demo /docs/demos/src/slides/
* @see {@link /docs/components#slides Slides Component Docs}
*
* Adopted from Swiper.js:
* The most modern mobile touch slider and framework with
* hardware accelerated transitions.
*
* http://www.idangero.us/swiper/
*
* Copyright 2016, Vladimir Kharlampidi
* The iDangero.us
* http://www.idangero.us/
*
* Licensed under MIT
*/
var Slides = (function (_super) {
__extends(Slides, _super);
function Slides(config, _plt, zone, viewCtrl, elementRef, renderer) {
var _this = _super.call(this, config, elementRef, renderer, 'slides') || this;
_this._plt = _plt;
_this._control = null;
_this._effectName = 'slide';
_this._direction = 'horizontal';
_this._initialSlide = 0;
_this._isLoop = false;
_this._pager = false;
_this._paginationType = 'bullets';
/** @hidden */
_this.paginationBulletRender = null;
_this._isParallax = false;
_this._speedMs = 300;
_this._isZoom = false;
/**
* @hidden
* Enabled this option and swiper will be operated as usual except it will
* not move, real translate values on wrapper will not be set. Useful when
* you may need to create custom slide transition.
*/
_this.virtualTranslate = false;
/**
* @hidden
* Set to true to round values of slides width and height to prevent blurry
* texts on usual resolution screens (if you have such)
*/
_this.roundLengths = false;
_this._spaceBetween = 0;
_this._slidesPerView = 1;
_this._centeredSlides = false;
/**
* @hidden
*/
_this.slidesPerColumn = 1;
/**
* @hidden
*/
_this.slidesPerColumnFill = 'column';
/**
* @hidden
*/
_this.slidesPerGroup = 1;
/**
* @hidden
*/
_this.slidesOffsetBefore = 0;
/**
* @hidden
*/
_this.slidesOffsetAfter = 0;
// autoplay
/**
* @hidden
*/
_this.autoplayDisableOnInteraction = true;
/**
* @hidden
*/
_this.autoplayStopOnLast = false;
// Free mode
/**
* @hidden
*/
_this.freeMode = false;
/**
* @hidden
*/
_this.freeModeMomentum = true;
/**
* @hidden
*/
_this.freeModeMomentumRatio = 1;
/**
* @hidden
*/
_this.freeModeMomentumBounce = true;
/**
* @hidden
*/
_this.freeModeMomentumBounceRatio = 1;
/**
* @hidden
*/
_this.freeModeMomentumVelocityRatio = 1;
/**
* @hidden
*/
_this.freeModeSticky = false;
/**
* @hidden
*/
_this.freeModeMinimumVelocity = 0.02;
// Autoheight
/**
* @hidden
*/
_this.autoHeight = false;
// Set wrapper width
/**
* @hidden
*/
_this.setWrapperSize = false;
// Zoom
/**
* @hidden
*/
_this.zoomMax = 3;
/**
* @hidden
*/
_this.zoomMin = 1;
/**
* @hidden
*/
_this.zoomToggle = true;
// Touches
/**
* @hidden
*/
_this.touchRatio = 1;
/**
* @hidden
*/
_this.touchAngle = 45;
/**
* @hidden
*/
_this.simulateTouch = true;
/**
* @hidden
*/
_this.shortSwipes = true;
/**
* @hidden
*/
_this.longSwipes = true;
/**
* @hidden
*/
_this.longSwipesRatio = 0.5;
/**
* @hidden
*/
_this.longSwipesMs = 300;
/**
* @hidden
*/
_this.followFinger = true;
/**
* @hidden
*/
_this.onlyExternal = false;
/**
* @hidden
*/
_this.threshold = 0;
/**
* @hidden
*/
_this.touchMoveStopPropagation = true;
/**
* @hidden
*/
_this.touchReleaseOnEdges = false;
// To support iOS's swipe-to-go-back gesture (when being used in-app, with UIWebView).
/**
* @hidden
*/
_this.iOSEdgeSwipeDetection = false;
/**
* @hidden
*/
_this.iOSEdgeSwipeThreshold = 20;
// Pagination
/**
* @hidden
*/
_this.paginationClickable = false;
/**
* @hidden
*/
_this.paginationHide = false;
// Resistance
/** @hidden */
_this.resistance = true;
/** @hidden */
_this.resistanceRatio = 0.85;
// Progress
/** @hidden */
_this.watchSlidesProgress = false;
/** @hidden */
_this.watchSlidesVisibility = false;
// Clicks
/**
* @hidden
*/
_this.preventClicks = true;
/**
* @hidden
*/
_this.preventClicksPropagation = true;
/**
* @hidden
*/
_this.slideToClickedSlide = false;
// loop
/**
* @hidden
*/
_this.loopAdditionalSlides = 0;
/**
* @hidden
*/
_this.loopedSlides = null;
// Swiping/no swiping
/**
* @hidden
*/
_this.swipeHandler = null;
/**
* @hidden
*/
_this.noSwiping = true;
// Callbacks
/** @hidden */
_this.runCallbacksOnInit = true;
// Controller
_this.controlBy = 'slide';
_this.controlInverse = false;
// Keyboard
/**
* @hidden
*/
_this.keyboardControl = true;
// Effects
/**
* @hidden
*/
_this.coverflow = {
rotate: 50,
stretch: 0,
depth: 100,
modifier: 1,
slideShadows: true
};
/**
* @hidden
*/
_this.flip = {
slideShadows: true,
limitRotation: true
};
/**
* @hidden
*/
_this.cube = {
slideShadows: true,
shadow: true,
shadowOffset: 20,
shadowScale: 0.94
};
/**
* @hidden
*/
_this.fade = {
crossFade: false
};
// Accessibility
/**
* @hidden
*/
_this.prevSlideMessage = 'Previous slide';
/**
* @hidden
*/
_this.nextSlideMessage = 'Next slide';
/**
* @hidden
*/
_this.firstSlideMessage = 'This is the first slide';
/**
* @hidden
*/
_this.lastSlideMessage = 'This is the last slide';
/**
* @output {Slides} Emitted when a slide change starts.
*/
_this.ionSlideWillChange = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* @output {Slides} Emitted when a slide change ends.
*/
_this.ionSlideDidChange = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* @output {Slides} Emitted when a slide moves.
*/
_this.ionSlideDrag = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* @output {Slides} Emitted when slides reaches its beginning (initial position).
*/
_this.ionSlideReachStart = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* @output {Slides} Emitted when slides reaches its last slide.
*/
_this.ionSlideReachEnd = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* @output {Slides} Emitted when a slide moves.
*/
_this.ionSlideAutoplay = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* @output {Slides} Emitted when a autoplay starts.
*/
_this.ionSlideAutoplayStart = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* @output {Slides} Emitted when a autoplay stops.
*/
_this.ionSlideAutoplayStop = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* @output {Slides} Emitted when a slide change starts with the "forward" direction.
*/
_this.ionSlideNextStart = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* @output {Slides} Emitted when a slide change starts with the "backward" direction.
*/
_this.ionSlidePrevStart = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* @output {Slides} Emitted when a slide change ends with the "forward" direction.
*/
_this.ionSlideNextEnd = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* @output {Slides} Emitted when a slide change ends with the "backward" direction.
*/
_this.ionSlidePrevEnd = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* @output {Slides} Emitted when the user taps/clicks on the slide's container.
*/
_this.ionSlideTap = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* @output {Slides} Emitted when the user double taps on the slide's container.
*/
_this.ionSlideDoubleTap = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/** @hidden */
_this.ionSlideProgress = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/** @hidden */
_this.ionSlideTransitionStart = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/** @hidden */
_this.ionSlideTransitionEnd = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/** @hidden */
_this.ionSlideTouchStart = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/** @hidden */
_this.ionSlideTouchEnd = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
_this._unregs = [];
/** @internal */
_this._allowSwipeToNext = true;
/** @internal */
_this._allowSwipeToPrev = true;
_this._zone = zone;
_this.id = ++slidesId;
_this.slideId = 'slides-' + _this.id;
_this.setElementClass(_this.slideId, true);
// only initialize the slides whent the content is ready
if (viewCtrl) {
var subscription = viewCtrl.readReady.subscribe(function () {
subscription.unsubscribe();
_this._initSlides();
});
}
return _this;
}
Object.defineProperty(Slides.prototype, "autoplay", {
/**
* @input {number} Delay between transitions (in milliseconds). If this
* parameter is not passed, autoplay is disabled. Default does
* not have a value and does not autoplay.
* Default: `null`.
*/
get: function () {
return this._autoplayMs;
},
set: function (val) {
this._autoplayMs = parseInt(val, 10);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Slides.prototype, "control", {
/**
* @input {Slides} Pass another Slides instance or array of Slides instances
* that should be controlled by this Slides instance.
* Default: `null`.
*/
get: function () {
return this._control;
},
set: function (val) {
if (val instanceof Slides || Array.isArray(val)) {
this._control = val;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(Slides.prototype, "effect", {
/**
* @input {string} The animation effect of the slides.
* Possible values are: `slide`, `fade`, `cube`, `coverflow` or `flip`.
* Default: `slide`.
*/
get: function () {
return this._effectName;
},
set: function (effectName) {
if (__WEBPACK_IMPORTED_MODULE_9__swiper_swiper_effects__["a" /* SWIPER_EFFECTS */][effectName]) {
this._effectName = effectName;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(Slides.prototype, "direction", {
/**
* @input {string} Swipe direction: 'horizontal' or 'vertical'.
* Default: `horizontal`.
*/
get: function () {
return this._direction;
},
set: function (val) {
if (val === 'horizontal' || val === 'vertical') {
this._direction = val;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(Slides.prototype, "initialSlide", {
/**
* @input {number} Index number of initial slide. Default: `0`.
*/
get: function () {
return this._initialSlide;
},
set: function (val) {
this._initialSlide = parseInt(val, 10);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Slides.prototype, "loop", {
/**
* @input {boolean} If true, continuously loop from the last slide to the
* first slide.
*/
get: function () {
return this._isLoop;
},
set: function (val) {
this._isLoop = Object(__WEBPACK_IMPORTED_MODULE_4__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Slides.prototype, "pager", {
/**
* @input {boolean} If true, show the pager.
*/
get: function () {
return this._pager;
},
set: function (val) {
this._pager = Object(__WEBPACK_IMPORTED_MODULE_4__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Slides.prototype, "dir", {
/**
* @input {string} If dir attribute is equal to rtl, set interal _rtl to true;
*/
set: function (val) {
this._rtl = (val.toLowerCase() === 'rtl');
},
enumerable: true,
configurable: true
});
Object.defineProperty(Slides.prototype, "paginationType", {
/**
* @input {string} Type of pagination. Possible values are:
* `bullets`, `fraction`, `progress`. Default: `bullets`.
* (Note that the pager will not show unless `pager` input
* is set to true).
*/
get: function () {
return this._paginationType;
},
set: function (val) {
if (val === 'bullets' || val === 'fraction' || val === 'progress') {
this._paginationType = val;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(Slides.prototype, "parallax", {
/**
* @input {boolean} If true, allows you to use "parallaxed" elements inside of
* slider.
*/
get: function () {
return this._isParallax;
},
set: function (val) {
this._isParallax = Object(__WEBPACK_IMPORTED_MODULE_4__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Slides.prototype, "speed", {
/**
* @input {number} Duration of transition between slides
* (in milliseconds). Default: `300`.
*/
get: function () {
return this._speedMs;
},
set: function (val) {
this._speedMs = parseInt(val, 10);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Slides.prototype, "zoom", {
/**
* @input {boolean} If true, enables zooming functionality.
*/
get: function () {
return this._isZoom;
},
set: function (val) {
this._isZoom = Object(__WEBPACK_IMPORTED_MODULE_4__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Slides.prototype, "spaceBetween", {
// Slides grid
/**
* @input {number} Distance between slides in px. Default: `0`.
*/
get: function () {
return this._spaceBetween;
},
set: function (val) {
this._spaceBetween = parseInt(val, 10);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Slides.prototype, "slidesPerView", {
/**
* @input {number} Slides per view. Slides visible at the same time. Default: `1`.
*/
get: function () {
return this._slidesPerView;
},
set: function (val) {
this._slidesPerView = val === 'auto' ? 'auto' : parseFloat(val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Slides.prototype, "centeredSlides", {
/**
* @input {boolean} Center a slide in the middle of the screen.
*/
get: function () {
return this._centeredSlides;
},
set: function (val) {
this._centeredSlides = Object(__WEBPACK_IMPORTED_MODULE_4__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
Slides.prototype._initSlides = function () {
if (!this._init) {
(void 0) /* console.debug */;
var s = this;
var plt = s._plt;
s.container = this.getNativeElement().children[0];
// init swiper core
Object(__WEBPACK_IMPORTED_MODULE_8__swiper_swiper__["d" /* initSwiper */])(s, plt);
// init core event listeners
this._unregs.push(Object(__WEBPACK_IMPORTED_MODULE_5__swiper_swiper_events__["a" /* initEvents */])(s, plt));
if (this.zoom) {
// init zoom event listeners
this._unregs.push(Object(__WEBPACK_IMPORTED_MODULE_6__swiper_swiper_zoom__["a" /* initZoom */])(s, plt));
}
if (this.keyboardControl) {
// init keyboard event listeners
s.enableKeyboardControl(true);
}
this._init = true;
}
};
/**
* @hidden
*/
Slides.prototype.ngAfterContentInit = function () {
var _this = this;
this._plt.timeout(function () {
_this._initSlides();
}, 300);
};
/**
* Update the underlying slider implementation. Call this if you've added or removed
* child slides.
*/
Slides.prototype.update = function (debounce) {
var _this = this;
if (debounce === void 0) { debounce = 300; }
if (this._init) {
this._plt.cancelTimeout(this._tmr);
this._tmr = this._plt.timeout(function () {
Object(__WEBPACK_IMPORTED_MODULE_8__swiper_swiper__["n" /* update */])(_this, _this._plt);
// Don't allow pager to show with > 10 slides
if (_this.length() > 10) {
_this.paginationType = undefined;
}
}, debounce);
}
};
Slides.prototype.resize = function () {
if (this._init) {
}
};
/**
* Transition to the specified slide.
*
* @param {number} index The index number of the slide.
* @param {number} [speed] Transition duration (in ms).
* @param {boolean} [runCallbacks] Whether or not to emit the `ionSlideWillChange`/`ionSlideDidChange` events. Default true.
*/
Slides.prototype.slideTo = function (index, speed, runCallbacks) {
Object(__WEBPACK_IMPORTED_MODULE_8__swiper_swiper__["k" /* slideTo */])(this, this._plt, index, speed, runCallbacks);
};
/**
* Transition to the next slide.
*
* @param {number} [speed] Transition duration (in ms).
* @param {boolean} [runCallbacks] Whether or not to emit the `ionSlideWillChange`/`ionSlideDidChange` events. Default true.
*/
Slides.prototype.slideNext = function (speed, runCallbacks) {
Object(__WEBPACK_IMPORTED_MODULE_8__swiper_swiper__["h" /* slideNext */])(this, this._plt, runCallbacks, speed, true);
};
/**
* Transition to the previous slide.
*
* @param {number} [speed] Transition duration (in ms).
* @param {boolean} [runCallbacks] Whether or not to emit the `ionSlideWillChange`/`ionSlideDidChange` events. Default true.
*/
Slides.prototype.slidePrev = function (speed, runCallbacks) {
Object(__WEBPACK_IMPORTED_MODULE_8__swiper_swiper__["i" /* slidePrev */])(this, this._plt, runCallbacks, speed, true);
};
/**
* Get the index of the active slide.
*
* @returns {number} The index number of the current slide.
*/
Slides.prototype.getActiveIndex = function () {
return this._activeIndex;
};
/**
* Get the index of the previous slide.
*
* @returns {number} The index number of the previous slide.
*/
Slides.prototype.getPreviousIndex = function () {
return this._previousIndex;
};
/**
* Get the total number of slides.
*
* @returns {number} The total number of slides.
*/
Slides.prototype.length = function () {
return this._slides.length;
};
/**
* Get whether or not the current slide is the last slide.
*
* @returns {boolean} If the slide is the last slide or not.
*/
Slides.prototype.isEnd = function () {
return this._isEnd;
};
/**
* Get whether or not the current slide is the first slide.
*
* @returns {boolean} If the slide is the first slide or not.
*/
Slides.prototype.isBeginning = function () {
return this._isBeginning;
};
/**
* Start auto play.
*/
Slides.prototype.startAutoplay = function () {
Object(__WEBPACK_IMPORTED_MODULE_8__swiper_swiper__["l" /* startAutoplay */])(this, this._plt);
};
/**
* Stop auto play.
*/
Slides.prototype.stopAutoplay = function () {
Object(__WEBPACK_IMPORTED_MODULE_8__swiper_swiper__["m" /* stopAutoplay */])(this);
};
/**
* Lock or unlock the ability to slide to the next slides.
* @param {boolean} shouldLockSwipeToNext If set to true the user will not be able to swipe to the next slide.
* Set to false to unlock this behaviour.
*/
Slides.prototype.lockSwipeToNext = function (shouldLockSwipeToNext) {
this._allowSwipeToNext = !shouldLockSwipeToNext;
};
/**
* Lock or unlock the ability to slide to the previous slides.
* @param {boolean} shouldLockSwipeToPrev If set to true the user will not be able to swipe to the previous slide.
* Set to false to unlock this behaviour.
*/
Slides.prototype.lockSwipeToPrev = function (shouldLockSwipeToPrev) {
this._allowSwipeToPrev = !shouldLockSwipeToPrev;
};
/**
* Lock or unlock the ability to slide to change slides.
* @param {boolean} shouldLockSwipes If set to true user can not swipe in either direction on slide.
* False allows swiping in both directions.
*/
Slides.prototype.lockSwipes = function (shouldLockSwipes) {
this._allowSwipeToNext = this._allowSwipeToPrev = !shouldLockSwipes;
};
/**
* Enable or disable keyboard control.
* @param {boolean} shouldEnableKeyboard If set to true the slider can be controled by a keyboard.
*/
Slides.prototype.enableKeyboardControl = function (shouldEnableKeyboard) {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper_swiper_keyboard__["a" /* enableKeyboardControl */])(this, this._plt, shouldEnableKeyboard);
};
/**
* @hidden
*/
Slides.prototype.ngOnDestroy = function () {
this._init = false;
this._unregs.forEach(function (unReg) {
unReg();
});
this._unregs.length = 0;
Object(__WEBPACK_IMPORTED_MODULE_8__swiper_swiper__["b" /* destroySwiper */])(this);
this.enableKeyboardControl(false);
};
Slides.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-slides',
template: '<div class="swiper-container" [attr.dir]="_rtl? \'rtl\' : null">' +
'<div class="swiper-wrapper">' +
'<ng-content></ng-content>' +
'</div>' +
'<div [class.hide]="!pager" class="swiper-pagination"></div>' +
'</div>',
changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* ChangeDetectionStrategy */].OnPush,
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
},] },
];
/** @nocollapse */
Slides.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_7__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["M" /* NgZone */], },
{ type: __WEBPACK_IMPORTED_MODULE_10__navigation_view_controller__["a" /* ViewController */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
]; };
Slides.propDecorators = {
'autoplay': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'control': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'effect': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'direction': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'initialSlide': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'loop': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'pager': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'dir': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'paginationType': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'parallax': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'speed': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'zoom': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'spaceBetween': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'slidesPerView': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'centeredSlides': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'ionSlideWillChange': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'ionSlideDidChange': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'ionSlideDrag': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'ionSlideReachStart': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'ionSlideReachEnd': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'ionSlideAutoplay': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'ionSlideAutoplayStart': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'ionSlideAutoplayStop': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'ionSlideNextStart': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'ionSlidePrevStart': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'ionSlideNextEnd': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'ionSlidePrevEnd': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'ionSlideTap': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'ionSlideDoubleTap': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
};
return Slides;
}(__WEBPACK_IMPORTED_MODULE_3__ion__["a" /* Ion */]));
var slidesId = -1;
//# sourceMappingURL=slides.js.map
/***/ }),
/* 112 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (immutable) */ __webpack_exports__["d"] = setWrapperTranslate;
/* harmony export (immutable) */ __webpack_exports__["a"] = getTranslate;
/* harmony export (immutable) */ __webpack_exports__["b"] = getWrapperTranslate;
/* harmony export (immutable) */ __webpack_exports__["c"] = setWrapperTransition;
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__swiper_utils__ = __webpack_require__(17);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__swiper_parallax__ = __webpack_require__(329);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__swiper_progress__ = __webpack_require__(65);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__swiper_index__ = __webpack_require__(66);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__swiper_controller__ = __webpack_require__(480);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__swiper_effects__ = __webpack_require__(115);
function setWrapperTranslate(s, plt, translate, shouldUpdateActiveIndex, byController) {
var x = 0, y = 0, z = 0;
if (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s)) {
x = s._rtl ? -translate : translate;
}
else {
y = translate;
}
if (s.roundLengths) {
x = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["m" /* round */])(x);
y = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["m" /* round */])(y);
}
if (!s.virtualTranslate) {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["n" /* transform */])(s._wrapper, 'translate3d(' + x + 'px, ' + y + 'px, ' + z + 'px)');
}
s._translate = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? x : y;
// Check if we need to update progress
var progress;
var translatesDiff = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["h" /* maxTranslate */])(s) - Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["i" /* minTranslate */])(s);
if (translatesDiff === 0) {
progress = 0;
}
else {
progress = (translate - Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["i" /* minTranslate */])(s)) / (translatesDiff);
}
if (progress !== s.progress) {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper_progress__["a" /* updateProgress */])(s, translate);
}
if (shouldUpdateActiveIndex) {
Object(__WEBPACK_IMPORTED_MODULE_3__swiper_index__["a" /* updateActiveIndex */])(s);
}
if (s.effect !== 'slide' && __WEBPACK_IMPORTED_MODULE_5__swiper_effects__["a" /* SWIPER_EFFECTS */][s.effect]) {
__WEBPACK_IMPORTED_MODULE_5__swiper_effects__["a" /* SWIPER_EFFECTS */][s.effect].setTranslate(s, plt);
}
if (s.parallax) {
Object(__WEBPACK_IMPORTED_MODULE_1__swiper_parallax__["b" /* parallaxSetTranslate */])(s);
}
if (s.control) {
__WEBPACK_IMPORTED_MODULE_4__swiper_controller__["a" /* SWIPER_CONTROLLER */].setTranslate(s, plt, s._translate, byController, setWrapperTranslate);
}
}
function getTranslate(s, plt, el, axis) {
var win = plt.win();
var matrix;
var curTransform;
var curStyle;
var transformMatrix;
// automatic axis detection
if (typeof axis === 'undefined') {
axis = 'x';
}
if (s.virtualTranslate) {
return s._rtl ? -s._translate : s._translate;
}
curStyle = plt.getElementComputedStyle(el);
if (win.WebKitCSSMatrix) {
curTransform = curStyle.transform || curStyle.webkitTransform;
if (curTransform.split(',').length > 6) {
curTransform = curTransform.split(', ').map(function (a) {
return a.replace(',', '.');
}).join(', ');
}
// Some old versions of Webkit choke when 'none' is passed; pass
// empty string instead in this case
transformMatrix = new win.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform);
}
else {
transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
matrix = transformMatrix.toString().split(',');
}
if (axis === 'x') {
if (win.WebKitCSSMatrix) {
// Latest Chrome and webkits Fix
curTransform = transformMatrix.m41;
}
else if (matrix.length === 16) {
// Crazy IE10 Matrix
curTransform = parseFloat(matrix[12]);
}
else {
// Normal Browsers
curTransform = parseFloat(matrix[4]);
}
}
if (axis === 'y') {
if (win.WebKitCSSMatrix) {
// Latest Chrome and webkits Fix
curTransform = transformMatrix.m42;
}
else if (matrix.length === 16) {
// Crazy IE10 Matrix
curTransform = parseFloat(matrix[13]);
}
else {
// Normal Browsers
curTransform = parseFloat(matrix[5]);
}
}
if (s._rtl && curTransform) {
curTransform = -curTransform;
}
return curTransform || 0;
}
function getWrapperTranslate(s, plt, axis) {
if (typeof axis === 'undefined') {
axis = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? 'x' : 'y';
}
return getTranslate(s, plt, s._wrapper, axis);
}
function setWrapperTransition(s, plt, duration, byController) {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["o" /* transition */])(s._wrapper, duration);
if (s.effect !== 'slide' && __WEBPACK_IMPORTED_MODULE_5__swiper_effects__["a" /* SWIPER_EFFECTS */][s.effect]) {
__WEBPACK_IMPORTED_MODULE_5__swiper_effects__["a" /* SWIPER_EFFECTS */][s.effect].setTransition(s, plt, duration);
}
if (s.parallax) {
Object(__WEBPACK_IMPORTED_MODULE_1__swiper_parallax__["a" /* parallaxSetTransition */])(s, duration);
}
if (s.control) {
__WEBPACK_IMPORTED_MODULE_4__swiper_controller__["a" /* SWIPER_CONTROLLER */].setTransition(s, plt, duration, byController, setWrapperTransition);
}
}
//# sourceMappingURL=swiper-transition.js.map
/***/ }),
/* 113 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (immutable) */ __webpack_exports__["a"] = updateClasses;
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__swiper_a11y__ = __webpack_require__(479);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__swiper_utils__ = __webpack_require__(17);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__swiper_pagination__ = __webpack_require__(114);
/*=========================
Classes
===========================*/
function updateClasses(s) {
var childElements;
Object(__WEBPACK_IMPORTED_MODULE_1__swiper_utils__["l" /* removeClass */])(s._slides, [__WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slideActive, __WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slideNext, __WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slidePrev, __WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slideDuplicateActive, __WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slideDuplicateNext, __WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slideDuplicatePrev]);
for (var i = 0; i < s._slides.length; i++) {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_a11y__["b" /* ariaHidden */])(s._slides[i], true);
}
var activeSlide = s._slides[s._activeIndex];
if (!activeSlide) {
return;
}
// Active classes
Object(__WEBPACK_IMPORTED_MODULE_1__swiper_utils__["b" /* addClass */])(activeSlide, __WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slideActive);
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_a11y__["b" /* ariaHidden */])(activeSlide, false);
if (s.loop) {
// Duplicate to all looped slides
if (activeSlide.classList.contains(__WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slideDuplicate)) {
childElements = Object(__WEBPACK_IMPORTED_MODULE_1__swiper_utils__["k" /* queryChildren */])(s._wrapper, '.' + __WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slide + ':not(.' + __WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slideDuplicate + ')[data-swiper-slide-index="' + s.realIndex + '"]');
}
else {
childElements = Object(__WEBPACK_IMPORTED_MODULE_1__swiper_utils__["k" /* queryChildren */])(s._wrapper, '.' + __WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slide + '.' + __WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slideDuplicate + '[data-swiper-slide-index="' + s.realIndex + '"]');
}
Object(__WEBPACK_IMPORTED_MODULE_1__swiper_utils__["b" /* addClass */])(childElements, __WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slideDuplicateActive);
}
// Next Slide
var nextSlide = activeSlide.nextElementSibling;
if (s.loop && !nextSlide) {
nextSlide = s._slides[0];
}
nextSlide && nextSlide.classList.add(__WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slideNext);
// Prev Slide
var prevSlide = activeSlide.previousElementSibling;
if (s.loop && !prevSlide) {
prevSlide = s._slides[s._slides.length - 1];
}
prevSlide && prevSlide.classList.add(__WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slidePrev);
if (s.loop) {
// Duplicate to all looped slides
if (nextSlide.classList.contains(__WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slideDuplicate)) {
childElements = Object(__WEBPACK_IMPORTED_MODULE_1__swiper_utils__["k" /* queryChildren */])(s._wrapper, '.' + __WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slide + ':not(.' + __WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slideDuplicate + ')[data-swiper-slide-index="' + nextSlide.getAttribute('data-swiper-slide-index') + '"]');
}
else {
childElements = Object(__WEBPACK_IMPORTED_MODULE_1__swiper_utils__["k" /* queryChildren */])(s._wrapper, '.' + __WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slide + '.' + __WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slideDuplicate + '[data-swiper-slide-index="' + nextSlide.getAttribute('data-swiper-slide-index') + '"]');
}
Object(__WEBPACK_IMPORTED_MODULE_1__swiper_utils__["b" /* addClass */])(childElements, __WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slideDuplicateNext);
if (prevSlide.classList.contains(__WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slideDuplicate)) {
childElements = Object(__WEBPACK_IMPORTED_MODULE_1__swiper_utils__["k" /* queryChildren */])(s._wrapper, '.' + __WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slide + ':not(.' + __WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slideDuplicate + ')[data-swiper-slide-index="' + prevSlide.getAttribute('data-swiper-slide-index') + '"]');
}
else {
childElements = Object(__WEBPACK_IMPORTED_MODULE_1__swiper_utils__["k" /* queryChildren */])(s._wrapper, '.' + __WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slide + '.' + __WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slideDuplicate + '[data-swiper-slide-index="' + prevSlide.getAttribute('data-swiper-slide-index') + '"]');
}
Object(__WEBPACK_IMPORTED_MODULE_1__swiper_utils__["b" /* addClass */])(childElements, __WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].slideDuplicatePrev);
}
// Pagination
if (s._paginationContainer) {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper_pagination__["b" /* updatePaginationClasses */])(s);
}
// Next/active buttons
if (!s.loop) {
if (s.prevButton) {
if (s._isBeginning) {
s.prevButton.classList.add(__WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].buttonDisabled);
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_a11y__["a" /* ariaDisable */])(s.prevButton, true);
}
else {
s.prevButton.classList.remove(__WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].buttonDisabled);
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_a11y__["a" /* ariaDisable */])(s.prevButton, false);
}
}
if (s.nextButton) {
if (s._isEnd) {
s.nextButton.classList.add(__WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].buttonDisabled);
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_a11y__["a" /* ariaDisable */])(s.nextButton, true);
}
else {
s.nextButton.classList.remove(__WEBPACK_IMPORTED_MODULE_1__swiper_utils__["a" /* CLS */].buttonDisabled);
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_a11y__["a" /* ariaDisable */])(s.nextButton, false);
}
}
}
}
//# sourceMappingURL=swiper-classes.js.map
/***/ }),
/* 114 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (immutable) */ __webpack_exports__["a"] = updatePagination;
/* harmony export (immutable) */ __webpack_exports__["b"] = updatePaginationClasses;
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__swiper_utils__ = __webpack_require__(17);
/*=========================
Pagination
===========================*/
function updatePagination(s) {
if (!s.paginationType || !s._paginationContainer)
return;
var paginationHTML = '';
if (s.paginationType === 'bullets') {
var numberOfBullets = s.loop ? Math.ceil((s._slides.length - s.loopedSlides * 2) / s.slidesPerGroup) : s._snapGrid.length;
for (var i = 0; i < numberOfBullets; i++) {
if (s.paginationBulletRender) {
paginationHTML += s.paginationBulletRender(i, __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].bullet);
}
else {
paginationHTML += "<button class=\"" + __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].bullet + "\" aria-label=\"Go to slide " + (i + 1) + "\" data-slide-index=\"" + i + "\"></button>";
}
}
}
else if (s.paginationType === 'fraction') {
paginationHTML =
'<span class="' + __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].paginationCurrent + '"></span>' +
' / ' +
'<span class="' + __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].paginationTotal + '"></span>';
}
else if (s.paginationType === 'progress') {
paginationHTML = '<span class="' + __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].paginationProgressbar + '"></span>';
}
s._paginationContainer.innerHTML = paginationHTML;
s._bullets = s._paginationContainer.querySelectorAll('.' + __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].bullet);
}
function updatePaginationClasses(s) {
// Current/Total
var current;
var total = s.loop ? Math.ceil((s._slides.length - s.loopedSlides * 2) / s.slidesPerGroup) : s._snapGrid.length;
if (s.loop) {
current = Math.ceil((s._activeIndex - s.loopedSlides) / s.slidesPerGroup);
if (current > s._slides.length - 1 - s.loopedSlides * 2) {
current = current - (s._slides.length - s.loopedSlides * 2);
}
if (current > total - 1) {
current = current - total;
}
if (current < 0 && s.paginationType !== 'bullets') {
current = total + current;
}
}
else {
if (typeof s._snapIndex !== 'undefined') {
current = s._snapIndex;
}
else {
current = s._activeIndex || 0;
}
}
// Types
if (s.paginationType === 'bullets' && s._bullets) {
var selector = current + (current < 0 ? s._bullets.length : 0);
for (var i = 0; i < s._bullets.length; i++) {
if (i === selector) {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["b" /* addClass */])(s._bullets[i], __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].bulletActive);
}
else {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["l" /* removeClass */])(s._bullets[i], __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].bulletActive);
}
}
}
if (s.paginationType === 'fraction') {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["c" /* eachChild */])(s._paginationContainer, '.' + __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].paginationCurrent, function (ele) {
ele.textContent = (current + 1);
});
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["c" /* eachChild */])(s._paginationContainer, '.' + __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].paginationTotal, function (ele) {
ele.textContent = total;
});
}
if (s.paginationType === 'progress') {
var scale = (current + 1) / total, scaleX = scale, scaleY = 1;
if (!Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s)) {
scaleY = scale;
scaleX = 1;
}
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["c" /* eachChild */])(s._paginationContainer, '.' + __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].paginationProgressbar, function (ele) {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["n" /* transform */])(ele, 'translate3d(0,0,0) scaleX(' + scaleX + ') scaleY(' + scaleY + ')');
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["o" /* transition */])(ele, s.speed);
});
}
}
//# sourceMappingURL=swiper-pagination.js.map
/***/ }),
/* 115 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SWIPER_EFFECTS; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__swiper_utils__ = __webpack_require__(17);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__platform_platform_utils__ = __webpack_require__(330);
/*=========================
Effects
===========================*/
var SWIPER_EFFECTS = {
'fade': {
setTranslate: function (s) {
for (var i = 0; i < s._slides.length; i++) {
var slide = s._slides[i];
var offset = slide.swiperSlideOffset;
var tx = -offset;
if (!s.virtualTranslate) {
tx = tx - s._translate;
}
var ty = 0;
if (!Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s)) {
ty = tx;
tx = 0;
}
var slideOpacity = s.fade.crossFade ?
Math.max(1 - Math.abs(slide.progress), 0) :
1 + Math.min(Math.max(slide.progress, -1), 0);
slide.style.opacity = slideOpacity;
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["n" /* transform */])(slide, 'translate3d(' + tx + 'px, ' + ty + 'px, 0px)');
}
},
setTransition: function (s, plt, duration) {
var slides = s._slides;
for (var i = 0; i < slides.length; i++) {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["o" /* transition */])(slides[i], duration);
}
if (s.virtualTranslate && duration !== 0) {
var eventTriggered = false;
for (var i_1 = 0; i_1 < slides.length; i_1++) {
plt.transitionEnd(slides[i_1], function () {
if (eventTriggered || !s)
return;
eventTriggered = true;
s._animating = false;
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["p" /* triggerTransitionEnd */])(plt, s._wrapper);
});
}
}
}
},
'flip': {
setTranslate: function (s, plt) {
for (var i = 0; i < s._slides.length; i++) {
var slide = s._slides[i];
var progress = slide.progress;
if (s.flip.limitRotation) {
progress = Math.max(Math.min(slide.progress, 1), -1);
}
var offset = slide.swiperSlideOffset;
var rotate = -180 * progress, rotateY = rotate, rotateX = 0, tx = -offset, ty = 0;
if (!Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s)) {
ty = tx;
tx = 0;
rotateX = -rotateY;
rotateY = 0;
}
else if (s._rtl) {
rotateY = -rotateY;
}
slide.style.zIndex = -Math.abs(Math.round(progress)) + s._slides.length;
if (s.flip.slideShadows) {
// Set shadows
var shadowBefore = (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? slide.querySelector('.swiper-slide-shadow-left') : slide.querySelector('.swiper-slide-shadow-top'));
var shadowAfter = (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? slide.querySelector('.swiper-slide-shadow-right') : slide.querySelector('.swiper-slide-shadow-bottom'));
if (!shadowBefore) {
shadowBefore = plt.doc().createElement('div');
shadowBefore.className = 'swiper-slide-shadow-' + (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? 'left' : 'top');
slide.appendChild(shadowBefore);
}
if (!shadowAfter) {
shadowAfter = plt.doc().createElement('div');
shadowAfter.className = 'swiper-slide-shadow-' + (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? 'right' : 'bottom');
slide.appendChild(shadowAfter);
}
if (shadowBefore) {
shadowBefore.style.opacity = Math.max(-progress, 0);
}
if (shadowAfter) {
shadowAfter.style.opacity = Math.max(progress, 0);
}
}
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["n" /* transform */])(slide, 'translate3d(' + tx + 'px, ' + ty + 'px, 0px) rotateX(' + rotateX + 'deg) rotateY(' + rotateY + 'deg)');
}
},
setTransition: function (s, plt, duration) {
for (var i = 0; i < s._slides.length; i++) {
var slide = s._slides[i];
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["o" /* transition */])(slide, duration);
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["c" /* eachChild */])(slide, '.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left', function (el) {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["o" /* transition */])(el, duration);
});
}
if (s.virtualTranslate && duration !== 0) {
var eventTriggered = false;
plt.transitionEnd(s._slides[s._activeIndex], function (ev) {
if (eventTriggered || !s)
return;
if (!ev.target.classList.contains(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].slideActive)) {
return;
}
eventTriggered = true;
s._animating = false;
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["p" /* triggerTransitionEnd */])(plt, s._wrapper);
});
}
}
},
'cube': {
setTranslate: function (s, plt) {
var wrapperRotate = 0;
var cubeShadow;
if (s.cube.shadow) {
if (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s)) {
cubeShadow = s._wrapper.querySelector('.swiper-cube-shadow');
if (!cubeShadow) {
cubeShadow = plt.doc().createElement('div');
cubeShadow.className = 'swiper-cube-shadow';
s._wrapper.appendChild(cubeShadow);
}
cubeShadow.style.height = s.renderedWidth + 'px';
}
else {
cubeShadow = s.container.querySelector('.swiper-cube-shadow');
if (!cubeShadow) {
cubeShadow = plt.doc().createElement('div');
cubeShadow.className = 'swiper-cube-shadow';
s._wrapper.appendChild(cubeShadow);
}
}
}
for (var i = 0; i < s._slides.length; i++) {
var slide = s._slides[i];
var slideAngle = i * 90;
var round = Math.floor(slideAngle / 360);
if (s._rtl) {
slideAngle = -slideAngle;
round = Math.floor(-slideAngle / 360);
}
var progress = Math.max(Math.min(slide.progress, 1), -1);
var tx = 0, ty = 0, tz = 0;
if (i % 4 === 0) {
tx = -round * 4 * s._renderedSize;
tz = 0;
}
else if ((i - 1) % 4 === 0) {
tx = 0;
tz = -round * 4 * s._renderedSize;
}
else if ((i - 2) % 4 === 0) {
tx = s._renderedSize + round * 4 * s._renderedSize;
tz = s._renderedSize;
}
else if ((i - 3) % 4 === 0) {
tx = -s._renderedSize;
tz = 3 * s._renderedSize + s._renderedSize * 4 * round;
}
if (s._rtl) {
tx = -tx;
}
if (!Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s)) {
ty = tx;
tx = 0;
}
var transformStr = 'rotateX(' + (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? 0 : -slideAngle) + 'deg) rotateY(' + (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? slideAngle : 0) + 'deg) translate3d(' + tx + 'px, ' + ty + 'px, ' + tz + 'px)';
if (progress <= 1 && progress > -1) {
wrapperRotate = i * 90 + progress * 90;
if (s._rtl)
wrapperRotate = -i * 90 - progress * 90;
}
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["n" /* transform */])(slide, transformStr);
if (s.cube.slideShadows) {
// Set shadows
var shadowBefore = (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? slide.querySelector('.swiper-slide-shadow-left') : slide.querySelector('.swiper-slide-shadow-top'));
var shadowAfter = (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? slide.querySelector('.swiper-slide-shadow-right') : slide.querySelector('.swiper-slide-shadow-bottom'));
if (!shadowBefore) {
shadowBefore = plt.doc().createElement('div');
shadowBefore.className = 'swiper-slide-shadow-' + (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? 'left' : 'top');
slide.appendChild(shadowBefore);
}
if (!shadowAfter) {
shadowAfter = plt.doc().createElement('div');
shadowAfter.className = 'swiper-slide-shadow-' + (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? 'right' : 'bottom');
slide.appendChild(shadowAfter);
}
if (shadowBefore)
shadowBefore.style.opacity = Math.max(-progress, 0);
if (shadowAfter)
shadowAfter.style.opacity = Math.max(progress, 0);
}
}
s._wrapper.style.transformOrigin = s._wrapper.style.webkitTransformOrigin = '50% 50% -' + (s._renderedSize / 2) + 'px';
if (s.cube.shadow) {
if (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s)) {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["n" /* transform */])(cubeShadow, 'translate3d(0px, ' + (s.renderedWidth / 2 + s.cube.shadowOffset) + 'px, ' + (-s.renderedWidth / 2) + 'px) rotateX(90deg) rotateZ(0deg) scale(' + (s.cube.shadowScale) + ')');
}
else {
var shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90;
var multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2);
var scale1 = s.cube.shadowScale;
var scale2 = s.cube.shadowScale / multiplier;
var offset = s.cube.shadowOffset;
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["n" /* transform */])(cubeShadow, 'scale3d(' + scale1 + ', 1, ' + scale2 + ') translate3d(0px, ' + (s.renderedHeight / 2 + offset) + 'px, ' + (-s.renderedHeight / 2 / scale2) + 'px) rotateX(-90deg)');
}
}
var zFactor = (Object(__WEBPACK_IMPORTED_MODULE_1__platform_platform_utils__["e" /* isSafari */])(plt) || Object(__WEBPACK_IMPORTED_MODULE_1__platform_platform_utils__["d" /* isIosUIWebView */])(plt)) ? (-s._renderedSize / 2) : 0;
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["n" /* transform */])(s._wrapper, 'translate3d(0px,0,' + zFactor + 'px) rotateX(' + (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? 0 : wrapperRotate) + 'deg) rotateY(' + (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? -wrapperRotate : 0) + 'deg)');
},
setTransition: function (s, _plt, duration) {
for (var i = 0; i < s._slides.length; i++) {
var slide = s._slides[i];
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["o" /* transition */])(slide, duration);
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["c" /* eachChild */])(slide, '.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left', function (el) {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["o" /* transition */])(el, duration);
});
}
if (s.cube.shadow && !Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s)) {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["c" /* eachChild */])(s.container, '.swiper-cube-shadow', function (el) {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["o" /* transition */])(el, duration);
});
}
}
},
'coverflow': {
setTranslate: function (s, plt) {
var transformStr = s._translate;
var center = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? -transformStr + s.renderedWidth / 2 : -transformStr + s.renderedHeight / 2;
var rotate = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? s.coverflow.rotate : -s.coverflow.rotate;
var translate = s.coverflow.depth;
// Each slide offset from center
for (var i = 0, length = s._slides.length; i < length; i++) {
var slide = s._slides[i];
var slideSize = s._slidesSizesGrid[i];
var slideOffset = slide.swiperSlideOffset;
var offsetMultiplier = (center - slideOffset - slideSize / 2) / slideSize * s.coverflow.modifier;
var rotateY = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? rotate * offsetMultiplier : 0;
var rotateX = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? 0 : rotate * offsetMultiplier;
// var rotateZ = 0
var translateZ = -translate * Math.abs(offsetMultiplier);
var translateY = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? 0 : s.coverflow.stretch * (offsetMultiplier);
var translateX = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? s.coverflow.stretch * (offsetMultiplier) : 0;
// Fix for ultra small values
if (Math.abs(translateX) < 0.001)
translateX = 0;
if (Math.abs(translateY) < 0.001)
translateY = 0;
if (Math.abs(translateZ) < 0.001)
translateZ = 0;
if (Math.abs(rotateY) < 0.001)
rotateY = 0;
if (Math.abs(rotateX) < 0.001)
rotateX = 0;
var slideTransform = 'translate3d(' + translateX + 'px,' + translateY + 'px,' + translateZ + 'px) rotateX(' + rotateX + 'deg) rotateY(' + rotateY + 'deg)';
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["n" /* transform */])(slide, slideTransform);
slide.style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1;
if (s.coverflow.slideShadows) {
// Set shadows
var shadowBefore = (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? slide.querySelector('.swiper-slide-shadow-left') : slide.querySelector('.swiper-slide-shadow-top'));
var shadowAfter = (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? slide.querySelector('.swiper-slide-shadow-right') : slide.querySelector('.swiper-slide-shadow-bottom'));
if (!shadowBefore) {
shadowBefore = plt.doc().createElement('div');
shadowBefore.className = 'swiper-slide-shadow-' + (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? 'left' : 'top');
slide.appendChild(shadowBefore);
}
if (!shadowAfter) {
shadowAfter = plt.doc().createElement('div');
shadowAfter.className = 'swiper-slide-shadow-' + (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? 'right' : 'bottom');
slide.appendChild(shadowAfter);
}
if (shadowBefore) {
shadowBefore.style.opacity = (offsetMultiplier > 0 ? offsetMultiplier : 0);
}
if (shadowAfter) {
shadowAfter.style.opacity = ((-offsetMultiplier) > 0 ? -offsetMultiplier : 0);
}
}
}
},
setTransition: function (s, _plt, duration) {
for (var i = 0; i < s._slides.length; i++) {
var slide = s._slides[i];
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["o" /* transition */])(slide, duration);
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["c" /* eachChild */])(slide, '.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left', function (el) {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["o" /* transition */])(el, duration);
});
}
}
}
};
//# sourceMappingURL=swiper-effects.js.map
/***/ }),
/* 116 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Tabs; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rxjs_Subject__ = __webpack_require__(42);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rxjs_Subject___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_rxjs_Subject__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_takeUntil__ = __webpack_require__(160);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_takeUntil___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_rxjs_add_operator_takeUntil__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__app_app__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__navigation_deep_linker__ = __webpack_require__(19);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__ion__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__platform_keyboard__ = __webpack_require__(46);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__navigation_nav_controller__ = __webpack_require__(27);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__navigation_nav_util__ = __webpack_require__(26);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__navigation_url_serializer__ = __webpack_require__(52);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__split_pane_split_pane__ = __webpack_require__(48);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__platform_platform__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__tab_highlight__ = __webpack_require__(117);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__navigation_view_controller__ = __webpack_require__(7);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name Tabs
* @description
* Tabs make it easy to navigate between different pages or functional
* aspects of an app. The Tabs component, written as `<ion-tabs>`, is
* a container of individual [Tab](../Tab/) components. Each individual `ion-tab`
* is a declarative component for a [NavController](../../../navigation/NavController/)
*
* For more information on using nav controllers like Tab or [Nav](../../nav/Nav/),
* take a look at the [NavController API Docs](../../../navigation/NavController/).
*
* ### Placement
*
* The position of the tabs relative to the content varies based on
* the mode. The tabs are placed at the bottom of the screen
* for iOS and Android, and at the top for Windows by default. The position can
* be configured using the `tabsPlacement` attribute on the `<ion-tabs>` component,
* or in an app's [config](../../config/Config/).
* See the [Input Properties](#input-properties) below for the available
* values of `tabsPlacement`.
*
* ### Layout
*
* The layout for all of the tabs can be defined using the `tabsLayout`
* property. If the individual tab has a title and icon, the icons will
* show on top of the title by default. All tabs can be changed by setting
* the value of `tabsLayout` on the `<ion-tabs>` element, or in your
* app's [config](../../config/Config/). For example, this is useful if
* you want to show tabs with a title only on Android, but show icons
* and a title for iOS. See the [Input Properties](#input-properties)
* below for the available values of `tabsLayout`.
*
* ### Selecting a Tab
*
* There are different ways you can select a specific tab from the tabs
* component. You can use the `selectedIndex` property to set the index
* on the `<ion-tabs>` element, or you can call `select()` from the `Tabs`
* instance after creation. See [usage](#usage) below for more information.
*
* @usage
*
* You can add a basic tabs template to a `@Component` using the following
* template:
*
* ```html
* <ion-tabs>
* <ion-tab [root]="tab1Root"></ion-tab>
* <ion-tab [root]="tab2Root"></ion-tab>
* <ion-tab [root]="tab3Root"></ion-tab>
* </ion-tabs>
* ```
*
* Where `tab1Root`, `tab2Root`, and `tab3Root` are each a page:
*
*```ts
* @Component({
* templateUrl: 'build/pages/tabs/tabs.html'
* })
* export class TabsPage {
* // this tells the tabs component which Pages
* // should be each tab's root Page
* tab1Root = Page1;
* tab2Root = Page2;
* tab3Root = Page3;
*
* constructor() {
*
* }
* }
*```
*
* By default, the first tab will be selected upon navigation to the
* Tabs page. We can change the selected tab by using `selectedIndex`
* on the `<ion-tabs>` element:
*
* ```html
* <ion-tabs selectedIndex="2">
* <ion-tab [root]="tab1Root"></ion-tab>
* <ion-tab [root]="tab2Root"></ion-tab>
* <ion-tab [root]="tab3Root"></ion-tab>
* </ion-tabs>
* ```
*
* Since the index starts at `0`, this will select the 3rd tab which has
* root set to `tab3Root`. If you wanted to change it dynamically from
* your class, you could use [property binding](https://angular.io/docs/ts/latest/guide/template-syntax.html#!#property-binding).
*
* Alternatively, you can grab the `Tabs` instance and call the `select()`
* method. This requires the `<ion-tabs>` element to have an `id`. For
* example, set the value of `id` to `myTabs`:
*
* ```html
* <ion-tabs #myTabs>
* <ion-tab [root]="tab1Root"></ion-tab>
* <ion-tab [root]="tab2Root"></ion-tab>
* <ion-tab [root]="tab3Root"></ion-tab>
* </ion-tabs>
* ```
*
* Then in your class you can grab the `Tabs` instance and call `select()`,
* passing the index of the tab as the argument. Here we're grabbing the tabs
* by using ViewChild.
*
*```ts
* export class TabsPage {
*
* @ViewChild('myTabs') tabRef: Tabs;
*
* ionViewDidEnter() {
* this.tabRef.select(2);
* }
*
* }
*```
*
* You can also switch tabs from a child component by calling `select()` on the
* parent view using the `NavController` instance. For example, assuming you have
* a `TabsPage` component, you could call the following from any of the child
* components to switch to `TabsRoot3`:
*
*```ts
* switchTabs() {
* this.navCtrl.parent.select(2);
* }
*```
* @demo /docs/demos/src/tabs/
*
* @see {@link /docs/components#tabs Tabs Component Docs}
* @see {@link ../Tab Tab API Docs}
* @see {@link ../../config/Config Config API Docs}
*
*/
var Tabs = (function (_super) {
__extends(Tabs, _super);
function Tabs(parent, viewCtrl, _app, config, elementRef, _plt, renderer, _linker, keyboard) {
var _this = _super.call(this, config, elementRef, renderer, 'tabs') || this;
_this.viewCtrl = viewCtrl;
_this._app = _app;
_this._plt = _plt;
_this._linker = _linker;
/** @internal */
_this._ids = -1;
/** @internal */
_this._tabs = [];
/** @internal */
_this._selectHistory = [];
/** @internal */
_this._onDestroy = new __WEBPACK_IMPORTED_MODULE_1_rxjs_Subject__["Subject"]();
/**
* @output {any} Emitted when the tab changes.
*/
_this.ionChange = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
_this.parent = parent;
_this.id = 't' + (++tabIds);
_this._sbPadding = config.getBoolean('statusbarPadding');
_this.tabsHighlight = config.getBoolean('tabsHighlight');
if (_this.parent) {
// this Tabs has a parent Nav
_this.parent.registerChildNav(_this);
}
else if (viewCtrl && viewCtrl.getNav()) {
// this Nav was opened from a modal
_this.parent = viewCtrl.getNav();
_this.parent.registerChildNav(_this);
}
else if (_this._app) {
// this is the root navcontroller for the entire app
_this._app.registerRootNav(_this);
}
// Tabs may also be an actual ViewController which was navigated to
// if Tabs is static and not navigated to within a NavController
// then skip this and don't treat it as it's own ViewController
if (viewCtrl) {
viewCtrl._setContent(_this);
viewCtrl._setContentRef(elementRef);
}
var keyboardResizes = config.getBoolean('keyboardResizes', false);
if (keyboard && keyboardResizes) {
keyboard.willHide
.takeUntil(_this._onDestroy)
.subscribe(function () {
_this._plt.timeout(function () { return _this.setTabbarHidden(false); }, 50);
});
keyboard.willShow
.takeUntil(_this._onDestroy)
.subscribe(function () { return _this.setTabbarHidden(true); });
}
return _this;
}
/**
* @internal
*/
Tabs.prototype.setTabbarHidden = function (tabbarHidden) {
this.setElementClass('tabbar-hidden', tabbarHidden);
this.resize();
};
/**
* @internal
*/
Tabs.prototype.ngOnDestroy = function () {
this._onDestroy.next();
if (this.parent) {
this.parent.unregisterChildNav(this);
}
else {
this._app.unregisterRootNav(this);
}
};
/**
* @internal
*/
Tabs.prototype.ngAfterViewInit = function () {
var _this = this;
this._setConfig('tabsPlacement', 'bottom');
this._setConfig('tabsLayout', 'icon-top');
this._setConfig('tabsHighlight', this.tabsHighlight);
if (this.tabsHighlight) {
this._plt.resize
.takeUntil(this._onDestroy)
.subscribe(function () { return _this._highlight.select(_this.getSelected()); });
}
this.initTabs();
};
/**
* @internal
*/
Tabs.prototype.initTabs = function () {
var _this = this;
// get the selected index from the input
// otherwise default it to use the first index
var selectedIndex = (Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["f" /* isBlank */])(this.selectedIndex) ? 0 : parseInt(this.selectedIndex, 10));
// now see if the deep linker can find a tab index
var tabsSegment = this._linker.getSegmentByNavIdOrName(this.id, this.name);
if (tabsSegment) {
// we found a segment which probably represents which tab to select
selectedIndex = this._getSelectedTabIndex(tabsSegment.secondaryId, selectedIndex);
}
// get the selectedIndex and ensure it isn't hidden or disabled
var selectedTab = this._tabs.find(function (t, i) { return i === selectedIndex && t.enabled && t.show; });
if (!selectedTab) {
// wasn't able to select the tab they wanted
// try to find the first tab that's available
selectedTab = this._tabs.find(function (t) { return t.enabled && t.show; });
}
var promise = Promise.resolve();
if (selectedTab) {
selectedTab._segment = tabsSegment;
promise = this.select(selectedTab);
}
return promise.then(function () {
// set the initial href attribute values for each tab
_this._tabs.forEach(function (t) {
t.updateHref(t.root, t.rootParams);
});
});
};
/**
* @internal
*/
Tabs.prototype._setConfig = function (attrKey, fallback) {
var val = this[attrKey];
if (Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["f" /* isBlank */])(val)) {
val = this._config.get(attrKey, fallback);
}
this.setElementAttribute(attrKey, val);
};
/**
* @hidden
*/
Tabs.prototype.add = function (tab) {
this._tabs.push(tab);
return this.id + '-' + (++this._ids);
};
/**
* @param {number|Tab} tabOrIndex Index, or the Tab instance, of the tab to select.
*/
Tabs.prototype.select = function (tabOrIndex, opts, fromUrl) {
var _this = this;
if (opts === void 0) { opts = {}; }
if (fromUrl === void 0) { fromUrl = false; }
var selectedTab = (typeof tabOrIndex === 'number' ? this.getByIndex(tabOrIndex) : tabOrIndex);
if (Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["f" /* isBlank */])(selectedTab)) {
return Promise.resolve();
}
// If the selected tab is the current selected tab, we do not switch
var currentTab = this.getSelected();
if (selectedTab === currentTab && currentTab.getActive()) {
return this._updateCurrentTab(selectedTab, fromUrl);
}
// If the selected tab does not have a root, we do not switch (#9392)
// it's possible the tab is only for opening modal's or signing out
// and doesn't actually have content. In the case there's no content
// for a tab then do nothing and leave the current view as is
if (selectedTab.root) {
// At this point we are going to perform a page switch
// Let's fire willLeave in the current tab page
var currentPage;
if (currentTab) {
currentPage = currentTab.getActive();
currentPage && currentPage._willLeave(false);
}
// Fire willEnter in the new selected tab
var selectedPage_1 = selectedTab.getActive();
selectedPage_1 && selectedPage_1._willEnter();
// Let's start the transition
opts.animate = false;
return selectedTab.load(opts).then(function () {
_this._tabSwitchEnd(selectedTab, selectedPage_1, currentPage);
if (opts.updateUrl !== false) {
_this._linker.navChange(__WEBPACK_IMPORTED_MODULE_10__navigation_nav_util__["c" /* DIRECTION_SWITCH */]);
}
(void 0) /* assert */;
_this._fireChangeEvent(selectedTab);
});
}
else {
this._fireChangeEvent(selectedTab);
return Promise.resolve();
}
};
Tabs.prototype._fireChangeEvent = function (selectedTab) {
selectedTab.ionSelect.emit(selectedTab);
this.ionChange.emit(selectedTab);
};
Tabs.prototype._tabSwitchEnd = function (selectedTab, selectedPage, currentPage) {
(void 0) /* assert */;
(void 0) /* assert */;
// Update tabs selection state
var tabs = this._tabs;
var tab;
for (var i = 0; i < tabs.length; i++) {
tab = tabs[i];
tab.setSelected(tab === selectedTab);
}
if (this.tabsHighlight) {
this._highlight.select(selectedTab);
}
// Fire didEnter/didLeave lifecycle events
if (selectedPage) {
selectedPage._didEnter();
this._app.viewDidEnter.emit(selectedPage);
}
if (currentPage) {
currentPage && currentPage._didLeave();
this._app.viewDidLeave.emit(currentPage);
}
// track the order of which tabs have been selected, by their index
// do not track if the tab index is the same as the previous
if (this._selectHistory[this._selectHistory.length - 1] !== selectedTab.id) {
this._selectHistory.push(selectedTab.id);
}
};
/**
* Get the previously selected Tab which is currently not disabled or hidden.
* @param {boolean} trimHistory If the selection history should be trimmed up to the previous tab selection or not.
* @returns {Tab}
*/
Tabs.prototype.previousTab = function (trimHistory) {
var _this = this;
if (trimHistory === void 0) { trimHistory = true; }
// walk backwards through the tab selection history
// and find the first previous tab that is enabled and shown
(void 0) /* console.debug */;
for (var i = this._selectHistory.length - 2; i >= 0; i--) {
var tab = this._tabs.find(function (t) { return t.id === _this._selectHistory[i]; });
if (tab && tab.enabled && tab.show) {
if (trimHistory) {
this._selectHistory.splice(i + 1);
}
return tab;
}
}
return null;
};
/**
* @param {number} index Index of the tab you want to get
* @returns {Tab} Returns the tab who's index matches the one passed
*/
Tabs.prototype.getByIndex = function (index) {
return this._tabs[index];
};
/**
* @return {Tab} Returns the currently selected tab
*/
Tabs.prototype.getSelected = function () {
var tabs = this._tabs;
for (var i = 0; i < tabs.length; i++) {
if (tabs[i].isSelected) {
return tabs[i];
}
}
return null;
};
/**
* @internal
*/
Tabs.prototype.getActiveChildNavs = function () {
var selected = this.getSelected();
return selected ? [selected] : [];
};
/**
* @internal
*/
Tabs.prototype.getAllChildNavs = function () {
return this._tabs;
};
/**
* @internal
*/
Tabs.prototype.getIndex = function (tab) {
return this._tabs.indexOf(tab);
};
/**
* @internal
*/
Tabs.prototype.length = function () {
return this._tabs.length;
};
/**
* "Touch" the active tab, going back to the root view of the tab
* or optionally letting the tab handle the event
*/
Tabs.prototype._updateCurrentTab = function (tab, fromUrl) {
var active = tab.getActive();
if (active) {
if (fromUrl && tab._segment) {
// see if the view controller exists
var vc = tab.getViewById(tab._segment.name);
if (vc) {
// the view is already in the stack
return tab.popTo(vc, {
animate: false,
updateUrl: false,
});
}
else if (tab._views.length === 0 && tab._segment.defaultHistory && tab._segment.defaultHistory.length) {
return this._linker.initViews(tab._segment).then(function (views) {
return tab.setPages(views, {
animate: false, updateUrl: false
});
}).then(function () {
tab._segment = null;
});
}
else {
return tab.setRoot(tab._segment.name, tab._segment.data, {
animate: false, updateUrl: false
}).then(function () {
tab._segment = null;
});
}
}
else if (active._cmp && active._cmp.instance.ionSelected) {
// if they have a custom tab selected handler, call it
active._cmp.instance.ionSelected();
return Promise.resolve();
}
else if (tab.length() > 1) {
// if we're a few pages deep, pop to root
return tab.popToRoot();
}
else {
return Object(__WEBPACK_IMPORTED_MODULE_10__navigation_nav_util__["j" /* getComponent */])(this._linker, tab.root).then(function (viewController) {
if (viewController.component !== active.component) {
// Otherwise, if the page we're on is not our real root
// reset it to our default root type
return tab.setRoot(tab.root);
}
}).catch(function () {
(void 0) /* console.debug */;
});
}
}
};
/**
* @internal
* DOM WRITE
*/
Tabs.prototype.setTabbarPosition = function (top, bottom) {
if (this._top !== top || this._bottom !== bottom) {
var tabbarEle = this._tabbar.nativeElement;
tabbarEle.style.top = (top > -1 ? top + 'px' : '');
tabbarEle.style.bottom = (bottom > -1 ? bottom + 'px' : '');
tabbarEle.classList.add('show-tabbar');
this._top = top;
this._bottom = bottom;
}
};
/**
* @internal
*/
Tabs.prototype.resize = function () {
var tab = this.getSelected();
tab && tab.resize();
};
/**
* @internal
*/
Tabs.prototype.initPane = function () {
var isMain = this._elementRef.nativeElement.hasAttribute('main');
return isMain;
};
/**
* @internal
*/
Tabs.prototype.paneChanged = function (isPane) {
if (isPane) {
this.resize();
}
};
Tabs.prototype.goToRoot = function (opts) {
if (this._tabs.length) {
return this.select(this._tabs[0], opts);
}
};
/*
* @private
*/
Tabs.prototype.getType = function () {
return 'tabs';
};
/*
* @private
*/
Tabs.prototype.getSecondaryIdentifier = function () {
var tabs = this.getActiveChildNavs();
if (tabs && tabs.length) {
return this._linker._getTabSelector(tabs[0]);
}
return '';
};
/**
* @private
*/
Tabs.prototype._getSelectedTabIndex = function (secondaryId, fallbackIndex) {
if (secondaryId === void 0) { secondaryId = ''; }
if (fallbackIndex === void 0) { fallbackIndex = 0; }
// we found a segment which probably represents which tab to select
var indexMatch = secondaryId.match(/tab-(\d+)/);
if (indexMatch) {
// awesome, the segment name was something "tab-0", and
// the numbe represents which tab to select
return parseInt(indexMatch[1], 10);
}
// wasn't in the "tab-0" format so maybe it's using a word
var tab = this._tabs.find(function (t) {
return (Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["l" /* isPresent */])(t.tabUrlPath) && t.tabUrlPath === secondaryId) ||
(Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["l" /* isPresent */])(t.tabTitle) && Object(__WEBPACK_IMPORTED_MODULE_11__navigation_url_serializer__["c" /* formatUrlPart */])(t.tabTitle) === secondaryId);
});
return Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["l" /* isPresent */])(tab) ? tab.index : fallbackIndex;
};
Tabs.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-tabs',
template: '<div class="tabbar" role="tablist" #tabbar>' +
'<a *ngFor="let t of _tabs" [tab]="t" class="tab-button" role="tab" href="#" (ionSelect)="select(t)"></a>' +
'<div class="tab-highlight"></div>' +
'</div>' +
'<ng-content></ng-content>' +
'<div #portal tab-portal></div>',
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
providers: [{ provide: __WEBPACK_IMPORTED_MODULE_12__split_pane_split_pane__["a" /* RootNode */], useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_14" /* forwardRef */])(function () { return Tabs; }) }]
},] },
];
/** @nocollapse */
Tabs.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_9__navigation_nav_controller__["a" /* NavController */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_15__navigation_view_controller__["a" /* ViewController */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_3__app_app__["a" /* App */], },
{ type: __WEBPACK_IMPORTED_MODULE_4__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_13__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_5__navigation_deep_linker__["a" /* DeepLinker */], },
{ type: __WEBPACK_IMPORTED_MODULE_8__platform_keyboard__["a" /* Keyboard */], },
]; };
Tabs.propDecorators = {
'name': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'selectedIndex': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'tabsLayout': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'tabsPlacement': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'tabsHighlight': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'ionChange': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'_highlight': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_8" /* ViewChild */], args: [__WEBPACK_IMPORTED_MODULE_14__tab_highlight__["a" /* TabHighlight */],] },],
'_tabbar': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_8" /* ViewChild */], args: ['tabbar',] },],
'portal': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_8" /* ViewChild */], args: ['portal', { read: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_10" /* ViewContainerRef */] },] },],
};
return Tabs;
}(__WEBPACK_IMPORTED_MODULE_6__ion__["a" /* Ion */]));
var tabIds = -1;
//# sourceMappingURL=tabs.js.map
/***/ }),
/* 117 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TabHighlight; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__platform_dom_controller__ = __webpack_require__(12);
/**
* @hidden
*/
var TabHighlight = (function () {
function TabHighlight(_elementRef, _dom) {
this._elementRef = _elementRef;
this._dom = _dom;
}
TabHighlight.prototype.select = function (tab) {
var _this = this;
if (!tab) {
return;
}
var dom = this._dom;
dom.read(function () {
var btnEle = tab.btn.getNativeElement();
var transform = "translate3d(" + btnEle.offsetLeft + "px,0,0) scaleX(" + btnEle.offsetWidth + ")";
dom.write(function () {
var ele = _this._elementRef.nativeElement;
ele.style[dom.plt.Css.transform] = transform;
if (!_this._init) {
_this._init = true;
dom.write(function () {
ele.classList.add('animate');
}, 80);
}
});
}, 32);
};
TabHighlight.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: '.tab-highlight'
},] },
];
/** @nocollapse */
TabHighlight.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__platform_dom_controller__["a" /* DomController */], },
]; };
return TabHighlight;
}());
//# sourceMappingURL=tab-highlight.js.map
/***/ }),
/* 118 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ToastCmp; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__navigation_nav_params__ = __webpack_require__(18);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__navigation_view_controller__ = __webpack_require__(7);
/**
* @hidden
*/
var ToastCmp = (function () {
function ToastCmp(_viewCtrl, _config, _elementRef, params, renderer) {
this._viewCtrl = _viewCtrl;
this._config = _config;
this._elementRef = _elementRef;
this.dismissTimeout = undefined;
renderer.setElementClass(_elementRef.nativeElement, "toast-" + _config.get('mode'), true);
this.d = params.data;
if (this.d.cssClass) {
this.d.cssClass.split(' ').forEach(function (cssClass) {
// Make sure the class isn't whitespace, otherwise it throws exceptions
if (cssClass.trim() !== '')
renderer.setElementClass(_elementRef.nativeElement, cssClass, true);
});
}
this.id = (++toastIds);
if (this.d.message) {
this.hdrId = 'toast-hdr-' + this.id;
}
}
ToastCmp.prototype.ngAfterViewInit = function () {
var _this = this;
// if there's a `duration` set, automatically dismiss.
if (this.d.duration) {
this.dismissTimeout = setTimeout(function () {
_this.dismiss('backdrop');
}, this.d.duration);
}
this.enabled = true;
};
ToastCmp.prototype.ionViewDidEnter = function () {
var activeElement = document.activeElement;
if (activeElement) {
activeElement.blur();
}
var focusableEle = this._elementRef.nativeElement.querySelector('button');
if (focusableEle) {
focusableEle.focus();
}
};
ToastCmp.prototype.cbClick = function () {
if (this.enabled) {
this.dismiss('close');
}
};
ToastCmp.prototype.dismiss = function (role) {
clearTimeout(this.dismissTimeout);
this.dismissTimeout = undefined;
return this._viewCtrl.dismiss(null, role, { disableApp: false });
};
ToastCmp.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-toast',
template: '<div class="toast-wrapper" ' +
'[class.toast-bottom]="d.position === \'bottom\'" ' +
'[class.toast-middle]="d.position === \'middle\'" ' +
'[class.toast-top]="d.position === \'top\'"> ' +
'<div class="toast-container"> ' +
'<div class="toast-message" id="{{hdrId}}" *ngIf="d.message">{{d.message}}</div> ' +
'<button ion-button clear class="toast-button" *ngIf="d.showCloseButton" (click)="cbClick()"> ' +
'{{ d.closeButtonText || \'Close\' }} ' +
'</button> ' +
'</div> ' +
'</div>',
host: {
'role': 'dialog',
'[attr.aria-labelledby]': 'hdrId',
'[attr.aria-describedby]': 'descId',
},
},] },
];
/** @nocollapse */
ToastCmp.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_3__navigation_view_controller__["a" /* ViewController */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_2__navigation_nav_params__["a" /* NavParams */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
]; };
return ToastCmp;
}());
var toastIds = -1;
//# sourceMappingURL=toast-component.js.map
/***/ }),
/* 119 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return VirtualFooter; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/**
* @hidden
*/
var VirtualFooter = (function () {
function VirtualFooter(templateRef) {
this.templateRef = templateRef;
}
VirtualFooter.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{ selector: '[virtualFooter]' },] },
];
/** @nocollapse */
VirtualFooter.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_5" /* TemplateRef */], },
]; };
return VirtualFooter;
}());
//# sourceMappingURL=virtual-footer.js.map
/***/ }),
/* 120 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return VirtualHeader; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/**
* @hidden
*/
var VirtualHeader = (function () {
function VirtualHeader(templateRef) {
this.templateRef = templateRef;
}
VirtualHeader.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{ selector: '[virtualHeader]' },] },
];
/** @nocollapse */
VirtualHeader.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_5" /* TemplateRef */], },
]; };
return VirtualHeader;
}());
//# sourceMappingURL=virtual-header.js.map
/***/ }),
/* 121 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return VirtualItem; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/**
* @hidden
*/
var VirtualItem = (function () {
function VirtualItem(templateRef, viewContainer) {
this.templateRef = templateRef;
this.viewContainer = viewContainer;
}
VirtualItem.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{ selector: '[virtualItem]' },] },
];
/** @nocollapse */
VirtualItem.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_5" /* TemplateRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_10" /* ViewContainerRef */], },
]; };
return VirtualItem;
}());
//# sourceMappingURL=virtual-item.js.map
/***/ }),
/* 122 */,
/* 123 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function isObject(x) {
return x != null && typeof x === 'object';
}
exports.isObject = isObject;
//# sourceMappingURL=isObject.js.map
/***/ }),
/* 124 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var errorObject_1 = __webpack_require__(71);
var tryCatchTarget;
function tryCatcher() {
try {
return tryCatchTarget.apply(this, arguments);
}
catch (e) {
errorObject_1.errorObject.e = e;
return errorObject_1.errorObject;
}
}
function tryCatch(fn) {
tryCatchTarget = fn;
return tryCatcher;
}
exports.tryCatch = tryCatch;
;
//# sourceMappingURL=tryCatch.js.map
/***/ }),
/* 125 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.empty = {
closed: true,
next: function (value) { },
error: function (err) { throw err; },
complete: function () { }
};
//# sourceMappingURL=Observer.js.map
/***/ }),
/* 126 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var root_1 = __webpack_require__(32);
function getSymbolObservable(context) {
var $$observable;
var Symbol = context.Symbol;
if (typeof Symbol === 'function') {
if (Symbol.observable) {
$$observable = Symbol.observable;
}
else {
$$observable = Symbol('observable');
Symbol.observable = $$observable;
}
}
else {
$$observable = '@@observable';
}
return $$observable;
}
exports.getSymbolObservable = getSymbolObservable;
exports.observable = getSymbolObservable(root_1.root);
/**
* @deprecated use observable instead
*/
exports.$$observable = exports.observable;
//# sourceMappingURL=observable.js.map
/***/ }),
/* 127 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var Observable_1 = __webpack_require__(9);
var ArrayObservable_1 = __webpack_require__(128);
var mergeAll_1 = __webpack_require__(364);
var isScheduler_1 = __webpack_require__(130);
/* tslint:enable:max-line-length */
function merge() {
var observables = [];
for (var _i = 0; _i < arguments.length; _i++) {
observables[_i - 0] = arguments[_i];
}
return function (source) { return source.lift.call(mergeStatic.apply(void 0, [source].concat(observables))); };
}
exports.merge = merge;
/* tslint:enable:max-line-length */
/**
* Creates an output Observable which concurrently emits all values from every
* given input Observable.
*
* <span class="informal">Flattens multiple Observables together by blending
* their values into one Observable.</span>
*
* <img src="./img/merge.png" width="100%">
*
* `merge` subscribes to each given input Observable (as arguments), and simply
* forwards (without doing any transformation) all the values from all the input
* Observables to the output Observable. The output Observable only completes
* once all input Observables have completed. Any error delivered by an input
* Observable will be immediately emitted on the output Observable.
*
* @example <caption>Merge together two Observables: 1s interval and clicks</caption>
* var clicks = Rx.Observable.fromEvent(document, 'click');
* var timer = Rx.Observable.interval(1000);
* var clicksOrTimer = Rx.Observable.merge(clicks, timer);
* clicksOrTimer.subscribe(x => console.log(x));
*
* // Results in the following:
* // timer will emit ascending values, one every second(1000ms) to console
* // clicks logs MouseEvents to console everytime the "document" is clicked
* // Since the two streams are merged you see these happening
* // as they occur.
*
* @example <caption>Merge together 3 Observables, but only 2 run concurrently</caption>
* var timer1 = Rx.Observable.interval(1000).take(10);
* var timer2 = Rx.Observable.interval(2000).take(6);
* var timer3 = Rx.Observable.interval(500).take(10);
* var concurrent = 2; // the argument
* var merged = Rx.Observable.merge(timer1, timer2, timer3, concurrent);
* merged.subscribe(x => console.log(x));
*
* // Results in the following:
* // - First timer1 and timer2 will run concurrently
* // - timer1 will emit a value every 1000ms for 10 iterations
* // - timer2 will emit a value every 2000ms for 6 iterations
* // - after timer1 hits it's max iteration, timer2 will
* // continue, and timer3 will start to run concurrently with timer2
* // - when timer2 hits it's max iteration it terminates, and
* // timer3 will continue to emit a value every 500ms until it is complete
*
* @see {@link mergeAll}
* @see {@link mergeMap}
* @see {@link mergeMapTo}
* @see {@link mergeScan}
*
* @param {...ObservableInput} observables Input Observables to merge together.
* @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input
* Observables being subscribed to concurrently.
* @param {Scheduler} [scheduler=null] The IScheduler to use for managing
* concurrency of input Observables.
* @return {Observable} an Observable that emits items that are the result of
* every input Observable.
* @static true
* @name merge
* @owner Observable
*/
function mergeStatic() {
var observables = [];
for (var _i = 0; _i < arguments.length; _i++) {
observables[_i - 0] = arguments[_i];
}
var concurrent = Number.POSITIVE_INFINITY;
var scheduler = null;
var last = observables[observables.length - 1];
if (isScheduler_1.isScheduler(last)) {
scheduler = observables.pop();
if (observables.length > 1 && typeof observables[observables.length - 1] === 'number') {
concurrent = observables.pop();
}
}
else if (typeof last === 'number') {
concurrent = observables.pop();
}
if (scheduler === null && observables.length === 1 && observables[0] instanceof Observable_1.Observable) {
return observables[0];
}
return mergeAll_1.mergeAll(concurrent)(new ArrayObservable_1.ArrayObservable(observables, scheduler));
}
exports.mergeStatic = mergeStatic;
//# sourceMappingURL=merge.js.map
/***/ }),
/* 128 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Observable_1 = __webpack_require__(9);
var ScalarObservable_1 = __webpack_require__(363);
var EmptyObservable_1 = __webpack_require__(129);
var isScheduler_1 = __webpack_require__(130);
/**
* We need this JSDoc comment for affecting ESDoc.
* @extends {Ignored}
* @hide true
*/
var ArrayObservable = (function (_super) {
__extends(ArrayObservable, _super);
function ArrayObservable(array, scheduler) {
_super.call(this);
this.array = array;
this.scheduler = scheduler;
if (!scheduler && array.length === 1) {
this._isScalar = true;
this.value = array[0];
}
}
ArrayObservable.create = function (array, scheduler) {
return new ArrayObservable(array, scheduler);
};
/**
* Creates an Observable that emits some values you specify as arguments,
* immediately one after the other, and then emits a complete notification.
*
* <span class="informal">Emits the arguments you provide, then completes.
* </span>
*
* <img src="./img/of.png" width="100%">
*
* This static operator is useful for creating a simple Observable that only
* emits the arguments given, and the complete notification thereafter. It can
* be used for composing with other Observables, such as with {@link concat}.
* By default, it uses a `null` IScheduler, which means the `next`
* notifications are sent synchronously, although with a different IScheduler
* it is possible to determine when those notifications will be delivered.
*
* @example <caption>Emit 10, 20, 30, then 'a', 'b', 'c', then start ticking every second.</caption>
* var numbers = Rx.Observable.of(10, 20, 30);
* var letters = Rx.Observable.of('a', 'b', 'c');
* var interval = Rx.Observable.interval(1000);
* var result = numbers.concat(letters).concat(interval);
* result.subscribe(x => console.log(x));
*
* @see {@link create}
* @see {@link empty}
* @see {@link never}
* @see {@link throw}
*
* @param {...T} values Arguments that represent `next` values to be emitted.
* @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling
* the emissions of the `next` notifications.
* @return {Observable<T>} An Observable that emits each given input value.
* @static true
* @name of
* @owner Observable
*/
ArrayObservable.of = function () {
var array = [];
for (var _i = 0; _i < arguments.length; _i++) {
array[_i - 0] = arguments[_i];
}
var scheduler = array[array.length - 1];
if (isScheduler_1.isScheduler(scheduler)) {
array.pop();
}
else {
scheduler = null;
}
var len = array.length;
if (len > 1) {
return new ArrayObservable(array, scheduler);
}
else if (len === 1) {
return new ScalarObservable_1.ScalarObservable(array[0], scheduler);
}
else {
return new EmptyObservable_1.EmptyObservable(scheduler);
}
};
ArrayObservable.dispatch = function (state) {
var array = state.array, index = state.index, count = state.count, subscriber = state.subscriber;
if (index >= count) {
subscriber.complete();
return;
}
subscriber.next(array[index]);
if (subscriber.closed) {
return;
}
state.index = index + 1;
this.schedule(state);
};
ArrayObservable.prototype._subscribe = function (subscriber) {
var index = 0;
var array = this.array;
var count = array.length;
var scheduler = this.scheduler;
if (scheduler) {
return scheduler.schedule(ArrayObservable.dispatch, 0, {
array: array, index: index, count: count, subscriber: subscriber
});
}
else {
for (var i = 0; i < count && !subscriber.closed; i++) {
subscriber.next(array[i]);
}
subscriber.complete();
}
};
return ArrayObservable;
}(Observable_1.Observable));
exports.ArrayObservable = ArrayObservable;
//# sourceMappingURL=ArrayObservable.js.map
/***/ }),
/* 129 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Observable_1 = __webpack_require__(9);
/**
* We need this JSDoc comment for affecting ESDoc.
* @extends {Ignored}
* @hide true
*/
var EmptyObservable = (function (_super) {
__extends(EmptyObservable, _super);
function EmptyObservable(scheduler) {
_super.call(this);
this.scheduler = scheduler;
}
/**
* Creates an Observable that emits no items to the Observer and immediately
* emits a complete notification.
*
* <span class="informal">Just emits 'complete', and nothing else.
* </span>
*
* <img src="./img/empty.png" width="100%">
*
* This static operator is useful for creating a simple Observable that only
* emits the complete notification. It can be used for composing with other
* Observables, such as in a {@link mergeMap}.
*
* @example <caption>Emit the number 7, then complete.</caption>
* var result = Rx.Observable.empty().startWith(7);
* result.subscribe(x => console.log(x));
*
* @example <caption>Map and flatten only odd numbers to the sequence 'a', 'b', 'c'</caption>
* var interval = Rx.Observable.interval(1000);
* var result = interval.mergeMap(x =>
* x % 2 === 1 ? Rx.Observable.of('a', 'b', 'c') : Rx.Observable.empty()
* );
* result.subscribe(x => console.log(x));
*
* // Results in the following to the console:
* // x is equal to the count on the interval eg(0,1,2,3,...)
* // x will occur every 1000ms
* // if x % 2 is equal to 1 print abc
* // if x % 2 is not equal to 1 nothing will be output
*
* @see {@link create}
* @see {@link never}
* @see {@link of}
* @see {@link throw}
*
* @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling
* the emission of the complete notification.
* @return {Observable} An "empty" Observable: emits only the complete
* notification.
* @static true
* @name empty
* @owner Observable
*/
EmptyObservable.create = function (scheduler) {
return new EmptyObservable(scheduler);
};
EmptyObservable.dispatch = function (arg) {
var subscriber = arg.subscriber;
subscriber.complete();
};
EmptyObservable.prototype._subscribe = function (subscriber) {
var scheduler = this.scheduler;
if (scheduler) {
return scheduler.schedule(EmptyObservable.dispatch, 0, { subscriber: subscriber });
}
else {
subscriber.complete();
}
};
return EmptyObservable;
}(Observable_1.Observable));
exports.EmptyObservable = EmptyObservable;
//# sourceMappingURL=EmptyObservable.js.map
/***/ }),
/* 130 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function isScheduler(value) {
return value && typeof value.schedule === 'function';
}
exports.isScheduler = isScheduler;
//# sourceMappingURL=isScheduler.js.map
/***/ }),
/* 131 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var subscribeToResult_1 = __webpack_require__(73);
var OuterSubscriber_1 = __webpack_require__(74);
/* tslint:enable:max-line-length */
/**
* Projects each source value to an Observable which is merged in the output
* Observable.
*
* <span class="informal">Maps each value to an Observable, then flattens all of
* these inner Observables using {@link mergeAll}.</span>
*
* <img src="./img/mergeMap.png" width="100%">
*
* Returns an Observable that emits items based on applying a function that you
* supply to each item emitted by the source Observable, where that function
* returns an Observable, and then merging those resulting Observables and
* emitting the results of this merger.
*
* @example <caption>Map and flatten each letter to an Observable ticking every 1 second</caption>
* var letters = Rx.Observable.of('a', 'b', 'c');
* var result = letters.mergeMap(x =>
* Rx.Observable.interval(1000).map(i => x+i)
* );
* result.subscribe(x => console.log(x));
*
* // Results in the following:
* // a0
* // b0
* // c0
* // a1
* // b1
* // c1
* // continues to list a,b,c with respective ascending integers
*
* @see {@link concatMap}
* @see {@link exhaustMap}
* @see {@link merge}
* @see {@link mergeAll}
* @see {@link mergeMapTo}
* @see {@link mergeScan}
* @see {@link switchMap}
*
* @param {function(value: T, ?index: number): ObservableInput} project A function
* that, when applied to an item emitted by the source Observable, returns an
* Observable.
* @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector]
* A function to produce the value on the output Observable based on the values
* and the indices of the source (outer) emission and the inner Observable
* emission. The arguments passed to this function are:
* - `outerValue`: the value that came from the source
* - `innerValue`: the value that came from the projected Observable
* - `outerIndex`: the "index" of the value that came from the source
* - `innerIndex`: the "index" of the value from the projected Observable
* @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input
* Observables being subscribed to concurrently.
* @return {Observable} An Observable that emits the result of applying the
* projection function (and the optional `resultSelector`) to each item emitted
* by the source Observable and merging the results of the Observables obtained
* from this transformation.
* @method mergeMap
* @owner Observable
*/
function mergeMap(project, resultSelector, concurrent) {
if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
return function mergeMapOperatorFunction(source) {
if (typeof resultSelector === 'number') {
concurrent = resultSelector;
resultSelector = null;
}
return source.lift(new MergeMapOperator(project, resultSelector, concurrent));
};
}
exports.mergeMap = mergeMap;
var MergeMapOperator = (function () {
function MergeMapOperator(project, resultSelector, concurrent) {
if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
this.project = project;
this.resultSelector = resultSelector;
this.concurrent = concurrent;
}
MergeMapOperator.prototype.call = function (observer, source) {
return source.subscribe(new MergeMapSubscriber(observer, this.project, this.resultSelector, this.concurrent));
};
return MergeMapOperator;
}());
exports.MergeMapOperator = MergeMapOperator;
/**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
var MergeMapSubscriber = (function (_super) {
__extends(MergeMapSubscriber, _super);
function MergeMapSubscriber(destination, project, resultSelector, concurrent) {
if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
_super.call(this, destination);
this.project = project;
this.resultSelector = resultSelector;
this.concurrent = concurrent;
this.hasCompleted = false;
this.buffer = [];
this.active = 0;
this.index = 0;
}
MergeMapSubscriber.prototype._next = function (value) {
if (this.active < this.concurrent) {
this._tryNext(value);
}
else {
this.buffer.push(value);
}
};
MergeMapSubscriber.prototype._tryNext = function (value) {
var result;
var index = this.index++;
try {
result = this.project(value, index);
}
catch (err) {
this.destination.error(err);
return;
}
this.active++;
this._innerSub(result, value, index);
};
MergeMapSubscriber.prototype._innerSub = function (ish, value, index) {
this.add(subscribeToResult_1.subscribeToResult(this, ish, value, index));
};
MergeMapSubscriber.prototype._complete = function () {
this.hasCompleted = true;
if (this.active === 0 && this.buffer.length === 0) {
this.destination.complete();
}
};
MergeMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
if (this.resultSelector) {
this._notifyResultSelector(outerValue, innerValue, outerIndex, innerIndex);
}
else {
this.destination.next(innerValue);
}
};
MergeMapSubscriber.prototype._notifyResultSelector = function (outerValue, innerValue, outerIndex, innerIndex) {
var result;
try {
result = this.resultSelector(outerValue, innerValue, outerIndex, innerIndex);
}
catch (err) {
this.destination.error(err);
return;
}
this.destination.next(result);
};
MergeMapSubscriber.prototype.notifyComplete = function (innerSub) {
var buffer = this.buffer;
this.remove(innerSub);
this.active--;
if (buffer.length > 0) {
this._next(buffer.shift());
}
else if (this.active === 0 && this.hasCompleted) {
this.destination.complete();
}
};
return MergeMapSubscriber;
}(OuterSubscriber_1.OuterSubscriber));
exports.MergeMapSubscriber = MergeMapSubscriber;
//# sourceMappingURL=mergeMap.js.map
/***/ }),
/* 132 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Subscriber_1 = __webpack_require__(25);
function refCount() {
return function refCountOperatorFunction(source) {
return source.lift(new RefCountOperator(source));
};
}
exports.refCount = refCount;
var RefCountOperator = (function () {
function RefCountOperator(connectable) {
this.connectable = connectable;
}
RefCountOperator.prototype.call = function (subscriber, source) {
var connectable = this.connectable;
connectable._refCount++;
var refCounter = new RefCountSubscriber(subscriber, connectable);
var subscription = source.subscribe(refCounter);
if (!refCounter.closed) {
refCounter.connection = connectable.connect();
}
return subscription;
};
return RefCountOperator;
}());
var RefCountSubscriber = (function (_super) {
__extends(RefCountSubscriber, _super);
function RefCountSubscriber(destination, connectable) {
_super.call(this, destination);
this.connectable = connectable;
}
RefCountSubscriber.prototype._unsubscribe = function () {
var connectable = this.connectable;
if (!connectable) {
this.connection = null;
return;
}
this.connectable = null;
var refCount = connectable._refCount;
if (refCount <= 0) {
this.connection = null;
return;
}
connectable._refCount = refCount - 1;
if (refCount > 1) {
this.connection = null;
return;
}
///
// Compare the local RefCountSubscriber's connection Subscription to the
// connection Subscription on the shared ConnectableObservable. In cases
// where the ConnectableObservable source synchronously emits values, and
// the RefCountSubscriber's downstream Observers synchronously unsubscribe,
// execution continues to here before the RefCountOperator has a chance to
// supply the RefCountSubscriber with the shared connection Subscription.
// For example:
// ```
// Observable.range(0, 10)
// .publish()
// .refCount()
// .take(5)
// .subscribe();
// ```
// In order to account for this case, RefCountSubscriber should only dispose
// the ConnectableObservable's shared connection Subscription if the
// connection Subscription exists, *and* either:
// a. RefCountSubscriber doesn't have a reference to the shared connection
// Subscription yet, or,
// b. RefCountSubscriber's connection Subscription reference is identical
// to the shared connection Subscription
///
var connection = this.connection;
var sharedConnection = connectable._connection;
this.connection = null;
if (sharedConnection && (!connection || sharedConnection === connection)) {
sharedConnection.unsubscribe();
}
};
return RefCountSubscriber;
}(Subscriber_1.Subscriber));
//# sourceMappingURL=refCount.js.map
/***/ }),
/* 133 */,
/* 134 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var map_1 = __webpack_require__(381);
/**
* Applies a given `project` function to each value emitted by the source
* Observable, and emits the resulting values as an Observable.
*
* <span class="informal">Like [Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map),
* it passes each source value through a transformation function to get
* corresponding output values.</span>
*
* <img src="./img/map.png" width="100%">
*
* Similar to the well known `Array.prototype.map` function, this operator
* applies a projection to each value and emits that projection in the output
* Observable.
*
* @example <caption>Map every click to the clientX position of that click</caption>
* var clicks = Rx.Observable.fromEvent(document, 'click');
* var positions = clicks.map(ev => ev.clientX);
* positions.subscribe(x => console.log(x));
*
* @see {@link mapTo}
* @see {@link pluck}
*
* @param {function(value: T, index: number): R} project The function to apply
* to each `value` emitted by the source Observable. The `index` parameter is
* the number `i` for the i-th emission that has happened since the
* subscription, starting from the number `0`.
* @param {any} [thisArg] An optional argument to define what `this` is in the
* `project` function.
* @return {Observable<R>} An Observable that emits the values from the source
* Observable transformed by the given `project` function.
* @method map
* @owner Observable
*/
function map(project, thisArg) {
return map_1.map(project, thisArg)(this);
}
exports.map = map;
//# sourceMappingURL=map.js.map
/***/ }),
/* 135 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return OverlayPortal; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__app__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__navigation_deep_linker__ = __webpack_require__(19);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__platform_dom_controller__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__gestures_gesture_controller__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__navigation_nav_controller_base__ = __webpack_require__(53);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__platform_platform__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__transitions_transition_controller__ = __webpack_require__(55);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
*/
var OverlayPortal = (function (_super) {
__extends(OverlayPortal, _super);
function OverlayPortal(app, config, plt, elementRef, zone, renderer, cfr, gestureCtrl, transCtrl, linker, viewPort, domCtrl, errHandler) {
var _this = _super.call(this, null, app, config, plt, elementRef, zone, renderer, cfr, gestureCtrl, transCtrl, linker, domCtrl, errHandler) || this;
_this._isPortal = true;
_this._init = true;
_this.setViewport(viewPort);
// on every page change make sure the portal has
// dismissed any views that should be auto dismissed on page change
app.viewDidLeave.subscribe(function (view) {
if (!view.isOverlay) {
_this.dismissPageChangeViews();
}
});
return _this;
}
Object.defineProperty(OverlayPortal.prototype, "_overlayPortal", {
set: function (val) {
this._zIndexOffset = (val || 0);
},
enumerable: true,
configurable: true
});
OverlayPortal.prototype.ngOnDestroy = function () {
this.destroy();
};
/*
* @private
*/
OverlayPortal.prototype.getType = function () {
return 'portal';
};
/*
* @private
*/
OverlayPortal.prototype.getSecondaryIdentifier = function () {
return null;
};
OverlayPortal.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: '[overlay-portal]',
},] },
];
/** @nocollapse */
OverlayPortal.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__app__["a" /* App */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["z" /* Inject */], args: [Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_14" /* forwardRef */])(function () { return __WEBPACK_IMPORTED_MODULE_1__app__["a" /* App */]; }),] },] },
{ type: __WEBPACK_IMPORTED_MODULE_2__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_7__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["M" /* NgZone */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["o" /* ComponentFactoryResolver */], },
{ type: __WEBPACK_IMPORTED_MODULE_5__gestures_gesture_controller__["l" /* GestureController */], },
{ type: __WEBPACK_IMPORTED_MODULE_8__transitions_transition_controller__["a" /* TransitionController */], },
{ type: __WEBPACK_IMPORTED_MODULE_3__navigation_deep_linker__["a" /* DeepLinker */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_10" /* ViewContainerRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_4__platform_dom_controller__["a" /* DomController */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["u" /* ErrorHandler */], },
]; };
OverlayPortal.propDecorators = {
'_overlayPortal': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */], args: ['overlay-portal',] },],
};
return OverlayPortal;
}(__WEBPACK_IMPORTED_MODULE_6__navigation_nav_controller_base__["a" /* NavControllerBase */]));
//# sourceMappingURL=overlay-portal.js.map
/***/ }),
/* 136 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SlideGesture; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__pan_gesture__ = __webpack_require__(54);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_dom__ = __webpack_require__(14);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
*/
var SlideGesture = (function (_super) {
__extends(SlideGesture, _super);
function SlideGesture(plt, element, opts) {
if (opts === void 0) { opts = {}; }
var _this = _super.call(this, plt, element, opts) || this;
_this.slide = null;
return _this;
}
/*
* Get the min and max for the slide. pageX/pageY.
* Only called on dragstart.
*/
SlideGesture.prototype.getSlideBoundaries = function (_slide, _ev) {
return {
min: 0,
max: this.getNativeElement().offsetWidth
};
};
/*
* Get the element's pos when the drag starts.
* For example, an open side menu starts at 100% and a closed
* sidemenu starts at 0%.
*/
SlideGesture.prototype.getElementStartPos = function (_slide, _ev) {
return 0;
};
SlideGesture.prototype.onDragStart = function (ev) {
this.onSlideBeforeStart(ev);
var coord = Object(__WEBPACK_IMPORTED_MODULE_2__util_dom__["f" /* pointerCoord */])(ev);
var pos = coord[this.direction];
this.slide = {
min: 0,
max: 0,
pointerStartPos: pos,
pos: pos,
timestamp: Date.now(),
elementStartPos: 0,
started: true,
delta: 0,
distance: 0,
velocity: 0,
};
// TODO: we should run this in the next frame
var _a = this.getSlideBoundaries(this.slide, ev), min = _a.min, max = _a.max;
this.slide.min = min;
this.slide.max = max;
this.slide.elementStartPos = this.getElementStartPos(this.slide, ev);
this.onSlideStart(this.slide, ev);
};
SlideGesture.prototype.onDragMove = function (ev) {
var slide = this.slide;
(void 0) /* assert */;
var coord = Object(__WEBPACK_IMPORTED_MODULE_2__util_dom__["f" /* pointerCoord */])(ev);
var newPos = coord[this.direction];
var newTimestamp = Date.now();
var velocity = (this.plt.isRTL ? (slide.pos - newPos) : (newPos - slide.pos)) / (newTimestamp - slide.timestamp);
slide.pos = newPos;
slide.timestamp = newTimestamp;
slide.distance = Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["a" /* clamp */])(slide.min, (this.plt.isRTL ? slide.pointerStartPos - newPos : newPos - slide.pointerStartPos) + slide.elementStartPos, slide.max);
slide.velocity = velocity;
slide.delta = (this.plt.isRTL ? slide.pointerStartPos - newPos : newPos - slide.pointerStartPos);
this.onSlide(slide, ev);
};
SlideGesture.prototype.onDragEnd = function (ev) {
this.onSlideEnd(this.slide, ev);
this.slide = null;
};
SlideGesture.prototype.onSlideBeforeStart = function (_ev) { };
SlideGesture.prototype.onSlideStart = function (_slide, _ev) { };
SlideGesture.prototype.onSlide = function (_slide, _ev) { };
SlideGesture.prototype.onSlideEnd = function (_slide, _ev) { };
return SlideGesture;
}(__WEBPACK_IMPORTED_MODULE_0__pan_gesture__["a" /* PanGesture */]));
//# sourceMappingURL=slide-gesture.js.map
/***/ }),
/* 137 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return PointerEvents; });
/* unused harmony export POINTER_EVENT_TYPE_MOUSE */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return POINTER_EVENT_TYPE_TOUCH; });
/**
* @hidden
*/
var PointerEvents = (function () {
function PointerEvents(plt, ele, pointerDown, pointerMove, pointerUp, option) {
this.plt = plt;
this.ele = ele;
this.pointerDown = pointerDown;
this.pointerMove = pointerMove;
this.pointerUp = pointerUp;
this.option = option;
this.rmTouchStart = null;
this.rmTouchMove = null;
this.rmTouchEnd = null;
this.rmTouchCancel = null;
this.rmMouseStart = null;
this.rmMouseMove = null;
this.rmMouseUp = null;
this.lastTouchEvent = 0;
this.mouseWait = 2 * 1000;
(void 0) /* assert */;
(void 0) /* assert */;
this.bindTouchEnd = this.handleTouchEnd.bind(this);
this.bindMouseUp = this.handleMouseUp.bind(this);
this.rmTouchStart = this.plt.registerListener(ele, 'touchstart', this.handleTouchStart.bind(this), option);
this.rmMouseStart = this.plt.registerListener(ele, 'mousedown', this.handleMouseDown.bind(this), option);
}
PointerEvents.prototype.handleTouchStart = function (ev) {
(void 0) /* assert */;
(void 0) /* assert */;
this.lastTouchEvent = Date.now() + this.mouseWait;
this.lastEventType = POINTER_EVENT_TYPE_TOUCH;
if (!this.pointerDown(ev, POINTER_EVENT_TYPE_TOUCH)) {
return;
}
if (!this.rmTouchMove && this.pointerMove) {
this.rmTouchMove = this.plt.registerListener(this.ele, 'touchmove', this.pointerMove, this.option);
}
if (!this.rmTouchEnd) {
this.rmTouchEnd = this.plt.registerListener(this.ele, 'touchend', this.bindTouchEnd, this.option);
}
if (!this.rmTouchCancel) {
this.rmTouchCancel = this.plt.registerListener(this.ele, 'touchcancel', this.bindTouchEnd, this.option);
}
};
PointerEvents.prototype.handleMouseDown = function (ev) {
(void 0) /* assert */;
(void 0) /* assert */;
if (this.lastTouchEvent > Date.now()) {
(void 0) /* console.debug */;
return;
}
this.lastEventType = POINTER_EVENT_TYPE_MOUSE;
if (!this.pointerDown(ev, POINTER_EVENT_TYPE_MOUSE)) {
return;
}
if (!this.rmMouseMove && this.pointerMove) {
this.rmMouseMove = this.plt.registerListener(this.plt.doc(), 'mousemove', this.pointerMove, this.option);
}
if (!this.rmMouseUp) {
this.rmMouseUp = this.plt.registerListener(this.plt.doc(), 'mouseup', this.bindMouseUp, this.option);
}
};
PointerEvents.prototype.handleTouchEnd = function (ev) {
this.stopTouch();
this.pointerUp && this.pointerUp(ev, POINTER_EVENT_TYPE_TOUCH);
};
PointerEvents.prototype.handleMouseUp = function (ev) {
this.stopMouse();
this.pointerUp && this.pointerUp(ev, POINTER_EVENT_TYPE_MOUSE);
};
PointerEvents.prototype.stopTouch = function () {
this.rmTouchMove && this.rmTouchMove();
this.rmTouchEnd && this.rmTouchEnd();
this.rmTouchCancel && this.rmTouchCancel();
this.rmTouchMove = this.rmTouchEnd = this.rmTouchCancel = null;
};
PointerEvents.prototype.stopMouse = function () {
this.rmMouseMove && this.rmMouseMove();
this.rmMouseUp && this.rmMouseUp();
this.rmMouseMove = this.rmMouseUp = null;
};
PointerEvents.prototype.stop = function () {
this.stopTouch();
this.stopMouse();
};
PointerEvents.prototype.destroy = function () {
this.rmTouchStart && this.rmTouchStart();
this.rmMouseStart && this.rmMouseStart();
this.stop();
this.ele = this.pointerUp = this.pointerMove = this.pointerDown = this.rmTouchStart = this.rmMouseStart = null;
};
return PointerEvents;
}());
var POINTER_EVENT_TYPE_MOUSE = 1;
var POINTER_EVENT_TYPE_TOUCH = 2;
//# sourceMappingURL=pointer-events.js.map
/***/ }),
/* 138 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ActionSheetController; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__action_sheet__ = __webpack_require__(77);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__app_app__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__config_config__ = __webpack_require__(2);
/**
* @name ActionSheetController
* @description
* An Action Sheet is a dialog that lets the user choose from a set of
* options. It appears on top of the app's content, and must be manually
* dismissed by the user before they can resume interaction with the app.
* Dangerous (destructive) options are made obvious in `ios` mode. There are easy
* ways to cancel out of the action sheet, such as tapping the backdrop or
* hitting the escape key on desktop.
*
* An action sheet is created from an array of `buttons`, with each button
* including properties for its `text`, and optionally a `handler` and `role`.
* If a handler returns `false` then the action sheet will not be dismissed. An
* action sheet can also optionally have a `title`, `subTitle` and an `icon`.
*
* A button's `role` property can either be `destructive` or `cancel`. Buttons
* without a role property will have the default look for the platform. Buttons
* with the `cancel` role will always load as the bottom button, no matter where
* they are in the array. All other buttons will be displayed in the order they
* have been added to the `buttons` array. Note: We recommend that `destructive`
* buttons are always the first button in the array, making them the top button.
* Additionally, if the action sheet is dismissed by tapping the backdrop, then
* it will fire the handler from the button with the cancel role.
*
* You can pass all of the action sheet's options in the first argument of
* the create method: `ActionSheet.create(opts)`. Otherwise the action sheet's
* instance has methods to add options, like `setTitle()` or `addButton()`.
*
* @usage
* ```ts
* import { ActionSheetController } from 'ionic-angular'
*
* export class MyClass{
*
* constructor(public actionSheetCtrl: ActionSheetController) { }
*
* presentActionSheet() {
* const actionSheet = this.actionSheetCtrl.create({
* title: 'Modify your album',
* buttons: [
* {
* text: 'Destructive',
* role: 'destructive',
* handler: () => {
* console.log('Destructive clicked');
* }
* },
* {
* text: 'Archive',
* handler: () => {
* console.log('Archive clicked');
* }
* },
* {
* text: 'Cancel',
* role: 'cancel',
* handler: () => {
* console.log('Cancel clicked');
* }
* }
* ]
* });
*
* actionSheet.present();
* }
* }
* ```
*
* @advanced
*
* ActionSheet create options
*
* | Option | Type | Description |
* |-----------------------|------------|--------------------------------------------------------------------|
* | title |`string` | The title for the Action Sheet. |
* | subTitle |`string` | The sub-title for the Action Sheet. |
* | cssClass |`string` | Additional classes for custom styles, separated by spaces. |
* | enableBackdropDismiss |`boolean` | If the Action Sheet should close when the user taps the backdrop. |
* | buttons |`array<any>`| An array of buttons to display. |
*
* ActionSheet button options
*
* | Option | Type | Description |
* |----------|----------|--------------------------------------------------------------------------------------------------------------------------------------------------|
* | text | `string` | The buttons text. |
* | icon | `icon` | The buttons icons. |
* | handler | `any` | An express the button should evaluate. |
* | cssClass | `string` | Additional classes for custom styles, separated by spaces. |
* | role | `string` | How the button should be displayed, `destructive` or `cancel`. If not role is provided, it will display the button without any additional styles.|
*
*
* ### Dismissing And Async Navigation
*
* After an action sheet has been dismissed, the app may need to also transition
* to another page depending on the handler's logic. However, because multiple
* transitions were fired at roughly the same time, it's difficult for the
* nav controller to cleanly animate multiple transitions that may
* have been kicked off asynchronously. This is further described in the
* [`Nav Transition Promises`](../../nav/NavController/#nav-transition-promises) section. For action sheets,
* this means it's best to wait for the action sheet to finish its transition
* out before starting a new transition on the same nav controller.
*
* In the example below, after the button has been clicked, its handler
* waits on async operation to complete, *then* it uses `pop` to navigate
* back a page in the same stack. The potential problem is that the async operation
* may have been completed before the action sheet has even finished its transition
* out. In this case, it's best to ensure the action sheet has finished its transition
* out first, *then* start the next transition.
*
* ```ts
* const actionSheet = this.actionSheetCtrl.create({
* title: 'Hello',
* buttons: [{
* text: 'Ok',
* handler: () => {
* // user has clicked the action sheet button
* // begin the action sheet's dimiss transition
* let navTransition = actionSheet.dismiss();
*
* // start some async method
* someAsyncOperation().then(() => {
* // once the async operation has completed
* // then run the next nav transition after the
* // first transition has finished animating out
*
* navTransition.then(() => {
* this.nav.pop();
* });
* });
* return false;
* }
* }]
* });
*
* actionSheet.present();
* ```
*
* It's important to note that the handler returns `false`. A feature of
* button handlers is that they automatically dismiss the action sheet when their button
* was clicked, however, we'll need more control regarding the transition. Because
* the handler returns `false`, then the action sheet does not automatically dismiss
* itself. Instead, you now have complete control of when the action sheet has finished
* transitioning, and the ability to wait for the action sheet to finish transitioning
* out before starting a new transition.
*
*
* @demo /docs/demos/src/action-sheet/
* @see {@link /docs/components#action-sheets ActionSheet Component Docs}
*/
var ActionSheetController = (function () {
function ActionSheetController(_app, config) {
this._app = _app;
this.config = config;
}
/**
* Open an action sheet with a title, subTitle, and an array of buttons
* @param {ActionSheetOptions} opts Action sheet options
*/
ActionSheetController.prototype.create = function (opts) {
if (opts === void 0) { opts = {}; }
return new __WEBPACK_IMPORTED_MODULE_1__action_sheet__["a" /* ActionSheet */](this._app, opts, this.config);
};
ActionSheetController.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
ActionSheetController.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_2__app_app__["a" /* App */], },
{ type: __WEBPACK_IMPORTED_MODULE_3__config_config__["a" /* Config */], },
]; };
return ActionSheetController;
}());
//# sourceMappingURL=action-sheet-controller.js.map
/***/ }),
/* 139 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AlertController; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__alert__ = __webpack_require__(79);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__app_app__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__config_config__ = __webpack_require__(2);
/**
* @name AlertController
* @description
* An Alert is a dialog that presents users with information or collects
* information from the user using inputs. An alert appears on top
* of the app's content, and must be manually dismissed by the user before
* they can resume interaction with the app. It can also optionally have a
* `title`, `subTitle` and `message`.
*
* You can pass all of the alert's options in the first argument of
* the create method: `create(opts)`. Otherwise the alert's instance
* has methods to add options, such as `setTitle()` or `addButton()`.
*
*
* ### Alert Buttons
*
* In the array of `buttons`, each button includes properties for its `text`,
* and optionally a `handler`. If a handler returns `false` then the alert
* will not automatically be dismissed when the button is clicked. All
* buttons will show up in the order they have been added to the `buttons`
* array, from left to right. Note: The right most button (the last one in
* the array) is the main button.
*
* Optionally, a `role` property can be added to a button, such as `cancel`.
* If a `cancel` role is on one of the buttons, then if the alert is
* dismissed by tapping the backdrop, then it will fire the handler from
* the button with a cancel role.
*
*
* ### Alert Inputs
*
* Alerts can also include several different inputs whose data can be passed
* back to the app. Inputs can be used as a simple way to prompt users for
* information. Radios, checkboxes and text inputs are all accepted, but they
* cannot be mixed. For example, an alert could have all radio button inputs,
* or all checkbox inputs, but the same alert cannot mix radio and checkbox
* inputs. Do note however, different types of "text"" inputs can be mixed,
* such as `url`, `email`, `text`, etc. If you require a complex form UI
* which doesn't fit within the guidelines of an alert then we recommend
* building the form within a modal instead.
*
*
* @usage
* ```ts
* import { AlertController } from 'ionic-angular';
*
* constructor(public alertCtrl: AlertController) { }
*
* presentAlert() {
* const alert = this.alertCtrl.create({
* title: 'Low battery',
* subTitle: '10% of battery remaining',
* buttons: ['Dismiss']
* });
* alert.present();
* }
*
* presentConfirm() {
* const alert = this.alertCtrl.create({
* title: 'Confirm purchase',
* message: 'Do you want to buy this book?',
* buttons: [
* {
* text: 'Cancel',
* role: 'cancel',
* handler: () => {
* console.log('Cancel clicked');
* }
* },
* {
* text: 'Buy',
* handler: () => {
* console.log('Buy clicked');
* }
* }
* ]
* });
* alert.present();
* }
*
* presentPrompt() {
* const alert = this.alertCtrl.create({
* title: 'Login',
* inputs: [
* {
* name: 'username',
* placeholder: 'Username'
* },
* {
* name: 'password',
* placeholder: 'Password',
* type: 'password'
* }
* ],
* buttons: [
* {
* text: 'Cancel',
* role: 'cancel',
* handler: data => {
* console.log('Cancel clicked');
* }
* },
* {
* text: 'Login',
* handler: data => {
* if (User.isValid(data.username, data.password)) {
* // logged in!
* } else {
* // invalid login
* return false;
* }
* }
* }
* ]
* });
* alert.present();
* }
* ```
* @advanced
*
*
* Alert options
*
* | Property | Type | Description |
* |-----------------------|-----------|------------------------------------------------------------------------------|
* | title | `string` | The title for the alert. |
* | subTitle | `string` | The subtitle for the alert. |
* | message | `string` | The message for the alert. |
* | cssClass | `string` | Additional classes for custom styles, separated by spaces. |
* | inputs | `array` | An array of inputs for the alert. See input options. |
* | buttons | `array` | An array of buttons for the alert. See buttons options. |
* | enableBackdropDismiss | `boolean` | Whether the alert should be dismissed by tapping the backdrop. Default true. |
*
*
* Input options
*
* | Property | Type | Description |
* |-------------|-----------|-----------------------------------------------------------------|
* | type | `string` | The type the input should be: text, tel, number, etc. |
* | name | `string` | The name for the input. |
* | placeholder | `string` | The input's placeholder (for textual/numeric inputs) |
* | value | `string` | The input's value. |
* | label | `string` | The input's label (only for radio/checkbox inputs) |
* | checked | `boolean` | Whether or not the input is checked. |
* | id | `string` | The input's id. |
*
* Button options
*
* | Property | Type | Description |
* |----------|----------|-----------------------------------------------------------------|
* | text | `string` | The buttons displayed text. |
* | handler | `any` | Emitted when the button is pressed. |
* | cssClass | `string` | An additional CSS class for the button. |
* | role | `string` | The buttons role, null or `cancel`. |
*
* ### Dismissing And Async Navigation
*
* After an alert has been dismissed, the app may need to also transition
* to another page depending on the handler's logic. However, because multiple
* transitions were fired at roughly the same time, it's difficult for the
* nav controller to cleanly animate multiple transitions that may
* have been kicked off asynchronously. This is further described in the
* [`Nav Transition Promises`](../../nav/NavController) section. For alerts,
* this means it's best to wait for the alert to finish its transition
* out before starting a new transition on the same nav controller.
*
* In the example below, after the alert button has been clicked, its handler
* waits on async operation to complete, *then* it uses `pop` to navigate
* back a page in the same stack. The potential problem is that the async operation
* may have been completed before the alert has even finished its transition
* out. In this case, it's best to ensure the alert has finished its transition
* out first, *then* start the next transition.
*
* ```ts
* const alert = this.alertCtrl.create({
* title: 'Hello',
* buttons: [{
* text: 'Ok',
* handler: () => {
* // user has clicked the alert button
* // begin the alert's dismiss transition
* const navTransition = alert.dismiss();
*
* // start some async method
* someAsyncOperation().then(() => {
* // once the async operation has completed
* // then run the next nav transition after the
* // first transition has finished animating out
*
* navTransition.then(() => {
* this.nav.pop();
* });
* });
* return false;
* }
* }]
* });
*
* alert.present();
* ```
*
* It's important to note that the handler returns `false`. A feature of
* button handlers is that they automatically dismiss the alert when their button
* was clicked, however, we'll need more control regarding the transition. Because
* the handler returns `false`, then the alert does not automatically dismiss
* itself. Instead, you now have complete control of when the alert has finished
* transitioning, and the ability to wait for the alert to finish transitioning
* out before starting a new transition.
*
*
* @demo /docs/demos/src/alert/
*/
var AlertController = (function () {
function AlertController(_app, config) {
this._app = _app;
this.config = config;
}
/**
* Display an alert with a title, inputs, and buttons
* @param {AlertOptions} opts Alert. See the table below
*/
AlertController.prototype.create = function (opts) {
if (opts === void 0) { opts = {}; }
return new __WEBPACK_IMPORTED_MODULE_1__alert__["a" /* Alert */](this._app, opts, this.config);
};
AlertController.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
AlertController.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_2__app_app__["a" /* App */], },
{ type: __WEBPACK_IMPORTED_MODULE_3__config_config__["a" /* Config */], },
]; };
return AlertController;
}());
//# sourceMappingURL=alert-controller.js.map
/***/ }),
/* 140 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Avatar; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/**
* @name Avatar
* @module ionic
* @description
* An Avatar is a component that creates a circular image for an item.
* Avatars can be placed on the left or right side of an item with the `item-start` or `item-end` directive.
* @see {@link /docs/components/#avatar-list Avatar Component Docs}
*/
var Avatar = (function () {
function Avatar() {
}
Avatar.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-avatar'
},] },
];
/** @nocollapse */
Avatar.ctorParameters = function () { return []; };
return Avatar;
}());
//# sourceMappingURL=avatar.js.map
/***/ }),
/* 141 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Badge; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ion__ = __webpack_require__(6);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name Badge
* @module ionic
* @description
* Badges are simple components in Ionic containing numbers or text. You can display a badge to indicate that there is new information associated with the item it is on.
* @see {@link /docs/components/#badges Badges Component Docs}
*/
var Badge = (function (_super) {
__extends(Badge, _super);
function Badge(config, elementRef, renderer) {
return _super.call(this, config, elementRef, renderer, 'badge') || this;
}
Badge.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-badge'
},] },
];
/** @nocollapse */
Badge.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
]; };
return Badge;
}(__WEBPACK_IMPORTED_MODULE_2__ion__["a" /* Ion */]));
//# sourceMappingURL=badge.js.map
/***/ }),
/* 142 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Card; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ion__ = __webpack_require__(6);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
*/
var Card = (function (_super) {
__extends(Card, _super);
function Card(config, elementRef, renderer) {
return _super.call(this, config, elementRef, renderer, 'card') || this;
}
Card.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-card'
},] },
];
/** @nocollapse */
Card.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
]; };
return Card;
}(__WEBPACK_IMPORTED_MODULE_2__ion__["a" /* Ion */]));
//# sourceMappingURL=card.js.map
/***/ }),
/* 143 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CardContent; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ion__ = __webpack_require__(6);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
*/
var CardContent = (function (_super) {
__extends(CardContent, _super);
function CardContent(config, elementRef, renderer) {
return _super.call(this, config, elementRef, renderer, 'card-content') || this;
}
CardContent.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-card-content'
},] },
];
/** @nocollapse */
CardContent.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
]; };
return CardContent;
}(__WEBPACK_IMPORTED_MODULE_2__ion__["a" /* Ion */]));
//# sourceMappingURL=card-content.js.map
/***/ }),
/* 144 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CardHeader; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ion__ = __webpack_require__(6);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
*/
var CardHeader = (function (_super) {
__extends(CardHeader, _super);
function CardHeader(config, elementRef, renderer) {
return _super.call(this, config, elementRef, renderer, 'card-header') || this;
}
CardHeader.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-card-header'
},] },
];
/** @nocollapse */
CardHeader.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
]; };
return CardHeader;
}(__WEBPACK_IMPORTED_MODULE_2__ion__["a" /* Ion */]));
//# sourceMappingURL=card-header.js.map
/***/ }),
/* 145 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CardTitle; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ion__ = __webpack_require__(6);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
*/
var CardTitle = (function (_super) {
__extends(CardTitle, _super);
function CardTitle(config, elementRef, renderer) {
return _super.call(this, config, elementRef, renderer, 'card-title') || this;
}
CardTitle.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-card-title'
},] },
];
/** @nocollapse */
CardTitle.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
]; };
return CardTitle;
}(__WEBPACK_IMPORTED_MODULE_2__ion__["a" /* Ion */]));
//# sourceMappingURL=card-title.js.map
/***/ }),
/* 146 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Checkbox; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_forms__ = __webpack_require__(16);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_form__ = __webpack_require__(20);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__util_base_input__ = __webpack_require__(29);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__item_item__ = __webpack_require__(21);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name Checkbox
* @module ionic
*
* @description
* The Checkbox is a simple component styled based on the mode. It can be
* placed in an `ion-item` or used as a stand-alone checkbox.
*
* See the [Angular Docs](https://angular.io/docs/ts/latest/guide/forms.html)
* for more info on forms and inputs.
*
*
* @usage
* ```html
*
* <ion-list>
*
* <ion-item>
* <ion-label>Pepperoni</ion-label>
* <ion-checkbox [(ngModel)]="pepperoni"></ion-checkbox>
* </ion-item>
*
* <ion-item>
* <ion-label>Sausage</ion-label>
* <ion-checkbox [(ngModel)]="sausage" disabled="true"></ion-checkbox>
* </ion-item>
*
* <ion-item>
* <ion-label>Mushrooms</ion-label>
* <ion-checkbox [(ngModel)]="mushrooms"></ion-checkbox>
* </ion-item>
*
* </ion-list>
* ```
*
* @advanced
*
* ```html
*
* <!-- Call function when state changes -->
* <ion-list>
*
* <ion-item>
* <ion-label>Cucumber</ion-label>
* <ion-checkbox [(ngModel)]="cucumber" (ionChange)="updateCucumber()"></ion-checkbox>
* </ion-item>
*
* </ion-list>
* ```
*
* ```ts
* @Component({
* templateUrl: 'main.html'
* })
* class SaladPage {
* cucumber: boolean;
*
* updateCucumber() {
* console.log('Cucumbers new state:' + this.cucumber);
* }
* }
* ```
*
* @demo /docs/demos/src/checkbox/
* @see {@link /docs/components#checkbox Checkbox Component Docs}
*/
var Checkbox = (function (_super) {
__extends(Checkbox, _super);
function Checkbox(config, form, item, elementRef, renderer) {
return _super.call(this, config, elementRef, renderer, 'checkbox', false, form, item, null) || this;
}
Object.defineProperty(Checkbox.prototype, "checked", {
/**
* @input {boolean} If true, the element is selected.
*/
get: function () {
return this.value;
},
set: function (val) {
this.value = val;
},
enumerable: true,
configurable: true
});
/**
* @hidden
*/
Checkbox.prototype._click = function (ev) {
ev.preventDefault();
ev.stopPropagation();
this.value = !this.value;
this._fireTouched();
};
/**
* @hidden
*/
Checkbox.prototype._inputNormalize = function (val) {
return Object(__WEBPACK_IMPORTED_MODULE_3__util_util__["o" /* isTrueProperty */])(val);
};
/**
* @hidden
*/
Checkbox.prototype._inputUpdated = function () {
this._item && this._item.setElementClass('item-checkbox-checked', this._value);
};
Checkbox.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-checkbox',
template: '<div class="checkbox-icon" [class.checkbox-checked]="_value">' +
'<div class="checkbox-inner"></div>' +
'</div>' +
'<button role="checkbox" ' +
'type="button" ' +
'ion-button="item-cover" ' +
'[id]="id" ' +
'[attr.aria-checked]="_value" ' +
'[attr.aria-labelledby]="_labelId" ' +
'[attr.aria-disabled]="_disabled" ' +
'class="item-cover"> ' +
'</button>',
host: {
'[class.checkbox-disabled]': '_disabled'
},
providers: [{ provide: __WEBPACK_IMPORTED_MODULE_1__angular_forms__["c" /* NG_VALUE_ACCESSOR */], useExisting: Checkbox, multi: true }],
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
},] },
];
/** @nocollapse */
Checkbox.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_2__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_4__util_form__["a" /* Form */], },
{ type: __WEBPACK_IMPORTED_MODULE_6__item_item__["a" /* Item */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
]; };
Checkbox.propDecorators = {
'checked': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'_click': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* HostListener */], args: ['click', ['$event'],] },],
};
return Checkbox;
}(__WEBPACK_IMPORTED_MODULE_5__util_base_input__["a" /* BaseInput */]));
//# sourceMappingURL=checkbox.js.map
/***/ }),
/* 147 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TimeoutDebouncer; });
var TimeoutDebouncer = (function () {
function TimeoutDebouncer(wait) {
this.wait = wait;
this.timer = null;
}
TimeoutDebouncer.prototype.debounce = function (callback) {
this.callback = callback;
this.schedule();
};
TimeoutDebouncer.prototype.schedule = function () {
this.cancel();
if (this.wait <= 0) {
this.callback();
}
else {
this.timer = setTimeout(this.callback, this.wait);
}
};
TimeoutDebouncer.prototype.cancel = function () {
if (this.timer) {
clearTimeout(this.timer);
this.timer = null;
}
};
return TimeoutDebouncer;
}());
//# sourceMappingURL=debouncer.js.map
/***/ }),
/* 148 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ScrollView; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__dom__ = __webpack_require__(14);
var ScrollView = (function () {
function ScrollView(_app, _plt, _dom) {
this._app = _app;
this._plt = _plt;
this._dom = _dom;
this.isScrolling = false;
this.initialized = false;
this._eventsEnabled = false;
this._t = 0;
this._l = 0;
this.ev = {
timeStamp: 0,
scrollTop: 0,
scrollLeft: 0,
scrollHeight: 0,
scrollWidth: 0,
contentHeight: 0,
contentWidth: 0,
contentTop: 0,
contentBottom: 0,
startY: 0,
startX: 0,
deltaY: 0,
deltaX: 0,
velocityY: 0,
velocityX: 0,
directionY: 'down',
directionX: null,
domWrite: _dom.write.bind(_dom)
};
}
ScrollView.prototype.init = function (ele, contentTop, contentBottom) {
(void 0) /* assert */;
this._el = ele;
if (!this.initialized) {
this.initialized = true;
if (this._js) {
this.enableJsScroll(contentTop, contentBottom);
}
else {
this.enableNativeScrolling();
}
}
};
ScrollView.prototype.enableEvents = function () {
this._eventsEnabled = true;
};
ScrollView.prototype.setScrolling = function (isScrolling, ev) {
if (this.isScrolling) {
if (isScrolling) {
this.onScroll && this.onScroll(ev);
}
else {
this.isScrolling = false;
this.onScrollEnd && this.onScrollEnd(ev);
}
}
else if (isScrolling) {
this.isScrolling = true;
this.onScrollStart && this.onScrollStart(ev);
}
};
ScrollView.prototype.enableNativeScrolling = function () {
(void 0) /* assert */;
(void 0) /* assert */;
(void 0) /* assert */;
this._js = false;
if (!this._el) {
return;
}
(void 0) /* console.debug */;
var self = this;
var ev = self.ev;
var positions = [];
function scrollCallback(scrollEvent) {
// remind the app that it's currently scrolling
self._app.setScrolling();
// if events are disabled, we do nothing
if (!self._eventsEnabled) {
return;
}
ev.timeStamp = scrollEvent.timeStamp;
// Event.timeStamp is 0 in firefox
if (!ev.timeStamp) {
ev.timeStamp = Date.now();
}
// get the current scrollTop
// ******** DOM READ ****************
ev.scrollTop = self.getTop();
// get the current scrollLeft
// ******** DOM READ ****************
ev.scrollLeft = self.getLeft();
if (!self.isScrolling) {
// remember the start positions
ev.startY = ev.scrollTop;
ev.startX = ev.scrollLeft;
// new scroll, so do some resets
ev.velocityY = ev.velocityX = 0;
ev.deltaY = ev.deltaX = 0;
positions.length = 0;
}
// actively scrolling
positions.push(ev.scrollTop, ev.scrollLeft, ev.timeStamp);
if (positions.length > 3) {
// we've gotten at least 2 scroll events so far
ev.deltaY = (ev.scrollTop - ev.startY);
ev.deltaX = (ev.scrollLeft - ev.startX);
var endPos = (positions.length - 1);
var startPos = endPos;
var timeRange = (ev.timeStamp - 100);
// move pointer to position measured 100ms ago
for (var i = endPos; i > 0 && positions[i] > timeRange; i -= 3) {
startPos = i;
}
if (startPos !== endPos) {
// compute relative movement between these two points
var movedTop = (positions[startPos - 2] - positions[endPos - 2]);
var movedLeft = (positions[startPos - 1] - positions[endPos - 1]);
var factor = FRAME_MS / (positions[endPos] - positions[startPos]);
// based on XXms compute the movement to apply for each render step
ev.velocityY = movedTop * factor;
ev.velocityX = movedLeft * factor;
// figure out which direction we're scrolling
ev.directionY = (movedTop > 0 ? 'up' : 'down');
ev.directionX = (movedLeft > 0 ? 'left' : 'right');
}
}
function scrollEnd() {
// reset velocity, do not reset the directions or deltas
ev.velocityY = ev.velocityX = 0;
// emit that the scroll has ended
self.setScrolling(false, ev);
self._endTmr = null;
}
// emit on each scroll event
self.setScrolling(true, ev);
// debounce for a moment after the last scroll event
self._dom.cancel(self._endTmr);
self._endTmr = self._dom.read(scrollEnd, SCROLL_END_DEBOUNCE_MS);
}
// clear out any existing listeners (just to be safe)
self._lsn && self._lsn();
// assign the raw scroll listener
// note that it does not have a wrapping requestAnimationFrame on purpose
// a scroll event callback will always be right before the raf callback
// so there's little to no value of using raf here since it'll all ways immediately
// call the raf if it was set within the scroll event, so this will save us some time
self._lsn = self._plt.registerListener(self._el, 'scroll', scrollCallback, EVENT_OPTS);
};
/**
* @hidden
* JS Scrolling has been provided only as a temporary solution
* until iOS apps can take advantage of scroll events at all times.
* The goal is to eventually remove JS scrolling entirely. When we
* no longer have to worry about iOS not firing scroll events during
* inertia then this can be burned to the ground. iOS's more modern
* WKWebView does not have this issue, only UIWebView does.
*/
ScrollView.prototype.enableJsScroll = function (contentTop, contentBottom) {
var self = this;
self._js = true;
var ele = self._el;
if (!ele) {
return;
}
(void 0) /* console.debug */;
var ev = self.ev;
var positions = [];
var rafCancel;
var max;
function setMax() {
if (!max) {
// ******** DOM READ ****************
max = ele.scrollHeight - ele.parentElement.offsetHeight + contentTop + contentBottom;
}
}
function jsScrollDecelerate(timeStamp) {
ev.timeStamp = timeStamp;
(void 0) /* console.debug */;
if (ev.velocityY) {
ev.velocityY *= DECELERATION_FRICTION;
// update top with updated velocity
// clamp top within scroll limits
// ******** DOM READ ****************
setMax();
self._t = Math.min(Math.max(self._t + ev.velocityY, 0), max);
ev.scrollTop = self._t;
// emit on each scroll event
self.onScroll(ev);
self._dom.write(function () {
// ******** DOM WRITE ****************
self.setTop(self._t);
if (self._t > 0 && self._t < max && Math.abs(ev.velocityY) > MIN_VELOCITY_CONTINUE_DECELERATION) {
rafCancel = self._dom.read(function (rafTimeStamp) {
jsScrollDecelerate(rafTimeStamp);
});
}
else {
// haven't scrolled in a while, so it's a scrollend
self.isScrolling = false;
// reset velocity, do not reset the directions or deltas
ev.velocityY = ev.velocityX = 0;
// emit that the scroll has ended
self.onScrollEnd(ev);
}
});
}
}
function jsScrollTouchStart(touchEvent) {
positions.length = 0;
max = null;
self._dom.cancel(rafCancel);
positions.push(Object(__WEBPACK_IMPORTED_MODULE_0__dom__["f" /* pointerCoord */])(touchEvent).y, touchEvent.timeStamp);
}
function jsScrollTouchMove(touchEvent) {
if (!positions.length) {
return;
}
ev.timeStamp = touchEvent.timeStamp;
var y = Object(__WEBPACK_IMPORTED_MODULE_0__dom__["f" /* pointerCoord */])(touchEvent).y;
// ******** DOM READ ****************
setMax();
self._t -= (y - positions[positions.length - 2]);
self._t = Math.min(Math.max(self._t, 0), max);
positions.push(y, ev.timeStamp);
if (!self.isScrolling) {
// remember the start position
ev.startY = self._t;
// new scroll, so do some resets
ev.velocityY = ev.deltaY = 0;
self.isScrolling = true;
// emit only on the first scroll event
self.onScrollStart(ev);
}
self._dom.write(function () {
// ******** DOM WRITE ****************
self.setTop(self._t);
});
}
function jsScrollTouchEnd(touchEvent) {
// figure out what the scroll position was about 100ms ago
self._dom.cancel(rafCancel);
if (!positions.length && self.isScrolling) {
self.isScrolling = false;
ev.velocityY = ev.velocityX = 0;
self.onScrollEnd(ev);
return;
}
var y = Object(__WEBPACK_IMPORTED_MODULE_0__dom__["f" /* pointerCoord */])(touchEvent).y;
positions.push(y, touchEvent.timeStamp);
var endPos = (positions.length - 1);
var startPos = endPos;
var timeRange = (touchEvent.timeStamp - 100);
// move pointer to position measured 100ms ago
for (var i = endPos; i > 0 && positions[i] > timeRange; i -= 2) {
startPos = i;
}
if (startPos !== endPos) {
// compute relative movement between these two points
var timeOffset = (positions[endPos] - positions[startPos]);
var movedTop = (positions[startPos - 1] - positions[endPos - 1]);
// based on XXms compute the movement to apply for each render step
ev.velocityY = ((movedTop / timeOffset) * FRAME_MS);
// verify that we have enough velocity to start deceleration
if (Math.abs(ev.velocityY) > MIN_VELOCITY_START_DECELERATION) {
// ******** DOM READ ****************
setMax();
rafCancel = self._dom.read(function (rafTimeStamp) {
jsScrollDecelerate(rafTimeStamp);
});
}
}
else {
self.isScrolling = false;
ev.velocityY = 0;
self.onScrollEnd(ev);
}
positions.length = 0;
}
var plt = self._plt;
var unRegStart = plt.registerListener(ele, 'touchstart', jsScrollTouchStart, EVENT_OPTS);
var unRegMove = plt.registerListener(ele, 'touchmove', jsScrollTouchMove, EVENT_OPTS);
var unRegEnd = plt.registerListener(ele, 'touchend', jsScrollTouchEnd, EVENT_OPTS);
ele.parentElement.classList.add('js-scroll');
// stop listening for actual scroll events
self._lsn && self._lsn();
// create an unregister for all of these events
self._lsn = function () {
unRegStart();
unRegMove();
unRegEnd();
ele.parentElement.classList.remove('js-scroll');
};
};
/**
* DOM READ
*/
ScrollView.prototype.getTop = function () {
if (this._js) {
return this._t;
}
return this._t = this._el.scrollTop;
};
/**
* DOM READ
*/
ScrollView.prototype.getLeft = function () {
if (this._js) {
return 0;
}
return this._l = this._el.scrollLeft;
};
/**
* DOM WRITE
*/
ScrollView.prototype.setTop = function (top) {
this._t = top;
if (this._js) {
this._el.style[this._plt.Css.transform] = "translate3d(" + this._l * -1 + "px," + top * -1 + "px,0px)";
}
else {
this._el.scrollTop = top;
}
};
/**
* DOM WRITE
*/
ScrollView.prototype.setLeft = function (left) {
this._l = left;
if (this._js) {
this._el.style[this._plt.Css.transform] = "translate3d(" + left * -1 + "px," + this._t * -1 + "px,0px)";
}
else {
this._el.scrollLeft = left;
}
};
ScrollView.prototype.scrollTo = function (x, y, duration, done) {
// scroll animation loop w/ easing
// credit https://gist.github.com/dezinezync/5487119
var promise;
if (done === undefined) {
// only create a promise if a done callback wasn't provided
// done can be a null, which avoids any functions
promise = new Promise(function (resolve) {
done = resolve;
});
}
var self = this;
var el = self._el;
if (!el) {
// invalid element
done();
return promise;
}
if (duration < 32) {
self.setTop(y);
self.setLeft(x);
done();
return promise;
}
var fromY = el.scrollTop;
var fromX = el.scrollLeft;
var maxAttempts = (duration / 16) + 100;
var transform = self._plt.Css.transform;
var startTime;
var attempts = 0;
var stopScroll = false;
// scroll loop
function step(timeStamp) {
attempts++;
if (!self._el || stopScroll || attempts > maxAttempts) {
self.setScrolling(false, null);
el.style[transform] = '';
done();
return;
}
var time = Math.min(1, ((timeStamp - startTime) / duration));
// where .5 would be 50% of time on a linear scale easedT gives a
// fraction based on the easing method
var easedT = (--time) * time * time + 1;
if (fromY !== y) {
self.setTop((easedT * (y - fromY)) + fromY);
}
if (fromX !== x) {
self.setLeft(Math.floor((easedT * (x - fromX)) + fromX));
}
if (easedT < 1) {
// do not use DomController here
// must use nativeRaf in order to fire in the next frame
self._plt.raf(step);
}
else {
stopScroll = true;
self.setScrolling(false, null);
el.style[transform] = '';
done();
}
}
// start scroll loop
self.setScrolling(true, null);
self.isScrolling = true;
// chill out for a frame first
self._dom.write(function (timeStamp) {
startTime = timeStamp;
step(timeStamp);
}, 16);
return promise;
};
ScrollView.prototype.scrollToTop = function (duration) {
return this.scrollTo(0, 0, duration);
};
ScrollView.prototype.scrollToBottom = function (duration) {
var y = 0;
if (this._el) {
y = this._el.scrollHeight - this._el.clientHeight;
}
return this.scrollTo(0, y, duration);
};
ScrollView.prototype.stop = function () {
this.setScrolling(false, null);
};
/**
* @hidden
*/
ScrollView.prototype.destroy = function () {
this.stop();
this._endTmr && this._dom.cancel(this._endTmr);
this._lsn && this._lsn();
var ev = this.ev;
ev.domWrite = ev.contentElement = ev.fixedElement = ev.scrollElement = ev.headerElement = null;
this._lsn = this._el = this._dom = this.ev = ev = null;
this.onScrollStart = this.onScroll = this.onScrollEnd = null;
};
return ScrollView;
}());
var SCROLL_END_DEBOUNCE_MS = 80;
var MIN_VELOCITY_START_DECELERATION = 4;
var MIN_VELOCITY_CONTINUE_DECELERATION = 0.12;
var DECELERATION_FRICTION = 0.97;
var FRAME_MS = (1000 / 60);
var EVENT_OPTS = {
passive: true,
zone: false
};
//# sourceMappingURL=scroll-view.js.map
/***/ }),
/* 149 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (immutable) */ __webpack_exports__["b"] = indexForItem;
/* unused harmony export reorderListForItem */
/* harmony export (immutable) */ __webpack_exports__["a"] = findReorderItem;
/**
* @hidden
*/
function indexForItem(element) {
return element['$ionIndex'];
}
/**
* @hidden
*/
function reorderListForItem(element) {
return element['$ionReorderList'];
}
/**
* @hidden
*/
function findReorderItem(node, listNode) {
var nested = 0;
while (node && nested < 4) {
if (indexForItem(node) !== undefined) {
if (listNode && node.parentNode !== listNode) {
return null;
}
return node;
}
node = node.parentNode;
nested++;
}
return null;
}
//# sourceMappingURL=item-reorder-util.js.map
/***/ }),
/* 150 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Chip; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ion__ = __webpack_require__(6);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name Chip
* @module ionic
* @description
* Chips represent complex entities in small blocks, such as a contact.
*
*
* @usage
*
* ```html
* <ion-chip>
* <ion-label>Default</ion-label>
* </ion-chip>
*
* <ion-chip>
* <ion-label color="secondary">Secondary Label</ion-label>
* </ion-chip>
*
* <ion-chip color="secondary">
* <ion-label color="dark">Secondary w/ Dark label</ion-label>
* </ion-chip>
*
* <ion-chip color="danger">
* <ion-label>Danger</ion-label>
* </ion-chip>
*
* <ion-chip>
* <ion-icon name="pin"></ion-icon>
* <ion-label>Default</ion-label>
* </ion-chip>
*
* <ion-chip>
* <ion-icon name="heart" color="dark"></ion-icon>
* <ion-label>Default</ion-label>
* </ion-chip>
*
* <ion-chip>
* <ion-avatar>
* <img src="assets/img/my-img.png">
* </ion-avatar>
* <ion-label>Default</ion-label>
* </ion-chip>
* ```
*
*
* @advanced
*
* ```html
* <ion-chip #chip1>
* <ion-label>Default</ion-label>
* <button ion-button clear color="light" (click)="delete(chip1)">
* <ion-icon name="close-circle"></ion-icon>
* </button>
* </ion-chip>
*
* <ion-chip #chip2>
* <ion-icon name="pin" color="primary"></ion-icon>
* <ion-label>With Icon</ion-label>
* <button ion-button (click)="delete(chip2)">
* <ion-icon name="close"></ion-icon>
* </button>
* </ion-chip>
*
* <ion-chip #chip3>
* <ion-avatar>
* <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAAAAACH5BAAAAAAALAAAAAABAAEAAAICTAEAOw==">
* </ion-avatar>
* <ion-label>With Avatar</ion-label>
* <button ion-button clear color="dark" (click)="delete(chip3)">
* <ion-icon name="close-circle"></ion-icon>
* </button>
* </ion-chip>
* ```
*
* ```ts
* @Component({
* templateUrl: 'main.html'
* })
* class E2EPage {
* delete(chip: Element) {
* chip.remove();
* }
* }
* ```
*
* @demo /docs/demos/src/chip/
**/
var Chip = (function (_super) {
__extends(Chip, _super);
function Chip(config, elementRef, renderer) {
return _super.call(this, config, elementRef, renderer, 'chip') || this;
}
Chip.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-chip'
},] },
];
/** @nocollapse */
Chip.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
]; };
return Chip;
}(__WEBPACK_IMPORTED_MODULE_2__ion__["a" /* Ion */]));
//# sourceMappingURL=chip.js.map
/***/ }),
/* 151 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DateTime; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_forms__ = __webpack_require__(16);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__picker_picker_controller__ = __webpack_require__(85);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_form__ = __webpack_require__(20);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__util_base_input__ = __webpack_require__(29);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__item_item__ = __webpack_require__(21);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__util_datetime_util__ = __webpack_require__(393);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
/**
* @name DateTime
* @description
* The DateTime component is used to present an interface which makes it easy for
* users to select dates and times. Tapping on `<ion-datetime>` will display a picker
* interface that slides up from the bottom of the page. The picker then displays
* scrollable columns that can be used to individually select years, months, days,
* hours and minute values. The DateTime component is similar to the native
* `<input type="datetime-local">` element, however, Ionic's DateTime component makes
* it easy to display the date and time in a preferred format, and manage the datetime
* values.
*
* ```html
* <ion-item>
* <ion-label>Date</ion-label>
* <ion-datetime displayFormat="MM/DD/YYYY" [(ngModel)]="myDate"></ion-datetime>
* </ion-item>
* ```
*
*
* ## Display and Picker Formats
*
* The DateTime component displays the values in two places: in the `<ion-datetime>`
* component, and in the interface that is presented from the bottom of the screen.
* The following chart lists all of the formats that can be used.
*
* | Format | Description | Example |
* |---------|--------------------------------|-------------------------|
* | `YYYY` | Year, 4 digits | `2018` |
* | `YY` | Year, 2 digits | `18` |
* | `M` | Month | `1` ... `12` |
* | `MM` | Month, leading zero | `01` ... `12` |
* | `MMM` | Month, short name | `Jan` |
* | `MMMM` | Month, full name | `January` |
* | `D` | Day | `1` ... `31` |
* | `DD` | Day, leading zero | `01` ... `31` |
* | `DDD` | Day, short name | `Fri` |
* | `DDDD` | Day, full name | `Friday` |
* | `H` | Hour, 24-hour | `0` ... `23` |
* | `HH` | Hour, 24-hour, leading zero | `00` ... `23` |
* | `h` | Hour, 12-hour | `1` ... `12` |
* | `hh` | Hour, 12-hour, leading zero | `01` ... `12` |
* | `a` | 12-hour time period, lowercase | `am` `pm` |
* | `A` | 12-hour time period, uppercase | `AM` `PM` |
* | `m` | Minute | `1` ... `59` |
* | `mm` | Minute, leading zero | `01` ... `59` |
* | `s` | Second | `1` ... `59` |
* | `ss` | Second, leading zero | `01` ... `59` |
* | `Z` | UTC Timezone Offset | `Z or +HH:mm or -HH:mm` |
*
* **Important**: See the [Month Names and Day of the Week Names](#month-names-and-day-of-the-week-names)
* section below on how to use different names for the month and day.
*
* ### Display Format
*
* The `displayFormat` input property specifies how a datetime's value should be
* printed, as formatted text, within the `ion-datetime` component.
*
* In the following example, the display in the `<ion-datetime>` will use the
* month's short name, the numerical day with a leading zero, a comma and the
* four-digit year. In addition to the date, it will display the time with the hours
* in the 24-hour format and the minutes. Any character can be used as a separator.
* An example display using this format is: `Jun 17, 2005 11:06`.
*
* ```html
* <ion-item>
* <ion-label>Date</ion-label>
* <ion-datetime displayFormat="MMM DD, YYYY HH:mm" [(ngModel)]="myDate"></ion-datetime>
* </ion-item>
* ```
*
* ### Picker Format
*
* The `pickerFormat` input property determines which columns should be shown in the
* interface, the order of the columns, and which format to use within each column.
* If the `pickerFormat` input is not provided then it will default to the `displayFormat`.
*
* In the following example, the display in the `<ion-datetime>` will use the
* `MM/YYYY` format, such as `06/2020`. However, the picker interface
* will display two columns with the month's long name, and the four-digit year.
*
* ```html
* <ion-item>
* <ion-label>Date</ion-label>
* <ion-datetime displayFormat="MM/YYYY" pickerFormat="MMMM YYYY" [(ngModel)]="myDate"></ion-datetime>
* </ion-item>
* ```
*
* ### Datetime Data
*
* Historically, handling datetime values within JavaScript, or even within HTML
* inputs, has always been a challenge. Specifically, JavaScript's `Date` object is
* notoriously difficult to correctly parse apart datetime strings or to format
* datetime values. Even worse is how different browsers and JavaScript versions
* parse various datetime strings differently, especially per locale.
*
* But no worries, all is not lost! Ionic's datetime input has been designed so
* developers can avoid the common pitfalls, allowing developers to easily format
* datetime values within the input, and give the user a simple datetime picker for a
* great user experience.
*
* ##### ISO 8601 Datetime Format: YYYY-MM-DDTHH:mmZ
*
* Ionic uses the [ISO 8601 datetime format](https://www.w3.org/TR/NOTE-datetime)
* for its value. The value is simply a string, rather than using JavaScript's `Date`
* object. Additionally, when using the ISO datetime format, it makes it easier
* to serialize and pass within JSON objects, and sending databases a standardized
* format which it can be easily parsed if need be.
*
* To create an ISO datetime string for the current date and time, e.g. use `const currentDate = (new Date()).toISOString();`.
*
* An ISO format can be used as a simple year, or just the hour and minute, or get more
* detailed down to the millisecond and timezone. Any of the ISO formats below can be used,
* and after a user selects a new value, Ionic will continue to use the same ISO format
* which datetime value was originally given as.
*
* | Description | Format | Datetime Value Example |
* |----------------------|------------------------|------------------------------|
* | Year | YYYY | 1994 |
* | Year and Month | YYYY-MM | 1994-12 |
* | Complete Date | YYYY-MM-DD | 1994-12-15 |
* | Date and Time | YYYY-MM-DDTHH:mm | 1994-12-15T13:47 |
* | UTC Timezone | YYYY-MM-DDTHH:mm:ssTZD | 1994-12-15T13:47:20.789Z |
* | Timezone Offset | YYYY-MM-DDTHH:mm:ssTZD | 1994-12-15T13:47:20.789+5:00 |
* | Hour and Minute | HH:mm | 13:47 |
* | Hour, Minute, Second | HH:mm:ss | 13:47:20 |
*
* Note that the year is always four-digits, milliseconds (if it's added) is always
* three-digits, and all others are always two-digits. So the number representing
* January always has a leading zero, such as `01`. Additionally, the hour is always
* in the 24-hour format, so `00` is `12am` on a 12-hour clock, `13` means `1pm`,
* and `23` means `11pm`.
*
* It's also important to note that neither the `displayFormat` or `pickerFormat` can
* set the datetime value's output, which is the value that is set by the component's
* `ngModel`. The format's are merely for displaying the value as text and the picker's
* interface, but the datetime's value is always persisted as a valid ISO 8601 datetime
* string.
*
*
* ## Min and Max Datetimes
*
* Dates are infinite in either direction, so for a user's selection there should be at
* least some form of restricting the dates that can be selected. By default, the maximum
* date is to the end of the current year, and the minimum date is from the beginning
* of the year that was 100 years ago.
*
* To customize the minimum and maximum datetime values, the `min` and `max` component
* inputs can be provided which may make more sense for the app's use-case, rather
* than the default of the last 100 years. Following the same IS0 8601 format listed
* in the table above, each component can restrict which dates can be selected by the
* user. Below is an example of restricting the date selection between the beginning
* of 2016, and October 31st of 2020:
*
* ```html
* <ion-item>
* <ion-label>Date</ion-label>
* <ion-datetime displayFormat="MMMM YYYY" min="2016" max="2020-10-31" [(ngModel)]="myDate">
* </ion-datetime>
* </ion-item>
* ```
*
*
* ## Month Names and Day of the Week Names
*
* At this time, there is no one-size-fits-all standard to automatically choose the correct
* language/spelling for a month name, or day of the week name, depending on the language
* or locale. Good news is that there is an
* [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat)
* standard which *most* browsers have adopted. However, at this time the standard has not
* been fully implemented by all popular browsers so Ionic is unavailable to take advantage
* of it *yet*. Additionally, Angular also provides an internationalization service, but it
* is still under heavy development so Ionic does not depend on it at this time.
*
* All things considered, the by far easiest solution is to just provide an array of names
* if the app needs to use names other than the default English version of month and day
* names. The month names and day names can be either configured at the app level, or
* individual `ion-datetime` level.
*
* ### App Config Level
*
* ```ts
* //app.module.ts
* @NgModule({
* ...,
* imports: [
* IonicModule.forRoot(MyApp, {
* monthNames: ['janeiro', 'fevereiro', 'mar\u00e7o', ... ],
* monthShortNames: ['jan', 'fev', 'mar', ... ],
* dayNames: ['domingo', 'segunda-feira', 'ter\u00e7a-feira', ... ],
* dayShortNames: ['dom', 'seg', 'ter', ... ],
* })
* ],
* ...
* })
* ```
*
* ### Component Input Level
*
* ```html
* <ion-item>
* <ion-label>Período</ion-label>
* <ion-datetime displayFormat="DDDD MMM D, YYYY" [(ngModel)]="myDate"
* monthNames="janeiro, fevereiro, mar\u00e7o, ..."
* monthShortNames="jan, fev, mar, ..."
* dayNames="domingo, segunda-feira, ter\u00e7a-feira, ..."
* dayShortNames="dom, seg, ter, ..."></ion-datetime>
* </ion-item>
* ```
*
*
* ### Advanced Datetime Validation and Manipulation
*
* The datetime picker provides the simplicity of selecting an exact format, and persists
* the datetime values as a string using the standardized
* [ISO 8601 datetime format](https://www.w3.org/TR/NOTE-datetime).
* However, it's important to note that `ion-datetime` does not attempt to solve all
* situtations when validating and manipulating datetime values. If datetime values need
* to be parsed from a certain format, or manipulated (such as adding 5 days to a date,
* subtracting 30 minutes, etc.), or even formatting data to a specific locale, then we highly
* recommend using [moment.js](http://momentjs.com/) to "Parse, validate, manipulate, and
* display dates in JavaScript". [Moment.js](http://momentjs.com/) has quickly become
* our goto standard when dealing with datetimes within JavaScript, but Ionic does not
* prepackage this dependency since most apps will not require it, and its locale
* configuration should be decided by the end-developer.
*
*
* @usage
* ```html
* <ion-item>
* <ion-label>Date</ion-label>
* <ion-datetime displayFormat="MM/DD/YYYY" [(ngModel)]="myDate">
* </ion-datetime>
* </ion-item>
* ```
*
*
* @demo /docs/demos/src/datetime/
*/
var DateTime = (function (_super) {
__extends(DateTime, _super);
function DateTime(form, config, elementRef, renderer, item, _pickerCtrl) {
var _this = _super.call(this, config, elementRef, renderer, 'datetime', {}, form, item, null) || this;
_this._pickerCtrl = _pickerCtrl;
_this._text = '';
_this._locale = {};
/**
* @input {string} The text to display on the picker's cancel button. Default: `Cancel`.
*/
_this.cancelText = 'Cancel';
/**
* @input {string} The text to display on the picker's "Done" button. Default: `Done`.
*/
_this.doneText = 'Done';
/**
* @input {any} Any additional options that the picker interface can accept.
* See the [Picker API docs](../../picker/Picker) for the picker options.
*/
_this.pickerOptions = {};
/**
* @input {string} The text to display when there's no date selected yet.
* Using lowercase to match the input attribute
*/
_this.placeholder = '';
/**
* @output {any} Emitted when the datetime selection was cancelled.
*/
_this.ionCancel = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
return _this;
}
/**
* @hidden
*/
DateTime.prototype.ngAfterContentInit = function () {
var _this = this;
// first see if locale names were provided in the inputs
// then check to see if they're in the config
// if neither were provided then it will use default English names
['monthNames', 'monthShortNames', 'dayNames', 'dayShortNames'].forEach(function (type) {
_this._locale[type] = convertToArrayOfStrings(Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["l" /* isPresent */])(_this[type]) ? _this[type] : _this._config.get(type), type);
});
this._initialize();
};
/**
* @hidden
*/
DateTime.prototype._inputNormalize = function (val) {
Object(__WEBPACK_IMPORTED_MODULE_8__util_datetime_util__["m" /* updateDate */])(this._value, val);
return this._value;
};
/**
* @hidden
*/
DateTime.prototype._inputUpdated = function () {
_super.prototype._inputUpdated.call(this);
this.updateText();
};
/**
* @hidden
*/
DateTime.prototype._inputShouldChange = function () {
return true;
};
/**
* TODO: REMOVE THIS
* @hidden
*/
DateTime.prototype._inputChangeEvent = function () {
return this.value;
};
/**
* @hidden
*/
DateTime.prototype._inputNgModelEvent = function () {
return Object(__WEBPACK_IMPORTED_MODULE_8__util_datetime_util__["b" /* convertDataToISO */])(this.value);
};
DateTime.prototype._click = function (ev) {
ev.preventDefault();
ev.stopPropagation();
this.open();
};
DateTime.prototype._keyup = function () {
this.open();
};
/**
* @hidden
*/
DateTime.prototype.open = function () {
var _this = this;
if (this.isFocus() || this._disabled) {
return;
}
(void 0) /* console.debug */;
// the user may have assigned some options specifically for the picker
var pickerOptions = __assign({}, this.pickerOptions);
// Add a cancel and done button by default to the picker
var defaultButtons = [{
text: this.cancelText,
role: 'cancel',
handler: function () { return _this.ionCancel.emit(_this); }
}, {
text: this.doneText,
handler: function (data) { return _this.value = data; },
}];
pickerOptions.buttons = (pickerOptions.buttons || []).concat(defaultButtons);
// Configure picker under the hood
var picker = this._picker = this._pickerCtrl.create(pickerOptions);
picker.ionChange.subscribe(function () {
_this.validate();
picker.refresh();
});
// Update picker status before presenting
this.generate();
this.validate();
// Present picker
this._fireFocus();
picker.present(pickerOptions);
picker.onDidDismiss(function () {
_this._fireBlur();
});
};
/**
* @hidden
*/
DateTime.prototype.generate = function () {
var _this = this;
var picker = this._picker;
// if a picker format wasn't provided, then fallback
// to use the display format
var template = this.pickerFormat || this.displayFormat || DEFAULT_FORMAT;
if (Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["l" /* isPresent */])(template)) {
// make sure we've got up to date sizing information
this.calcMinMax();
// does not support selecting by day name
// automaticallly remove any day name formats
template = template.replace('DDDD', '{~}').replace('DDD', '{~}');
if (template.indexOf('D') === -1) {
// there is not a day in the template
// replace the day name with a numeric one if it exists
template = template.replace('{~}', 'D');
}
// make sure no day name replacer is left in the string
template = template.replace(/{~}/g, '');
// parse apart the given template into an array of "formats"
Object(__WEBPACK_IMPORTED_MODULE_8__util_datetime_util__["j" /* parseTemplate */])(template).forEach(function (format) {
// loop through each format in the template
// create a new picker column to build up with data
var key = Object(__WEBPACK_IMPORTED_MODULE_8__util_datetime_util__["c" /* convertFormatToKey */])(format);
var values;
// first see if they have exact values to use for this input
if (Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["l" /* isPresent */])(_this[key + 'Values'])) {
// user provide exact values for this date part
values = convertToArrayOfNumbers(_this[key + 'Values'], key);
}
else {
// use the default date part values
values = Object(__WEBPACK_IMPORTED_MODULE_8__util_datetime_util__["f" /* dateValueRange */])(format, _this._min, _this._max);
}
var column = {
name: key,
selectedIndex: 0,
options: values.map(function (val) {
return {
value: val,
text: Object(__WEBPACK_IMPORTED_MODULE_8__util_datetime_util__["l" /* renderTextFormat */])(format, val, null, _this._locale),
};
})
};
// cool, we've loaded up the columns with options
// preselect the option for this column
var optValue = Object(__WEBPACK_IMPORTED_MODULE_8__util_datetime_util__["h" /* getValueFromFormat */])(_this.getValueOrDefault(), format);
var selectedIndex = column.options.findIndex(function (opt) { return opt.value === optValue; });
if (selectedIndex >= 0) {
// set the select index for this column's options
column.selectedIndex = selectedIndex;
}
// add our newly created column to the picker
picker.addColumn(column);
});
// Normalize min/max
var min_1 = this._min;
var max_1 = this._max;
var columns_1 = this._picker.getColumns();
['month', 'day', 'hour', 'minute']
.filter(function (name) { return !columns_1.find(function (column) { return column.name === name; }); })
.forEach(function (name) {
min_1[name] = 0;
max_1[name] = 0;
});
this.divyColumns();
}
};
/**
* @hidden
*/
DateTime.prototype.validateColumn = function (name, index, min, max, lowerBounds, upperBounds) {
(void 0) /* assert */;
(void 0) /* assert */;
var column = this._picker.getColumn(name);
if (!column) {
return 0;
}
var lb = lowerBounds.slice();
var ub = upperBounds.slice();
var options = column.options;
var indexMin = options.length - 1;
var indexMax = 0;
for (var i = 0; i < options.length; i++) {
var opt = options[i];
var value = opt.value;
lb[index] = opt.value;
ub[index] = opt.value;
var disabled = opt.disabled = (value < lowerBounds[index] ||
value > upperBounds[index] ||
Object(__WEBPACK_IMPORTED_MODULE_8__util_datetime_util__["e" /* dateSortValue */])(ub[0], ub[1], ub[2], ub[3], ub[4]) < min ||
Object(__WEBPACK_IMPORTED_MODULE_8__util_datetime_util__["e" /* dateSortValue */])(lb[0], lb[1], lb[2], lb[3], lb[4]) > max);
if (!disabled) {
indexMin = Math.min(indexMin, i);
indexMax = Math.max(indexMax, i);
}
}
var selectedIndex = column.selectedIndex = Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["a" /* clamp */])(indexMin, column.selectedIndex, indexMax);
opt = column.options[selectedIndex];
if (opt) {
return opt.value;
}
return 0;
};
/**
* @private
*/
DateTime.prototype.validate = function () {
var today = new Date();
var minCompareVal = Object(__WEBPACK_IMPORTED_MODULE_8__util_datetime_util__["d" /* dateDataSortValue */])(this._min);
var maxCompareVal = Object(__WEBPACK_IMPORTED_MODULE_8__util_datetime_util__["d" /* dateDataSortValue */])(this._max);
var yearCol = this._picker.getColumn('year');
(void 0) /* assert */;
var selectedYear = today.getFullYear();
if (yearCol) {
// default to the first value if the current year doesn't exist in the options
if (!yearCol.options.find(function (col) { return col.value === today.getFullYear(); })) {
selectedYear = yearCol.options[0].value;
}
var yearOpt = yearCol.options[yearCol.selectedIndex];
if (yearOpt) {
// they have a selected year value
selectedYear = yearOpt.value;
}
}
var selectedMonth = this.validateColumn('month', 1, minCompareVal, maxCompareVal, [selectedYear, 0, 0, 0, 0], [selectedYear, 12, 31, 23, 59]);
var numDaysInMonth = Object(__WEBPACK_IMPORTED_MODULE_8__util_datetime_util__["g" /* daysInMonth */])(selectedMonth, selectedYear);
var selectedDay = this.validateColumn('day', 2, minCompareVal, maxCompareVal, [selectedYear, selectedMonth, 0, 0, 0], [selectedYear, selectedMonth, numDaysInMonth, 23, 59]);
var selectedHour = this.validateColumn('hour', 3, minCompareVal, maxCompareVal, [selectedYear, selectedMonth, selectedDay, 0, 0], [selectedYear, selectedMonth, selectedDay, 23, 59]);
this.validateColumn('minute', 4, minCompareVal, maxCompareVal, [selectedYear, selectedMonth, selectedDay, selectedHour, 0], [selectedYear, selectedMonth, selectedDay, selectedHour, 59]);
};
/**
* @hidden
*/
DateTime.prototype.divyColumns = function () {
var pickerColumns = this._picker.getColumns();
var columnsWidth = [];
var col;
var width;
for (var i = 0; i < pickerColumns.length; i++) {
col = pickerColumns[i];
columnsWidth.push(0);
for (var j = 0; j < col.options.length; j++) {
width = col.options[j].text.length;
if (width > columnsWidth[i]) {
columnsWidth[i] = width;
}
}
}
if (columnsWidth.length === 2) {
width = Math.max(columnsWidth[0], columnsWidth[1]);
pickerColumns[0].align = 'right';
pickerColumns[1].align = 'left';
pickerColumns[0].optionsWidth = pickerColumns[1].optionsWidth = width * 17 + "px";
}
else if (columnsWidth.length === 3) {
width = Math.max(columnsWidth[0], columnsWidth[2]);
pickerColumns[0].align = 'right';
pickerColumns[1].columnWidth = columnsWidth[1] * 17 + "px";
pickerColumns[0].optionsWidth = pickerColumns[2].optionsWidth = width * 17 + "px";
pickerColumns[2].align = 'left';
}
};
/**
* @hidden
*/
DateTime.prototype.updateText = function () {
// create the text of the formatted data
var template = this.displayFormat || this.pickerFormat || DEFAULT_FORMAT;
this._text = Object(__WEBPACK_IMPORTED_MODULE_8__util_datetime_util__["k" /* renderDateTime */])(template, this.getValue(), this._locale);
};
/**
* @hidden
*/
DateTime.prototype.getValue = function () {
return this._value;
};
/**
* @hidden
*/
DateTime.prototype.getValueOrDefault = function () {
if (this.hasValue()) {
return this._value;
}
var initialDateString = this.getDefaultValueDateString();
var _default = {};
Object(__WEBPACK_IMPORTED_MODULE_8__util_datetime_util__["m" /* updateDate */])(_default, initialDateString);
return _default;
};
/**
* Get the default value as a date string
* @hidden
*/
DateTime.prototype.getDefaultValueDateString = function () {
if (this.initialValue) {
return this.initialValue;
}
var nowString = (new Date).toISOString();
if (this.max) {
var now = Object(__WEBPACK_IMPORTED_MODULE_8__util_datetime_util__["i" /* parseDate */])(nowString);
var max = Object(__WEBPACK_IMPORTED_MODULE_8__util_datetime_util__["i" /* parseDate */])(this.max);
var v = void 0;
for (var i in max) {
v = max[i];
if (v === null) {
max[i] = now[i];
}
}
var diff = Object(__WEBPACK_IMPORTED_MODULE_8__util_datetime_util__["a" /* compareDates */])(now, max);
// If max is before current time, return max
if (diff > 0) {
return this.max;
}
}
return nowString;
};
/**
* @hidden
*/
DateTime.prototype.hasValue = function () {
var val = this._value;
return Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["l" /* isPresent */])(val)
&& Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["k" /* isObject */])(val)
&& Object.keys(val).length > 0;
};
/**
* @hidden
*/
DateTime.prototype.calcMinMax = function (now) {
var todaysYear = (now || new Date()).getFullYear();
if (Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["l" /* isPresent */])(this.yearValues)) {
var years = convertToArrayOfNumbers(this.yearValues, 'year');
if (Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["f" /* isBlank */])(this.min)) {
this.min = Math.min.apply(Math, years);
}
if (Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["f" /* isBlank */])(this.max)) {
this.max = Math.max.apply(Math, years);
}
}
else {
if (Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["f" /* isBlank */])(this.min)) {
this.min = (todaysYear - 100).toString();
}
if (Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["f" /* isBlank */])(this.max)) {
this.max = todaysYear.toString();
}
}
var min = this._min = Object(__WEBPACK_IMPORTED_MODULE_8__util_datetime_util__["i" /* parseDate */])(this.min);
var max = this._max = Object(__WEBPACK_IMPORTED_MODULE_8__util_datetime_util__["i" /* parseDate */])(this.max);
min.year = min.year || todaysYear;
max.year = max.year || todaysYear;
min.month = min.month || 1;
max.month = max.month || 12;
min.day = min.day || 1;
max.day = max.day || 31;
min.hour = min.hour || 0;
max.hour = max.hour || 23;
min.minute = min.minute || 0;
max.minute = max.minute || 59;
min.second = min.second || 0;
max.second = max.second || 59;
// Ensure min/max constraits
if (min.year > max.year) {
console.error('min.year > max.year');
min.year = max.year - 100;
}
if (min.year === max.year) {
if (min.month > max.month) {
console.error('min.month > max.month');
min.month = 1;
}
else if (min.month === max.month && min.day > max.day) {
console.error('min.day > max.day');
min.day = 1;
}
}
};
DateTime.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-datetime',
template: '<div *ngIf="!_text" class="datetime-text datetime-placeholder">{{placeholder}}</div>' +
'<div *ngIf="_text" class="datetime-text">{{_text}}</div>' +
'<button aria-haspopup="true" ' +
'type="button" ' +
'[id]="id" ' +
'ion-button="item-cover" ' +
'[attr.aria-labelledby]="_labelId" ' +
'[attr.aria-disabled]="_disabled" ' +
'class="item-cover">' +
'</button>',
host: {
'[class.datetime-disabled]': '_disabled'
},
providers: [{ provide: __WEBPACK_IMPORTED_MODULE_1__angular_forms__["c" /* NG_VALUE_ACCESSOR */], useExisting: DateTime, multi: true }],
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
},] },
];
/** @nocollapse */
DateTime.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_4__util_form__["a" /* Form */], },
{ type: __WEBPACK_IMPORTED_MODULE_2__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_6__item_item__["a" /* Item */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_3__picker_picker_controller__["a" /* PickerController */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
]; };
DateTime.propDecorators = {
'min': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'max': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'displayFormat': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'initialValue': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'pickerFormat': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'cancelText': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'doneText': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'yearValues': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'monthValues': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'dayValues': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'hourValues': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'minuteValues': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'monthNames': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'monthShortNames': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'dayNames': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'dayShortNames': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'pickerOptions': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'placeholder': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'ionCancel': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'_click': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* HostListener */], args: ['click', ['$event'],] },],
'_keyup': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* HostListener */], args: ['keyup.space',] },],
};
return DateTime;
}(__WEBPACK_IMPORTED_MODULE_5__util_base_input__["a" /* BaseInput */]));
/**
* @hidden
* Use to convert a string of comma separated numbers or
* an array of numbers, and clean up any user input
*/
function convertToArrayOfNumbers(input, type) {
if (Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["n" /* isString */])(input)) {
// convert the string to an array of strings
// auto remove any whitespace and [] characters
input = input.replace(/\[|\]|\s/g, '').split(',');
}
var values;
if (Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["e" /* isArray */])(input)) {
// ensure each value is an actual number in the returned array
values = input
.map(function (num) { return parseInt(num, 10); })
.filter(isFinite);
}
if (!values || !values.length) {
console.warn("Invalid \"" + type + "Values\". Must be an array of numbers, or a comma separated string of numbers.");
}
return values;
}
/**
* @hidden
* Use to convert a string of comma separated strings or
* an array of strings, and clean up any user input
*/
function convertToArrayOfStrings(input, type) {
if (Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["l" /* isPresent */])(input)) {
if (Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["n" /* isString */])(input)) {
// convert the string to an array of strings
// auto remove any [] characters
input = input.replace(/\[|\]/g, '').split(',');
}
var values;
if (Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["e" /* isArray */])(input)) {
// trim up each string value
values = input.map(function (val) { return val.trim(); });
}
if (!values || !values.length) {
console.warn("Invalid \"" + type + "Names\". Must be an array of strings, or a comma separated string.");
}
return values;
}
}
var DEFAULT_FORMAT = 'MMM D, YYYY';
//# sourceMappingURL=datetime.js.map
/***/ }),
/* 152 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Picker; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__picker_component__ = __webpack_require__(86);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__picker_transitions__ = __webpack_require__(392);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__navigation_view_controller__ = __webpack_require__(7);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
*/
var Picker = (function (_super) {
__extends(Picker, _super);
function Picker(app, opts, config) {
if (opts === void 0) { opts = {}; }
var _this = this;
if (!opts) {
opts = {};
}
opts.columns = opts.columns || [];
opts.buttons = opts.buttons || [];
opts.enableBackdropDismiss = Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["l" /* isPresent */])(opts.enableBackdropDismiss) ? Boolean(opts.enableBackdropDismiss) : true;
_this = _super.call(this, __WEBPACK_IMPORTED_MODULE_2__picker_component__["a" /* PickerCmp */], opts, null) || this;
_this._app = app;
_this.isOverlay = true;
_this.ionChange = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
config.setTransition('picker-slide-in', __WEBPACK_IMPORTED_MODULE_3__picker_transitions__["a" /* PickerSlideIn */]);
config.setTransition('picker-slide-out', __WEBPACK_IMPORTED_MODULE_3__picker_transitions__["b" /* PickerSlideOut */]);
return _this;
}
/**
* @hidden
*/
Picker.prototype.getTransitionName = function (direction) {
var key = (direction === 'back' ? 'pickerLeave' : 'pickerEnter');
return this._nav && this._nav.config.get(key);
};
/**
* @param {any} button Picker toolbar button
*/
Picker.prototype.addButton = function (button) {
this.data.buttons.push(button);
};
/**
* @param {PickerColumn} column Picker toolbar button
*/
Picker.prototype.addColumn = function (column) {
this.data.columns.push(column);
};
Picker.prototype.getColumns = function () {
return this.data.columns;
};
Picker.prototype.getColumn = function (name) {
return this.getColumns().find(function (column) { return column.name === name; });
};
Picker.prototype.refresh = function () {
(void 0) /* assert */;
(void 0) /* assert */;
this._cmp && this._cmp.instance.refresh && this._cmp.instance.refresh();
};
/**
* @param {string} cssClass CSS class name to add to the picker's outer wrapper.
*/
Picker.prototype.setCssClass = function (cssClass) {
this.data.cssClass = cssClass;
};
/**
* Present the picker instance.
*
* @param {NavOptions} [navOptions={}] Nav options to go with this transition.
* @returns {Promise} Returns a promise which is resolved when the transition has completed.
*/
Picker.prototype.present = function (navOptions) {
if (navOptions === void 0) { navOptions = {}; }
return this._app.present(this, navOptions);
};
Picker.propDecorators = {
'ionChange': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
};
return Picker;
}(__WEBPACK_IMPORTED_MODULE_4__navigation_view_controller__["a" /* ViewController */]));
//# sourceMappingURL=picker.js.map
/***/ }),
/* 153 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FabContainer; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__platform_platform__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__gestures_ui_event_manager__ = __webpack_require__(28);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__fab__ = __webpack_require__(56);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__fab_list__ = __webpack_require__(88);
/**
* @name FabContainer
* @module ionic
*
* @description
* `<ion-fab>` is not a FAB button by itself but a container that assist the fab button (`<button ion-fab>`) allowing it
* to be placed in fixed position that does not scroll with the content. It is also used to implement "material design speed dial",
* ie. a FAB buttons displays a small lists of related actions when clicked.
*
* @property [top] - Places the container on the top of the content
* @property [bottom] - Places the container on the bottom of the content
* @property [left] - Places the container on the left
* @property [right] - Places the container on the right
* @property [middle] - Places the container on the middle vertically
* @property [center] - Places the container on the center horizontally
* @property [edge] - Used to place the container between the content and the header/footer
*
* @usage
*
* ```html
* <!-- this fab is placed at top right -->
* <ion-content>
* <ion-fab top right>
* <button ion-fab>Button</button>
* </ion-fab>
*
* <!-- this fab is placed at the center of the content viewport -->
* <ion-fab center middle>
* <button ion-fab>Button</button>
* </ion-fab>
* </ion-content>
* ```
*
* Ionic's FAB also supports "material design's fab speed dial". It is a normal fab button
* that shows a list of related actions when clicked.
*
* The same `ion-fab` container can contain several `ion-fab-list` with different side values:
* `top`, `bottom`, `left` and `right`. For example, if you want to have a list of button that are
* on the top of the main button, you should use `side="top"` and so on. By default, if side is ommited, `side="bottom"`.
*
* ```html
* <ion-content>
* <!-- this fab is placed at bottom right -->
* <ion-fab bottom right >
* <button ion-fab>Share</button>
* <ion-fab-list side="top">
* <button ion-fab>Facebook</button>
* <button ion-fab>Twitter</button>
* <button ion-fab>Youtube</button>
* </ion-fab-list>
* <ion-fab-list side="left">
* <button ion-fab>Vimeo</button>
* </ion-fab-list>
* </ion-fab>
* </ion-content>
* ```
*
* A FAB speed dial can also be closed programatically.
*
* ```html
* <ion-content>
* <ion-fab bottom right #fab>
* <button ion-fab>Share</button>
* <ion-fab-list side="top">
* <button ion-fab (click)="share('facebook', fab)">Facebook</button>
* <button ion-fab (click)="share('twitter', fab)">Twitter</button>
* </ion-fab-list>
* </ion-fab>
* </ion-content>
* ```
*
* ```ts
* share(socialNet: string, fab: FabContainer) {
* fab.close();
* console.log("Sharing in", socialNet);
* }
* ```
*
* @demo /docs/demos/src/fab/
* @see {@link /docs/components#fabs FAB Component Docs}
*/
var FabContainer = (function () {
function FabContainer(plt) {
/**
* @hidden
*/
this._listsActive = false;
this._events = new __WEBPACK_IMPORTED_MODULE_2__gestures_ui_event_manager__["a" /* UIEventManager */](plt);
}
/**
* @hidden
*/
FabContainer.prototype.ngAfterContentInit = function () {
var mainButton = this._mainButton;
if (!mainButton || !mainButton.getNativeElement()) {
console.error('FAB container needs a main <button ion-fab>');
return;
}
this._events.listen(mainButton.getNativeElement(), 'click', this.clickHandler.bind(this), { zone: true });
};
/**
* @hidden
*/
FabContainer.prototype.clickHandler = function (ev) {
if (this.canActivateList(ev)) {
this.toggleList();
}
};
/**
* @hidden
*/
FabContainer.prototype.canActivateList = function (ev) {
if (this._fabLists.length > 0 && this._mainButton && ev.target) {
var ele = ev.target.closest('ion-fab>[ion-fab]');
return (ele && ele === this._mainButton.getNativeElement());
}
return false;
};
/**
* @hidden
*/
FabContainer.prototype.toggleList = function () {
this.setActiveLists(!this._listsActive);
};
/**
* @hidden
*/
FabContainer.prototype.setActiveLists = function (isActive) {
if (isActive === this._listsActive) {
return;
}
var lists = this._fabLists.toArray();
for (var _i = 0, lists_1 = lists; _i < lists_1.length; _i++) {
var list = lists_1[_i];
list.setVisible(isActive);
}
this._mainButton.setActiveClose(isActive);
this._listsActive = isActive;
};
/**
* Close an active FAB list container
*/
FabContainer.prototype.close = function () {
this.setActiveLists(false);
};
/**
* @hidden
*/
FabContainer.prototype.ngOnDestroy = function () {
this._events.destroy();
};
FabContainer.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-fab',
template: '<ng-content></ng-content>'
},] },
];
/** @nocollapse */
FabContainer.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__platform_platform__["a" /* Platform */], },
]; };
FabContainer.propDecorators = {
'_mainButton': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* ContentChild */], args: [__WEBPACK_IMPORTED_MODULE_3__fab__["a" /* FabButton */],] },],
'_fabLists': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["r" /* ContentChildren */], args: [__WEBPACK_IMPORTED_MODULE_4__fab_list__["a" /* FabList */],] },],
};
return FabContainer;
}());
//# sourceMappingURL=fab-container.js.map
/***/ }),
/* 154 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Col; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/**
* @name Col
* @module ionic
* @description
*
* Columns are cellular components of the [grid](../Grid) system and go inside of a [row](../Row).
* They will expand to fill their row. All content within a grid should go inside of a column.
*
* ## Column attributes
*
* By default, columns will stretch to fill the entire height of the row.
* There are several attributes that can be added to a column to customize this behavior.
*
* | Property | Description |
* |-----------------------|-------------------------------------------------------------------------------------------------------------|
* | align-self-start | Adds `align-self: flex-start`. The column will be vertically aligned at the top. |
* | align-self-center | Adds `align-self: center`. The column will be vertically aligned in the center. |
* | align-self-end | Adds `align-self: flex-end`. The column will be vertically aligned at the bottom. |
* | align-self-stretch | Adds `align-self: stretch`. The column will be stretched to take up the entire height of the row. |
* | align-self-baseline | Adds `align-self: baseline`. The column will be vertically aligned at its baseline. |
*
*
*/
var Col = (function () {
function Col() {
}
Col.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-col, [ion-col]',
host: {
'class': 'col'
}
},] },
];
/** @nocollapse */
Col.ctorParameters = function () { return []; };
return Col;
}());
//# sourceMappingURL=col.js.map
/***/ }),
/* 155 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Grid; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/**
* @name Grid
* @module ionic
* @description
*
* The grid is a powerful mobile-first flexbox system for building custom layouts.
* It is heavily influenced by [Bootstrap's grid system](http://v4-alpha.getbootstrap.com/layout/grid/).
*
* The grid is composed of three units — a grid, row(s) and column(s). Columns will expand to fill their
* row, and will resize to fit additional columns. It is based on a 12 column layout with different
* breakpoints based on the screen size. The number of columns and breakpoints can be fully customized
* using Sass.
*
* - [How it works](#how-it-works)
* - [Grid size](#grid-size)
* - [Grid attributes](#grid-attributes)
* - [Default breakpoints](#default-breakpoints)
* - [Auto-layout columns](#auto-layout-columns)
* - [Equal-width](#equal-width)
* - [Setting one column width](#setting-one-column-width)
* - [Variable-width](#variable-width)
* - [Responsive attributes](#responsive-attributes)
* - [All breakpoints](#all-breakpoints)
* - [Stacked to horizontal](#stacked-to-horizontal)
* - [Reordering](#reordering)
* - [Offsetting columns](#offsetting-columns)
* - [Push and pull](#push-and-pull)
* - [Alignment](#alignment)
* - [Vertical Alignment](#vertical-alignment)
* - [Horizontal Alignment](#horizontal-alignment)
* - [Customizing the grid](#customizing-the-grid)
* - [Number of columns and padding](#number-of-columns-and-padding)
* - [Grid tiers](#grid-tiers)
*
*
* ## How it works
*
* The grid is a mobile-first system made up of any number of rows and columns.
* It is built with flexbox making it extremely responsive. The components that
* make up the grid can be written as an element (e.g., `<ion-grid>`) or added as
* an attribute to any element (e.g., `<div ion-row>`).
*
* Here's how it works:
*
* - Grids act as a container for all rows and columns. Grids take up the full width of their container,
* but adding the `fixed` attribute will specify the width per screen size, see [grid size](#grid-size) below.
* - Rows are horizontal groups of columns that line the columns up properly.
* - Content should be placed within columns, and only columns may be immediate children of rows.
* - Grid columns without a specified width will automatically have equal widths.
* For example, four instances of `col-sm` will each automatically be 25% wide for small breakpoints.
* - Column attributes indicate the number of columns to use out of the default 12 per row.
* So, `col-4` can be added in order to have three equal-width columns.
* - Column widths are set as a percentage, so they’re always fluid and sized relative to their parent element.
* - Columns have padding between individual columns, however, the padding can be removed from the grid and
* columns by adding `no-padding` on the grid.
* - There are five grid tiers by default, one for each responsive breakpoint: all breakpoints (extra small),
* small, medium, large, and extra large.
* - Grid tiers are based on minimum widths, meaning they apply to their tier and all those larger than it
* (e.g., `col-sm-4` applies to small, medium, large, and extra large devices).
* - Grids can easily be customized via Sass variables. See [customizing the grid](#customizing-the-grid).
*
* There are some [known bugs with flexbox](https://github.com/philipwalton/flexbugs) that
* should be checked prior to creating issues with Ionic.
*
* ## Grid size
*
* By default, the grid will take up 100% width. To set a maximum width based on the screen
* size add the `fixed` attribute. The maximum width of the grid for each breakpoint is defined
* in the `$grid-max-widths` Sass variable. For more information, see
* [customizing the grid](#customizing-the-grid).
*
* | Name | Value | Description |
* |----------|----------|-----------------------------------------------------|
* | xs | auto | Don't set the grid width for xs screens |
* | sm | 540px | Set grid width to 540px when (min-width: 576px) |
* | md | 720px | Set grid width to 720px when (min-width: 768px) |
* | lg | 960px | Set grid width to 960px when (min-width: 992px) |
* | xl | 1140px | Set grid width to 1140px when (min-width: 1200px) |
*
*
* ## Grid attributes
*
* The grid takes up full width and has padding added to it based on the screen size. There are two
* attributes that can be used to adjust this behavior.
*
* | Property | Description |
* |-----------------|-------------------------------------------------------------------------------------------------------------------|
* | no-padding | Removes padding from the grid and immediate children columns. |
* | fixed | Set a max width based on the screen size. |
*
*
* ## Default breakpoints
*
* The default breakpoints are defined by the `$grid-breakpoints` Sass variable. It can be
* customized to use different values for the breakpoint, rename and add/remove breakpoints.
* For more information, see [customizing the grid](#customizing-the-grid).
*
* | Name | Value | Width Prefix | Offset Prefix | Push Prefix | Pull Prefix | Description |
* |----------|----------|--------------|---------------|--------------|-------------|---------------------------------------------------|
* | xs | 0 | `col-` | `offset-` | `push-` | `pull-` | Set columns when (min-width: 0) |
* | sm | 576px | `col-sm-` | `offset-sm-` | `push-sm-` | `pull-sm-` | Set columns when (min-width: 576px) |
* | md | 768px | `col-md-` | `offset-md-` | `push-md-` | `pull-md-` | Set columns when (min-width: 768px) |
* | lg | 992px | `col-lg-` | `offset-lg-` | `push-lg-` | `pull-lg-` | Set columns when (min-width: 992px) |
* | xl | 1200px | `col-xl-` | `offset-xl-` | `push-xl-` | `pull-xl-` | Set columns when (min-width: 1200px) |
*
* _Note: the first breakpoint must have the value set to 0 and all breakpoint values must be in
* ascending order._
*
* ## Auto-layout columns
*
* ### Equal-width
*
* By default, columns will take up equal width inside of a row for all devices and screen sizes.
*
* ```
* <ion-grid>
* <ion-row>
* <ion-col>
* 1 of 2
* </ion-col>
* <ion-col>
* 2 of 2
* </ion-col>
* </ion-row>
* <ion-row>
* <ion-col>
* 1 of 3
* </ion-col>
* <ion-col>
* 2 of 3
* </ion-col>
* <ion-col>
* 3 of 3
* </ion-col>
* </ion-row>
* </ion-grid>
* ```
*
* ### Setting one column width
*
* Set the width of one column and the others will automatically resize around it.
* This can be done using our predefined grid attributes. In the example below,
* the other columns will resize no matter the width of the center column.
*
* ```
* <ion-grid>
* <ion-row>
* <ion-col>
* 1 of 3
* </ion-col>
* <ion-col col-8>
* 2 of 3 (wider)
* </ion-col>
* <ion-col>
* 3 of 3
* </ion-col>
* </ion-row>
* <ion-row>
* <ion-col>
* 1 of 3
* </ion-col>
* <ion-col col-6>
* 2 of 3 (wider)
* </ion-col>
* <ion-col>
* 3 of 3
* </ion-col>
* </ion-row>
* </ion-grid>
* ```
*
* ### Variable-width
*
* Using the `col-{breakpoint}-auto` attributes, the column can size itself based on the
* natural width of its content. This is extremely useful for setting a column width
* using pixels. The columns next to the variable-width column will resize to fill the row.
*
* ```
* <ion-grid>
* <ion-row>
* <ion-col>
* 1 of 3
* </ion-col>
* <ion-col col-auto>
* Variable width content
* </ion-col>
* <ion-col>
* 3 of 3
* </ion-col>
* </ion-row>
* <ion-row>
* <ion-col>
* 1 of 4
* </ion-col>
* <ion-col>
* 2 of 4
* </ion-col>
* <ion-col col-auto>
* <ion-input placeholder="Variable width input"></ion-input>
* </ion-col>
* <ion-col>
* 4 of 4
* </ion-col>
* </ion-row>
* </ion-grid>
* ```
*
*
* ## Responsive attributes
*
* ### All breakpoints
*
* To customize a column's width for all devices and screens, add the `col-*`
* attribute. These attributes tell the column to take up `*` columns out
* of the available columns.
*
* ```
* <ion-grid>
* <ion-row>
* <ion-col col-4>
* 1 of 4
* </ion-col>
* <ion-col col-2>
* 2 of 4
* </ion-col>
* <ion-col col-2>
* 3 of 4
* </ion-col>
* <ion-col col-4>
* 4 of 4
* </ion-col>
* </ion-row>
* </ion-grid>
* ```
*
* ### Stacked to horizontal
*
* Use a combination of width and breakpoint attributes to create a grid that starts out stacked
* on extra small screens before becoming horizontal on small screens.
*
* ```
* <ion-grid>
* <ion-row>
* <ion-col col-12 col-sm>
* 1 of 4
* </ion-col>
* <ion-col col-12 col-sm>
* 2 of 4
* </ion-col>
* <ion-col col-12 col-sm>
* 3 of 4
* </ion-col>
* <ion-col col-12 col-sm>
* 4 of 4
* </ion-col>
* </ion-row>
* </ion-grid>
* ```
*
*
* ## Reordering
*
* ### Offsetting columns
*
* Move columns to the right by adding the `offset-*` attributes. These attributes
* increase the margin start of the column by `*` columns. For example, in the following
* grid the last column will be offset by 3 columns and take up 3 columns:
*
* ```
* <ion-grid>
* <ion-row>
* <ion-col col-3>
* 1 of 2
* </ion-col>
* <ion-col col-3 offset-3>
* 2 of 2
* </ion-col>
* </ion-row>
* </ion-grid>
* ```
*
* Offsets can also be added based on screen breakpoints. Here's an example of a
* grid where the last column will be offset by 3 columns for `md` screens and up:
*
* ```
* <ion-grid>
* <ion-row>
* <ion-col col-md-3>
* 1 of 3
* </ion-col>
* <ion-col col-md-3>
* 2 of 3
* </ion-col>
* <ion-col col-md-3 offset-md-3>
* 3 of 3
* </ion-col>
* </ion-row>
* </ion-grid>
* ```
*
* ### Push and pull
*
* Reorder the columns by adding the `push-*` and `pull-*` attributes. These attributes
* adjust the `left` and `right` of the columns by `*` columns making it easy to reorder
* columns. For example, in the following grid the column with the `1st col` description
* will actually be the last column and the `2nd col` will be the first column.
*
* ```
* <ion-grid>
* <ion-row>
* <ion-col col-9 push-3>
* 1 of 2
* </ion-col>
* <ion-col col-3 pull-9>
* 2 of 2
* </ion-col>
* </ion-row>
* </ion-grid>
* ```
*
* Push and pull can also be added based on screen breakpoints. In the following example,
* the column with the `3rd` column description will actually be the first column for
* `md` screens and up:
*
* ```
* <ion-grid>
* <ion-row>
* <ion-col col-md-6 push-md-3>
* 1 of 3
* </ion-col>
* <ion-col col-md-3 push-md-3>
* 2 of 3
* </ion-col>
* <ion-col col-md-3 pull-md-9>
* 3 of 3
* </ion-col>
* </ion-row>
* </ion-grid>
* ```
*
*
* ## Alignment
*
* ### Vertical alignment
*
* All columns can be vertically aligned inside of a row by adding different
* attributes to the row. For a list of available attributes, see
* [row attributes](../Row#row-attributes).
*
* ```
* <ion-grid>
* <ion-row align-items-start>
* <ion-col>
* 1 of 4
* </ion-col>
* <ion-col>
* 2 of 4
* </ion-col>
* <ion-col>
* 3 of 4
* </ion-col>
* <ion-col>
* 4 of 4 <br>#<br>#<br>#
* </ion-col>
* </ion-row>
*
* <ion-row align-items-center>
* <ion-col>
* 1 of 4
* </ion-col>
* <ion-col>
* 2 of 4
* </ion-col>
* <ion-col>
* 3 of 4
* </ion-col>
* <ion-col>
* 4 of 4 <br>#<br>#<br>#
* </ion-col>
* </ion-row>
*
* <ion-row align-items-end>
* <ion-col>
* 1 of 4
* </ion-col>
* <ion-col>
* 2 of 4
* </ion-col>
* <ion-col>
* 3 of 4
* </ion-col>
* <ion-col>
* 4 of 4 <br>#<br>#<br>#
* </ion-col>
* </ion-row>
* </ion-grid>
* ```
*
* Columns can also align themselves differently than other columns by
* adding the alignment attribute directly to the column. For a list of available
* attributes, see [column attributes](../Col#column-attributes).
*
* ```
* <ion-grid>
* <ion-row>
* <ion-col align-self-start>
* <div>
* 1 of 4
* </div>
* </ion-col>
* <ion-col align-self-center>
* <div>
* 2 of 4
* </div>
* </ion-col>
* <ion-col align-self-end>
* <div>
* 3 of 4
* </div>
* </ion-col>
* <ion-col>
* <div>
* 4 of 4 <br>#<br>#<br>#
* </div>
* </ion-col>
* </ion-row>
* </ion-grid>
* ```
*
* ### Horizontal alignment
*
* All columns can be horizontally aligned inside of a row by adding different
* attributes to the row. For a list of available attributes, see
* [row attributes](../Row#row-attributes).
*
* ```
* <ion-grid>
* <ion-row justify-content-start>
* <ion-col col-3>
* 1 of 2
* </ion-col>
* <ion-col col-3>
* 2 of 2
* </ion-col>
* </ion-row>
*
* <ion-row justify-content-center>
* <ion-col col-3>
* 1 of 2
* </ion-col>
* <ion-col col-3>
* 2 of 2
* </ion-col>
* </ion-row>
*
* <ion-row justify-content-end>
* <ion-col col-3>
* 1 of 2
* </ion-col>
* <ion-col col-3>
* 2 of 2
* </ion-col>
* </ion-row>
*
* <ion-row justify-content-around>
* <ion-col col-3>
* 1 of 2
* </ion-col>
* <ion-col col-3>
* 2 of 2
* </ion-col>
* </ion-row>
*
* <ion-row justify-content-between>
* <ion-col col-3>
* 1 of 2
* </ion-col>
* <ion-col col-3>
* 2 of 2
* </ion-col>
* </ion-row>
* </ion-grid>
* ```
*
*
* ## Customizing the grid
*
* Using our built-in grid Sass variables and maps, it’s possible to completely customize
* the predefined grid attributes. Change the number of breakpoints, the media query values,
* the number of columns, and more.
*
* ### Number of columns and padding
*
* The number of grid columns and their padding can be modified via Sass variables.
* `$grid-columns` is used to generate the widths (in percent) of each individual column.
* `$grid-padding-width` is used for the padding on the grid, while `$grid-padding-widths`
* allows breakpoint-specific widths that are divided evenly across `padding-left` and
* `padding-right` as well as `padding-top` and `padding-bottom` of the grid and columns.
*
* ```
* $grid-columns: 12 !default;
*
* $grid-padding-width: 10px !default;
*
* $grid-padding-widths: (
* xs: $grid-padding-width,
* sm: $grid-padding-width,
* md: $grid-padding-width,
* lg: $grid-padding-width,
* xl: $grid-padding-width
* ) !default;
* ```
*
* ### Grid tiers
*
* To customize the breakpoints and their values, override the values of
* `$grid-breakpoints` and `$grid-max-widths`. For example, to only use
* 3 breakpoints, the following could be written:
*
* ```
* $grid-breakpoints: (
* sm: 0,
* md: 768px,
* lg: 1024px
* );
*
* $grid-max-widths: (
* sm: 420px,
* md: 720px,
* lg: 960px
* );
* ```
*
*/
var Grid = (function () {
function Grid() {
}
Grid.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-grid, [ion-grid]',
host: {
'class': 'grid'
}
},] },
];
/** @nocollapse */
Grid.ctorParameters = function () { return []; };
return Grid;
}());
//# sourceMappingURL=grid.js.map
/***/ }),
/* 156 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Row; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/**
* @name Row
* @module ionic
* @description
*
* Rows are horizontal components of the [grid](../Grid) system and contain varying numbers of
* [columns](../Col). They ensure the columns are positioned properly.
*
* ## Row attributes
*
* By default, columns will stretch to fill the entire height of the row and wrap when necessary.
* There are several attributes that can be added to a row to customize this behavior.
*
* | Property | Description |
* |-----------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|
* | nowrap | Adds `flex-wrap: nowrap`. Forces the columns to a single row. |
* | wrap-reverse | Adds `flex-wrap: wrap-reverse`. The columns will wrap in reverse. |
* | align-items-start | Adds `align-items: flex-start`. All columns will be vertically aligned at the top, unless they specify their own alignment. |
* | align-items-center | Adds `align-items: center`. All columns will be vertically aligned in the center, unless they specify their own alignment. |
* | align-items-end | Adds `align-items: flex-end`. All columns will be vertically aligned at the bottom, unless they specify their own alignment. |
* | align-items-stretch | Adds `align-items: stretch`. All columns will be stretched to take up the entire height of the row, unless they specify their own alignment. |
* | align-items-baseline | Adds `align-items: baseline`. All columns will be vertically aligned at their baselines, unless they specify their own alignment. |
* | justify-content-start | Adds `justify-content: start`. All columns will be horizontally aligned at the start. |
* | justify-content-center | Adds `justify-content: center`. All columns will be horizontally aligned at the center. |
* | justify-content-end | Adds `justify-content: end`. All columns will be horizontally aligned at the end. |
* | justify-content-around | Adds `justify-content: space-around`. All columns will be horizontally aligned with equal space around them. |
* | justify-content-between | Adds `justify-content: space-between`. All columns will be horizontally aligned with a half-size space on either end. |
*
*
*/
var Row = (function () {
function Row() {
}
Row.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-row, [ion-row]',
host: {
'class': 'row'
}
},] },
];
/** @nocollapse */
Row.ctorParameters = function () { return []; };
return Row;
}());
//# sourceMappingURL=row.js.map
/***/ }),
/* 157 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Img; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__content_content__ = __webpack_require__(24);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__platform_dom_controller__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__platform_platform__ = __webpack_require__(4);
/**
* @name Img
* @description
* Two of the biggest cuprits of scroll jank is starting up a new HTTP
* request, and rendering images. These two reasons is largely why
* `ion-img` was created. The standard HTML `img` element is often a large
* source of these problems, and what makes matters worse is that the app
* does not have fine-grained control of requests and rendering for each
* `img` element.
*
* The `ion-img` component is similar to the standard `img` element,
* but it also adds features in order to provide improved performance.
* Features include only loading images which are visible, using web workers
* for HTTP requests, preventing jank while scrolling and in-memory caching.
*
* Note that `ion-img` also comes with a few more restrictions in comparison
* to the standard `img` element. A good rule is, if there are only a few
* images to be rendered on a page, then the standard `img` is probably
* best. However, if a page has the potential for hundreds or even thousands
* of images within a scrollable area, then `ion-img` would be better suited
* for the job.
*
* > Note: `ion-img` is only meant to be used inside of [virtual-scroll](/docs/api/components/virtual-scroll/VirtualScroll/)
*
*
* ### Lazy Loading
*
* Lazy loading images refers to only loading images which are actually
* visible within the user's viewport. This also means that images which are
* not viewable on the initial load would not be downloaded or rendered. Next,
* as the user scrolls, each image which becomes visible is then requested
* then rendered on-demand.
*
* The benefits of this approach is that unnecessary and resource intensive
* HTTP requests are not started, valuable bandwidth isn't wasted, and this
* allows the browser to free up resources which would be wasted on images
* which are not even viewable. For example, animated GIFs are enourmous
* performance drains, however, with `ion-img` the app is able to dedicate
* resources to just the viewable images. But again, if the problems listed
* above are not problems within your app, then the standard `img` element
* may be best.
*
*
* ### Image Dimensions
*
* By providing image dimensions up front, Ionic is able to accurately size
* up the image's location within the viewport, which helps lazy load only
* images which are viewable. Image dimensions can either by set as
* properties, inline styles, or external stylesheets. It doesn't matter
* which method of setting dimensions is used, but it's important that somehow
* each `ion-img` has been given an exact size.
*
* For example, by default `<ion-avatar>` and `<ion-thumbnail>` already come
* with exact sizes when placed within an `<ion-item>`. By giving each image
* an exact size, this then further locks in the size of each `ion-item`,
* which again helps improve scroll performance.
*
* ```html
* <!-- dimensions set using attributes -->
* <ion-img width="80" height="80" src="..."></ion-img>
*
* <!-- dimensions set using input properties -->
* <ion-img [width]="imgWidth" [height]="imgHeight" src="..."></ion-img>
*
* <!-- dimensions set using inline styles -->
* <ion-img style="width: 80px; height: 80px;" src="..."></ion-img>
* ```
*
* Additionally, each `ion-img` uses the `object-fit: cover` CSS property.
* What this means is that the actual rendered image will center itself within
* it's container. Or to really get detailed: The image is sized to maintain
* its aspect ratio while filling the containing element’s entire content box.
* Its concrete object size is resolved as a cover constraint against the
* element’s used width and height.
*
* ### Future Optimizations
*
* Future goals are to place image requests within web workers, and cache
* images in-memory as datauris. This method has proven to be effective,
* however there are some current limitations with Cordova which we are
* currently working on.
*
*/
var Img = (function () {
function Img(_elementRef, _renderer, _plt, _content, _dom) {
this._elementRef = _elementRef;
this._renderer = _renderer;
this._plt = _plt;
this._content = _content;
this._dom = _dom;
/** @internal */
this._cache = true;
/** @internal */
this._w = '';
/** @internal */
this._h = '';
/** @internal */
this._wQ = '';
/** @internal */
this._hQ = '';
/**
* @input {string} Set the `alt` attribute which gets assigned to
* the inner `img` element.
*/
this.alt = '';
if (!this._content) {
console.warn("ion-img can only be used within an ion-content");
}
else {
this._content.addImg(this);
}
this._isLoaded(false);
}
Object.defineProperty(Img.prototype, "src", {
/**
* @input {string} The source of the image.
*/
get: function () {
return this._src;
},
set: function (newSrc) {
// if the source hasn't changed, then um, let's not change it
if (newSrc !== this._src) {
// we're changing the source
// so abort any active http requests
// and render the image empty
this.reset();
// update to the new src
this._src = newSrc;
// Are they using an actual datauri already,
// or reset any existing datauri we might be holding onto
this._hasLoaded = newSrc.indexOf('data:') === 0;
// run update to kick off requests or render if everything is good
this.update();
}
},
enumerable: true,
configurable: true
});
/**
* @hidden
*/
Img.prototype.reset = function () {
if (this._requestingSrc) {
// abort any active requests
(void 0) /* console.debug */;
this._srcAttr('');
this._requestingSrc = null;
}
if (this._renderedSrc) {
// clear out the currently rendered img
(void 0) /* console.debug */;
this._renderedSrc = null;
this._isLoaded(false);
}
};
/**
* @hidden
*/
Img.prototype.update = function () {
var _this = this;
// only attempt an update if there is an active src
// and the content containing the image considers it updatable
if (this._src && this._content.isImgsUpdatable()) {
if (this.canRequest && (this._src !== this._renderedSrc && this._src !== this._requestingSrc) && !this._hasLoaded) {
// only begin the request if we "can" request
// begin the image request if the src is different from the rendered src
// and if we don't already has a tmpDataUri
(void 0) /* console.debug */;
this._requestingSrc = this._src;
this._isLoaded(false);
this._srcAttr(this._src);
// set the dimensions of the image if we do have different data
this._setDims();
}
if (this.canRender && this._hasLoaded && this._src !== this._renderedSrc) {
// we can render and we have a datauri to render
this._renderedSrc = this._src;
this._setDims();
this._dom.write(function () {
if (_this._hasLoaded) {
(void 0) /* console.debug */;
_this._isLoaded(true);
_this._srcAttr(_this._src);
}
});
}
}
};
/**
* @internal
*/
Img.prototype._isLoaded = function (isLoaded) {
var renderer = this._renderer;
var ele = this._elementRef.nativeElement;
renderer.setElementClass(ele, 'img-loaded', isLoaded);
renderer.setElementClass(ele, 'img-unloaded', !isLoaded);
};
/**
* @internal
*/
Img.prototype._srcAttr = function (srcAttr) {
var imgEle = this._img;
var renderer = this._renderer;
if (imgEle && imgEle.src !== srcAttr) {
renderer.setElementAttribute(this._img, 'src', srcAttr);
renderer.setElementAttribute(this._img, 'alt', this.alt);
}
};
Object.defineProperty(Img.prototype, "top", {
/**
* @hidden
*/
get: function () {
var bounds = this._getBounds();
return bounds && bounds.top || 0;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Img.prototype, "bottom", {
/**
* @hidden
*/
get: function () {
var bounds = this._getBounds();
return bounds && bounds.bottom || 0;
},
enumerable: true,
configurable: true
});
Img.prototype._getBounds = function () {
if (this._bounds) {
// we've been manually passed bounds data
// this is probably from Virtual Scroll items
return this._bounds;
}
if (!this._rect) {
// we don't have bounds from virtual scroll
// so let's do the raw DOM lookup w/ getBoundingClientRect
this._rect = this._elementRef.nativeElement.getBoundingClientRect();
(void 0) /* console.debug */;
}
return this._rect;
};
Object.defineProperty(Img.prototype, "bounds", {
/**
* @input {any} Sets the bounding rectangle of the element relative to the viewport.
* When using `VirtualScroll`, each virtual item should pass its bounds to each
* `ion-img`. The passed in data object should include `top` and `bottom` properties.
*/
set: function (b) {
if (Object(__WEBPACK_IMPORTED_MODULE_3__util_util__["l" /* isPresent */])(b)) {
this._bounds = b;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(Img.prototype, "cache", {
/**
* @input {boolean} After an image has been successfully downloaded, it can be cached
* in-memory. This is useful for `VirtualScroll` by allowing image responses to be
* cached, and not rendered, until after scrolling has completed, which allows for
* smoother scrolling.
*/
get: function () {
return this._cache;
},
set: function (val) {
this._cache = Object(__WEBPACK_IMPORTED_MODULE_3__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Img.prototype, "width", {
/**
* @input {string} Image width. If this property is not set it's important that
* the dimensions are still set using CSS. If the dimension is just a number it
* will assume the `px` unit.
*/
set: function (val) {
this._wQ = getUnitValue(val);
this._setDims();
},
enumerable: true,
configurable: true
});
Object.defineProperty(Img.prototype, "height", {
/**
* @input {string} Image height. If this property is not set it's important that
* the dimensions are still set using CSS. If the dimension is just a number it
* will assume the `px` unit.
*/
set: function (val) {
this._hQ = getUnitValue(val);
this._setDims();
},
enumerable: true,
configurable: true
});
Img.prototype._setDims = function () {
var _this = this;
// only set the dimensions if we can render
// and only if the dimensions have changed from when we last set it
if (this.canRender && (this._w !== this._wQ || this._h !== this._hQ)) {
var wrapperEle = this._elementRef.nativeElement;
var renderer = this._renderer;
this._dom.write(function () {
if (_this._w !== _this._wQ) {
_this._w = _this._wQ;
renderer.setElementStyle(wrapperEle, 'width', _this._w);
}
if (_this._h !== _this._hQ) {
_this._h = _this._hQ;
renderer.setElementStyle(wrapperEle, 'height', _this._h);
}
});
}
};
/**
* @hidden
*/
Img.prototype.ngAfterContentInit = function () {
var _this = this;
this._img = this._elementRef.nativeElement.firstChild;
this._unreg = this._plt.registerListener(this._img, 'load', function () {
_this._hasLoaded = true;
_this.update();
}, { passive: true });
};
/**
* @hidden
*/
Img.prototype.ngOnDestroy = function () {
this._unreg && this._unreg();
this._content && this._content.removeImg(this);
};
Img.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-img',
template: '<img>',
changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* ChangeDetectionStrategy */].OnPush,
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
},] },
];
/** @nocollapse */
Img.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_4__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__content_content__["a" /* Content */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_2__platform_dom_controller__["a" /* DomController */], },
]; };
Img.propDecorators = {
'src': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'bounds': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'cache': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'width': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'height': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'alt': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
};
return Img;
}());
function getUnitValue(val) {
if (Object(__WEBPACK_IMPORTED_MODULE_3__util_util__["l" /* isPresent */])(val)) {
if (typeof val === 'string') {
if (val.indexOf('%') > -1 || val.indexOf('px') > -1) {
return val;
}
if (val.length) {
return val + 'px';
}
}
else if (typeof val === 'number') {
return val + 'px';
}
}
return '';
}
//# sourceMappingURL=img.js.map
/***/ }),
/* 158 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return InfiniteScrollContent; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__infinite_scroll__ = __webpack_require__(89);
/**
* @hidden
*/
var InfiniteScrollContent = (function () {
function InfiniteScrollContent(inf, _config) {
this.inf = inf;
this._config = _config;
}
/**
* @hidden
*/
InfiniteScrollContent.prototype.ngOnInit = function () {
if (!this.loadingSpinner) {
this.loadingSpinner = this._config.get('infiniteLoadingSpinner', this._config.get('spinner', 'ios'));
}
};
InfiniteScrollContent.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-infinite-scroll-content',
template: '<div class="infinite-loading">' +
'<div class="infinite-loading-spinner" *ngIf="loadingSpinner">' +
'<ion-spinner [name]="loadingSpinner"></ion-spinner>' +
'</div>' +
'<div class="infinite-loading-text" [innerHTML]="loadingText" *ngIf="loadingText"></div>' +
'</div>',
host: {
'[attr.state]': 'inf.state'
},
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
},] },
];
/** @nocollapse */
InfiniteScrollContent.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_2__infinite_scroll__["a" /* InfiniteScroll */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
]; };
InfiniteScrollContent.propDecorators = {
'loadingSpinner': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'loadingText': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
};
return InfiniteScrollContent;
}());
//# sourceMappingURL=infinite-scroll-content.js.map
/***/ }),
/* 159 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TextInput; });
/* unused harmony export getScrollData */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_forms__ = __webpack_require__(16);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_Subject__ = __webpack_require__(42);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_Subject___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_rxjs_Subject__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_add_operator_takeUntil__ = __webpack_require__(160);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_add_operator_takeUntil___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_rxjs_add_operator_takeUntil__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__app_app__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__content_content__ = __webpack_require__(24);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__util_dom__ = __webpack_require__(14);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__platform_dom_controller__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__util_form__ = __webpack_require__(20);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__util_base_input__ = __webpack_require__(29);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__item_item__ = __webpack_require__(21);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__platform_platform__ = __webpack_require__(4);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name Input
* @description
*
* `ion-input` is meant for text type inputs only, such as `text`,
* `password`, `email`, `number`, `search`, `tel`, and `url`. Ionic
* still uses an actual `<input type="text">` HTML element within the
* component, however, with Ionic wrapping the native HTML input
* element it's better able to handle the user experience and
* interactivity.
*
* Similarly, `<ion-textarea>` should be used in place of `<textarea>`.
*
* An `ion-input` is **not** used for non-text type inputs, such as a
* `checkbox`, `radio`, `toggle`, `range`, `select`, etc.
*
* Along with the blur/focus events, `input` support all standard text input
* events like `keyup`, `keydown`, `keypress`, `input`,etc. Any standard event
* can be attached and will function as expected.
*
* @usage
* ```html
* <ion-list>
* <ion-item>
* <ion-label color="primary">Inline Label</ion-label>
* <ion-input placeholder="Text Input"></ion-input>
* </ion-item>
*
* <ion-item>
* <ion-label color="primary" fixed>Fixed Label</ion-label>
* <ion-input type="tel" placeholder="Tel Input"></ion-input>
* </ion-item>
*
* <ion-item>
* <ion-input type="number" placeholder="Number Input with no label"></ion-input>
* </ion-item>
*
* <ion-item>
* <ion-label color="primary" stacked>Stacked Label</ion-label>
* <ion-input type="email" placeholder="Email Input"></ion-input>
* </ion-item>
*
* <ion-item>
* <ion-label color="primary" stacked>Stacked Label</ion-label>
* <ion-input type="password" placeholder="Password Input"></ion-input>
* </ion-item>
*
* <ion-item>
* <ion-label color="primary" floating>Floating Label</ion-label>
* <ion-input></ion-input>
* </ion-item>
*
* <ion-item>
* <ion-input placeholder="Clear Input" clearInput></ion-input>
* </ion-item>
*
* <ion-item>
* <ion-textarea placeholder="Enter a description"></ion-textarea>
* </ion-item>
* </ion-list>
* ```
*
* @demo /docs/demos/src/input/
*/
var TextInput = (function (_super) {
__extends(TextInput, _super);
function TextInput(config, _plt, _form, _app, elementRef, renderer, _content, _item, ngControl, _dom) {
var _this = _super.call(this, config, elementRef, renderer, 'input', '', _form, _item, ngControl) || this;
_this._plt = _plt;
_this._app = _app;
_this._content = _content;
_this.ngControl = ngControl;
_this._dom = _dom;
_this._clearInput = false;
_this._readonly = false;
_this._type = 'text';
_this._isTextarea = false;
_this._onDestroy = new __WEBPACK_IMPORTED_MODULE_2_rxjs_Subject__["Subject"]();
_this._useAssist = false;
_this._relocated = false;
/**
* @input {string} Set the input's autocomplete property. Values: `"on"`, `"off"`. Default `"off"`.
*/
_this.autocomplete = '';
/**
* @input {string} Set the input's autocorrect property. Values: `"on"`, `"off"`. Default `"off"`.
*/
_this.autocorrect = '';
/**
* @input {string} Instructional text that shows before the input has a value.
*/
_this.placeholder = '';
/**
* @input {any} The minimum value, which must not be greater than its maximum (max attribute) value.
*/
_this.min = null;
/**
* @input {any} The maximum value, which must not be less than its minimum (min attribute) value.
*/
_this.max = null;
/**
* @input {any} Works with the min and max attributes to limit the increments at which a value can be set.
*/
_this.step = null;
/**
* @hidden
*/
_this.input = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* @hidden
*/
_this.blur = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* @hidden
*/
_this.focus = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
_this.autocomplete = config.get('autocomplete', 'off');
_this.autocorrect = config.get('autocorrect', 'off');
_this._autoFocusAssist = config.get('autoFocusAssist', 'delay');
_this._keyboardHeight = config.getNumber('keyboardHeight');
_this._isTextarea = !!(elementRef.nativeElement.tagName === 'ION-TEXTAREA');
if (_this._isTextarea && _item) {
_item.setElementClass('item-textarea', true);
}
// If not inside content, let's disable all the hacks
if (!_content) {
return _this;
}
var hideCaretOnScroll = config.getBoolean('hideCaretOnScroll', false);
if (hideCaretOnScroll) {
_this._enableHideCaretOnScroll();
}
var win = _plt.win();
var keyboardPlugin = win.Ionic && win.Ionic.keyboardPlugin;
if (keyboardPlugin) {
var keyboardResizes = config.getBoolean('keyboardResizes', false);
if (keyboardResizes) {
_this._keyboardHeight = config.getNumber('keyboardSafeArea', 60);
_this._enableScrollMove();
}
else {
_this._enableScrollPadding();
_this._enableScrollMove();
}
}
else {
_this._useAssist = config.getBoolean('scrollAssist', false);
var usePadding = config.getBoolean('scrollPadding', _this._useAssist);
if (usePadding) {
_this._enableScrollPadding();
}
}
return _this;
}
Object.defineProperty(TextInput.prototype, "clearInput", {
/**
* @input {boolean} If true, a clear icon will appear in the input when there is a value. Clicking it clears the input.
*/
get: function () {
return this._clearInput;
},
set: function (val) {
this._clearInput = (!this._isTextarea && Object(__WEBPACK_IMPORTED_MODULE_11__util_util__["o" /* isTrueProperty */])(val));
},
enumerable: true,
configurable: true
});
Object.defineProperty(TextInput.prototype, "type", {
/**
* @input {string} The type of control to display. The default type is text.
* Possible values are: `"text"`, `"password"`, `"email"`, `"number"`, `"search"`, `"tel"`, or `"url"`.
*/
get: function () {
return (this._isTextarea)
? 'text'
: this._type;
},
set: function (val) {
this._type = val;
},
enumerable: true,
configurable: true
});
Object.defineProperty(TextInput.prototype, "readonly", {
/**
* @input {boolean} If true, the user cannot modify the value.
*/
get: function () {
return this._readonly;
},
set: function (val) {
this._readonly = Object(__WEBPACK_IMPORTED_MODULE_11__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(TextInput.prototype, "clearOnEdit", {
/**
* @input {boolean} If true, the value will be cleared after focus upon edit.
* Defaults to `true` when `type` is `"password"`, `false` for all other types.
*/
get: function () {
return this._clearOnEdit;
},
set: function (val) {
this._clearOnEdit = Object(__WEBPACK_IMPORTED_MODULE_11__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
TextInput.prototype.ngAfterContentInit = function () { };
/**
* @hidden
*/
TextInput.prototype.ngAfterViewInit = function () {
(void 0) /* assert */;
// By default, password inputs clear after focus when they have content
if (this.clearOnEdit !== false && this.type === 'password') {
this.clearOnEdit = true;
}
var ionInputEle = this._elementRef.nativeElement;
var nativeInputEle = this._native.nativeElement;
// Copy remaining attributes, not handled by ionic/angular
Object(__WEBPACK_IMPORTED_MODULE_7__util_dom__["b" /* copyInputAttributes */])(ionInputEle, nativeInputEle);
// prevent having tabIndex duplicated
if (ionInputEle.hasAttribute('tabIndex')) {
ionInputEle.removeAttribute('tabIndex');
}
// handle the autofocus attribute
if (ionInputEle.hasAttribute('autofocus')) {
ionInputEle.removeAttribute('autofocus');
switch (this._autoFocusAssist) {
case 'immediate':
// config says to immediate focus on the input
// works best on android devices
nativeInputEle.focus();
break;
case 'delay':
// config says to chill out a bit and focus on the input after transitions
// works best on desktop
this._plt.timeout(function () { return nativeInputEle.focus(); }, 800);
break;
}
// traditionally iOS has big issues with autofocus on actual devices
// autoFocus is disabled by default with the iOS mode config
}
// Initialize the input (can start emitting events)
this._initialize();
if (this.focus.observers.length > 0) {
console.warn('(focus) is deprecated in ion-input, use (ionFocus) instead');
}
if (this.blur.observers.length > 0) {
console.warn('(blur) is deprecated in ion-input, use (ionBlur) instead');
}
};
/**
* @hidden
*/
TextInput.prototype.ngOnDestroy = function () {
_super.prototype.ngOnDestroy.call(this);
this._onDestroy.next();
this._onDestroy = null;
};
/**
* @hidden
*/
TextInput.prototype.initFocus = function () {
this.setFocus();
};
/**
* @hidden
*/
TextInput.prototype.setFocus = function () {
// let's set focus to the element
// but only if it does not already have focus
if (!this.isFocus()) {
this._native.nativeElement.focus();
}
};
/**
* @hidden
*/
TextInput.prototype.setBlur = function () {
if (this.isFocus()) {
this._native.nativeElement.blur();
}
};
/**
* @hidden
*/
TextInput.prototype.onInput = function (ev) {
this.value = ev.target.value;
// TODO: deprecate this
this.input.emit(ev);
};
/**
* @hidden
*/
TextInput.prototype.onBlur = function (ev) {
this._fireBlur();
// TODO: deprecate this (06/07/2017)
this.blur.emit(ev);
this._scrollData = null;
if (this._clearOnEdit && this.hasValue()) {
this._didBlurAfterEdit = true;
}
};
/**
* @hidden
*/
TextInput.prototype.onFocus = function (ev) {
this._fireFocus();
// TODO: deprecate this (06/07/2017)
this.focus.emit(ev);
};
/**
* @hidden
*/
TextInput.prototype.onKeydown = function (ev) {
if (ev && this._clearOnEdit) {
this.checkClearOnEdit(ev.target.value);
}
};
/**
* @hidden
*/
TextInput.prototype._inputUpdated = function () {
_super.prototype._inputUpdated.call(this);
var inputEle = this._native.nativeElement;
var value = this._value;
if (inputEle.value !== value) {
inputEle.value = value;
}
};
/**
* @hidden
*/
TextInput.prototype.clearTextInput = function () {
this.value = '';
};
/**
* Check if we need to clear the text input if clearOnEdit is enabled
* @hidden
*/
TextInput.prototype.checkClearOnEdit = function (_) {
if (!this._clearOnEdit) {
return;
}
// Did the input value change after it was blurred and edited?
if (this._didBlurAfterEdit && this.hasValue()) {
// Clear the input
this.clearTextInput();
}
// Reset the flag
this._didBlurAfterEdit = false;
};
TextInput.prototype._getScrollData = function () {
if (!this._content) {
return newScrollData();
}
// get container of this input, probably an ion-item a few nodes up
if (this._scrollData) {
return this._scrollData;
}
var ele = this._elementRef.nativeElement;
ele = ele.closest('ion-item,[ion-item]') || ele;
return this._scrollData = getScrollData(ele.offsetTop, ele.offsetHeight, this._content.getContentDimensions(), this._keyboardHeight, this._plt.height());
};
TextInput.prototype._relocateInput = function (shouldRelocate) {
if (this._relocated === shouldRelocate) {
return;
}
var platform = this._plt;
var componentEle = this.getNativeElement();
var focusedInputEle = this._native.nativeElement;
(void 0) /* console.debug */;
if (shouldRelocate) {
// this allows for the actual input to receive the focus from
// the user's touch event, but before it receives focus, it
// moves the actual input to a location that will not screw
// up the app's layout, and does not allow the native browser
// to attempt to scroll the input into place (messing up headers/footers)
// the cloned input fills the area of where native input should be
// while the native input fakes out the browser by relocating itself
// before it receives the actual focus event
// We hide the focused input (with the visible caret) invisiable by making it scale(0),
cloneInputComponent(platform, componentEle, focusedInputEle);
var inputRelativeY = this._getScrollData().inputSafeY;
// fix for #11817
var tx = this._plt.isRTL ? 9999 : -9999;
focusedInputEle.style[platform.Css.transform] = "translate3d(" + tx + "px," + inputRelativeY + "px,0)";
focusedInputEle.style.opacity = '0';
}
else {
removeClone(platform, componentEle, focusedInputEle);
}
this._relocated = shouldRelocate;
};
TextInput.prototype._enableScrollPadding = function () {
var _this = this;
(void 0) /* assert */;
(void 0) /* console.debug */;
this.ionFocus.subscribe(function () {
var content = _this._content;
var scrollPadding = _this._getScrollData().scrollPadding;
content.addScrollPadding(scrollPadding);
content.clearScrollPaddingFocusOut();
});
};
TextInput.prototype._enableHideCaretOnScroll = function () {
var _this = this;
(void 0) /* assert */;
var content = this._content;
(void 0) /* console.debug */;
content.ionScrollStart
.takeUntil(this._onDestroy)
.subscribe(function () { return scrollHideCaret(true); });
content.ionScrollEnd
.takeUntil(this._onDestroy)
.subscribe(function () { return scrollHideCaret(false); });
this.ionBlur.subscribe(function () { return _this._relocateInput(false); });
var self = this;
function scrollHideCaret(shouldHideCaret) {
// if it does have focus, then do the dom write
if (self.isFocus()) {
self._dom.write(function () { return self._relocateInput(shouldHideCaret); });
}
}
};
TextInput.prototype._enableScrollMove = function () {
var _this = this;
(void 0) /* assert */;
(void 0) /* console.debug */;
this.ionFocus.subscribe(function () {
var scrollData = _this._getScrollData();
if (Math.abs(scrollData.scrollAmount) > 4) {
_this._content.scrollTo(0, scrollData.scrollTo, scrollData.scrollDuration);
}
});
};
TextInput.prototype._pointerStart = function (ev) {
(void 0) /* assert */;
// input cover touchstart
if (ev.type === 'touchstart') {
this._isTouch = true;
}
if ((this._isTouch || (!this._isTouch && ev.type === 'mousedown')) && this._app.isEnabled()) {
// remember where the touchstart/mousedown started
this._coord = Object(__WEBPACK_IMPORTED_MODULE_7__util_dom__["f" /* pointerCoord */])(ev);
}
(void 0) /* console.debug */;
};
TextInput.prototype._pointerEnd = function (ev) {
(void 0) /* assert */;
// input cover touchend/mouseup
(void 0) /* console.debug */;
if ((this._isTouch && ev.type === 'mouseup') || !this._app.isEnabled()) {
// the app is actively doing something right now
// don't try to scroll in the input
ev.preventDefault();
ev.stopPropagation();
}
else if (this._coord) {
// get where the touchend/mouseup ended
var endCoord = Object(__WEBPACK_IMPORTED_MODULE_7__util_dom__["f" /* pointerCoord */])(ev);
// focus this input if the pointer hasn't moved XX pixels
// and the input doesn't already have focus
if (!Object(__WEBPACK_IMPORTED_MODULE_7__util_dom__["d" /* hasPointerMoved */])(8, this._coord, endCoord) && !this.isFocus()) {
ev.preventDefault();
ev.stopPropagation();
// begin the input focus process
this._jsSetFocus();
}
}
this._coord = null;
};
TextInput.prototype._jsSetFocus = function () {
var _this = this;
(void 0) /* assert */;
// begin the process of setting focus to the inner input element
var content = this._content;
(void 0) /* console.debug */;
if (!content) {
// not inside of a scroll view, just focus it
this.setFocus();
}
var scrollData = this._getScrollData();
if (Math.abs(scrollData.scrollAmount) < 4) {
// the text input is in a safe position that doesn't
// require it to be scrolled into view, just set focus now
this.setFocus();
return;
}
// temporarily move the focus to the focus holder so the browser
// doesn't freak out while it's trying to get the input in place
// at this point the native text input still does not have focus
this._relocateInput(true);
this.setFocus();
// scroll the input into place
content.scrollTo(0, scrollData.scrollTo, scrollData.scrollDuration, function () {
// the scroll view is in the correct position now
// give the native text input focus
_this._relocateInput(false);
// ensure this is the focused input
_this.setFocus();
});
};
TextInput.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-input,ion-textarea',
template: '<input #textInput *ngIf="!_isTextarea" class="text-input" ' +
'[ngClass]="\'text-input-\' + _mode"' +
'(input)="onInput($event)" ' +
'(blur)="onBlur($event)" ' +
'(focus)="onFocus($event)" ' +
'(keydown)="onKeydown($event)" ' +
'[type]="_type" ' +
'dir="auto" ' +
'[attr.aria-labelledby]="_labelId" ' +
'[attr.min]="min" ' +
'[attr.max]="max" ' +
'[attr.step]="step" ' +
'[attr.autocomplete]="autocomplete" ' +
'[attr.autocorrect]="autocorrect" ' +
'[placeholder]="placeholder" ' +
'[disabled]="_disabled" ' +
'[readonly]="_readonly">' +
'<textarea #textInput *ngIf="_isTextarea" class="text-input" ' +
'[ngClass]="\'text-input-\' + _mode"' +
'(input)="onInput($event)" ' +
'(blur)="onBlur($event)" ' +
'(focus)="onFocus($event)" ' +
'(keydown)="onKeydown($event)" ' +
'[attr.aria-labelledby]="_labelId" ' +
'[attr.autocomplete]="autocomplete" ' +
'[attr.autocorrect]="autocorrect" ' +
'[placeholder]="placeholder" ' +
'[disabled]="_disabled" ' +
'[readonly]="_readonly"></textarea>' +
'<button ion-button *ngIf="_clearInput" clear class="text-input-clear-icon" ' +
'type="button" ' +
'(click)="clearTextInput($event)" ' +
'(mousedown)="clearTextInput($event)" ' +
'tabindex="-1"></button>' +
'<div class="input-cover" *ngIf="_useAssist" ' +
'(touchstart)="_pointerStart($event)" ' +
'(touchend)="_pointerEnd($event)" ' +
'(mousedown)="_pointerStart($event)" ' +
'(mouseup)="_pointerEnd($event)"></div>',
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* ChangeDetectionStrategy */].OnPush,
inputs: ['value']
},] },
];
/** @nocollapse */
TextInput.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_5__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_13__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_9__util_form__["a" /* Form */], },
{ type: __WEBPACK_IMPORTED_MODULE_4__app_app__["a" /* App */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_6__content_content__["a" /* Content */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_12__item_item__["a" /* Item */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_forms__["d" /* NgControl */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_8__platform_dom_controller__["a" /* DomController */], },
]; };
TextInput.propDecorators = {
'clearInput': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'type': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'readonly': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'clearOnEdit': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'_native': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_8" /* ViewChild */], args: ['textInput', { read: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */] },] },],
'autocomplete': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'autocorrect': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'placeholder': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'min': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'max': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'step': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'input': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'blur': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'focus': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
};
return TextInput;
}(__WEBPACK_IMPORTED_MODULE_10__util_base_input__["a" /* BaseInput */]));
/**
* @name TextArea
* @description
*
* `ion-textarea` is used for multi-line text inputs. Ionic still
* uses an actual `<textarea>` HTML element within the component;
* however, with Ionic wrapping the native HTML text area element, Ionic
* is able to better handle the user experience and interactivity.
*
* Note that `<ion-textarea>` must load its value from the `value` or
* `[(ngModel)]` attribute. Unlike the native `<textarea>` element,
* `<ion-textarea>` does not support loading its value from the
* textarea's inner content.
*
* When requiring only a single-line text input, we recommend using
* `<ion-input>` instead.
*
* @usage
* ```html
* <ion-item>
* <ion-label>Comments</ion-label>
* <ion-textarea></ion-textarea>
* </ion-item>
*
* <ion-item>
* <ion-label stacked>Message</ion-label>
* <ion-textarea [(ngModel)]="msg"></ion-textarea>
* </ion-item>
*
* <ion-item>
* <ion-label floating>Description</ion-label>
* <ion-textarea></ion-textarea>
* </ion-item>
*
* <ion-item>
* <ion-label>Long Description</ion-label>
* <ion-textarea rows="6" placeholder="enter long description here..."></ion-textarea>
* </ion-item>
* ```
*
* @demo /docs/demos/src/textarea/
*/
var SCROLL_ASSIST_SPEED = 0.3;
function newScrollData() {
return {
scrollAmount: 0,
scrollTo: 0,
scrollPadding: 0,
scrollDuration: 0,
inputSafeY: 0
};
}
/**
* @hidden
*/
function getScrollData(inputOffsetTop, inputOffsetHeight, scrollViewDimensions, keyboardHeight, plaformHeight) {
// compute input's Y values relative to the body
var inputTop = (inputOffsetTop + scrollViewDimensions.contentTop - scrollViewDimensions.scrollTop);
var inputBottom = (inputTop + inputOffsetHeight);
// compute the safe area which is the viewable content area when the soft keyboard is up
var safeAreaTop = scrollViewDimensions.contentTop;
var safeAreaHeight = (plaformHeight - keyboardHeight - safeAreaTop) / 2;
var safeAreaBottom = safeAreaTop + safeAreaHeight;
// figure out if each edge of teh input is within the safe area
var inputTopWithinSafeArea = (inputTop >= safeAreaTop && inputTop <= safeAreaBottom);
var inputTopAboveSafeArea = (inputTop < safeAreaTop);
var inputTopBelowSafeArea = (inputTop > safeAreaBottom);
var inputBottomWithinSafeArea = (inputBottom >= safeAreaTop && inputBottom <= safeAreaBottom);
var inputBottomBelowSafeArea = (inputBottom > safeAreaBottom);
/*
Text Input Scroll To Scenarios
---------------------------------------
1) Input top within safe area, bottom within safe area
2) Input top within safe area, bottom below safe area, room to scroll
3) Input top above safe area, bottom within safe area, room to scroll
4) Input top below safe area, no room to scroll, input smaller than safe area
5) Input top within safe area, bottom below safe area, no room to scroll, input smaller than safe area
6) Input top within safe area, bottom below safe area, no room to scroll, input larger than safe area
7) Input top below safe area, no room to scroll, input larger than safe area
*/
var scrollData = newScrollData();
// when auto-scrolling, there also needs to be enough
// content padding at the bottom of the scroll view
// always add scroll padding when a text input has focus
// this allows for the content to scroll above of the keyboard
// content behind the keyboard would be blank
// some cases may not need it, but when jumping around it's best
// to have the padding already rendered so there's no jank
scrollData.scrollPadding = keyboardHeight;
if (inputTopWithinSafeArea && inputBottomWithinSafeArea) {
// Input top within safe area, bottom within safe area
// no need to scroll to a position, it's good as-is
return scrollData;
}
// looks like we'll have to do some auto-scrolling
if (inputTopBelowSafeArea || inputBottomBelowSafeArea || inputTopAboveSafeArea) {
// Input top or bottom below safe area
// auto scroll the input up so at least the top of it shows
if (safeAreaHeight > inputOffsetHeight) {
// safe area height is taller than the input height, so we
// can bring up the input just enough to show the input bottom
scrollData.scrollAmount = Math.round(safeAreaBottom - inputBottom);
}
else {
// safe area height is smaller than the input height, so we can
// only scroll it up so the input top is at the top of the safe area
// however the input bottom will be below the safe area
scrollData.scrollAmount = Math.round(safeAreaTop - inputTop);
}
scrollData.inputSafeY = -(inputTop - safeAreaTop) + 4;
if (inputTopAboveSafeArea && scrollData.scrollAmount > inputOffsetHeight) {
// the input top is above the safe area and we're already scrolling it into place
// don't let it scroll more than the height of the input
scrollData.scrollAmount = inputOffsetHeight;
}
}
// figure out where it should scroll to for the best position to the input
scrollData.scrollTo = (scrollViewDimensions.scrollTop - scrollData.scrollAmount);
// calculate animation duration
var distance = Math.abs(scrollData.scrollAmount);
var duration = distance / SCROLL_ASSIST_SPEED;
scrollData.scrollDuration = Math.min(400, Math.max(150, duration));
return scrollData;
}
function cloneInputComponent(plt, srcComponentEle, srcNativeInputEle) {
// Make sure we kill all the clones before creating new ones
// It is a defensive, removeClone() should do nothing
// removeClone(plt, srcComponentEle, srcNativeInputEle);
(void 0) /* assert */;
// given a native <input> or <textarea> element
// find its parent wrapping component like <ion-input> or <ion-textarea>
// then clone the entire component
if (srcComponentEle) {
// DOM READ
var srcTop = srcComponentEle.offsetTop;
var srcLeft = srcComponentEle.offsetLeft;
var srcWidth = srcComponentEle.offsetWidth;
var srcHeight = srcComponentEle.offsetHeight;
// DOM WRITE
// not using deep clone so we don't pull in unnecessary nodes
var clonedComponentEle = srcComponentEle.cloneNode(false);
var clonedStyle = clonedComponentEle.style;
clonedComponentEle.classList.add('cloned-input');
clonedComponentEle.setAttribute('aria-hidden', 'true');
clonedStyle.pointerEvents = 'none';
clonedStyle.position = 'absolute';
clonedStyle.top = srcTop + 'px';
clonedStyle.left = srcLeft + 'px';
clonedStyle.width = srcWidth + 'px';
clonedStyle.height = srcHeight + 'px';
var clonedNativeInputEle = srcNativeInputEle.cloneNode(false);
clonedNativeInputEle.value = srcNativeInputEle.value;
clonedNativeInputEle.tabIndex = -1;
clonedComponentEle.appendChild(clonedNativeInputEle);
srcComponentEle.parentNode.appendChild(clonedComponentEle);
srcComponentEle.style.pointerEvents = 'none';
}
srcNativeInputEle.style[plt.Css.transform] = 'scale(0)';
}
function removeClone(plt, srcComponentEle, srcNativeInputEle) {
if (srcComponentEle && srcComponentEle.parentElement) {
var clonedInputEles = srcComponentEle.parentElement.querySelectorAll('.cloned-input');
for (var i = 0; i < clonedInputEles.length; i++) {
clonedInputEles[i].parentNode.removeChild(clonedInputEles[i]);
}
srcComponentEle.style.pointerEvents = '';
}
srcNativeInputEle.style[plt.Css.transform] = '';
srcNativeInputEle.style.opacity = '';
}
//# sourceMappingURL=input.js.map
/***/ }),
/* 160 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var Observable_1 = __webpack_require__(9);
var takeUntil_1 = __webpack_require__(394);
Observable_1.Observable.prototype.takeUntil = takeUntil_1.takeUntil;
//# sourceMappingURL=takeUntil.js.map
/***/ }),
/* 161 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ItemContent; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/**
* @hidden
*/
var ItemContent = (function () {
function ItemContent() {
}
ItemContent.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-item,[ion-item]',
host: {
'class': 'item-block'
}
},] },
];
/** @nocollapse */
ItemContent.ctorParameters = function () { return []; };
return ItemContent;
}());
//# sourceMappingURL=item-content.js.map
/***/ }),
/* 162 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ItemDivider; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ion__ = __webpack_require__(6);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
*/
var ItemDivider = (function (_super) {
__extends(ItemDivider, _super);
function ItemDivider(config, elementRef, renderer) {
return _super.call(this, config, elementRef, renderer, 'item-divider') || this;
}
ItemDivider.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-item-divider',
host: {
'class': 'item-divider'
}
},] },
];
/** @nocollapse */
ItemDivider.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
]; };
return ItemDivider;
}(__WEBPACK_IMPORTED_MODULE_2__ion__["a" /* Ion */]));
//# sourceMappingURL=item-divider.js.map
/***/ }),
/* 163 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ItemGroup; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/**
* @hidden
*/
var ItemGroup = (function () {
function ItemGroup() {
}
ItemGroup.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-item-group'
},] },
];
/** @nocollapse */
ItemGroup.ctorParameters = function () { return []; };
return ItemGroup;
}());
//# sourceMappingURL=item-group.js.map
/***/ }),
/* 164 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ItemSliding; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__item__ = __webpack_require__(21);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__list_list__ = __webpack_require__(91);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__platform_platform__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__item_options__ = __webpack_require__(90);
var SWIPE_MARGIN = 30;
var ELASTIC_FACTOR = 0.55;
var ITEM_SIDE_FLAG_NONE = 0;
var ITEM_SIDE_FLAG_LEFT = 1 << 0;
var ITEM_SIDE_FLAG_RIGHT = 1 << 1;
var ITEM_SIDE_FLAG_BOTH = ITEM_SIDE_FLAG_LEFT | ITEM_SIDE_FLAG_RIGHT;
/**
* @name ItemSliding
* @description
* A sliding item is a list item that can be swiped to reveal buttons. It requires
* an [Item](../Item) component as a child and a [List](../../list/List) component as
* a parent. All buttons to reveal can be placed in the `<ion-item-options>` element.
*
* @usage
* ```html
* <ion-list>
* <ion-item-sliding #item>
* <ion-item>
* Item
* </ion-item>
* <ion-item-options side="left">
* <button ion-button (click)="favorite(item)">Favorite</button>
* <button ion-button color="danger" (click)="share(item)">Share</button>
* </ion-item-options>
*
* <ion-item-options side="right">
* <button ion-button (click)="unread(item)">Unread</button>
* </ion-item-options>
* </ion-item-sliding>
* </ion-list>
* ```
*
* ### Swipe Direction
* By default, the buttons are revealed when the sliding item is swiped from right to left,
* so the buttons are placed in the right side. But it's also possible to reveal them
* in the right side (sliding from left to right) by setting the `side` attribute
* on the `ion-item-options` element. Up to 2 `ion-item-options` can used at the same time
* in order to reveal two different sets of buttons depending the swipping direction.
*
* ```html
* <ion-item-options side="right">
* <button ion-button (click)="archive(item)">
* <ion-icon name="archive"></ion-icon>
* Archive
* </button>
* </ion-item-options>
*
* <ion-item-options side="left">
* <button ion-button (click)="archive(item)">
* <ion-icon name="archive"></ion-icon>
* Archive
* </button>
* </ion-item-options>
* ```
*
* ### Listening for events (ionDrag) and (ionSwipe)
* It's possible to know the current relative position of the sliding item by subscribing
* to the (ionDrag)` event.
*
* ```html
* <ion-item-sliding (ionDrag)="logDrag($event)">
* <ion-item>Item</ion-item>
* <ion-item-options>
* <button ion-button>Favorite</button>
* </ion-item-options>
* </ion-item-sliding>
* ```
*
* ### Button Layout
* If an icon is placed with text in the option button, by default it will
* display the icon on top of the text. This can be changed to display the icon
* to the left of the text by setting `icon-start` as an attribute on the
* `<ion-item-options>` element.
*
* ```html
* <ion-item-options icon-start>
* <button ion-button (click)="archive(item)">
* <ion-icon name="archive"></ion-icon>
* Archive
* </button>
* </ion-item-options>
*
* ```
*
* ### Expandable Options
*
* Options can be expanded to take up the full width of the item if you swipe past
* a certain point. This can be combined with the `ionSwipe` event to call methods
* on the class.
*
* ```html
*
* <ion-item-sliding (ionSwipe)="delete(item)">
* <ion-item>Item</ion-item>
* <ion-item-options>
* <button ion-button expandable (click)="delete(item)">Delete</button>
* </ion-item-options>
* </ion-item-sliding>
* ```
*
* We can call `delete` by either clicking the button, or by doing a full swipe on the item.
*
* @demo /docs/demos/src/item-sliding/
* @see {@link /docs/components#lists List Component Docs}
* @see {@link ../Item Item API Docs}
* @see {@link ../../list/List List API Docs}
*/
var ItemSliding = (function () {
function ItemSliding(list, _plt, _renderer, _elementRef, _zone) {
this._plt = _plt;
this._renderer = _renderer;
this._elementRef = _elementRef;
this._zone = _zone;
this._openAmount = 0;
this._startX = 0;
this._optsWidthRightSide = 0;
this._optsWidthLeftSide = 0;
this._tmr = null;
this._optsDirty = true;
this._state = 2 /* Disabled */;
/**
* @output {event} Emitted when the sliding position changes.
* It reports the relative position.
*
* ```ts
* ondrag(item) {
* let percent = item.getSlidingPercent();
* if (percent > 0) {
* // positive
* console.log('right side');
* } else {
* // negative
* console.log('left side');
* }
* if (Math.abs(percent) > 1) {
* console.log('overscroll');
* }
* }
* ```
*
*/
this.ionDrag = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
list && list.containsSlidingItem(true);
_elementRef.nativeElement.$ionComponent = this;
this.setElementClass('item-wrapper', true);
}
Object.defineProperty(ItemSliding.prototype, "_itemOptions", {
set: function (itemOptions) {
var sides = 0;
// Reset left and right options in case they were removed
this._leftOptions = this._rightOptions = null;
for (var _i = 0, _a = itemOptions.toArray(); _i < _a.length; _i++) {
var item = _a[_i];
if (item.isRightSide()) {
this._rightOptions = item;
sides |= ITEM_SIDE_FLAG_RIGHT;
}
else {
this._leftOptions = item;
sides |= ITEM_SIDE_FLAG_LEFT;
}
}
this._optsDirty = true;
this._sides = sides;
},
enumerable: true,
configurable: true
});
/**
* @hidden
*/
ItemSliding.prototype.getOpenAmount = function () {
return this._openAmount;
};
/**
* @hidden
*/
ItemSliding.prototype.getSlidingPercent = function () {
var openAmount = this._openAmount;
if (openAmount > 0) {
return openAmount / this._optsWidthRightSide;
}
else if (openAmount < 0) {
return openAmount / this._optsWidthLeftSide;
}
else {
return 0;
}
};
/**
* @hidden
*/
ItemSliding.prototype.startSliding = function (startX) {
if (this._tmr) {
this._plt.cancelTimeout(this._tmr);
this._tmr = null;
}
if (this._openAmount === 0) {
this._optsDirty = true;
this._setState(4 /* Enabled */);
}
this._startX = startX + this._openAmount;
this.item.setElementStyle(this._plt.Css.transition, 'none');
};
/**
* @hidden
*/
ItemSliding.prototype.moveSliding = function (x) {
if (this._optsDirty) {
this.calculateOptsWidth();
return;
}
var openAmount = (this._startX - x);
switch (this._sides) {
case ITEM_SIDE_FLAG_RIGHT:
openAmount = Math.max(0, openAmount);
break;
case ITEM_SIDE_FLAG_LEFT:
openAmount = Math.min(0, openAmount);
break;
case ITEM_SIDE_FLAG_BOTH: break;
case ITEM_SIDE_FLAG_NONE: return;
default:
(void 0) /* assert */;
break;
}
if (openAmount > this._optsWidthRightSide) {
var optsWidth = this._optsWidthRightSide;
openAmount = optsWidth + (openAmount - optsWidth) * ELASTIC_FACTOR;
}
else if (openAmount < -this._optsWidthLeftSide) {
var optsWidth = -this._optsWidthLeftSide;
openAmount = optsWidth + (openAmount - optsWidth) * ELASTIC_FACTOR;
}
this._setOpenAmount(openAmount, false);
return openAmount;
};
/**
* @hidden
*/
ItemSliding.prototype.endSliding = function (velocity) {
var restingPoint = (this._openAmount > 0)
? this._optsWidthRightSide
: -this._optsWidthLeftSide;
// Check if the drag didn't clear the buttons mid-point
// and we aren't moving fast enough to swipe open
var isResetDirection = (this._openAmount > 0) === !(velocity < 0);
var isMovingFast = Math.abs(velocity) > 0.3;
var isOnCloseZone = Math.abs(this._openAmount) < Math.abs(restingPoint / 2);
if (Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["t" /* swipeShouldReset */])(isResetDirection, isMovingFast, isOnCloseZone)) {
restingPoint = 0;
}
this.fireSwipeEvent();
this._setOpenAmount(restingPoint, true);
return restingPoint;
};
/**
* @hidden
*/
ItemSliding.prototype.fireSwipeEvent = function () {
var _this = this;
if (this._state & 32 /* SwipeRight */) {
this._zone.run(function () { return _this._rightOptions.ionSwipe.emit(_this); });
}
else if (this._state & 64 /* SwipeLeft */) {
this._zone.run(function () { return _this._leftOptions.ionSwipe.emit(_this); });
}
};
/**
* @hidden
*/
ItemSliding.prototype.calculateOptsWidth = function () {
if (!this._optsDirty) {
return;
}
this._optsWidthRightSide = 0;
if (this._rightOptions) {
this._optsWidthRightSide = this._rightOptions.width();
(void 0) /* assert */;
}
this._optsWidthLeftSide = 0;
if (this._leftOptions) {
this._optsWidthLeftSide = this._leftOptions.width();
(void 0) /* assert */;
}
this._optsDirty = false;
};
ItemSliding.prototype._setOpenAmount = function (openAmount, isFinal) {
var _this = this;
var platform = this._plt;
if (this._tmr) {
platform.cancelTimeout(this._tmr);
this._tmr = null;
}
this._openAmount = openAmount;
if (isFinal) {
this.item.setElementStyle(platform.Css.transition, '');
}
if (openAmount > 0) {
var state = (openAmount >= (this._optsWidthRightSide + SWIPE_MARGIN))
? 8 /* Right */ | 32 /* SwipeRight */
: 8 /* Right */;
this._setState(state);
}
else if (openAmount < 0) {
var state_1 = (openAmount <= (-this._optsWidthLeftSide - SWIPE_MARGIN))
? 16 /* Left */ | 64 /* SwipeLeft */
: 16 /* Left */;
this._setState(state_1);
}
else {
(void 0) /* assert */;
this._tmr = platform.timeout(function () {
_this._setState(2 /* Disabled */);
_this._tmr = null;
}, 600);
this.item.setElementStyle(platform.Css.transform, '');
return;
}
this.item.setElementStyle(platform.Css.transform, "translate3d(" + -openAmount + "px,0,0)");
var ionDrag = this.ionDrag;
if (ionDrag.observers.length > 0) {
ionDrag.emit(this);
}
};
ItemSliding.prototype._setState = function (state) {
if (state === this._state) {
return;
}
this.setElementClass('active-slide', (state !== 2 /* Disabled */));
this.setElementClass('active-options-right', !!(state & 8 /* Right */));
this.setElementClass('active-options-left', !!(state & 16 /* Left */));
this.setElementClass('active-swipe-right', !!(state & 32 /* SwipeRight */));
this.setElementClass('active-swipe-left', !!(state & 64 /* SwipeLeft */));
this._state = state;
};
/**
* Close the sliding item. Items can also be closed from the [List](../../list/List).
*
* The sliding item can be closed by grabbing a reference to `ItemSliding`. In the
* below example, the template reference variable `slidingItem` is placed on the element
* and passed to the `share` method.
*
* ```html
* <ion-list>
* <ion-item-sliding #slidingItem>
* <ion-item>
* Item
* </ion-item>
* <ion-item-options>
* <button ion-button (click)="share(slidingItem)">Share</button>
* </ion-item-options>
* </ion-item-sliding>
* </ion-list>
* ```
*
* ```ts
* import { Component } from '@angular/core';
* import { ItemSliding } from 'ionic-angular';
*
* @Component({...})
* export class MyClass {
* constructor() { }
*
* share(slidingItem: ItemSliding) {
* slidingItem.close();
* }
* }
* ```
*/
ItemSliding.prototype.close = function () {
this._setOpenAmount(0, true);
};
/**
* @hidden
*/
ItemSliding.prototype.setElementClass = function (cssClass, shouldAdd) {
this._renderer.setElementClass(this._elementRef.nativeElement, cssClass, shouldAdd);
};
ItemSliding.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-item-sliding',
template: "\n <ng-content select=\"ion-item,[ion-item]\"></ng-content>\n <ng-content select=\"ion-item-options\"></ng-content>\n ",
changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* ChangeDetectionStrategy */].OnPush,
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None
},] },
];
/** @nocollapse */
ItemSliding.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_3__list_list__["a" /* List */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_4__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["M" /* NgZone */], },
]; };
ItemSliding.propDecorators = {
'item': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* ContentChild */], args: [__WEBPACK_IMPORTED_MODULE_2__item__["a" /* Item */],] },],
'ionDrag': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'_itemOptions': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["r" /* ContentChildren */], args: [Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_14" /* forwardRef */])(function () { return __WEBPACK_IMPORTED_MODULE_5__item_options__["a" /* ItemOptions */]; }),] },],
};
return ItemSliding;
}());
//# sourceMappingURL=item-sliding.js.map
/***/ }),
/* 165 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Reorder; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__item_reorder_util__ = __webpack_require__(149);
/**
* @hidden
*/
var Reorder = (function () {
function Reorder(elementRef) {
this.elementRef = elementRef;
elementRef.nativeElement['$ionComponent'] = this;
}
Reorder.prototype.getReorderNode = function () {
return Object(__WEBPACK_IMPORTED_MODULE_1__item_reorder_util__["a" /* findReorderItem */])(this.elementRef.nativeElement, null);
};
Reorder.prototype.onClick = function (ev) {
// Stop propagation if click event reaches ion-reorder
ev.preventDefault();
ev.stopPropagation();
};
Reorder.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-reorder',
template: "<ion-icon name=\"reorder\"></ion-icon>"
},] },
];
/** @nocollapse */
Reorder.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
]; };
Reorder.propDecorators = {
'onClick': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* HostListener */], args: ['click', ['$event'],] },],
};
return Reorder;
}());
//# sourceMappingURL=reorder.js.map
/***/ }),
/* 166 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Loading; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__app_app_constants__ = __webpack_require__(44);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__loading_component__ = __webpack_require__(93);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__loading_transitions__ = __webpack_require__(397);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__navigation_view_controller__ = __webpack_require__(7);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
*/
var Loading = (function (_super) {
__extends(Loading, _super);
function Loading(app, opts, config) {
if (opts === void 0) { opts = {}; }
var _this = this;
opts.showBackdrop = Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["l" /* isPresent */])(opts.showBackdrop) ? !!opts.showBackdrop : true;
opts.enableBackdropDismiss = Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["l" /* isPresent */])(opts.enableBackdropDismiss) ? !!opts.enableBackdropDismiss : false;
opts.dismissOnPageChange = Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["l" /* isPresent */])(opts.dismissOnPageChange) ? !!opts.dismissOnPageChange : false;
_this = _super.call(this, __WEBPACK_IMPORTED_MODULE_2__loading_component__["a" /* LoadingCmp */], opts, null) || this;
_this._app = app;
_this.isOverlay = true;
config.setTransition('loading-pop-in', __WEBPACK_IMPORTED_MODULE_3__loading_transitions__["c" /* LoadingPopIn */]);
config.setTransition('loading-pop-out', __WEBPACK_IMPORTED_MODULE_3__loading_transitions__["d" /* LoadingPopOut */]);
config.setTransition('loading-md-pop-in', __WEBPACK_IMPORTED_MODULE_3__loading_transitions__["a" /* LoadingMdPopIn */]);
config.setTransition('loading-md-pop-out', __WEBPACK_IMPORTED_MODULE_3__loading_transitions__["b" /* LoadingMdPopOut */]);
config.setTransition('loading-wp-pop-in', __WEBPACK_IMPORTED_MODULE_3__loading_transitions__["e" /* LoadingWpPopIn */]);
config.setTransition('loading-wp-pop-out', __WEBPACK_IMPORTED_MODULE_3__loading_transitions__["f" /* LoadingWpPopOut */]);
return _this;
}
/**
* @hidden
*/
Loading.prototype.getTransitionName = function (direction) {
var key = (direction === 'back' ? 'loadingLeave' : 'loadingEnter');
return this._nav && this._nav.config.get(key);
};
/**
* @param {string} content sets the html content for the loading indicator.
*/
Loading.prototype.setContent = function (content) {
this.data.content = content;
return this;
};
/**
* @param {string} spinner sets the name of the SVG spinner for the loading indicator.
*/
Loading.prototype.setSpinner = function (spinner) {
this.data.spinner = spinner;
return this;
};
/**
* @param {string} cssClass sets additional classes for custom styles, separated by spaces.
*/
Loading.prototype.setCssClass = function (cssClass) {
this.data.cssClass = cssClass;
return this;
};
/**
* @param {boolean} showBackdrop sets whether to show the backdrop.
*/
Loading.prototype.setShowBackdrop = function (showBackdrop) {
this.data.showBackdrop = showBackdrop;
return this;
};
/**
* @param {number} dur how many milliseconds to wait before hiding the indicator.
*/
Loading.prototype.setDuration = function (dur) {
this.data.duration = dur;
return this;
};
/**
* Present the loading instance.
*
* @param {NavOptions} [navOptions={}] Nav options to go with this transition.
* @returns {Promise} Returns a promise which is resolved when the transition has completed.
*/
Loading.prototype.present = function (navOptions) {
if (navOptions === void 0) { navOptions = {}; }
return this._app.present(this, navOptions, __WEBPACK_IMPORTED_MODULE_1__app_app_constants__["b" /* PORTAL_LOADING */]);
};
/**
* Dismiss all loading components which have been presented.
*/
Loading.prototype.dismissAll = function () {
this._nav && this._nav.popAll();
};
return Loading;
}(__WEBPACK_IMPORTED_MODULE_4__navigation_view_controller__["a" /* ViewController */]));
//# sourceMappingURL=loading.js.map
/***/ }),
/* 167 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return LoadingController; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__app_app__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__loading__ = __webpack_require__(166);
/**
* @name LoadingController
* @description
* An overlay that can be used to indicate activity while blocking user
* interaction. The loading indicator appears on top of the app's content,
* and can be dismissed by the app to resume user interaction with
* the app. It includes an optional backdrop, which can be disabled
* by setting `showBackdrop: false` upon creation.
*
* ### Creating
* You can pass all of the loading options in the first argument of
* the create method: `create(opts)`. The spinner name should be
* passed in the `spinner` property, and any optional HTML can be passed
* in the `content` property. If you do not pass a value to `spinner`
* the loading indicator will use the spinner specified by the mode. To
* set the spinner name across the app, set the value of `loadingSpinner`
* in your app's config. To hide the spinner, set `loadingSpinner: 'hide'`
* in the app's config or pass `spinner: 'hide'` in the loading
* options. See the [create](#create) method below for all available options.
*
* ### Dismissing
* The loading indicator can be dismissed automatically after a specific
* amount of time by passing the number of milliseconds to display it in
* the `duration` of the loading options. By default the loading indicator
* will show even during page changes, but this can be disabled by setting
* `dismissOnPageChange` to `true`. To dismiss the loading indicator after
* creation, call the `dismiss()` method on the Loading instance. The
* `onDidDismiss` function can be called to perform an action after the loading
* indicator is dismissed.
*
* >Note that after the component is dismissed, it will not be usable anymore
* and another one must be created. This can be avoided by wrapping the
* creation and presentation of the component in a reusable function as shown
* in the `usage` section below.
*
* ### Limitations
* The element is styled to appear on top of other content by setting its
* `z-index` property. You must ensure no element has a stacking context with
* a higher `z-index` than this element.
*
* @usage
* ```ts
* import { LoadingController } from 'ionic-angular';
*
* constructor(public loadingCtrl: LoadingController) { }
*
* presentLoadingDefault() {
* const loading = this.loadingCtrl.create({
* content: 'Please wait...'
* });
*
* loading.present();
*
* setTimeout(() => {
* loading.dismiss();
* }, 5000);
* }
*
* presentLoadingCustom() {
* const loading = this.loadingCtrl.create({
* spinner: 'hide',
* content: `
* <div class="custom-spinner-container">
* <div class="custom-spinner-box"></div>
* </div>`,
* duration: 5000
* });
*
* loading.onDidDismiss(() => {
* console.log('Dismissed loading');
* });
*
* loading.present();
* }
*
* presentLoadingText() {
* const loading = this.loadingCtrl.create({
* spinner: 'hide',
* content: 'Loading Please Wait...'
* });
*
* loading.present();
*
* setTimeout(() => {
* this.nav.push(Page2);
* }, 1000);
*
* setTimeout(() => {
* loading.dismiss();
* }, 5000);
* }
* ```
* @advanced
*
* Loading options
*
* | Option | Type | Description |
* |-----------------------|------------|------------------------------------------------------------------------------------------------------------------|
* | spinner |`string` | The name of the SVG spinner for the loading indicator. |
* | content |`string` | The html content for the loading indicator. |
* | cssClass |`string` | Additional classes for custom styles, separated by spaces. |
* | showBackdrop |`boolean` | Whether to show the backdrop. Default true. |
* | enableBackdropDismiss | `boolean` | Whether the loading indicator should be dismissed by tapping the backdrop. Default false. |
* | dismissOnPageChange |`boolean` | Whether to dismiss the indicator when navigating to a new page. Default false. |
* | duration |`number` | How many milliseconds to wait before hiding the indicator. By default, it will show until `dismiss()` is called. |
*
* @demo /docs/demos/src/loading/
* @see {@link /docs/api/components/spinner/Spinner Spinner API Docs}
*/
var LoadingController = (function () {
function LoadingController(_app, config) {
this._app = _app;
this.config = config;
}
/**
* Create a loading indicator. See below for options.
* @param {LoadingOptions} [opts] Loading options
* @returns {Loading} Returns a Loading Instance
*/
LoadingController.prototype.create = function (opts) {
if (opts === void 0) { opts = {}; }
return new __WEBPACK_IMPORTED_MODULE_3__loading__["a" /* Loading */](this._app, opts, this.config);
};
LoadingController.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
LoadingController.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__app_app__["a" /* App */], },
{ type: __WEBPACK_IMPORTED_MODULE_2__config_config__["a" /* Config */], },
]; };
return LoadingController;
}());
//# sourceMappingURL=loading-controller.js.map
/***/ }),
/* 168 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Menu; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__app_app__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__backdrop_backdrop__ = __webpack_require__(81);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__content_content__ = __webpack_require__(24);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__platform_dom_controller__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__gestures_gesture_controller__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__platform_keyboard__ = __webpack_require__(46);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__menu_gestures__ = __webpack_require__(398);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__app_menu_controller__ = __webpack_require__(34);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__nav_nav__ = __webpack_require__(94);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__platform_platform__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__gestures_ui_event_manager__ = __webpack_require__(28);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__split_pane_split_pane__ = __webpack_require__(48);
/**
* @name Menu
* @description
* The Menu component is a navigation drawer that slides in from the side of the current
* view. By default, it slides in from the left, but the side can be overridden. The menu
* will be displayed differently based on the mode, however the display type can be changed
* to any of the available [menu types](#menu-types). The menu element should be a sibling
* to the app's content element. There can be any number of menus attached to the content.
* These can be controlled from the templates, or programmatically using the [MenuController](../../app/MenuController).
*
* @usage
*
* ```html
* <ion-menu [content]="mycontent">
* <ion-content>
* <ion-list>
* <p>some menu content, could be list items</p>
* </ion-list>
* </ion-content>
* </ion-menu>
*
* <ion-nav #mycontent [root]="rootPage"></ion-nav>
* ```
*
* To add a menu to an app, the `<ion-menu>` element should be added as a sibling to the `ion-nav` it will belongs
* to. A [local variable](https://angular.io/docs/ts/latest/guide/user-input.html#local-variables)
* should be added to the `ion-nav` and passed to the `ion-menu`s `content` property.
*
* This tells the menu what it is bound to and what element to watch for gestures.
* In the below example, `content` is using [property binding](https://angular.io/docs/ts/latest/guide/template-syntax.html#!#property-binding)
* because `mycontent` is a reference to the `<ion-nav>` element, and not a string.
*
*
* ### Opening/Closing Menus
*
* There are several ways to open or close a menu. The menu can be **toggled** open or closed
* from the template using the [MenuToggle](../MenuToggle) directive. It can also be
* **closed** from the template using the [MenuClose](../MenuClose) directive. To display a menu
* programmatically, inject the [MenuController](../MenuController) provider and call any of the
* `MenuController` methods.
*
*
* ### Menu Types
*
* The menu supports several display types: `overlay`, `reveal` and `push`. By default,
* it will use the correct type based on the mode, but this can be changed. The default
* type for both Material Design and Windows mode is `overlay`, and `reveal` is the default
* type for iOS mode. The menu type can be changed in the app's [config](../../config/Config)
* via the `menuType` property, or passed in the `type` property on the `<ion-menu>` element.
* See [usage](#usage) below for examples of changing the menu type.
*
*
* ### Navigation Bar Behavior
*
* If a [MenuToggle](../MenuToggle) button is added to the [Navbar](../../navbar/Navbar) of
* a page, the button will only appear when the page it's in is currently a root page. The
* root page is the initial page loaded in the app, or a page that has been set as the root
* using the [setRoot](../../nav/NavController/#setRoot) method on the [NavController](../../nav/NavController).
*
* For example, say the application has two pages, `Page1` and `Page2`, and both have a
* `MenuToggle` button in their navigation bars. Assume the initial page loaded into the app
* is `Page1`, making it the root page. `Page1` will display the `MenuToggle` button, but once
* `Page2` is pushed onto the navigation stack, the `MenuToggle` will not be displayed.
*
*
* ### Persistent Menus
*
* Persistent menus display the [MenuToggle](../MenuToggle) button in the [Navbar](../../navbar/Navbar)
* on all pages in the navigation stack. To make a menu persistent set `persistent` to `true` on the
* `<ion-menu>` element. Note that this will only affect the `MenuToggle` button in the `Navbar` attached
* to the `Menu` with `persistent` set to true, any other `MenuToggle` buttons will not be affected.
* ### Menu Side
*
* By default, menus slide in from the left, but this can be overridden by passing `right`
* to the `side` property:
*
* ```html
* <ion-menu side="right" [content]="mycontent">...</ion-menu>
* ```
*
*
* ### Menu Type
*
* The menu type can be changed by passing the value to `type` on the `<ion-menu>`:
*
* ```html
* <ion-menu type="overlay" [content]="mycontent">...</ion-menu>
* ```
*
* It can also be set in the app's config. The below will set the menu type to
* `push` for all modes, and then set the type to `overlay` for the `ios` mode.
*
* ```ts
* // in NgModules
*
* imports: [
* IonicModule.forRoot(MyApp,{
* menuType: 'push',
* platforms: {
* ios: {
* menuType: 'overlay',
* }
* }
* })
* ],
* ```
*
*
* ### Displaying the Menu
*
* To toggle a menu from the template, add a button with the `menuToggle`
* directive anywhere in the page's template:
*
* ```html
* <button ion-button menuToggle>Toggle Menu</button>
* ```
*
* To close a menu, add the `menuClose` button. It can be added anywhere
* in the content, or even the menu itself. Below it is added to the menu's
* content:
*
* ```html
* <ion-menu [content]="mycontent">
* <ion-content>
* <ion-list>
* <ion-item menuClose detail-none>Close Menu</ion-item>
* </ion-list>
* </ion-content>
* </ion-menu>
* ```
*
* See the [MenuToggle](../MenuToggle) and [MenuClose](../MenuClose) docs
* for more information on these directives.
*
* The menu can also be controlled from the Page by using the `MenuController`.
* Inject the `MenuController` provider into the page and then call any of its
* methods. In the below example, the `openMenu` method will open the menu
* when it is called.
*
* ```ts
* import { Component } from '@angular/core';
* import { MenuController } from 'ionic-angular';
*
* @Component({...})
* export class MyPage {
* constructor(public menuCtrl: MenuController) {}
*
* openMenu() {
* this.menuCtrl.open();
* }
* }
* ```
*
* See the [MenuController](../../app/MenuController) API docs for all of the methods
* and usage information.
*
*
* @demo /docs/demos/src/menu/
*
* @see {@link /docs/components#menus Menu Component Docs}
* @see {@link ../../app/MenuController MenuController API Docs}
* @see {@link ../../nav/Nav Nav API Docs}
* @see {@link ../../nav/NavController NavController API Docs}
*/
var Menu = (function () {
function Menu(_menuCtrl, _elementRef, _config, _plt, _renderer, _keyboard, _gestureCtrl, _domCtrl, _app) {
this._menuCtrl = _menuCtrl;
this._elementRef = _elementRef;
this._config = _config;
this._plt = _plt;
this._renderer = _renderer;
this._keyboard = _keyboard;
this._gestureCtrl = _gestureCtrl;
this._domCtrl = _domCtrl;
this._app = _app;
this._isSwipeEnabled = true;
this._isAnimating = false;
this._isPersistent = false;
this._init = false;
this._isPane = false;
/**
* @hidden
*/
this.isOpen = false;
/**
* @hidden
*/
this.isRightSide = false;
/**
* @output {event} Emitted when the menu is being dragged open.
*/
this.ionDrag = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* @output {event} Emitted when the menu has been opened.
*/
this.ionOpen = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* @output {event} Emitted when the menu has been closed.
*/
this.ionClose = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
this._events = new __WEBPACK_IMPORTED_MODULE_13__gestures_ui_event_manager__["a" /* UIEventManager */](_plt);
this._gestureBlocker = _gestureCtrl.createBlocker({
disable: [__WEBPACK_IMPORTED_MODULE_6__gestures_gesture_controller__["b" /* GESTURE_GO_BACK_SWIPE */]]
});
this.side = 'start';
}
Object.defineProperty(Menu.prototype, "enabled", {
/**
* @input {boolean} If true, the menu is enabled. Default `true`.
*/
get: function () {
return this._isEnabled;
},
set: function (val) {
var isEnabled = Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["o" /* isTrueProperty */])(val);
this.enable(isEnabled);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Menu.prototype, "side", {
/**
* @input {string} Which side of the view the menu should be placed. Default `"left"`.
*/
get: function () {
return this._side;
},
set: function (val) {
this.isRightSide = Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["m" /* isRightSide */])(val, this._plt.isRTL);
if (this.isRightSide) {
this._side = 'right';
}
else {
this._side = 'left';
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(Menu.prototype, "swipeEnabled", {
/**
* @input {boolean} If true, swiping the menu is enabled. Default `true`.
*/
get: function () {
return this._isSwipeEnabled;
},
set: function (val) {
var isEnabled = Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["o" /* isTrueProperty */])(val);
this.swipeEnable(isEnabled);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Menu.prototype, "persistent", {
/**
* @input {boolean} If true, the menu will persist on child pages.
*/
get: function () {
return this._isPersistent;
},
set: function (val) {
this._isPersistent = Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
/**
* @hidden
*/
Menu.prototype.ngOnInit = function () {
var _this = this;
this._init = true;
var content = this.content;
this._cntEle = (content instanceof Node) ? content : content && content.getNativeElement && content.getNativeElement();
// requires content element
if (!this._cntEle) {
return console.error('Menu: must have a [content] element to listen for drag events on. Example:\n\n<ion-menu [content]="content"></ion-menu>\n\n<ion-nav #content></ion-nav>');
}
this.setElementAttribute('side', this._side);
// normalize the "type"
if (!this.type) {
this.type = this._config.get('menuType');
}
this.setElementAttribute('type', this.type);
// add the gestures
this._gesture = new __WEBPACK_IMPORTED_MODULE_9__menu_gestures__["a" /* MenuContentGesture */](this._plt, this, this._gestureCtrl, this._domCtrl);
// add menu's content classes
this._cntEle.classList.add('menu-content');
this._cntEle.classList.add('menu-content-' + this.type);
var isEnabled = this._isEnabled;
if (isEnabled === true || typeof isEnabled === 'undefined') {
// check if more than one menu is on the same side
isEnabled = !this._menuCtrl.getMenus().some(function (m) {
return m.side === _this.side && m.enabled;
});
}
// register this menu with the app's menu controller
this._menuCtrl._register(this);
// mask it as enabled / disabled
this.enable(isEnabled);
};
/**
* @hidden
*/
Menu.prototype.onBackdropClick = function (ev) {
ev.preventDefault();
ev.stopPropagation();
this._menuCtrl.close();
};
/**
* @hidden
*/
Menu.prototype._getType = function () {
if (!this._type) {
this._type = __WEBPACK_IMPORTED_MODULE_10__app_menu_controller__["a" /* MenuController */].create(this.type, this, this._plt);
if (this._config.get('animate') === false) {
this._type.ani.duration(0);
}
}
return this._type;
};
/**
* @hidden
*/
Menu.prototype.setOpen = function (shouldOpen, animated) {
var _this = this;
if (animated === void 0) { animated = true; }
// If the menu is disabled or it is currenly being animated, let's do nothing
if ((shouldOpen === this.isOpen) || !this._canOpen() || this._isAnimating) {
return Promise.resolve(this.isOpen);
}
return new Promise(function (resolve) {
_this._before();
_this._getType().setOpen(shouldOpen, animated, function () {
_this._after(shouldOpen);
resolve(_this.isOpen);
});
});
};
Menu.prototype._forceClosing = function () {
var _this = this;
(void 0) /* assert */;
this._isAnimating = true;
this._getType().setOpen(false, false, function () {
_this._after(false);
});
};
/**
* @hidden
*/
Menu.prototype.canSwipe = function () {
return this._isSwipeEnabled &&
!this._isAnimating &&
this._canOpen() &&
this._app.isEnabled();
};
/**
* @hidden
*/
Menu.prototype.isAnimating = function () {
return this._isAnimating;
};
Menu.prototype._swipeBeforeStart = function () {
if (!this.canSwipe()) {
(void 0) /* assert */;
return;
}
this._before();
};
Menu.prototype._swipeStart = function () {
if (!this._isAnimating) {
(void 0) /* assert */;
return;
}
this._getType().setProgressStart(this.isOpen);
};
Menu.prototype._swipeProgress = function (stepValue) {
if (!this._isAnimating) {
(void 0) /* assert */;
return;
}
this._getType().setProgessStep(stepValue);
var ionDrag = this.ionDrag;
if (ionDrag.observers.length > 0) {
ionDrag.emit(stepValue);
}
};
Menu.prototype._swipeEnd = function (shouldCompleteLeft, shouldCompleteRight, stepValue, velocity) {
var _this = this;
if (!this._isAnimating) {
(void 0) /* assert */;
return;
}
// user has finished dragging the menu
var isRightSide = this.isRightSide;
var isRTL = this._plt.isRTL;
var opening = !this.isOpen;
var shouldComplete = (opening)
? (isRightSide !== isRTL) ? shouldCompleteLeft : shouldCompleteRight
: (isRightSide !== isRTL) ? shouldCompleteRight : shouldCompleteLeft;
this._getType().setProgressEnd(shouldComplete, stepValue, velocity, function (isOpen) {
(void 0) /* console.debug */;
_this._after(isOpen);
});
};
Menu.prototype._before = function () {
(void 0) /* assert */;
// this places the menu into the correct location before it animates in
// this css class doesn't actually kick off any animations
this.setElementClass('show-menu', true);
this.backdrop.setElementClass('show-backdrop', true);
this.resize();
this._keyboard.close();
this._isAnimating = true;
};
Menu.prototype._after = function (isOpen) {
(void 0) /* assert */;
this._app.setEnabled(false, 100);
// keep opening/closing the menu disabled for a touch more yet
// only add listeners/css if it's enabled and isOpen
// and only remove listeners/css if it's not open
// emit opened/closed events
this.isOpen = isOpen;
this._isAnimating = false;
this._events.unlistenAll();
if (isOpen) {
// Disable swipe to go back gesture
this._gestureBlocker.block();
this._cntEle.classList.add('menu-content-open');
var callback = this.onBackdropClick.bind(this);
this._events.listen(this._cntEle, 'click', callback, { capture: true });
this._events.listen(this.backdrop.getNativeElement(), 'click', callback, { capture: true });
this.ionOpen.emit(true);
}
else {
// Enable swipe to go back gesture
this._gestureBlocker.unblock();
this._cntEle.classList.remove('menu-content-open');
this.setElementClass('show-menu', false);
this.backdrop.setElementClass('show-menu', false);
this.ionClose.emit(true);
}
};
/**
* @hidden
*/
Menu.prototype.open = function () {
return this.setOpen(true);
};
/**
* @hidden
*/
Menu.prototype.close = function () {
return this.setOpen(false);
};
/**
* @hidden
*/
Menu.prototype.resize = function () {
var content = this.menuContent
? this.menuContent
: this.menuNav;
content && content.resize();
};
/**
* @hidden
*/
Menu.prototype.toggle = function () {
return this.setOpen(!this.isOpen);
};
Menu.prototype._canOpen = function () {
return this._isEnabled && !this._isPane;
};
/**
* @hidden
*/
Menu.prototype._updateState = function () {
var canOpen = this._canOpen();
// Close menu inmediately
if (!canOpen && this.isOpen) {
(void 0) /* assert */;
// close if this menu is open, and should not be enabled
this._forceClosing();
}
if (this._isEnabled && this._menuCtrl) {
this._menuCtrl._setActiveMenu(this);
}
if (!this._init) {
return;
}
var gesture = this._gesture;
// only listen/unlisten if the menu has initialized
if (canOpen && this._isSwipeEnabled && !gesture.isListening) {
// should listen, but is not currently listening
(void 0) /* console.debug */;
gesture.listen();
}
else if (gesture.isListening && (!canOpen || !this._isSwipeEnabled)) {
// should not listen, but is currently listening
(void 0) /* console.debug */;
gesture.unlisten();
}
if (this.isOpen || (this._isPane && this._isEnabled)) {
this.resize();
}
(void 0) /* assert */;
};
/**
* @hidden
*/
Menu.prototype.enable = function (shouldEnable) {
this._isEnabled = shouldEnable;
this.setElementClass('menu-enabled', shouldEnable);
this._updateState();
return this;
};
/**
* @internal
*/
Menu.prototype.initPane = function () {
return false;
};
/**
* @internal
*/
Menu.prototype.paneChanged = function (isPane) {
this._isPane = isPane;
this._updateState();
};
/**
* @hidden
*/
Menu.prototype.swipeEnable = function (shouldEnable) {
this._isSwipeEnabled = shouldEnable;
this._updateState();
return this;
};
/**
* @hidden
*/
Menu.prototype.getNativeElement = function () {
return this._elementRef.nativeElement;
};
/**
* @hidden
*/
Menu.prototype.getMenuElement = function () {
return this.getNativeElement().querySelector('.menu-inner');
};
/**
* @hidden
*/
Menu.prototype.getContentElement = function () {
return this._cntEle;
};
/**
* @hidden
*/
Menu.prototype.getBackdropElement = function () {
return this.backdrop.getNativeElement();
};
/**
* @hidden
*/
Menu.prototype.width = function () {
return this.getMenuElement().offsetWidth;
};
/**
* @hidden
*/
Menu.prototype.getMenuController = function () {
return this._menuCtrl;
};
/**
* @hidden
*/
Menu.prototype.setElementClass = function (className, add) {
this._renderer.setElementClass(this._elementRef.nativeElement, className, add);
};
/**
* @hidden
*/
Menu.prototype.setElementAttribute = function (attributeName, value) {
this._renderer.setElementAttribute(this._elementRef.nativeElement, attributeName, value);
};
/**
* @hidden
*/
Menu.prototype.getElementRef = function () {
return this._elementRef;
};
/**
* @hidden
*/
Menu.prototype.ngOnDestroy = function () {
this._menuCtrl._unregister(this);
this._events.destroy();
this._gesture && this._gesture.destroy();
this._type && this._type.destroy();
this._gesture = null;
this._type = null;
this._cntEle = null;
};
Menu.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-menu',
template: '<div class="menu-inner"><ng-content></ng-content></div>' +
'<ion-backdrop></ion-backdrop>',
host: {
'role': 'navigation'
},
changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* ChangeDetectionStrategy */].OnPush,
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
providers: [{ provide: __WEBPACK_IMPORTED_MODULE_14__split_pane_split_pane__["a" /* RootNode */], useExisting: Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_14" /* forwardRef */])(function () { return Menu; }) }]
},] },
];
/** @nocollapse */
Menu.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_10__app_menu_controller__["a" /* MenuController */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_3__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_12__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_8__platform_keyboard__["a" /* Keyboard */], },
{ type: __WEBPACK_IMPORTED_MODULE_6__gestures_gesture_controller__["l" /* GestureController */], },
{ type: __WEBPACK_IMPORTED_MODULE_5__platform_dom_controller__["a" /* DomController */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__app_app__["a" /* App */], },
]; };
Menu.propDecorators = {
'backdrop': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_8" /* ViewChild */], args: [__WEBPACK_IMPORTED_MODULE_2__backdrop_backdrop__["a" /* Backdrop */],] },],
'menuContent': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* ContentChild */], args: [__WEBPACK_IMPORTED_MODULE_4__content_content__["a" /* Content */],] },],
'menuNav': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* ContentChild */], args: [__WEBPACK_IMPORTED_MODULE_11__nav_nav__["a" /* Nav */],] },],
'content': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'id': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'type': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'enabled': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'side': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'swipeEnabled': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'persistent': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'maxEdgeStart': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'ionDrag': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'ionOpen': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'ionClose': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
};
return Menu;
}());
//# sourceMappingURL=menu.js.map
/***/ }),
/* 169 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return MenuClose; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__app_menu_controller__ = __webpack_require__(34);
/**
* @name MenuClose
* @description
* The `menuClose` directive can be placed on any button to close an open menu.
*
* @usage
*
* A simple `menuClose` button can be added using the following markup:
*
* ```html
* <button ion-button menuClose>Close Menu</button>
* ```
*
* To close a certain menu by its id or side, give the `menuClose`
* directive a value.
*
* ```html
* <button ion-button menuClose="left">Close Left Menu</button>
* ```
*
* @demo /docs/demos/src/menu/
* @see {@link /docs/components#menus Menu Component Docs}
* @see {@link ../../menu/Menu Menu API Docs}
*/
var MenuClose = (function () {
function MenuClose(_menu) {
this._menu = _menu;
}
/**
* @hidden
*/
MenuClose.prototype.close = function () {
var menu = this._menu.get(this.menuClose);
menu && menu.close();
};
MenuClose.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: '[menuClose]'
},] },
];
/** @nocollapse */
MenuClose.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__app_menu_controller__["a" /* MenuController */], },
]; };
MenuClose.propDecorators = {
'menuClose': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'close': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* HostListener */], args: ['click',] },],
};
return MenuClose;
}());
//# sourceMappingURL=menu-close.js.map
/***/ }),
/* 170 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return MenuToggle; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__button_button__ = __webpack_require__(45);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__app_menu_controller__ = __webpack_require__(34);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__toolbar_navbar__ = __webpack_require__(49);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__navigation_view_controller__ = __webpack_require__(7);
/**
* @name MenuToggle
* @description
* The `menuToggle` directive can be placed on any button to toggle a menu open or closed.
* If it is added to the [NavBar](../../toolbar/Navbar) of a page, the button will only appear
* when the page it's in is currently a root page. See the [Menu Navigation Bar Behavior](../Menu#navigation-bar-behavior)
* docs for more information.
*
*
* @usage
*
* A simple `menuToggle` button can be added using the following markup:
*
* ```html
* <button ion-button menuToggle>Toggle Menu</button>
* ```
*
* To toggle a specific menu by its id or side, give the `menuToggle`
* directive a value.
*
* ```html
* <button ion-button menuToggle="right">Toggle Right Menu</button>
* ```
*
* If placing the `menuToggle` in a navbar or toolbar, it should be
* placed as a child of the `<ion-navbar>` or `<ion-toolbar>`, and not in
* the `<ion-buttons>` element:
*
* ```html
* <ion-header>
*
* <ion-navbar>
* <ion-buttons start>
* <button ion-button>
* <ion-icon name="contact"></ion-icon>
* </button>
* </ion-buttons>
* <button ion-button menuToggle>
* <ion-icon name="menu"></ion-icon>
* </button>
* <ion-title>
* Title
* </ion-title>
* <ion-buttons end>
* <button ion-button (click)="doClick()">
* <ion-icon name="more"></ion-icon>
* </button>
* </ion-buttons>
* </ion-navbar>
*
* </ion-header>
* ```
*
* Similar to `<ion-buttons>`, the `menuToggle` can be positioned using
* `start`, `end`, `left`, or `right`:
*
* ```html
* <ion-toolbar>
* <button ion-button menuToggle right>
* <ion-icon name="menu"></ion-icon>
* </button>
* <ion-title>
* Title
* </ion-title>
* <ion-buttons end>
* <button ion-button (click)="doClick()">
* <ion-icon name="more"></ion-icon>
* </button>
* </ion-buttons>
* </ion-toolbar>
* ```
*
* See the [Toolbar API docs](../../toolbar/Toolbar) for more information
* on the different positions.
*
* @demo /docs/demos/src/menu/
* @see {@link /docs/components#menus Menu Component Docs}
* @see {@link ../../menu/Menu Menu API Docs}
*/
var MenuToggle = (function () {
function MenuToggle(_menu, _viewCtrl, _button, _navbar) {
this._menu = _menu;
this._viewCtrl = _viewCtrl;
this._button = _button;
this._isButton = !!_button;
this._inNavbar = !!_navbar;
}
MenuToggle.prototype.ngAfterContentInit = function () {
// Add the bar-button-menutoggle / button-menutoggle class
if (this._isButton) {
this._button._setClass('menutoggle', true);
}
};
/**
* @hidden
*/
MenuToggle.prototype.toggle = function () {
var menu = this._menu.get(this.menuToggle);
menu && menu.toggle();
};
Object.defineProperty(MenuToggle.prototype, "isHidden", {
/**
* @hidden
*/
get: function () {
var menu = this._menu.get(this.menuToggle);
if (this._inNavbar && this._viewCtrl) {
if (!menu || !menu._canOpen()) {
return true;
}
if (this._viewCtrl.isFirst()) {
// this is the first view, so it should always show
return false;
}
if (menu) {
// this is not the root view, so see if this menu
// is configured to still be enabled if it's not the root view
return !menu.persistent;
}
}
return false;
},
enumerable: true,
configurable: true
});
MenuToggle.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: '[menuToggle]',
host: {
'[hidden]': 'isHidden'
}
},] },
];
/** @nocollapse */
MenuToggle.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_2__app_menu_controller__["a" /* MenuController */], },
{ type: __WEBPACK_IMPORTED_MODULE_4__navigation_view_controller__["a" /* ViewController */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_1__button_button__["a" /* Button */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_3__toolbar_navbar__["a" /* Navbar */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
]; };
MenuToggle.propDecorators = {
'menuToggle': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'toggle': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* HostListener */], args: ['click',] },],
};
return MenuToggle;
}());
//# sourceMappingURL=menu-toggle.js.map
/***/ }),
/* 171 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ToolbarBase; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ion__ = __webpack_require__(6);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
*/
var ToolbarBase = (function (_super) {
__extends(ToolbarBase, _super);
function ToolbarBase(config, elementRef, renderer) {
return _super.call(this, config, elementRef, renderer, 'toolbar') || this;
}
/**
* @hidden
*/
ToolbarBase.prototype._setTitle = function (titleCmp) {
this._title = titleCmp;
};
/**
* @hidden
* Returns the toolbar title text if it exists or an empty string
*/
ToolbarBase.prototype.getTitleText = function () {
return (this._title && this._title.getTitleText()) || '';
};
return ToolbarBase;
}(__WEBPACK_IMPORTED_MODULE_0__ion__["a" /* Ion */]));
//# sourceMappingURL=toolbar-base.js.map
/***/ }),
/* 172 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Modal; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__navigation_overlay_proxy__ = __webpack_require__(173);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__modal_impl__ = __webpack_require__(400);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
*/
var Modal = (function (_super) {
__extends(Modal, _super);
function Modal(app, component, data, opts, config, deepLinker) {
if (opts === void 0) { opts = {}; }
var _this = _super.call(this, app, component, config, deepLinker) || this;
_this.data = data;
_this.opts = opts;
_this.isOverlay = true;
return _this;
}
Modal.prototype.getImplementation = function () {
return new __WEBPACK_IMPORTED_MODULE_1__modal_impl__["a" /* ModalImpl */](this._app, this._component, this.data, this.opts, this._config);
};
return Modal;
}(__WEBPACK_IMPORTED_MODULE_0__navigation_overlay_proxy__["a" /* OverlayProxy */]));
//# sourceMappingURL=modal.js.map
/***/ }),
/* 173 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return OverlayProxy; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_util__ = __webpack_require__(3);
var OverlayProxy = (function () {
function OverlayProxy(_app, _component, _config, _deepLinker) {
this._app = _app;
this._component = _component;
this._config = _config;
this._deepLinker = _deepLinker;
}
OverlayProxy.prototype.getImplementation = function () {
throw new Error('Child class must implement "getImplementation" method');
};
/**
* Present the modal instance.
*
* @param {NavOptions} [navOptions={}] Nav options to go with this transition.
* @returns {Promise} Returns a promise which is resolved when the transition has completed.
*/
OverlayProxy.prototype.present = function (navOptions) {
var _this = this;
if (navOptions === void 0) { navOptions = {}; }
// check if it's a lazy loaded component, or not
var isLazyLoaded = Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["n" /* isString */])(this._component);
if (isLazyLoaded) {
return this._deepLinker.getComponentFromName(this._component).then(function (loadedComponent) {
_this._component = loadedComponent;
return _this.createAndPresentOverlay(navOptions);
});
}
else {
return this.createAndPresentOverlay(navOptions);
}
};
OverlayProxy.prototype.dismiss = function (data, role, navOptions) {
if (this.overlay) {
return this.overlay.dismiss(data, role, navOptions);
}
};
/**
* Called when the current viewController has be successfully dismissed
*/
OverlayProxy.prototype.onDidDismiss = function (callback) {
this._onDidDismiss = callback;
if (this.overlay) {
this.overlay.onDidDismiss(this._onDidDismiss);
}
};
OverlayProxy.prototype.createAndPresentOverlay = function (navOptions) {
this.overlay = this.getImplementation();
this.overlay.onWillDismiss(this._onWillDismiss);
this.overlay.onDidDismiss(this._onDidDismiss);
return this.overlay.present(navOptions);
};
/**
* Called when the current viewController will be dismissed
*/
OverlayProxy.prototype.onWillDismiss = function (callback) {
this._onWillDismiss = callback;
if (this.overlay) {
this.overlay.onWillDismiss(this._onWillDismiss);
}
};
return OverlayProxy;
}());
//# sourceMappingURL=overlay-proxy.js.map
/***/ }),
/* 174 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NgModuleLoader; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/**
* NgModuleFactoryLoader that uses SystemJS to load NgModuleFactory
*/
var NgModuleLoader = (function () {
function NgModuleLoader(_compiler) {
this._compiler = _compiler;
}
NgModuleLoader.prototype.load = function (modulePath, ngModuleExport) {
var offlineMode = this._compiler instanceof __WEBPACK_IMPORTED_MODULE_0__angular_core__["k" /* Compiler */];
return offlineMode ? loadPrecompiledFactory(modulePath, ngModuleExport) : loadAndCompile(this._compiler, modulePath, ngModuleExport);
};
NgModuleLoader.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
NgModuleLoader.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["k" /* Compiler */], },
]; };
return NgModuleLoader;
}());
function loadAndCompile(compiler, modulePath, ngModuleExport) {
if (!ngModuleExport) {
ngModuleExport = 'default';
}
return __webpack_require__(175)(modulePath)
.then(function (rawModule) {
var module = rawModule[ngModuleExport];
if (!module) {
throw new Error("Module " + modulePath + " does not export " + ngModuleExport);
}
return compiler.compileModuleAsync(module);
});
}
function loadPrecompiledFactory(modulePath, ngModuleExport) {
return __webpack_require__(175)(modulePath)
.then(function (rawModule) {
var ngModuleFactory = rawModule[ngModuleExport];
if (!ngModuleFactory) {
throw new Error("Module " + modulePath + " does not export " + ngModuleExport);
}
return ngModuleFactory;
});
}
//# sourceMappingURL=ng-module-loader.js.map
/***/ }),
/* 175 */,
/* 176 */,
/* 177 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ELocalNotificationTriggerUnit; });
/* unused harmony export ILocalNotificationActionType */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return LocalNotifications; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__ionic_native_core__ = __webpack_require__(59);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_Observable__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_Observable___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_rxjs_Observable__);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var ELocalNotificationTriggerUnit;
(function (ELocalNotificationTriggerUnit) {
ELocalNotificationTriggerUnit["SECOND"] = "second";
ELocalNotificationTriggerUnit["MINUTE"] = "minute";
ELocalNotificationTriggerUnit["HOUR"] = "hour";
ELocalNotificationTriggerUnit["DAY"] = "day";
ELocalNotificationTriggerUnit["WEEK"] = "week";
ELocalNotificationTriggerUnit["MONTH"] = "month";
ELocalNotificationTriggerUnit["QUARTER"] = "quarter";
ELocalNotificationTriggerUnit["YEAR"] = "year";
ELocalNotificationTriggerUnit["WEEKDAY"] = "weekday";
ELocalNotificationTriggerUnit["WEEKDAY_ORDINAL"] = "weekdayOrdinal";
ELocalNotificationTriggerUnit["WEEK_OF_MONTH"] = "weekOfMonth";
})(ELocalNotificationTriggerUnit || (ELocalNotificationTriggerUnit = {}));
var ILocalNotificationActionType;
(function (ILocalNotificationActionType) {
ILocalNotificationActionType["INPUT"] = "input";
ILocalNotificationActionType["BUTTON"] = "button";
})(ILocalNotificationActionType || (ILocalNotificationActionType = {}));
/**
* @name Local Notifications
* @description
* This plugin allows you to display local notifications on the device
*
* @usage
* ```typescript
* import { LocalNotifications } from '@ionic-native/local-notifications';
*
*
* constructor(private localNotifications: LocalNotifications) { }
*
* ...
*
*
* // Schedule a single notification
* this.localNotifications.schedule({
* id: 1,
* text: 'Single ILocalNotification',
* sound: isAndroid? 'file://sound.mp3': 'file://beep.caf',
* data: { secret: key }
* });
*
*
* // Schedule multiple notifications
* this.localNotifications.schedule([{
* id: 1,
* text: 'Multi ILocalNotification 1',
* sound: isAndroid ? 'file://sound.mp3': 'file://beep.caf',
* data: { secret:key }
* },{
* id: 2,
* title: 'Local ILocalNotification Example',
* text: 'Multi ILocalNotification 2',
* icon: 'http://example.com/icon.png'
* }]);
*
*
* // Schedule delayed notification
* this.localNotifications.schedule({
* text: 'Delayed ILocalNotification',
* trigger: {at: new Date(new Date().getTime() + 3600)},
* led: 'FF0000',
* sound: null
* });
* ```
* @interfaces
* ILocalNotification
*/
var LocalNotifications = (function (_super) {
__extends(LocalNotifications, _super);
function LocalNotifications() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Schedules a single or multiple notifications
* @param options {Notification | Array<ILocalNotification>} optional
*/
LocalNotifications.prototype.schedule = function (options) { };
/**
* Updates a previously scheduled notification. Must include the id in the options parameter.
* @param options {ILocalNotification} optional
*/
LocalNotifications.prototype.update = function (options) { };
/**
* Clears single or multiple notifications
* @param notificationId {any} A single notification id, or an array of notification ids.
* @returns {Promise<any>} Returns a promise when the notification had been cleared
*/
LocalNotifications.prototype.clear = function (notificationId) { return; };
/**
* Clears all notifications
* @returns {Promise<any>} Returns a promise when all notifications have cleared
*/
LocalNotifications.prototype.clearAll = function () { return; };
/**
* Cancels single or multiple notifications
* @param notificationId {any} A single notification id, or an array of notification ids.
* @returns {Promise<any>} Returns a promise when the notification is canceled
*/
LocalNotifications.prototype.cancel = function (notificationId) { return; };
/**
* Cancels all notifications
* @returns {Promise<any>} Returns a promise when all notifications are canceled
*/
LocalNotifications.prototype.cancelAll = function () { return; };
/**
* Checks presence of a notification
* @param notificationId {number}
* @returns {Promise<boolean>}
*/
LocalNotifications.prototype.isPresent = function (notificationId) { return; };
/**
* Checks is a notification is scheduled
* @param notificationId {number}
* @returns {Promise<boolean>}
*/
LocalNotifications.prototype.isScheduled = function (notificationId) { return; };
/**
* Checks if a notification is triggered
* @param notificationId {number}
* @returns {Promise<boolean>}
*/
LocalNotifications.prototype.isTriggered = function (notificationId) { return; };
/**
* Get all the notification ids
* @returns {Promise<Array<number>>}
*/
LocalNotifications.prototype.getIds = function () { return; };
/**
* Get the ids of triggered notifications
* @returns {Promise<Array<number>>}
*/
LocalNotifications.prototype.getTriggeredIds = function () { return; };
/**
* Get the ids of scheduled notifications
* @returns {Promise<Array<number>>} Returns a promise
*/
LocalNotifications.prototype.getScheduledIds = function () { return; };
/**
* Get a notification object
* @param notificationId {any} The id of the notification to get
* @returns {Promise<ILocalNotification>}
*/
LocalNotifications.prototype.get = function (notificationId) { return; };
/**
* Get a scheduled notification object
* @param notificationId {any} The id of the notification to get
* @returns {Promise<ILocalNotification>}
*/
LocalNotifications.prototype.getScheduled = function (notificationId) { return; };
/**
* Get a triggered notification object
* @param notificationId The id of the notification to get
* @returns {Promise<ILocalNotification>}
*/
LocalNotifications.prototype.getTriggered = function (notificationId) { return; };
/**
* Get all notification objects
* @returns {Promise<Array<ILocalNotification>>}
*/
LocalNotifications.prototype.getAll = function () { return; };
/**
* Get all scheduled notification objects
* @returns {Promise<Array<ILocalNotification>>}
*/
LocalNotifications.prototype.getAllScheduled = function () { return; };
/**
* Get all triggered notification objects
* @returns {Promise<Array<ILocalNotification>>}
*/
LocalNotifications.prototype.getAllTriggered = function () { return; };
/**
* Request permission to show notifications if not already granted.
* @returns {Promise<boolean>}
*/
LocalNotifications.prototype.requestPermission = function () { return; };
/**
* Informs if the app has the permission to show notifications.
* @returns {Promise<boolean>}
*/
LocalNotifications.prototype.hasPermission = function () { return; };
/**
* Adds a group of actions
* @param groupId The id of the action group
* @param actions The actions of this group
* @returns {Promise<any>}
*/
LocalNotifications.prototype.addActions = function (groupId, actions) { return; };
/**
* Removes a group of actions
* @param groupId The id of the action group
* @returns {Promise<any>}
*/
LocalNotifications.prototype.removeActions = function (groupId) { return; };
/**
* Checks if a group of actions is defined
* @param groupId The id of the action group
* @returns {Promise<boolean>} Whether the group is defined
*/
LocalNotifications.prototype.hasActions = function (groupId) { return; };
/**
* Gets the (platform specific) default settings.
* @returns {Promise<any>} An object with all default settings
*/
LocalNotifications.prototype.getDefaults = function () { return; };
/**
* Overwrites the (platform specific) default settings.
* @returns {Promise<any>}
*/
LocalNotifications.prototype.setDefaults = function (defaults) { return; };
/**
* Sets a callback for a specific event
* @param eventName {string} The name of the event. Available events: schedule, trigger, click, update, clear, clearall, cancel, cancelall. Custom event names are possible for actions
* @return {Observable}
*/
LocalNotifications.prototype.on = function (eventName) { return; };
/**
* Not an official interface, however its possible to manually fire events.
** @param eventName The name of the event. Available events: schedule, trigger, click, update, clear, clearall, cancel, cancelall. Custom event names are possible for actions
* @param args Optional arguments
*/
LocalNotifications.prototype.fireEvent = function (eventName, args) { };
/**
* Fire queued events once the device is ready and all listeners are registered.
* @returns {Promise<any>}
*/
LocalNotifications.prototype.fireQueuedEvents = function () { return; };
LocalNotifications.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
LocalNotifications.ctorParameters = function () { return []; };
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])({
sync: true
}),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], LocalNotifications.prototype, "schedule", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])({
sync: true
}),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], LocalNotifications.prototype, "update", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise)
], LocalNotifications.prototype, "clear", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], LocalNotifications.prototype, "clearAll", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise)
], LocalNotifications.prototype, "cancel", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], LocalNotifications.prototype, "cancelAll", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Number]),
__metadata("design:returntype", Promise)
], LocalNotifications.prototype, "isPresent", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Number]),
__metadata("design:returntype", Promise)
], LocalNotifications.prototype, "isScheduled", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Number]),
__metadata("design:returntype", Promise)
], LocalNotifications.prototype, "isTriggered", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], LocalNotifications.prototype, "getIds", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], LocalNotifications.prototype, "getTriggeredIds", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], LocalNotifications.prototype, "getScheduledIds", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise)
], LocalNotifications.prototype, "get", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise)
], LocalNotifications.prototype, "getScheduled", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise)
], LocalNotifications.prototype, "getTriggered", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], LocalNotifications.prototype, "getAll", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], LocalNotifications.prototype, "getAllScheduled", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], LocalNotifications.prototype, "getAllTriggered", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], LocalNotifications.prototype, "requestPermission", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], LocalNotifications.prototype, "hasPermission", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, Array]),
__metadata("design:returntype", Promise)
], LocalNotifications.prototype, "addActions", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise)
], LocalNotifications.prototype, "removeActions", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise)
], LocalNotifications.prototype, "hasActions", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])({
sync: true
}),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], LocalNotifications.prototype, "getDefaults", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])({
sync: true
}),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise)
], LocalNotifications.prototype, "setDefaults", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])({
observable: true,
clearFunction: 'un',
clearWithArgs: true
}),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", __WEBPACK_IMPORTED_MODULE_2_rxjs_Observable__["Observable"])
], LocalNotifications.prototype, "on", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])({
sync: true
}),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String, Object]),
__metadata("design:returntype", void 0)
], LocalNotifications.prototype, "fireEvent", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], LocalNotifications.prototype, "fireQueuedEvents", null);
LocalNotifications = __decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["e" /* Plugin */])({
pluginName: 'LocalNotifications',
plugin: 'cordova-plugin-local-notification',
pluginRef: 'cordova.plugins.notification.local',
repo: 'https://github.com/katzer/cordova-plugin-local-notifications',
platforms: ['Android', 'iOS', 'Windows']
})
], LocalNotifications);
return LocalNotifications;
}(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["d" /* IonicNativePlugin */]));
//# sourceMappingURL=index.js.map
/***/ }),
/* 178 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export ERR_CORDOVA_NOT_AVAILABLE */
/* unused harmony export ERR_PLUGIN_NOT_INSTALLED */
/* harmony export (immutable) */ __webpack_exports__["a"] = checkAvailability;
/* harmony export (immutable) */ __webpack_exports__["b"] = instanceAvailability;
/* unused harmony export wrapEventObservable */
/* harmony export (immutable) */ __webpack_exports__["c"] = overrideFunction;
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return wrap; });
/* harmony export (immutable) */ __webpack_exports__["e"] = wrapInstance;
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util__ = __webpack_require__(98);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__bootstrap__ = __webpack_require__(409);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_Observable__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_Observable___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_rxjs_Observable__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_add_observable_fromEvent__ = __webpack_require__(410);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_add_observable_fromEvent___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_rxjs_add_observable_fromEvent__);
Object(__WEBPACK_IMPORTED_MODULE_1__bootstrap__["a" /* checkReady */])();
// declare const window;
// declare var Promise;
var ERR_CORDOVA_NOT_AVAILABLE = { error: 'cordova_not_available' };
var ERR_PLUGIN_NOT_INSTALLED = { error: 'plugin_not_installed' };
function checkAvailability(plugin, methodName, pluginName) {
var pluginRef, pluginInstance, pluginPackage;
if (typeof plugin === 'string') {
pluginRef = plugin;
}
else {
pluginRef = plugin.constructor.getPluginRef();
pluginName = plugin.constructor.getPluginName();
pluginPackage = plugin.constructor.getPluginInstallName();
}
pluginInstance = Object(__WEBPACK_IMPORTED_MODULE_0__util__["b" /* getPlugin */])(pluginRef);
if (!pluginInstance || (!!methodName && typeof pluginInstance[methodName] === 'undefined')) {
if (!window.cordova) {
Object(__WEBPACK_IMPORTED_MODULE_0__util__["a" /* cordovaWarn */])(pluginName, methodName);
return ERR_CORDOVA_NOT_AVAILABLE;
}
Object(__WEBPACK_IMPORTED_MODULE_0__util__["d" /* pluginWarn */])(pluginName, pluginPackage, methodName);
return ERR_PLUGIN_NOT_INSTALLED;
}
return true;
}
/**
* Checks if _objectInstance exists and has the method/property
* @private
*/
function instanceAvailability(pluginObj, methodName) {
return pluginObj._objectInstance && (!methodName || typeof pluginObj._objectInstance[methodName] !== 'undefined');
}
function setIndex(args, opts, resolve, reject) {
if (opts === void 0) { opts = {}; }
// ignore resolve and reject in case sync
if (opts.sync) {
return args;
}
// If the plugin method expects myMethod(success, err, options)
if (opts.callbackOrder === 'reverse') {
// Get those arguments in the order [resolve, reject, ...restOfArgs]
args.unshift(reject);
args.unshift(resolve);
}
else if (opts.callbackStyle === 'node') {
args.push(function (err, result) {
if (err) {
reject(err);
}
else {
resolve(result);
}
});
}
else if (opts.callbackStyle === 'object' && opts.successName && opts.errorName) {
var obj = {};
obj[opts.successName] = resolve;
obj[opts.errorName] = reject;
args.push(obj);
}
else if (typeof opts.successIndex !== 'undefined' || typeof opts.errorIndex !== 'undefined') {
var setSuccessIndex = function () {
// If we've specified a success/error index
if (opts.successIndex > args.length) {
args[opts.successIndex] = resolve;
}
else {
args.splice(opts.successIndex, 0, resolve);
}
};
var setErrorIndex = function () {
// We don't want that the reject cb gets spliced into the position of an optional argument that has not been defined and thus causing non expected behaviour.
if (opts.errorIndex > args.length) {
args[opts.errorIndex] = reject; // insert the reject fn at the correct specific index
}
else {
args.splice(opts.errorIndex, 0, reject); // otherwise just splice it into the array
}
};
if (opts.successIndex > opts.errorIndex) {
setErrorIndex();
setSuccessIndex();
}
else {
setSuccessIndex();
setErrorIndex();
}
}
else {
// Otherwise, let's tack them on to the end of the argument list
// which is 90% of cases
args.push(resolve);
args.push(reject);
}
return args;
}
function callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject) {
if (opts === void 0) { opts = {}; }
// Try to figure out where the success/error callbacks need to be bound
// to our promise resolve/reject handlers.
args = setIndex(args, opts, resolve, reject);
var availabilityCheck = checkAvailability(pluginObj, methodName);
if (availabilityCheck === true) {
var pluginInstance = Object(__WEBPACK_IMPORTED_MODULE_0__util__["b" /* getPlugin */])(pluginObj.constructor.getPluginRef());
return pluginInstance[methodName].apply(pluginInstance, args);
}
else {
return availabilityCheck;
}
}
function wrapPromise(pluginObj, methodName, args, opts) {
if (opts === void 0) { opts = {}; }
var pluginResult, rej;
var p = Object(__WEBPACK_IMPORTED_MODULE_0__util__["c" /* getPromise */])(function (resolve, reject) {
if (opts.destruct) {
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return resolve(args);
}, function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return reject(args);
});
}
else {
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, resolve, reject);
}
rej = reject;
});
// Angular throws an error on unhandled rejection, but in this case we have already printed
// a warning that Cordova is undefined or the plugin is uninstalled, so there is no reason
// to error
if (pluginResult && pluginResult.error) {
p.catch(function () { });
typeof rej === 'function' && rej(pluginResult.error);
}
return p;
}
function wrapOtherPromise(pluginObj, methodName, args, opts) {
if (opts === void 0) { opts = {}; }
return Object(__WEBPACK_IMPORTED_MODULE_0__util__["c" /* getPromise */])(function (resolve, reject) {
var pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts);
if (pluginResult) {
if (pluginResult.error) {
reject(pluginResult.error);
}
else if (pluginResult.then) {
pluginResult.then(resolve).catch(reject);
}
}
else {
reject({ error: 'unexpected_error' });
}
});
}
function wrapObservable(pluginObj, methodName, args, opts) {
if (opts === void 0) { opts = {}; }
return new __WEBPACK_IMPORTED_MODULE_2_rxjs_Observable__["Observable"](function (observer) {
var pluginResult;
if (opts.destruct) {
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return observer.next(args);
}, function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return observer.error(args);
});
}
else {
pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
}
if (pluginResult && pluginResult.error) {
observer.error(pluginResult.error);
observer.complete();
}
return function () {
try {
if (opts.clearFunction) {
if (opts.clearWithArgs) {
return callCordovaPlugin(pluginObj, opts.clearFunction, args, opts, observer.next.bind(observer), observer.error.bind(observer));
}
return callCordovaPlugin(pluginObj, opts.clearFunction, []);
}
}
catch (e) {
console.warn('Unable to clear the previous observable watch for', pluginObj.constructor.getPluginName(), methodName);
console.warn(e);
}
};
});
}
function callInstance(pluginObj, methodName, args, opts, resolve, reject) {
if (opts === void 0) { opts = {}; }
args = setIndex(args, opts, resolve, reject);
if (instanceAvailability(pluginObj, methodName)) {
return pluginObj._objectInstance[methodName].apply(pluginObj._objectInstance, args);
}
}
/**
* Wrap the event with an observable
* @private
* @param event even name
* @param element The element to attach the event listener to
* @returns {Observable}
*/
function wrapEventObservable(event, element) {
if (element === void 0) { element = window; }
return __WEBPACK_IMPORTED_MODULE_2_rxjs_Observable__["Observable"].fromEvent(element, event);
}
/**
* Certain plugins expect the user to override methods in the plugin. For example,
* window.cordova.plugins.backgroundMode.onactivate = function() { ... }.
*
* Unfortunately, this is brittle and would be better wrapped as an Observable. overrideFunction
* does just this.
* @private
*/
function overrideFunction(pluginObj, methodName, args, opts) {
if (opts === void 0) { opts = {}; }
return new __WEBPACK_IMPORTED_MODULE_2_rxjs_Observable__["Observable"](function (observer) {
var availabilityCheck = checkAvailability(pluginObj, methodName);
if (availabilityCheck === true) {
var pluginInstance_1 = Object(__WEBPACK_IMPORTED_MODULE_0__util__["b" /* getPlugin */])(pluginObj.constructor.getPluginRef());
pluginInstance_1[methodName] = observer.next.bind(observer);
return function () { return pluginInstance_1[methodName] = function () { }; };
}
else {
observer.error(availabilityCheck);
observer.complete();
}
});
}
/**
* @private
*/
var wrap = function (pluginObj, methodName, opts) {
if (opts === void 0) { opts = {}; }
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (opts.sync) {
// Sync doesn't wrap the plugin with a promise or observable, it returns the result as-is
return callCordovaPlugin(pluginObj, methodName, args, opts);
}
else if (opts.observable) {
return wrapObservable(pluginObj, methodName, args, opts);
}
else if (opts.eventObservable && opts.event) {
return wrapEventObservable(opts.event, opts.element);
}
else if (opts.otherPromise) {
return wrapOtherPromise(pluginObj, methodName, args, opts);
}
else {
return wrapPromise(pluginObj, methodName, args, opts);
}
};
};
/**
* @private
*/
function wrapInstance(pluginObj, methodName, opts) {
if (opts === void 0) { opts = {}; }
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (opts.sync) {
return callInstance(pluginObj, methodName, args, opts);
}
else if (opts.observable) {
return new __WEBPACK_IMPORTED_MODULE_2_rxjs_Observable__["Observable"](function (observer) {
var pluginResult;
if (opts.destruct) {
pluginResult = callInstance(pluginObj, methodName, args, opts, function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return observer.next(args);
}, function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return observer.error(args);
});
}
else {
pluginResult = callInstance(pluginObj, methodName, args, opts, observer.next.bind(observer), observer.error.bind(observer));
}
if (pluginResult && pluginResult.error) {
observer.error(pluginResult.error);
observer.complete();
}
return function () {
try {
if (opts.clearWithArgs) {
return callInstance(pluginObj, opts.clearFunction, args, opts, observer.next.bind(observer), observer.error.bind(observer));
}
return callInstance(pluginObj, opts.clearFunction, []);
}
catch (e) {
console.warn('Unable to clear the previous observable watch for', pluginObj.constructor.getPluginName(), methodName);
console.warn(e);
}
};
});
}
else if (opts.otherPromise) {
return Object(__WEBPACK_IMPORTED_MODULE_0__util__["c" /* getPromise */])(function (resolve, reject) {
var result;
if (opts.destruct) {
result = callInstance(pluginObj, methodName, args, opts, function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return resolve(args);
}, function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return reject(args);
});
}
else {
result = callInstance(pluginObj, methodName, args, opts, resolve, reject);
}
if (result && !!result.then) {
result.then(resolve, reject);
}
else {
reject();
}
});
}
else {
var pluginResult_1, rej_1;
var p = Object(__WEBPACK_IMPORTED_MODULE_0__util__["c" /* getPromise */])(function (resolve, reject) {
if (opts.destruct) {
pluginResult_1 = callInstance(pluginObj, methodName, args, opts, function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return resolve(args);
}, function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return reject(args);
});
}
else {
pluginResult_1 = callInstance(pluginObj, methodName, args, opts, resolve, reject);
}
rej_1 = reject;
});
// Angular throws an error on unhandled rejection, but in this case we have already printed
// a warning that Cordova is undefined or the plugin is uninstalled, so there is no reason
// to error
if (pluginResult_1 && pluginResult_1.error) {
p.catch(function () { });
typeof rej_1 === 'function' && rej_1(pluginResult_1.error);
}
return p;
}
};
}
//# sourceMappingURL=plugin.js.map
/***/ }),
/* 179 */,
/* 180 */,
/* 181 */,
/* 182 */
/***/ (function(module, exports, __webpack_require__) {
/* MIT license */
var convert = __webpack_require__(425);
var string = __webpack_require__(427);
var Color = function (obj) {
if (obj instanceof Color) {
return obj;
}
if (!(this instanceof Color)) {
return new Color(obj);
}
this.valid = false;
this.values = {
rgb: [0, 0, 0],
hsl: [0, 0, 0],
hsv: [0, 0, 0],
hwb: [0, 0, 0],
cmyk: [0, 0, 0, 0],
alpha: 1
};
// parse Color() argument
var vals;
if (typeof obj === 'string') {
vals = string.getRgba(obj);
if (vals) {
this.setValues('rgb', vals);
} else if (vals = string.getHsla(obj)) {
this.setValues('hsl', vals);
} else if (vals = string.getHwb(obj)) {
this.setValues('hwb', vals);
}
} else if (typeof obj === 'object') {
vals = obj;
if (vals.r !== undefined || vals.red !== undefined) {
this.setValues('rgb', vals);
} else if (vals.l !== undefined || vals.lightness !== undefined) {
this.setValues('hsl', vals);
} else if (vals.v !== undefined || vals.value !== undefined) {
this.setValues('hsv', vals);
} else if (vals.w !== undefined || vals.whiteness !== undefined) {
this.setValues('hwb', vals);
} else if (vals.c !== undefined || vals.cyan !== undefined) {
this.setValues('cmyk', vals);
}
}
};
Color.prototype = {
isValid: function () {
return this.valid;
},
rgb: function () {
return this.setSpace('rgb', arguments);
},
hsl: function () {
return this.setSpace('hsl', arguments);
},
hsv: function () {
return this.setSpace('hsv', arguments);
},
hwb: function () {
return this.setSpace('hwb', arguments);
},
cmyk: function () {
return this.setSpace('cmyk', arguments);
},
rgbArray: function () {
return this.values.rgb;
},
hslArray: function () {
return this.values.hsl;
},
hsvArray: function () {
return this.values.hsv;
},
hwbArray: function () {
var values = this.values;
if (values.alpha !== 1) {
return values.hwb.concat([values.alpha]);
}
return values.hwb;
},
cmykArray: function () {
return this.values.cmyk;
},
rgbaArray: function () {
var values = this.values;
return values.rgb.concat([values.alpha]);
},
hslaArray: function () {
var values = this.values;
return values.hsl.concat([values.alpha]);
},
alpha: function (val) {
if (val === undefined) {
return this.values.alpha;
}
this.setValues('alpha', val);
return this;
},
red: function (val) {
return this.setChannel('rgb', 0, val);
},
green: function (val) {
return this.setChannel('rgb', 1, val);
},
blue: function (val) {
return this.setChannel('rgb', 2, val);
},
hue: function (val) {
if (val) {
val %= 360;
val = val < 0 ? 360 + val : val;
}
return this.setChannel('hsl', 0, val);
},
saturation: function (val) {
return this.setChannel('hsl', 1, val);
},
lightness: function (val) {
return this.setChannel('hsl', 2, val);
},
saturationv: function (val) {
return this.setChannel('hsv', 1, val);
},
whiteness: function (val) {
return this.setChannel('hwb', 1, val);
},
blackness: function (val) {
return this.setChannel('hwb', 2, val);
},
value: function (val) {
return this.setChannel('hsv', 2, val);
},
cyan: function (val) {
return this.setChannel('cmyk', 0, val);
},
magenta: function (val) {
return this.setChannel('cmyk', 1, val);
},
yellow: function (val) {
return this.setChannel('cmyk', 2, val);
},
black: function (val) {
return this.setChannel('cmyk', 3, val);
},
hexString: function () {
return string.hexString(this.values.rgb);
},
rgbString: function () {
return string.rgbString(this.values.rgb, this.values.alpha);
},
rgbaString: function () {
return string.rgbaString(this.values.rgb, this.values.alpha);
},
percentString: function () {
return string.percentString(this.values.rgb, this.values.alpha);
},
hslString: function () {
return string.hslString(this.values.hsl, this.values.alpha);
},
hslaString: function () {
return string.hslaString(this.values.hsl, this.values.alpha);
},
hwbString: function () {
return string.hwbString(this.values.hwb, this.values.alpha);
},
keyword: function () {
return string.keyword(this.values.rgb, this.values.alpha);
},
rgbNumber: function () {
var rgb = this.values.rgb;
return (rgb[0] << 16) | (rgb[1] << 8) | rgb[2];
},
luminosity: function () {
// http://www.w3.org/TR/WCAG20/#relativeluminancedef
var rgb = this.values.rgb;
var lum = [];
for (var i = 0; i < rgb.length; i++) {
var chan = rgb[i] / 255;
lum[i] = (chan <= 0.03928) ? chan / 12.92 : Math.pow(((chan + 0.055) / 1.055), 2.4);
}
return 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];
},
contrast: function (color2) {
// http://www.w3.org/TR/WCAG20/#contrast-ratiodef
var lum1 = this.luminosity();
var lum2 = color2.luminosity();
if (lum1 > lum2) {
return (lum1 + 0.05) / (lum2 + 0.05);
}
return (lum2 + 0.05) / (lum1 + 0.05);
},
level: function (color2) {
var contrastRatio = this.contrast(color2);
if (contrastRatio >= 7.1) {
return 'AAA';
}
return (contrastRatio >= 4.5) ? 'AA' : '';
},
dark: function () {
// YIQ equation from http://24ways.org/2010/calculating-color-contrast
var rgb = this.values.rgb;
var yiq = (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000;
return yiq < 128;
},
light: function () {
return !this.dark();
},
negate: function () {
var rgb = [];
for (var i = 0; i < 3; i++) {
rgb[i] = 255 - this.values.rgb[i];
}
this.setValues('rgb', rgb);
return this;
},
lighten: function (ratio) {
var hsl = this.values.hsl;
hsl[2] += hsl[2] * ratio;
this.setValues('hsl', hsl);
return this;
},
darken: function (ratio) {
var hsl = this.values.hsl;
hsl[2] -= hsl[2] * ratio;
this.setValues('hsl', hsl);
return this;
},
saturate: function (ratio) {
var hsl = this.values.hsl;
hsl[1] += hsl[1] * ratio;
this.setValues('hsl', hsl);
return this;
},
desaturate: function (ratio) {
var hsl = this.values.hsl;
hsl[1] -= hsl[1] * ratio;
this.setValues('hsl', hsl);
return this;
},
whiten: function (ratio) {
var hwb = this.values.hwb;
hwb[1] += hwb[1] * ratio;
this.setValues('hwb', hwb);
return this;
},
blacken: function (ratio) {
var hwb = this.values.hwb;
hwb[2] += hwb[2] * ratio;
this.setValues('hwb', hwb);
return this;
},
greyscale: function () {
var rgb = this.values.rgb;
// http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
var val = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;
this.setValues('rgb', [val, val, val]);
return this;
},
clearer: function (ratio) {
var alpha = this.values.alpha;
this.setValues('alpha', alpha - (alpha * ratio));
return this;
},
opaquer: function (ratio) {
var alpha = this.values.alpha;
this.setValues('alpha', alpha + (alpha * ratio));
return this;
},
rotate: function (degrees) {
var hsl = this.values.hsl;
var hue = (hsl[0] + degrees) % 360;
hsl[0] = hue < 0 ? 360 + hue : hue;
this.setValues('hsl', hsl);
return this;
},
/**
* Ported from sass implementation in C
* https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209
*/
mix: function (mixinColor, weight) {
var color1 = this;
var color2 = mixinColor;
var p = weight === undefined ? 0.5 : weight;
var w = 2 * p - 1;
var a = color1.alpha() - color2.alpha();
var w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
var w2 = 1 - w1;
return this
.rgb(
w1 * color1.red() + w2 * color2.red(),
w1 * color1.green() + w2 * color2.green(),
w1 * color1.blue() + w2 * color2.blue()
)
.alpha(color1.alpha() * p + color2.alpha() * (1 - p));
},
toJSON: function () {
return this.rgb();
},
clone: function () {
// NOTE(SB): using node-clone creates a dependency to Buffer when using browserify,
// making the final build way to big to embed in Chart.js. So let's do it manually,
// assuming that values to clone are 1 dimension arrays containing only numbers,
// except 'alpha' which is a number.
var result = new Color();
var source = this.values;
var target = result.values;
var value, type;
for (var prop in source) {
if (source.hasOwnProperty(prop)) {
value = source[prop];
type = ({}).toString.call(value);
if (type === '[object Array]') {
target[prop] = value.slice(0);
} else if (type === '[object Number]') {
target[prop] = value;
} else {
console.error('unexpected color value:', value);
}
}
}
return result;
}
};
Color.prototype.spaces = {
rgb: ['red', 'green', 'blue'],
hsl: ['hue', 'saturation', 'lightness'],
hsv: ['hue', 'saturation', 'value'],
hwb: ['hue', 'whiteness', 'blackness'],
cmyk: ['cyan', 'magenta', 'yellow', 'black']
};
Color.prototype.maxes = {
rgb: [255, 255, 255],
hsl: [360, 100, 100],
hsv: [360, 100, 100],
hwb: [360, 100, 100],
cmyk: [100, 100, 100, 100]
};
Color.prototype.getValues = function (space) {
var values = this.values;
var vals = {};
for (var i = 0; i < space.length; i++) {
vals[space.charAt(i)] = values[space][i];
}
if (values.alpha !== 1) {
vals.a = values.alpha;
}
// {r: 255, g: 255, b: 255, a: 0.4}
return vals;
};
Color.prototype.setValues = function (space, vals) {
var values = this.values;
var spaces = this.spaces;
var maxes = this.maxes;
var alpha = 1;
var i;
this.valid = true;
if (space === 'alpha') {
alpha = vals;
} else if (vals.length) {
// [10, 10, 10]
values[space] = vals.slice(0, space.length);
alpha = vals[space.length];
} else if (vals[space.charAt(0)] !== undefined) {
// {r: 10, g: 10, b: 10}
for (i = 0; i < space.length; i++) {
values[space][i] = vals[space.charAt(i)];
}
alpha = vals.a;
} else if (vals[spaces[space][0]] !== undefined) {
// {red: 10, green: 10, blue: 10}
var chans = spaces[space];
for (i = 0; i < space.length; i++) {
values[space][i] = vals[chans[i]];
}
alpha = vals.alpha;
}
values.alpha = Math.max(0, Math.min(1, (alpha === undefined ? values.alpha : alpha)));
if (space === 'alpha') {
return false;
}
var capped;
// cap values of the space prior converting all values
for (i = 0; i < space.length; i++) {
capped = Math.max(0, Math.min(maxes[space][i], values[space][i]));
values[space][i] = Math.round(capped);
}
// convert to all the other color spaces
for (var sname in spaces) {
if (sname !== space) {
values[sname] = convert[space][sname](values[space]);
}
}
return true;
};
Color.prototype.setSpace = function (space, args) {
var vals = args[0];
if (vals === undefined) {
// color.rgb()
return this.getValues(space);
}
// color.rgb(10, 10, 10)
if (typeof vals === 'number') {
vals = Array.prototype.slice.call(args);
}
this.setValues(space, vals);
return this;
};
Color.prototype.setChannel = function (space, index, val) {
var svalues = this.values[space];
if (val === undefined) {
// color.red()
return svalues[index];
} else if (val === svalues[index]) {
// color.red(color.red())
return this;
}
// color.red(100)
svalues[index] = val;
this.setValues(space, svalues);
return this;
};
if (typeof window !== 'undefined') {
window.Color = Color;
}
module.exports = Color;
/***/ }),
/* 183 */
/***/ (function(module, exports, __webpack_require__) {
/* MIT license */
var cssKeywords = __webpack_require__(184);
// NOTE: conversions should only return primitive values (i.e. arrays, or
// values that give correct `typeof` results).
// do not use box values types (i.e. Number(), String(), etc.)
var reverseKeywords = {};
for (var key in cssKeywords) {
if (cssKeywords.hasOwnProperty(key)) {
reverseKeywords[cssKeywords[key]] = key;
}
}
var convert = module.exports = {
rgb: {channels: 3, labels: 'rgb'},
hsl: {channels: 3, labels: 'hsl'},
hsv: {channels: 3, labels: 'hsv'},
hwb: {channels: 3, labels: 'hwb'},
cmyk: {channels: 4, labels: 'cmyk'},
xyz: {channels: 3, labels: 'xyz'},
lab: {channels: 3, labels: 'lab'},
lch: {channels: 3, labels: 'lch'},
hex: {channels: 1, labels: ['hex']},
keyword: {channels: 1, labels: ['keyword']},
ansi16: {channels: 1, labels: ['ansi16']},
ansi256: {channels: 1, labels: ['ansi256']},
hcg: {channels: 3, labels: ['h', 'c', 'g']},
apple: {channels: 3, labels: ['r16', 'g16', 'b16']},
gray: {channels: 1, labels: ['gray']}
};
// hide .channels and .labels properties
for (var model in convert) {
if (convert.hasOwnProperty(model)) {
if (!('channels' in convert[model])) {
throw new Error('missing channels property: ' + model);
}
if (!('labels' in convert[model])) {
throw new Error('missing channel labels property: ' + model);
}
if (convert[model].labels.length !== convert[model].channels) {
throw new Error('channel and label counts mismatch: ' + model);
}
var channels = convert[model].channels;
var labels = convert[model].labels;
delete convert[model].channels;
delete convert[model].labels;
Object.defineProperty(convert[model], 'channels', {value: channels});
Object.defineProperty(convert[model], 'labels', {value: labels});
}
}
convert.rgb.hsl = function (rgb) {
var r = rgb[0] / 255;
var g = rgb[1] / 255;
var b = rgb[2] / 255;
var min = Math.min(r, g, b);
var max = Math.max(r, g, b);
var delta = max - min;
var h;
var s;
var l;
if (max === min) {
h = 0;
} else if (r === max) {
h = (g - b) / delta;
} else if (g === max) {
h = 2 + (b - r) / delta;
} else if (b === max) {
h = 4 + (r - g) / delta;
}
h = Math.min(h * 60, 360);
if (h < 0) {
h += 360;
}
l = (min + max) / 2;
if (max === min) {
s = 0;
} else if (l <= 0.5) {
s = delta / (max + min);
} else {
s = delta / (2 - max - min);
}
return [h, s * 100, l * 100];
};
convert.rgb.hsv = function (rgb) {
var r = rgb[0];
var g = rgb[1];
var b = rgb[2];
var min = Math.min(r, g, b);
var max = Math.max(r, g, b);
var delta = max - min;
var h;
var s;
var v;
if (max === 0) {
s = 0;
} else {
s = (delta / max * 1000) / 10;
}
if (max === min) {
h = 0;
} else if (r === max) {
h = (g - b) / delta;
} else if (g === max) {
h = 2 + (b - r) / delta;
} else if (b === max) {
h = 4 + (r - g) / delta;
}
h = Math.min(h * 60, 360);
if (h < 0) {
h += 360;
}
v = ((max / 255) * 1000) / 10;
return [h, s, v];
};
convert.rgb.hwb = function (rgb) {
var r = rgb[0];
var g = rgb[1];
var b = rgb[2];
var h = convert.rgb.hsl(rgb)[0];
var w = 1 / 255 * Math.min(r, Math.min(g, b));
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
return [h, w * 100, b * 100];
};
convert.rgb.cmyk = function (rgb) {
var r = rgb[0] / 255;
var g = rgb[1] / 255;
var b = rgb[2] / 255;
var c;
var m;
var y;
var k;
k = Math.min(1 - r, 1 - g, 1 - b);
c = (1 - r - k) / (1 - k) || 0;
m = (1 - g - k) / (1 - k) || 0;
y = (1 - b - k) / (1 - k) || 0;
return [c * 100, m * 100, y * 100, k * 100];
};
/**
* See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
* */
function comparativeDistance(x, y) {
return (
Math.pow(x[0] - y[0], 2) +
Math.pow(x[1] - y[1], 2) +
Math.pow(x[2] - y[2], 2)
);
}
convert.rgb.keyword = function (rgb) {
var reversed = reverseKeywords[rgb];
if (reversed) {
return reversed;
}
var currentClosestDistance = Infinity;
var currentClosestKeyword;
for (var keyword in cssKeywords) {
if (cssKeywords.hasOwnProperty(keyword)) {
var value = cssKeywords[keyword];
// Compute comparative distance
var distance = comparativeDistance(rgb, value);
// Check if its less, if so set as closest
if (distance < currentClosestDistance) {
currentClosestDistance = distance;
currentClosestKeyword = keyword;
}
}
}
return currentClosestKeyword;
};
convert.keyword.rgb = function (keyword) {
return cssKeywords[keyword];
};
convert.rgb.xyz = function (rgb) {
var r = rgb[0] / 255;
var g = rgb[1] / 255;
var b = rgb[2] / 255;
// assume sRGB
r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);
g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);
b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);
var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);
var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);
var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);
return [x * 100, y * 100, z * 100];
};
convert.rgb.lab = function (rgb) {
var xyz = convert.rgb.xyz(rgb);
var x = xyz[0];
var y = xyz[1];
var z = xyz[2];
var l;
var a;
var b;
x /= 95.047;
y /= 100;
z /= 108.883;
x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
l = (116 * y) - 16;
a = 500 * (x - y);
b = 200 * (y - z);
return [l, a, b];
};
convert.hsl.rgb = function (hsl) {
var h = hsl[0] / 360;
var s = hsl[1] / 100;
var l = hsl[2] / 100;
var t1;
var t2;
var t3;
var rgb;
var val;
if (s === 0) {
val = l * 255;
return [val, val, val];
}
if (l < 0.5) {
t2 = l * (1 + s);
} else {
t2 = l + s - l * s;
}
t1 = 2 * l - t2;
rgb = [0, 0, 0];
for (var i = 0; i < 3; i++) {
t3 = h + 1 / 3 * -(i - 1);
if (t3 < 0) {
t3++;
}
if (t3 > 1) {
t3--;
}
if (6 * t3 < 1) {
val = t1 + (t2 - t1) * 6 * t3;
} else if (2 * t3 < 1) {
val = t2;
} else if (3 * t3 < 2) {
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
} else {
val = t1;
}
rgb[i] = val * 255;
}
return rgb;
};
convert.hsl.hsv = function (hsl) {
var h = hsl[0];
var s = hsl[1] / 100;
var l = hsl[2] / 100;
var smin = s;
var lmin = Math.max(l, 0.01);
var sv;
var v;
l *= 2;
s *= (l <= 1) ? l : 2 - l;
smin *= lmin <= 1 ? lmin : 2 - lmin;
v = (l + s) / 2;
sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);
return [h, sv * 100, v * 100];
};
convert.hsv.rgb = function (hsv) {
var h = hsv[0] / 60;
var s = hsv[1] / 100;
var v = hsv[2] / 100;
var hi = Math.floor(h) % 6;
var f = h - Math.floor(h);
var p = 255 * v * (1 - s);
var q = 255 * v * (1 - (s * f));
var t = 255 * v * (1 - (s * (1 - f)));
v *= 255;
switch (hi) {
case 0:
return [v, t, p];
case 1:
return [q, v, p];
case 2:
return [p, v, t];
case 3:
return [p, q, v];
case 4:
return [t, p, v];
case 5:
return [v, p, q];
}
};
convert.hsv.hsl = function (hsv) {
var h = hsv[0];
var s = hsv[1] / 100;
var v = hsv[2] / 100;
var vmin = Math.max(v, 0.01);
var lmin;
var sl;
var l;
l = (2 - s) * v;
lmin = (2 - s) * vmin;
sl = s * vmin;
sl /= (lmin <= 1) ? lmin : 2 - lmin;
sl = sl || 0;
l /= 2;
return [h, sl * 100, l * 100];
};
// http://dev.w3.org/csswg/css-color/#hwb-to-rgb
convert.hwb.rgb = function (hwb) {
var h = hwb[0] / 360;
var wh = hwb[1] / 100;
var bl = hwb[2] / 100;
var ratio = wh + bl;
var i;
var v;
var f;
var n;
// wh + bl cant be > 1
if (ratio > 1) {
wh /= ratio;
bl /= ratio;
}
i = Math.floor(6 * h);
v = 1 - bl;
f = 6 * h - i;
if ((i & 0x01) !== 0) {
f = 1 - f;
}
n = wh + f * (v - wh); // linear interpolation
var r;
var g;
var b;
switch (i) {
default:
case 6:
case 0: r = v; g = n; b = wh; break;
case 1: r = n; g = v; b = wh; break;
case 2: r = wh; g = v; b = n; break;
case 3: r = wh; g = n; b = v; break;
case 4: r = n; g = wh; b = v; break;
case 5: r = v; g = wh; b = n; break;
}
return [r * 255, g * 255, b * 255];
};
convert.cmyk.rgb = function (cmyk) {
var c = cmyk[0] / 100;
var m = cmyk[1] / 100;
var y = cmyk[2] / 100;
var k = cmyk[3] / 100;
var r;
var g;
var b;
r = 1 - Math.min(1, c * (1 - k) + k);
g = 1 - Math.min(1, m * (1 - k) + k);
b = 1 - Math.min(1, y * (1 - k) + k);
return [r * 255, g * 255, b * 255];
};
convert.xyz.rgb = function (xyz) {
var x = xyz[0] / 100;
var y = xyz[1] / 100;
var z = xyz[2] / 100;
var r;
var g;
var b;
r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);
g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);
b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);
// assume sRGB
r = r > 0.0031308
? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)
: r * 12.92;
g = g > 0.0031308
? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)
: g * 12.92;
b = b > 0.0031308
? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)
: b * 12.92;
r = Math.min(Math.max(0, r), 1);
g = Math.min(Math.max(0, g), 1);
b = Math.min(Math.max(0, b), 1);
return [r * 255, g * 255, b * 255];
};
convert.xyz.lab = function (xyz) {
var x = xyz[0];
var y = xyz[1];
var z = xyz[2];
var l;
var a;
var b;
x /= 95.047;
y /= 100;
z /= 108.883;
x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
l = (116 * y) - 16;
a = 500 * (x - y);
b = 200 * (y - z);
return [l, a, b];
};
convert.lab.xyz = function (lab) {
var l = lab[0];
var a = lab[1];
var b = lab[2];
var x;
var y;
var z;
y = (l + 16) / 116;
x = a / 500 + y;
z = y - b / 200;
var y2 = Math.pow(y, 3);
var x2 = Math.pow(x, 3);
var z2 = Math.pow(z, 3);
y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;
x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;
z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;
x *= 95.047;
y *= 100;
z *= 108.883;
return [x, y, z];
};
convert.lab.lch = function (lab) {
var l = lab[0];
var a = lab[1];
var b = lab[2];
var hr;
var h;
var c;
hr = Math.atan2(b, a);
h = hr * 360 / 2 / Math.PI;
if (h < 0) {
h += 360;
}
c = Math.sqrt(a * a + b * b);
return [l, c, h];
};
convert.lch.lab = function (lch) {
var l = lch[0];
var c = lch[1];
var h = lch[2];
var a;
var b;
var hr;
hr = h / 360 * 2 * Math.PI;
a = c * Math.cos(hr);
b = c * Math.sin(hr);
return [l, a, b];
};
convert.rgb.ansi16 = function (args) {
var r = args[0];
var g = args[1];
var b = args[2];
var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
value = Math.round(value / 50);
if (value === 0) {
return 30;
}
var ansi = 30
+ ((Math.round(b / 255) << 2)
| (Math.round(g / 255) << 1)
| Math.round(r / 255));
if (value === 2) {
ansi += 60;
}
return ansi;
};
convert.hsv.ansi16 = function (args) {
// optimization here; we already know the value and don't need to get
// it converted for us.
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
};
convert.rgb.ansi256 = function (args) {
var r = args[0];
var g = args[1];
var b = args[2];
// we use the extended greyscale palette here, with the exception of
// black and white. normal palette only has 4 greyscale shades.
if (r === g && g === b) {
if (r < 8) {
return 16;
}
if (r > 248) {
return 231;
}
return Math.round(((r - 8) / 247) * 24) + 232;
}
var ansi = 16
+ (36 * Math.round(r / 255 * 5))
+ (6 * Math.round(g / 255 * 5))
+ Math.round(b / 255 * 5);
return ansi;
};
convert.ansi16.rgb = function (args) {
var color = args % 10;
// handle greyscale
if (color === 0 || color === 7) {
if (args > 50) {
color += 3.5;
}
color = color / 10.5 * 255;
return [color, color, color];
}
var mult = (~~(args > 50) + 1) * 0.5;
var r = ((color & 1) * mult) * 255;
var g = (((color >> 1) & 1) * mult) * 255;
var b = (((color >> 2) & 1) * mult) * 255;
return [r, g, b];
};
convert.ansi256.rgb = function (args) {
// handle greyscale
if (args >= 232) {
var c = (args - 232) * 10 + 8;
return [c, c, c];
}
args -= 16;
var rem;
var r = Math.floor(args / 36) / 5 * 255;
var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
var b = (rem % 6) / 5 * 255;
return [r, g, b];
};
convert.rgb.hex = function (args) {
var integer = ((Math.round(args[0]) & 0xFF) << 16)
+ ((Math.round(args[1]) & 0xFF) << 8)
+ (Math.round(args[2]) & 0xFF);
var string = integer.toString(16).toUpperCase();
return '000000'.substring(string.length) + string;
};
convert.hex.rgb = function (args) {
var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
if (!match) {
return [0, 0, 0];
}
var colorString = match[0];
if (match[0].length === 3) {
colorString = colorString.split('').map(function (char) {
return char + char;
}).join('');
}
var integer = parseInt(colorString, 16);
var r = (integer >> 16) & 0xFF;
var g = (integer >> 8) & 0xFF;
var b = integer & 0xFF;
return [r, g, b];
};
convert.rgb.hcg = function (rgb) {
var r = rgb[0] / 255;
var g = rgb[1] / 255;
var b = rgb[2] / 255;
var max = Math.max(Math.max(r, g), b);
var min = Math.min(Math.min(r, g), b);
var chroma = (max - min);
var grayscale;
var hue;
if (chroma < 1) {
grayscale = min / (1 - chroma);
} else {
grayscale = 0;
}
if (chroma <= 0) {
hue = 0;
} else
if (max === r) {
hue = ((g - b) / chroma) % 6;
} else
if (max === g) {
hue = 2 + (b - r) / chroma;
} else {
hue = 4 + (r - g) / chroma + 4;
}
hue /= 6;
hue %= 1;
return [hue * 360, chroma * 100, grayscale * 100];
};
convert.hsl.hcg = function (hsl) {
var s = hsl[1] / 100;
var l = hsl[2] / 100;
var c = 1;
var f = 0;
if (l < 0.5) {
c = 2.0 * s * l;
} else {
c = 2.0 * s * (1.0 - l);
}
if (c < 1.0) {
f = (l - 0.5 * c) / (1.0 - c);
}
return [hsl[0], c * 100, f * 100];
};
convert.hsv.hcg = function (hsv) {
var s = hsv[1] / 100;
var v = hsv[2] / 100;
var c = s * v;
var f = 0;
if (c < 1.0) {
f = (v - c) / (1 - c);
}
return [hsv[0], c * 100, f * 100];
};
convert.hcg.rgb = function (hcg) {
var h = hcg[0] / 360;
var c = hcg[1] / 100;
var g = hcg[2] / 100;
if (c === 0.0) {
return [g * 255, g * 255, g * 255];
}
var pure = [0, 0, 0];
var hi = (h % 1) * 6;
var v = hi % 1;
var w = 1 - v;
var mg = 0;
switch (Math.floor(hi)) {
case 0:
pure[0] = 1; pure[1] = v; pure[2] = 0; break;
case 1:
pure[0] = w; pure[1] = 1; pure[2] = 0; break;
case 2:
pure[0] = 0; pure[1] = 1; pure[2] = v; break;
case 3:
pure[0] = 0; pure[1] = w; pure[2] = 1; break;
case 4:
pure[0] = v; pure[1] = 0; pure[2] = 1; break;
default:
pure[0] = 1; pure[1] = 0; pure[2] = w;
}
mg = (1.0 - c) * g;
return [
(c * pure[0] + mg) * 255,
(c * pure[1] + mg) * 255,
(c * pure[2] + mg) * 255
];
};
convert.hcg.hsv = function (hcg) {
var c = hcg[1] / 100;
var g = hcg[2] / 100;
var v = c + g * (1.0 - c);
var f = 0;
if (v > 0.0) {
f = c / v;
}
return [hcg[0], f * 100, v * 100];
};
convert.hcg.hsl = function (hcg) {
var c = hcg[1] / 100;
var g = hcg[2] / 100;
var l = g * (1.0 - c) + 0.5 * c;
var s = 0;
if (l > 0.0 && l < 0.5) {
s = c / (2 * l);
} else
if (l >= 0.5 && l < 1.0) {
s = c / (2 * (1 - l));
}
return [hcg[0], s * 100, l * 100];
};
convert.hcg.hwb = function (hcg) {
var c = hcg[1] / 100;
var g = hcg[2] / 100;
var v = c + g * (1.0 - c);
return [hcg[0], (v - c) * 100, (1 - v) * 100];
};
convert.hwb.hcg = function (hwb) {
var w = hwb[1] / 100;
var b = hwb[2] / 100;
var v = 1 - b;
var c = v - w;
var g = 0;
if (c < 1) {
g = (v - c) / (1 - c);
}
return [hwb[0], c * 100, g * 100];
};
convert.apple.rgb = function (apple) {
return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];
};
convert.rgb.apple = function (rgb) {
return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];
};
convert.gray.rgb = function (args) {
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
};
convert.gray.hsl = convert.gray.hsv = function (args) {
return [0, 0, args[0]];
};
convert.gray.hwb = function (gray) {
return [0, 100, gray[0]];
};
convert.gray.cmyk = function (gray) {
return [0, 0, 0, gray[0]];
};
convert.gray.lab = function (gray) {
return [gray[0], 0, 0];
};
convert.gray.hex = function (gray) {
var val = Math.round(gray[0] / 100 * 255) & 0xFF;
var integer = (val << 16) + (val << 8) + val;
var string = integer.toString(16).toUpperCase();
return '000000'.substring(string.length) + string;
};
convert.rgb.gray = function (rgb) {
var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
return [val / 255 * 100];
};
/***/ }),
/* 184 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = {
"aliceblue": [240, 248, 255],
"antiquewhite": [250, 235, 215],
"aqua": [0, 255, 255],
"aquamarine": [127, 255, 212],
"azure": [240, 255, 255],
"beige": [245, 245, 220],
"bisque": [255, 228, 196],
"black": [0, 0, 0],
"blanchedalmond": [255, 235, 205],
"blue": [0, 0, 255],
"blueviolet": [138, 43, 226],
"brown": [165, 42, 42],
"burlywood": [222, 184, 135],
"cadetblue": [95, 158, 160],
"chartreuse": [127, 255, 0],
"chocolate": [210, 105, 30],
"coral": [255, 127, 80],
"cornflowerblue": [100, 149, 237],
"cornsilk": [255, 248, 220],
"crimson": [220, 20, 60],
"cyan": [0, 255, 255],
"darkblue": [0, 0, 139],
"darkcyan": [0, 139, 139],
"darkgoldenrod": [184, 134, 11],
"darkgray": [169, 169, 169],
"darkgreen": [0, 100, 0],
"darkgrey": [169, 169, 169],
"darkkhaki": [189, 183, 107],
"darkmagenta": [139, 0, 139],
"darkolivegreen": [85, 107, 47],
"darkorange": [255, 140, 0],
"darkorchid": [153, 50, 204],
"darkred": [139, 0, 0],
"darksalmon": [233, 150, 122],
"darkseagreen": [143, 188, 143],
"darkslateblue": [72, 61, 139],
"darkslategray": [47, 79, 79],
"darkslategrey": [47, 79, 79],
"darkturquoise": [0, 206, 209],
"darkviolet": [148, 0, 211],
"deeppink": [255, 20, 147],
"deepskyblue": [0, 191, 255],
"dimgray": [105, 105, 105],
"dimgrey": [105, 105, 105],
"dodgerblue": [30, 144, 255],
"firebrick": [178, 34, 34],
"floralwhite": [255, 250, 240],
"forestgreen": [34, 139, 34],
"fuchsia": [255, 0, 255],
"gainsboro": [220, 220, 220],
"ghostwhite": [248, 248, 255],
"gold": [255, 215, 0],
"goldenrod": [218, 165, 32],
"gray": [128, 128, 128],
"green": [0, 128, 0],
"greenyellow": [173, 255, 47],
"grey": [128, 128, 128],
"honeydew": [240, 255, 240],
"hotpink": [255, 105, 180],
"indianred": [205, 92, 92],
"indigo": [75, 0, 130],
"ivory": [255, 255, 240],
"khaki": [240, 230, 140],
"lavender": [230, 230, 250],
"lavenderblush": [255, 240, 245],
"lawngreen": [124, 252, 0],
"lemonchiffon": [255, 250, 205],
"lightblue": [173, 216, 230],
"lightcoral": [240, 128, 128],
"lightcyan": [224, 255, 255],
"lightgoldenrodyellow": [250, 250, 210],
"lightgray": [211, 211, 211],
"lightgreen": [144, 238, 144],
"lightgrey": [211, 211, 211],
"lightpink": [255, 182, 193],
"lightsalmon": [255, 160, 122],
"lightseagreen": [32, 178, 170],
"lightskyblue": [135, 206, 250],
"lightslategray": [119, 136, 153],
"lightslategrey": [119, 136, 153],
"lightsteelblue": [176, 196, 222],
"lightyellow": [255, 255, 224],
"lime": [0, 255, 0],
"limegreen": [50, 205, 50],
"linen": [250, 240, 230],
"magenta": [255, 0, 255],
"maroon": [128, 0, 0],
"mediumaquamarine": [102, 205, 170],
"mediumblue": [0, 0, 205],
"mediumorchid": [186, 85, 211],
"mediumpurple": [147, 112, 219],
"mediumseagreen": [60, 179, 113],
"mediumslateblue": [123, 104, 238],
"mediumspringgreen": [0, 250, 154],
"mediumturquoise": [72, 209, 204],
"mediumvioletred": [199, 21, 133],
"midnightblue": [25, 25, 112],
"mintcream": [245, 255, 250],
"mistyrose": [255, 228, 225],
"moccasin": [255, 228, 181],
"navajowhite": [255, 222, 173],
"navy": [0, 0, 128],
"oldlace": [253, 245, 230],
"olive": [128, 128, 0],
"olivedrab": [107, 142, 35],
"orange": [255, 165, 0],
"orangered": [255, 69, 0],
"orchid": [218, 112, 214],
"palegoldenrod": [238, 232, 170],
"palegreen": [152, 251, 152],
"paleturquoise": [175, 238, 238],
"palevioletred": [219, 112, 147],
"papayawhip": [255, 239, 213],
"peachpuff": [255, 218, 185],
"peru": [205, 133, 63],
"pink": [255, 192, 203],
"plum": [221, 160, 221],
"powderblue": [176, 224, 230],
"purple": [128, 0, 128],
"rebeccapurple": [102, 51, 153],
"red": [255, 0, 0],
"rosybrown": [188, 143, 143],
"royalblue": [65, 105, 225],
"saddlebrown": [139, 69, 19],
"salmon": [250, 128, 114],
"sandybrown": [244, 164, 96],
"seagreen": [46, 139, 87],
"seashell": [255, 245, 238],
"sienna": [160, 82, 45],
"silver": [192, 192, 192],
"skyblue": [135, 206, 235],
"slateblue": [106, 90, 205],
"slategray": [112, 128, 144],
"slategrey": [112, 128, 144],
"snow": [255, 250, 250],
"springgreen": [0, 255, 127],
"steelblue": [70, 130, 180],
"tan": [210, 180, 140],
"teal": [0, 128, 128],
"thistle": [216, 191, 216],
"tomato": [255, 99, 71],
"turquoise": [64, 224, 208],
"violet": [238, 130, 238],
"wheat": [245, 222, 179],
"white": [255, 255, 255],
"whitesmoke": [245, 245, 245],
"yellow": [255, 255, 0],
"yellowgreen": [154, 205, 50]
};
/***/ }),
/* 185 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var helpers = __webpack_require__(5);
/**
* Helper function to get relative position for an event
* @param {Event|IEvent} event - The event to get the position for
* @param {Chart} chart - The chart
* @returns {Point} the event position
*/
function getRelativePosition(e, chart) {
if (e.native) {
return {
x: e.x,
y: e.y
};
}
return helpers.getRelativePosition(e, chart);
}
/**
* Helper function to traverse all of the visible elements in the chart
* @param chart {chart} the chart
* @param handler {Function} the callback to execute for each visible item
*/
function parseVisibleItems(chart, handler) {
var datasets = chart.data.datasets;
var meta, i, j, ilen, jlen;
for (i = 0, ilen = datasets.length; i < ilen; ++i) {
if (!chart.isDatasetVisible(i)) {
continue;
}
meta = chart.getDatasetMeta(i);
for (j = 0, jlen = meta.data.length; j < jlen; ++j) {
var element = meta.data[j];
if (!element._view.skip) {
handler(element);
}
}
}
}
/**
* Helper function to get the items that intersect the event position
* @param items {ChartElement[]} elements to filter
* @param position {Point} the point to be nearest to
* @return {ChartElement[]} the nearest items
*/
function getIntersectItems(chart, position) {
var elements = [];
parseVisibleItems(chart, function(element) {
if (element.inRange(position.x, position.y)) {
elements.push(element);
}
});
return elements;
}
/**
* Helper function to get the items nearest to the event position considering all visible items in teh chart
* @param chart {Chart} the chart to look at elements from
* @param position {Point} the point to be nearest to
* @param intersect {Boolean} if true, only consider items that intersect the position
* @param distanceMetric {Function} function to provide the distance between points
* @return {ChartElement[]} the nearest items
*/
function getNearestItems(chart, position, intersect, distanceMetric) {
var minDistance = Number.POSITIVE_INFINITY;
var nearestItems = [];
parseVisibleItems(chart, function(element) {
if (intersect && !element.inRange(position.x, position.y)) {
return;
}
var center = element.getCenterPoint();
var distance = distanceMetric(position, center);
if (distance < minDistance) {
nearestItems = [element];
minDistance = distance;
} else if (distance === minDistance) {
// Can have multiple items at the same distance in which case we sort by size
nearestItems.push(element);
}
});
return nearestItems;
}
/**
* Get a distance metric function for two points based on the
* axis mode setting
* @param {String} axis the axis mode. x|y|xy
*/
function getDistanceMetricForAxis(axis) {
var useX = axis.indexOf('x') !== -1;
var useY = axis.indexOf('y') !== -1;
return function(pt1, pt2) {
var deltaX = useX ? Math.abs(pt1.x - pt2.x) : 0;
var deltaY = useY ? Math.abs(pt1.y - pt2.y) : 0;
return Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));
};
}
function indexMode(chart, e, options) {
var position = getRelativePosition(e, chart);
// Default axis for index mode is 'x' to match old behaviour
options.axis = options.axis || 'x';
var distanceMetric = getDistanceMetricForAxis(options.axis);
var items = options.intersect ? getIntersectItems(chart, position) : getNearestItems(chart, position, false, distanceMetric);
var elements = [];
if (!items.length) {
return [];
}
chart.data.datasets.forEach(function(dataset, datasetIndex) {
if (chart.isDatasetVisible(datasetIndex)) {
var meta = chart.getDatasetMeta(datasetIndex);
var element = meta.data[items[0]._index];
// don't count items that are skipped (null data)
if (element && !element._view.skip) {
elements.push(element);
}
}
});
return elements;
}
/**
* @interface IInteractionOptions
*/
/**
* If true, only consider items that intersect the point
* @name IInterfaceOptions#boolean
* @type Boolean
*/
/**
* Contains interaction related functions
* @namespace Chart.Interaction
*/
module.exports = {
// Helper function for different modes
modes: {
single: function(chart, e) {
var position = getRelativePosition(e, chart);
var elements = [];
parseVisibleItems(chart, function(element) {
if (element.inRange(position.x, position.y)) {
elements.push(element);
return elements;
}
});
return elements.slice(0, 1);
},
/**
* @function Chart.Interaction.modes.label
* @deprecated since version 2.4.0
* @todo remove at version 3
* @private
*/
label: indexMode,
/**
* Returns items at the same index. If the options.intersect parameter is true, we only return items if we intersect something
* If the options.intersect mode is false, we find the nearest item and return the items at the same index as that item
* @function Chart.Interaction.modes.index
* @since v2.4.0
* @param chart {chart} the chart we are returning items from
* @param e {Event} the event we are find things at
* @param options {IInteractionOptions} options to use during interaction
* @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
*/
index: indexMode,
/**
* Returns items in the same dataset. If the options.intersect parameter is true, we only return items if we intersect something
* If the options.intersect is false, we find the nearest item and return the items in that dataset
* @function Chart.Interaction.modes.dataset
* @param chart {chart} the chart we are returning items from
* @param e {Event} the event we are find things at
* @param options {IInteractionOptions} options to use during interaction
* @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
*/
dataset: function(chart, e, options) {
var position = getRelativePosition(e, chart);
options.axis = options.axis || 'xy';
var distanceMetric = getDistanceMetricForAxis(options.axis);
var items = options.intersect ? getIntersectItems(chart, position) : getNearestItems(chart, position, false, distanceMetric);
if (items.length > 0) {
items = chart.getDatasetMeta(items[0]._datasetIndex).data;
}
return items;
},
/**
* @function Chart.Interaction.modes.x-axis
* @deprecated since version 2.4.0. Use index mode and intersect == true
* @todo remove at version 3
* @private
*/
'x-axis': function(chart, e) {
return indexMode(chart, e, {intersect: false});
},
/**
* Point mode returns all elements that hit test based on the event position
* of the event
* @function Chart.Interaction.modes.intersect
* @param chart {chart} the chart we are returning items from
* @param e {Event} the event we are find things at
* @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
*/
point: function(chart, e) {
var position = getRelativePosition(e, chart);
return getIntersectItems(chart, position);
},
/**
* nearest mode returns the element closest to the point
* @function Chart.Interaction.modes.intersect
* @param chart {chart} the chart we are returning items from
* @param e {Event} the event we are find things at
* @param options {IInteractionOptions} options to use
* @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
*/
nearest: function(chart, e, options) {
var position = getRelativePosition(e, chart);
options.axis = options.axis || 'xy';
var distanceMetric = getDistanceMetricForAxis(options.axis);
var nearestItems = getNearestItems(chart, position, options.intersect, distanceMetric);
// We have multiple items at the same distance from the event. Now sort by smallest
if (nearestItems.length > 1) {
nearestItems.sort(function(a, b) {
var sizeA = a.getArea();
var sizeB = b.getArea();
var ret = sizeA - sizeB;
if (ret === 0) {
// if equal sort by dataset index
ret = a._datasetIndex - b._datasetIndex;
}
return ret;
});
}
// Return only 1 item
return nearestItems.slice(0, 1);
},
/**
* x mode returns the elements that hit-test at the current x coordinate
* @function Chart.Interaction.modes.x
* @param chart {chart} the chart we are returning items from
* @param e {Event} the event we are find things at
* @param options {IInteractionOptions} options to use
* @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
*/
x: function(chart, e, options) {
var position = getRelativePosition(e, chart);
var items = [];
var intersectsItem = false;
parseVisibleItems(chart, function(element) {
if (element.inXRange(position.x)) {
items.push(element);
}
if (element.inRange(position.x, position.y)) {
intersectsItem = true;
}
});
// If we want to trigger on an intersect and we don't have any items
// that intersect the position, return nothing
if (options.intersect && !intersectsItem) {
items = [];
}
return items;
},
/**
* y mode returns the elements that hit-test at the current y coordinate
* @function Chart.Interaction.modes.y
* @param chart {chart} the chart we are returning items from
* @param e {Event} the event we are find things at
* @param options {IInteractionOptions} options to use
* @return {Chart.Element[]} Array of elements that are under the point. If none are found, an empty array is returned
*/
y: function(chart, e, options) {
var position = getRelativePosition(e, chart);
var items = [];
var intersectsItem = false;
parseVisibleItems(chart, function(element) {
if (element.inYRange(position.y)) {
items.push(element);
}
if (element.inRange(position.x, position.y)) {
intersectsItem = true;
}
});
// If we want to trigger on an intersect and we don't have any items
// that intersect the position, return nothing
if (options.intersect && !intersectsItem) {
items = [];
}
return items;
}
}
};
/***/ }),
/* 186 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var helpers = __webpack_require__(5);
var basic = __webpack_require__(432);
var dom = __webpack_require__(433);
// @TODO Make possible to select another platform at build time.
var implementation = dom._enabled ? dom : basic;
/**
* @namespace Chart.platform
* @see https://chartjs.gitbooks.io/proposals/content/Platform.html
* @since 2.4.0
*/
module.exports = helpers.extend({
/**
* @since 2.7.0
*/
initialize: function() {},
/**
* Called at chart construction time, returns a context2d instance implementing
* the [W3C Canvas 2D Context API standard]{@link https://www.w3.org/TR/2dcontext/}.
* @param {*} item - The native item from which to acquire context (platform specific)
* @param {Object} options - The chart options
* @returns {CanvasRenderingContext2D} context2d instance
*/
acquireContext: function() {},
/**
* Called at chart destruction time, releases any resources associated to the context
* previously returned by the acquireContext() method.
* @param {CanvasRenderingContext2D} context - The context2d instance
* @returns {Boolean} true if the method succeeded, else false
*/
releaseContext: function() {},
/**
* Registers the specified listener on the given chart.
* @param {Chart} chart - Chart from which to listen for event
* @param {String} type - The ({@link IEvent}) type to listen for
* @param {Function} listener - Receives a notification (an object that implements
* the {@link IEvent} interface) when an event of the specified type occurs.
*/
addEventListener: function() {},
/**
* Removes the specified listener previously registered with addEventListener.
* @param {Chart} chart -Chart from which to remove the listener
* @param {String} type - The ({@link IEvent}) type to remove
* @param {Function} listener - The listener function to remove from the event target.
*/
removeEventListener: function() {}
}, implementation);
/**
* @interface IPlatform
* Allows abstracting platform dependencies away from the chart
* @borrows Chart.platform.acquireContext as acquireContext
* @borrows Chart.platform.releaseContext as releaseContext
* @borrows Chart.platform.addEventListener as addEventListener
* @borrows Chart.platform.removeEventListener as removeEventListener
*/
/**
* @interface IEvent
* @prop {String} type - The event type name, possible values are:
* 'contextmenu', 'mouseenter', 'mousedown', 'mousemove', 'mouseup', 'mouseout',
* 'click', 'dblclick', 'keydown', 'keypress', 'keyup' and 'resize'
* @prop {*} native - The original native event (null for emulated events, e.g. 'resize')
* @prop {Number} x - The mouse x position, relative to the canvas (null for incompatible events)
* @prop {Number} y - The mouse y position, relative to the canvas (null for incompatible events)
*/
/***/ }),
/* 187 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var defaults = __webpack_require__(8);
var helpers = __webpack_require__(5);
defaults._set('global', {
plugins: {}
});
/**
* The plugin service singleton
* @namespace Chart.plugins
* @since 2.1.0
*/
module.exports = {
/**
* Globally registered plugins.
* @private
*/
_plugins: [],
/**
* This identifier is used to invalidate the descriptors cache attached to each chart
* when a global plugin is registered or unregistered. In this case, the cache ID is
* incremented and descriptors are regenerated during following API calls.
* @private
*/
_cacheId: 0,
/**
* Registers the given plugin(s) if not already registered.
* @param {Array|Object} plugins plugin instance(s).
*/
register: function(plugins) {
var p = this._plugins;
([]).concat(plugins).forEach(function(plugin) {
if (p.indexOf(plugin) === -1) {
p.push(plugin);
}
});
this._cacheId++;
},
/**
* Unregisters the given plugin(s) only if registered.
* @param {Array|Object} plugins plugin instance(s).
*/
unregister: function(plugins) {
var p = this._plugins;
([]).concat(plugins).forEach(function(plugin) {
var idx = p.indexOf(plugin);
if (idx !== -1) {
p.splice(idx, 1);
}
});
this._cacheId++;
},
/**
* Remove all registered plugins.
* @since 2.1.5
*/
clear: function() {
this._plugins = [];
this._cacheId++;
},
/**
* Returns the number of registered plugins?
* @returns {Number}
* @since 2.1.5
*/
count: function() {
return this._plugins.length;
},
/**
* Returns all registered plugin instances.
* @returns {Array} array of plugin objects.
* @since 2.1.5
*/
getAll: function() {
return this._plugins;
},
/**
* Calls enabled plugins for `chart` on the specified hook and with the given args.
* This method immediately returns as soon as a plugin explicitly returns false. The
* returned value can be used, for instance, to interrupt the current action.
* @param {Object} chart - The chart instance for which plugins should be called.
* @param {String} hook - The name of the plugin method to call (e.g. 'beforeUpdate').
* @param {Array} [args] - Extra arguments to apply to the hook call.
* @returns {Boolean} false if any of the plugins return false, else returns true.
*/
notify: function(chart, hook, args) {
var descriptors = this.descriptors(chart);
var ilen = descriptors.length;
var i, descriptor, plugin, params, method;
for (i = 0; i < ilen; ++i) {
descriptor = descriptors[i];
plugin = descriptor.plugin;
method = plugin[hook];
if (typeof method === 'function') {
params = [chart].concat(args || []);
params.push(descriptor.options);
if (method.apply(plugin, params) === false) {
return false;
}
}
}
return true;
},
/**
* Returns descriptors of enabled plugins for the given chart.
* @returns {Array} [{ plugin, options }]
* @private
*/
descriptors: function(chart) {
var cache = chart.$plugins || (chart.$plugins = {});
if (cache.id === this._cacheId) {
return cache.descriptors;
}
var plugins = [];
var descriptors = [];
var config = (chart && chart.config) || {};
var options = (config.options && config.options.plugins) || {};
this._plugins.concat(config.plugins || []).forEach(function(plugin) {
var idx = plugins.indexOf(plugin);
if (idx !== -1) {
return;
}
var id = plugin.id;
var opts = options[id];
if (opts === false) {
return;
}
if (opts === true) {
opts = helpers.clone(defaults.global.plugins[id]);
}
plugins.push(plugin);
descriptors.push({
plugin: plugin,
options: opts || {}
});
});
cache.descriptors = descriptors;
cache.id = this._cacheId;
return descriptors;
},
/**
* Invalidates cache for the given chart: descriptors hold a reference on plugin option,
* but in some cases, this reference can be changed by the user when updating options.
* https://github.com/chartjs/Chart.js/issues/5111#issuecomment-355934167
* @private
*/
_invalidate: function(chart) {
delete chart.$plugins;
}
};
/**
* Plugin extension hooks.
* @interface IPlugin
* @since 2.1.0
*/
/**
* @method IPlugin#beforeInit
* @desc Called before initializing `chart`.
* @param {Chart.Controller} chart - The chart instance.
* @param {Object} options - The plugin options.
*/
/**
* @method IPlugin#afterInit
* @desc Called after `chart` has been initialized and before the first update.
* @param {Chart.Controller} chart - The chart instance.
* @param {Object} options - The plugin options.
*/
/**
* @method IPlugin#beforeUpdate
* @desc Called before updating `chart`. If any plugin returns `false`, the update
* is cancelled (and thus subsequent render(s)) until another `update` is triggered.
* @param {Chart.Controller} chart - The chart instance.
* @param {Object} options - The plugin options.
* @returns {Boolean} `false` to cancel the chart update.
*/
/**
* @method IPlugin#afterUpdate
* @desc Called after `chart` has been updated and before rendering. Note that this
* hook will not be called if the chart update has been previously cancelled.
* @param {Chart.Controller} chart - The chart instance.
* @param {Object} options - The plugin options.
*/
/**
* @method IPlugin#beforeDatasetsUpdate
* @desc Called before updating the `chart` datasets. If any plugin returns `false`,
* the datasets update is cancelled until another `update` is triggered.
* @param {Chart.Controller} chart - The chart instance.
* @param {Object} options - The plugin options.
* @returns {Boolean} false to cancel the datasets update.
* @since version 2.1.5
*/
/**
* @method IPlugin#afterDatasetsUpdate
* @desc Called after the `chart` datasets have been updated. Note that this hook
* will not be called if the datasets update has been previously cancelled.
* @param {Chart.Controller} chart - The chart instance.
* @param {Object} options - The plugin options.
* @since version 2.1.5
*/
/**
* @method IPlugin#beforeDatasetUpdate
* @desc Called before updating the `chart` dataset at the given `args.index`. If any plugin
* returns `false`, the datasets update is cancelled until another `update` is triggered.
* @param {Chart} chart - The chart instance.
* @param {Object} args - The call arguments.
* @param {Number} args.index - The dataset index.
* @param {Object} args.meta - The dataset metadata.
* @param {Object} options - The plugin options.
* @returns {Boolean} `false` to cancel the chart datasets drawing.
*/
/**
* @method IPlugin#afterDatasetUpdate
* @desc Called after the `chart` datasets at the given `args.index` has been updated. Note
* that this hook will not be called if the datasets update has been previously cancelled.
* @param {Chart} chart - The chart instance.
* @param {Object} args - The call arguments.
* @param {Number} args.index - The dataset index.
* @param {Object} args.meta - The dataset metadata.
* @param {Object} options - The plugin options.
*/
/**
* @method IPlugin#beforeLayout
* @desc Called before laying out `chart`. If any plugin returns `false`,
* the layout update is cancelled until another `update` is triggered.
* @param {Chart.Controller} chart - The chart instance.
* @param {Object} options - The plugin options.
* @returns {Boolean} `false` to cancel the chart layout.
*/
/**
* @method IPlugin#afterLayout
* @desc Called after the `chart` has been layed out. Note that this hook will not
* be called if the layout update has been previously cancelled.
* @param {Chart.Controller} chart - The chart instance.
* @param {Object} options - The plugin options.
*/
/**
* @method IPlugin#beforeRender
* @desc Called before rendering `chart`. If any plugin returns `false`,
* the rendering is cancelled until another `render` is triggered.
* @param {Chart.Controller} chart - The chart instance.
* @param {Object} options - The plugin options.
* @returns {Boolean} `false` to cancel the chart rendering.
*/
/**
* @method IPlugin#afterRender
* @desc Called after the `chart` has been fully rendered (and animation completed). Note
* that this hook will not be called if the rendering has been previously cancelled.
* @param {Chart.Controller} chart - The chart instance.
* @param {Object} options - The plugin options.
*/
/**
* @method IPlugin#beforeDraw
* @desc Called before drawing `chart` at every animation frame specified by the given
* easing value. If any plugin returns `false`, the frame drawing is cancelled until
* another `render` is triggered.
* @param {Chart.Controller} chart - The chart instance.
* @param {Number} easingValue - The current animation value, between 0.0 and 1.0.
* @param {Object} options - The plugin options.
* @returns {Boolean} `false` to cancel the chart drawing.
*/
/**
* @method IPlugin#afterDraw
* @desc Called after the `chart` has been drawn for the specific easing value. Note
* that this hook will not be called if the drawing has been previously cancelled.
* @param {Chart.Controller} chart - The chart instance.
* @param {Number} easingValue - The current animation value, between 0.0 and 1.0.
* @param {Object} options - The plugin options.
*/
/**
* @method IPlugin#beforeDatasetsDraw
* @desc Called before drawing the `chart` datasets. If any plugin returns `false`,
* the datasets drawing is cancelled until another `render` is triggered.
* @param {Chart.Controller} chart - The chart instance.
* @param {Number} easingValue - The current animation value, between 0.0 and 1.0.
* @param {Object} options - The plugin options.
* @returns {Boolean} `false` to cancel the chart datasets drawing.
*/
/**
* @method IPlugin#afterDatasetsDraw
* @desc Called after the `chart` datasets have been drawn. Note that this hook
* will not be called if the datasets drawing has been previously cancelled.
* @param {Chart.Controller} chart - The chart instance.
* @param {Number} easingValue - The current animation value, between 0.0 and 1.0.
* @param {Object} options - The plugin options.
*/
/**
* @method IPlugin#beforeDatasetDraw
* @desc Called before drawing the `chart` dataset at the given `args.index` (datasets
* are drawn in the reverse order). If any plugin returns `false`, the datasets drawing
* is cancelled until another `render` is triggered.
* @param {Chart} chart - The chart instance.
* @param {Object} args - The call arguments.
* @param {Number} args.index - The dataset index.
* @param {Object} args.meta - The dataset metadata.
* @param {Number} args.easingValue - The current animation value, between 0.0 and 1.0.
* @param {Object} options - The plugin options.
* @returns {Boolean} `false` to cancel the chart datasets drawing.
*/
/**
* @method IPlugin#afterDatasetDraw
* @desc Called after the `chart` datasets at the given `args.index` have been drawn
* (datasets are drawn in the reverse order). Note that this hook will not be called
* if the datasets drawing has been previously cancelled.
* @param {Chart} chart - The chart instance.
* @param {Object} args - The call arguments.
* @param {Number} args.index - The dataset index.
* @param {Object} args.meta - The dataset metadata.
* @param {Number} args.easingValue - The current animation value, between 0.0 and 1.0.
* @param {Object} options - The plugin options.
*/
/**
* @method IPlugin#beforeTooltipDraw
* @desc Called before drawing the `tooltip`. If any plugin returns `false`,
* the tooltip drawing is cancelled until another `render` is triggered.
* @param {Chart} chart - The chart instance.
* @param {Object} args - The call arguments.
* @param {Object} args.tooltip - The tooltip.
* @param {Number} args.easingValue - The current animation value, between 0.0 and 1.0.
* @param {Object} options - The plugin options.
* @returns {Boolean} `false` to cancel the chart tooltip drawing.
*/
/**
* @method IPlugin#afterTooltipDraw
* @desc Called after drawing the `tooltip`. Note that this hook will not
* be called if the tooltip drawing has been previously cancelled.
* @param {Chart} chart - The chart instance.
* @param {Object} args - The call arguments.
* @param {Object} args.tooltip - The tooltip.
* @param {Number} args.easingValue - The current animation value, between 0.0 and 1.0.
* @param {Object} options - The plugin options.
*/
/**
* @method IPlugin#beforeEvent
* @desc Called before processing the specified `event`. If any plugin returns `false`,
* the event will be discarded.
* @param {Chart.Controller} chart - The chart instance.
* @param {IEvent} event - The event object.
* @param {Object} options - The plugin options.
*/
/**
* @method IPlugin#afterEvent
* @desc Called after the `event` has been consumed. Note that this hook
* will not be called if the `event` has been previously discarded.
* @param {Chart.Controller} chart - The chart instance.
* @param {IEvent} event - The event object.
* @param {Object} options - The plugin options.
*/
/**
* @method IPlugin#resize
* @desc Called after the chart as been resized.
* @param {Chart.Controller} chart - The chart instance.
* @param {Number} size - The new canvas display size (eq. canvas.style width & height).
* @param {Object} options - The plugin options.
*/
/**
* @method IPlugin#destroy
* @desc Called after the chart as been destroyed.
* @param {Chart.Controller} chart - The chart instance.
* @param {Object} options - The plugin options.
*/
/***/ }),
/* 188 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var af = moment.defineLocale('af', {
months : 'Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember'.split('_'),
monthsShort : 'Jan_Feb_Mrt_Apr_Mei_Jun_Jul_Aug_Sep_Okt_Nov_Des'.split('_'),
weekdays : 'Sondag_Maandag_Dinsdag_Woensdag_Donderdag_Vrydag_Saterdag'.split('_'),
weekdaysShort : 'Son_Maa_Din_Woe_Don_Vry_Sat'.split('_'),
weekdaysMin : 'So_Ma_Di_Wo_Do_Vr_Sa'.split('_'),
meridiemParse: /vm|nm/i,
isPM : function (input) {
return /^nm$/i.test(input);
},
meridiem : function (hours, minutes, isLower) {
if (hours < 12) {
return isLower ? 'vm' : 'VM';
} else {
return isLower ? 'nm' : 'NM';
}
},
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd, D MMMM YYYY HH:mm'
},
calendar : {
sameDay : '[Vandag om] LT',
nextDay : '[Môre om] LT',
nextWeek : 'dddd [om] LT',
lastDay : '[Gister om] LT',
lastWeek : '[Laas] dddd [om] LT',
sameElse : 'L'
},
relativeTime : {
future : 'oor %s',
past : '%s gelede',
s : '\'n paar sekondes',
ss : '%d sekondes',
m : '\'n minuut',
mm : '%d minute',
h : '\'n uur',
hh : '%d ure',
d : '\'n dag',
dd : '%d dae',
M : '\'n maand',
MM : '%d maande',
y : '\'n jaar',
yy : '%d jaar'
},
dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/,
ordinal : function (number) {
return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de'); // Thanks to Joris Röling : https://github.com/jjupiter
},
week : {
dow : 1, // Maandag is die eerste dag van die week.
doy : 4 // Die week wat die 4de Januarie bevat is die eerste week van die jaar.
}
});
return af;
})));
/***/ }),
/* 189 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var symbolMap = {
'1': '١',
'2': '٢',
'3': '٣',
'4': '٤',
'5': '٥',
'6': '٦',
'7': '٧',
'8': '٨',
'9': '٩',
'0': '٠'
}, numberMap = {
'١': '1',
'٢': '2',
'٣': '3',
'٤': '4',
'٥': '5',
'٦': '6',
'٧': '7',
'٨': '8',
'٩': '9',
'٠': '0'
}, pluralForm = function (n) {
return n === 0 ? 0 : n === 1 ? 1 : n === 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5;
}, plurals = {
s : ['أقل من ثانية', 'ثانية واحدة', ['ثانيتان', 'ثانيتين'], '%d ثوان', '%d ثانية', '%d ثانية'],
m : ['أقل من دقيقة', 'دقيقة واحدة', ['دقيقتان', 'دقيقتين'], '%d دقائق', '%d دقيقة', '%d دقيقة'],
h : ['أقل من ساعة', 'ساعة واحدة', ['ساعتان', 'ساعتين'], '%d ساعات', '%d ساعة', '%d ساعة'],
d : ['أقل من يوم', 'يوم واحد', ['يومان', 'يومين'], '%d أيام', '%d يومًا', '%d يوم'],
M : ['أقل من شهر', 'شهر واحد', ['شهران', 'شهرين'], '%d أشهر', '%d شهرا', '%d شهر'],
y : ['أقل من عام', 'عام واحد', ['عامان', 'عامين'], '%d أعوام', '%d عامًا', '%d عام']
}, pluralize = function (u) {
return function (number, withoutSuffix, string, isFuture) {
var f = pluralForm(number),
str = plurals[u][pluralForm(number)];
if (f === 2) {
str = str[withoutSuffix ? 0 : 1];
}
return str.replace(/%d/i, number);
};
}, months = [
'يناير',
'فبراير',
'مارس',
'أبريل',
'مايو',
'يونيو',
'يوليو',
'أغسطس',
'سبتمبر',
'أكتوبر',
'نوفمبر',
'ديسمبر'
];
var ar = moment.defineLocale('ar', {
months : months,
monthsShort : months,
weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'),
weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'D/\u200FM/\u200FYYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd D MMMM YYYY HH:mm'
},
meridiemParse: /ص|م/,
isPM : function (input) {
return 'م' === input;
},
meridiem : function (hour, minute, isLower) {
if (hour < 12) {
return 'ص';
} else {
return 'م';
}
},
calendar : {
sameDay: '[اليوم عند الساعة] LT',
nextDay: '[غدًا عند الساعة] LT',
nextWeek: 'dddd [عند الساعة] LT',
lastDay: '[أمس عند الساعة] LT',
lastWeek: 'dddd [عند الساعة] LT',
sameElse: 'L'
},
relativeTime : {
future : 'بعد %s',
past : 'منذ %s',
s : pluralize('s'),
ss : pluralize('s'),
m : pluralize('m'),
mm : pluralize('m'),
h : pluralize('h'),
hh : pluralize('h'),
d : pluralize('d'),
dd : pluralize('d'),
M : pluralize('M'),
MM : pluralize('M'),
y : pluralize('y'),
yy : pluralize('y')
},
preparse: function (string) {
return string.replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) {
return numberMap[match];
}).replace(/،/g, ',');
},
postformat: function (string) {
return string.replace(/\d/g, function (match) {
return symbolMap[match];
}).replace(/,/g, '،');
},
week : {
dow : 6, // Saturday is the first day of the week.
doy : 12 // The week that contains Jan 1st is the first week of the year.
}
});
return ar;
})));
/***/ }),
/* 190 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var arDz = moment.defineLocale('ar-dz', {
months : 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'),
monthsShort : 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'),
weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
weekdaysShort : 'احد_اثنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'),
weekdaysMin : 'أح_إث_ثلا_أر_خم_جم_سب'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd D MMMM YYYY HH:mm'
},
calendar : {
sameDay: '[اليوم على الساعة] LT',
nextDay: '[غدا على الساعة] LT',
nextWeek: 'dddd [على الساعة] LT',
lastDay: '[أمس على الساعة] LT',
lastWeek: 'dddd [على الساعة] LT',
sameElse: 'L'
},
relativeTime : {
future : 'في %s',
past : 'منذ %s',
s : 'ثوان',
ss : '%d ثانية',
m : 'دقيقة',
mm : '%d دقائق',
h : 'ساعة',
hh : '%d ساعات',
d : 'يوم',
dd : '%d أيام',
M : 'شهر',
MM : '%d أشهر',
y : 'سنة',
yy : '%d سنوات'
},
week : {
dow : 0, // Sunday is the first day of the week.
doy : 4 // The week that contains Jan 1st is the first week of the year.
}
});
return arDz;
})));
/***/ }),
/* 191 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var arKw = moment.defineLocale('ar-kw', {
months : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'),
monthsShort : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'),
weekdays : 'الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
weekdaysShort : 'احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'),
weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd D MMMM YYYY HH:mm'
},
calendar : {
sameDay: '[اليوم على الساعة] LT',
nextDay: '[غدا على الساعة] LT',
nextWeek: 'dddd [على الساعة] LT',
lastDay: '[أمس على الساعة] LT',
lastWeek: 'dddd [على الساعة] LT',
sameElse: 'L'
},
relativeTime : {
future : 'في %s',
past : 'منذ %s',
s : 'ثوان',
ss : '%d ثانية',
m : 'دقيقة',
mm : '%d دقائق',
h : 'ساعة',
hh : '%d ساعات',
d : 'يوم',
dd : '%d أيام',
M : 'شهر',
MM : '%d أشهر',
y : 'سنة',
yy : '%d سنوات'
},
week : {
dow : 0, // Sunday is the first day of the week.
doy : 12 // The week that contains Jan 1st is the first week of the year.
}
});
return arKw;
})));
/***/ }),
/* 192 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var symbolMap = {
'1': '1',
'2': '2',
'3': '3',
'4': '4',
'5': '5',
'6': '6',
'7': '7',
'8': '8',
'9': '9',
'0': '0'
}, pluralForm = function (n) {
return n === 0 ? 0 : n === 1 ? 1 : n === 2 ? 2 : n % 100 >= 3 && n % 100 <= 10 ? 3 : n % 100 >= 11 ? 4 : 5;
}, plurals = {
s : ['أقل من ثانية', 'ثانية واحدة', ['ثانيتان', 'ثانيتين'], '%d ثوان', '%d ثانية', '%d ثانية'],
m : ['أقل من دقيقة', 'دقيقة واحدة', ['دقيقتان', 'دقيقتين'], '%d دقائق', '%d دقيقة', '%d دقيقة'],
h : ['أقل من ساعة', 'ساعة واحدة', ['ساعتان', 'ساعتين'], '%d ساعات', '%d ساعة', '%d ساعة'],
d : ['أقل من يوم', 'يوم واحد', ['يومان', 'يومين'], '%d أيام', '%d يومًا', '%d يوم'],
M : ['أقل من شهر', 'شهر واحد', ['شهران', 'شهرين'], '%d أشهر', '%d شهرا', '%d شهر'],
y : ['أقل من عام', 'عام واحد', ['عامان', 'عامين'], '%d أعوام', '%d عامًا', '%d عام']
}, pluralize = function (u) {
return function (number, withoutSuffix, string, isFuture) {
var f = pluralForm(number),
str = plurals[u][pluralForm(number)];
if (f === 2) {
str = str[withoutSuffix ? 0 : 1];
}
return str.replace(/%d/i, number);
};
}, months = [
'يناير',
'فبراير',
'مارس',
'أبريل',
'مايو',
'يونيو',
'يوليو',
'أغسطس',
'سبتمبر',
'أكتوبر',
'نوفمبر',
'ديسمبر'
];
var arLy = moment.defineLocale('ar-ly', {
months : months,
monthsShort : months,
weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'),
weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'D/\u200FM/\u200FYYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd D MMMM YYYY HH:mm'
},
meridiemParse: /ص|م/,
isPM : function (input) {
return 'م' === input;
},
meridiem : function (hour, minute, isLower) {
if (hour < 12) {
return 'ص';
} else {
return 'م';
}
},
calendar : {
sameDay: '[اليوم عند الساعة] LT',
nextDay: '[غدًا عند الساعة] LT',
nextWeek: 'dddd [عند الساعة] LT',
lastDay: '[أمس عند الساعة] LT',
lastWeek: 'dddd [عند الساعة] LT',
sameElse: 'L'
},
relativeTime : {
future : 'بعد %s',
past : 'منذ %s',
s : pluralize('s'),
ss : pluralize('s'),
m : pluralize('m'),
mm : pluralize('m'),
h : pluralize('h'),
hh : pluralize('h'),
d : pluralize('d'),
dd : pluralize('d'),
M : pluralize('M'),
MM : pluralize('M'),
y : pluralize('y'),
yy : pluralize('y')
},
preparse: function (string) {
return string.replace(/،/g, ',');
},
postformat: function (string) {
return string.replace(/\d/g, function (match) {
return symbolMap[match];
}).replace(/,/g, '،');
},
week : {
dow : 6, // Saturday is the first day of the week.
doy : 12 // The week that contains Jan 1st is the first week of the year.
}
});
return arLy;
})));
/***/ }),
/* 193 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var arMa = moment.defineLocale('ar-ma', {
months : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'),
monthsShort : 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split('_'),
weekdays : 'الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
weekdaysShort : 'احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'),
weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd D MMMM YYYY HH:mm'
},
calendar : {
sameDay: '[اليوم على الساعة] LT',
nextDay: '[غدا على الساعة] LT',
nextWeek: 'dddd [على الساعة] LT',
lastDay: '[أمس على الساعة] LT',
lastWeek: 'dddd [على الساعة] LT',
sameElse: 'L'
},
relativeTime : {
future : 'في %s',
past : 'منذ %s',
s : 'ثوان',
ss : '%d ثانية',
m : 'دقيقة',
mm : '%d دقائق',
h : 'ساعة',
hh : '%d ساعات',
d : 'يوم',
dd : '%d أيام',
M : 'شهر',
MM : '%d أشهر',
y : 'سنة',
yy : '%d سنوات'
},
week : {
dow : 6, // Saturday is the first day of the week.
doy : 12 // The week that contains Jan 1st is the first week of the year.
}
});
return arMa;
})));
/***/ }),
/* 194 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var symbolMap = {
'1': '١',
'2': '٢',
'3': '٣',
'4': '٤',
'5': '٥',
'6': '٦',
'7': '٧',
'8': '٨',
'9': '٩',
'0': '٠'
}, numberMap = {
'١': '1',
'٢': '2',
'٣': '3',
'٤': '4',
'٥': '5',
'٦': '6',
'٧': '7',
'٨': '8',
'٩': '9',
'٠': '0'
};
var arSa = moment.defineLocale('ar-sa', {
months : 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'),
monthsShort : 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'),
weekdays : 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
weekdaysShort : 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'),
weekdaysMin : 'ح_ن_ث_ر_خ_ج_س'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd D MMMM YYYY HH:mm'
},
meridiemParse: /ص|م/,
isPM : function (input) {
return 'م' === input;
},
meridiem : function (hour, minute, isLower) {
if (hour < 12) {
return 'ص';
} else {
return 'م';
}
},
calendar : {
sameDay: '[اليوم على الساعة] LT',
nextDay: '[غدا على الساعة] LT',
nextWeek: 'dddd [على الساعة] LT',
lastDay: '[أمس على الساعة] LT',
lastWeek: 'dddd [على الساعة] LT',
sameElse: 'L'
},
relativeTime : {
future : 'في %s',
past : 'منذ %s',
s : 'ثوان',
ss : '%d ثانية',
m : 'دقيقة',
mm : '%d دقائق',
h : 'ساعة',
hh : '%d ساعات',
d : 'يوم',
dd : '%d أيام',
M : 'شهر',
MM : '%d أشهر',
y : 'سنة',
yy : '%d سنوات'
},
preparse: function (string) {
return string.replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) {
return numberMap[match];
}).replace(/،/g, ',');
},
postformat: function (string) {
return string.replace(/\d/g, function (match) {
return symbolMap[match];
}).replace(/,/g, '،');
},
week : {
dow : 0, // Sunday is the first day of the week.
doy : 6 // The week that contains Jan 1st is the first week of the year.
}
});
return arSa;
})));
/***/ }),
/* 195 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var arTn = moment.defineLocale('ar-tn', {
months: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'),
monthsShort: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split('_'),
weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'),
weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'),
weekdaysParseExact : true,
longDateFormat: {
LT: 'HH:mm',
LTS: 'HH:mm:ss',
L: 'DD/MM/YYYY',
LL: 'D MMMM YYYY',
LLL: 'D MMMM YYYY HH:mm',
LLLL: 'dddd D MMMM YYYY HH:mm'
},
calendar: {
sameDay: '[اليوم على الساعة] LT',
nextDay: '[غدا على الساعة] LT',
nextWeek: 'dddd [على الساعة] LT',
lastDay: '[أمس على الساعة] LT',
lastWeek: 'dddd [على الساعة] LT',
sameElse: 'L'
},
relativeTime: {
future: 'في %s',
past: 'منذ %s',
s: 'ثوان',
ss : '%d ثانية',
m: 'دقيقة',
mm: '%d دقائق',
h: 'ساعة',
hh: '%d ساعات',
d: 'يوم',
dd: '%d أيام',
M: 'شهر',
MM: '%d أشهر',
y: 'سنة',
yy: '%d سنوات'
},
week: {
dow: 1, // Monday is the first day of the week.
doy: 4 // The week that contains Jan 4th is the first week of the year.
}
});
return arTn;
})));
/***/ }),
/* 196 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var suffixes = {
1: '-inci',
5: '-inci',
8: '-inci',
70: '-inci',
80: '-inci',
2: '-nci',
7: '-nci',
20: '-nci',
50: '-nci',
3: '-üncü',
4: '-üncü',
100: '-üncü',
6: '-ncı',
9: '-uncu',
10: '-uncu',
30: '-uncu',
60: '-ıncı',
90: '-ıncı'
};
var az = moment.defineLocale('az', {
months : 'yanvar_fevral_mart_aprel_may_iyun_iyul_avqust_sentyabr_oktyabr_noyabr_dekabr'.split('_'),
monthsShort : 'yan_fev_mar_apr_may_iyn_iyl_avq_sen_okt_noy_dek'.split('_'),
weekdays : 'Bazar_Bazar ertəsi_Çərşənbə axşamı_Çərşənbə_Cümə axşamı_Cümə_Şənbə'.split('_'),
weekdaysShort : 'Baz_BzE_ÇAx_Çər_CAx_Cüm_Şən'.split('_'),
weekdaysMin : 'Bz_BE_ÇA_Çə_CA_Cü_Şə'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd, D MMMM YYYY HH:mm'
},
calendar : {
sameDay : '[bugün saat] LT',
nextDay : '[sabah saat] LT',
nextWeek : '[gələn həftə] dddd [saat] LT',
lastDay : '[dünən] LT',
lastWeek : '[keçən həftə] dddd [saat] LT',
sameElse : 'L'
},
relativeTime : {
future : '%s sonra',
past : '%s əvvəl',
s : 'birneçə saniyyə',
ss : '%d saniyə',
m : 'bir dəqiqə',
mm : '%d dəqiqə',
h : 'bir saat',
hh : '%d saat',
d : 'bir gün',
dd : '%d gün',
M : 'bir ay',
MM : '%d ay',
y : 'bir il',
yy : '%d il'
},
meridiemParse: /gecə|səhər|gündüz|axşam/,
isPM : function (input) {
return /^(gündüz|axşam)$/.test(input);
},
meridiem : function (hour, minute, isLower) {
if (hour < 4) {
return 'gecə';
} else if (hour < 12) {
return 'səhər';
} else if (hour < 17) {
return 'gündüz';
} else {
return 'axşam';
}
},
dayOfMonthOrdinalParse: /\d{1,2}-(ıncı|inci|nci|üncü|ncı|uncu)/,
ordinal : function (number) {
if (number === 0) { // special case for zero
return number + '-ıncı';
}
var a = number % 10,
b = number % 100 - a,
c = number >= 100 ? 100 : null;
return number + (suffixes[a] || suffixes[b] || suffixes[c]);
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
return az;
})));
/***/ }),
/* 197 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
function plural(word, num) {
var forms = word.split('_');
return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]);
}
function relativeTimeWithPlural(number, withoutSuffix, key) {
var format = {
'ss': withoutSuffix ? 'секунда_секунды_секунд' : 'секунду_секунды_секунд',
'mm': withoutSuffix ? 'хвіліна_хвіліны_хвілін' : 'хвіліну_хвіліны_хвілін',
'hh': withoutSuffix ? 'гадзіна_гадзіны_гадзін' : 'гадзіну_гадзіны_гадзін',
'dd': 'дзень_дні_дзён',
'MM': 'месяц_месяцы_месяцаў',
'yy': 'год_гады_гадоў'
};
if (key === 'm') {
return withoutSuffix ? 'хвіліна' : 'хвіліну';
}
else if (key === 'h') {
return withoutSuffix ? 'гадзіна' : 'гадзіну';
}
else {
return number + ' ' + plural(format[key], +number);
}
}
var be = moment.defineLocale('be', {
months : {
format: 'студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня'.split('_'),
standalone: 'студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань'.split('_')
},
monthsShort : 'студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж'.split('_'),
weekdays : {
format: 'нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу'.split('_'),
standalone: 'нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота'.split('_'),
isFormat: /\[ ?[Вв] ?(?:мінулую|наступную)? ?\] ?dddd/
},
weekdaysShort : 'нд_пн_ат_ср_чц_пт_сб'.split('_'),
weekdaysMin : 'нд_пн_ат_ср_чц_пт_сб'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D MMMM YYYY г.',
LLL : 'D MMMM YYYY г., HH:mm',
LLLL : 'dddd, D MMMM YYYY г., HH:mm'
},
calendar : {
sameDay: '[Сёння ў] LT',
nextDay: '[Заўтра ў] LT',
lastDay: '[Учора ў] LT',
nextWeek: function () {
return '[У] dddd [ў] LT';
},
lastWeek: function () {
switch (this.day()) {
case 0:
case 3:
case 5:
case 6:
return '[У мінулую] dddd [ў] LT';
case 1:
case 2:
case 4:
return '[У мінулы] dddd [ў] LT';
}
},
sameElse: 'L'
},
relativeTime : {
future : 'праз %s',
past : '%s таму',
s : 'некалькі секунд',
m : relativeTimeWithPlural,
mm : relativeTimeWithPlural,
h : relativeTimeWithPlural,
hh : relativeTimeWithPlural,
d : 'дзень',
dd : relativeTimeWithPlural,
M : 'месяц',
MM : relativeTimeWithPlural,
y : 'год',
yy : relativeTimeWithPlural
},
meridiemParse: /ночы|раніцы|дня|вечара/,
isPM : function (input) {
return /^(дня|вечара)$/.test(input);
},
meridiem : function (hour, minute, isLower) {
if (hour < 4) {
return 'ночы';
} else if (hour < 12) {
return 'раніцы';
} else if (hour < 17) {
return 'дня';
} else {
return 'вечара';
}
},
dayOfMonthOrdinalParse: /\d{1,2}-(і|ы|га)/,
ordinal: function (number, period) {
switch (period) {
case 'M':
case 'd':
case 'DDD':
case 'w':
case 'W':
return (number % 10 === 2 || number % 10 === 3) && (number % 100 !== 12 && number % 100 !== 13) ? number + '-і' : number + '-ы';
case 'D':
return number + '-га';
default:
return number;
}
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
return be;
})));
/***/ }),
/* 198 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var bg = moment.defineLocale('bg', {
months : 'януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември'.split('_'),
monthsShort : 'янр_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек'.split('_'),
weekdays : 'неделя_понеделник_вторник_сряда_четвъртък_петък_събота'.split('_'),
weekdaysShort : 'нед_пон_вто_сря_чет_пет_съб'.split('_'),
weekdaysMin : 'нд_пн_вт_ср_чт_пт_сб'.split('_'),
longDateFormat : {
LT : 'H:mm',
LTS : 'H:mm:ss',
L : 'D.MM.YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY H:mm',
LLLL : 'dddd, D MMMM YYYY H:mm'
},
calendar : {
sameDay : '[Днес в] LT',
nextDay : '[Утре в] LT',
nextWeek : 'dddd [в] LT',
lastDay : '[Вчера в] LT',
lastWeek : function () {
switch (this.day()) {
case 0:
case 3:
case 6:
return '[В изминалата] dddd [в] LT';
case 1:
case 2:
case 4:
case 5:
return '[В изминалия] dddd [в] LT';
}
},
sameElse : 'L'
},
relativeTime : {
future : 'след %s',
past : 'преди %s',
s : 'няколко секунди',
ss : '%d секунди',
m : 'минута',
mm : '%d минути',
h : 'час',
hh : '%d часа',
d : 'ден',
dd : '%d дни',
M : 'месец',
MM : '%d месеца',
y : 'година',
yy : '%d години'
},
dayOfMonthOrdinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/,
ordinal : function (number) {
var lastDigit = number % 10,
last2Digits = number % 100;
if (number === 0) {
return number + '-ев';
} else if (last2Digits === 0) {
return number + '-ен';
} else if (last2Digits > 10 && last2Digits < 20) {
return number + '-ти';
} else if (lastDigit === 1) {
return number + '-ви';
} else if (lastDigit === 2) {
return number + '-ри';
} else if (lastDigit === 7 || lastDigit === 8) {
return number + '-ми';
} else {
return number + '-ти';
}
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
return bg;
})));
/***/ }),
/* 199 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var bm = moment.defineLocale('bm', {
months : 'Zanwuyekalo_Fewuruyekalo_Marisikalo_Awirilikalo_Mɛkalo_Zuwɛnkalo_Zuluyekalo_Utikalo_Sɛtanburukalo_ɔkutɔburukalo_Nowanburukalo_Desanburukalo'.split('_'),
monthsShort : 'Zan_Few_Mar_Awi_Mɛ_Zuw_Zul_Uti_Sɛt_ɔku_Now_Des'.split('_'),
weekdays : 'Kari_Ntɛnɛn_Tarata_Araba_Alamisa_Juma_Sibiri'.split('_'),
weekdaysShort : 'Kar_Ntɛ_Tar_Ara_Ala_Jum_Sib'.split('_'),
weekdaysMin : 'Ka_Nt_Ta_Ar_Al_Ju_Si'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'MMMM [tile] D [san] YYYY',
LLL : 'MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm',
LLLL : 'dddd MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm'
},
calendar : {
sameDay : '[Bi lɛrɛ] LT',
nextDay : '[Sini lɛrɛ] LT',
nextWeek : 'dddd [don lɛrɛ] LT',
lastDay : '[Kunu lɛrɛ] LT',
lastWeek : 'dddd [tɛmɛnen lɛrɛ] LT',
sameElse : 'L'
},
relativeTime : {
future : '%s kɔnɔ',
past : 'a bɛ %s bɔ',
s : 'sanga dama dama',
ss : 'sekondi %d',
m : 'miniti kelen',
mm : 'miniti %d',
h : 'lɛrɛ kelen',
hh : 'lɛrɛ %d',
d : 'tile kelen',
dd : 'tile %d',
M : 'kalo kelen',
MM : 'kalo %d',
y : 'san kelen',
yy : 'san %d'
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return bm;
})));
/***/ }),
/* 200 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var symbolMap = {
'1': '১',
'2': '২',
'3': '৩',
'4': '৪',
'5': '৫',
'6': '৬',
'7': '৭',
'8': '৮',
'9': '৯',
'0': '০'
},
numberMap = {
'১': '1',
'২': '2',
'৩': '3',
'৪': '4',
'৫': '5',
'৬': '6',
'৭': '7',
'৮': '8',
'৯': '9',
'০': '0'
};
var bn = moment.defineLocale('bn', {
months : 'জানুয়ারী_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর'.split('_'),
monthsShort : 'জানু_ফেব_মার্চ_এপ্র_মে_জুন_জুল_আগ_সেপ্ট_অক্টো_নভে_ডিসে'.split('_'),
weekdays : 'রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পতিবার_শুক্রবার_শনিবার'.split('_'),
weekdaysShort : 'রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি'.split('_'),
weekdaysMin : 'রবি_সোম_মঙ্গ_বুধ_বৃহঃ_শুক্র_শনি'.split('_'),
longDateFormat : {
LT : 'A h:mm সময়',
LTS : 'A h:mm:ss সময়',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY, A h:mm সময়',
LLLL : 'dddd, D MMMM YYYY, A h:mm সময়'
},
calendar : {
sameDay : '[আজ] LT',
nextDay : '[আগামীকাল] LT',
nextWeek : 'dddd, LT',
lastDay : '[গতকাল] LT',
lastWeek : '[গত] dddd, LT',
sameElse : 'L'
},
relativeTime : {
future : '%s পরে',
past : '%s আগে',
s : 'কয়েক সেকেন্ড',
ss : '%d সেকেন্ড',
m : 'এক মিনিট',
mm : '%d মিনিট',
h : 'এক ঘন্টা',
hh : '%d ঘন্টা',
d : 'এক দিন',
dd : '%d দিন',
M : 'এক মাস',
MM : '%d মাস',
y : 'এক বছর',
yy : '%d বছর'
},
preparse: function (string) {
return string.replace(/[১২৩৪৫৬৭৮৯০]/g, function (match) {
return numberMap[match];
});
},
postformat: function (string) {
return string.replace(/\d/g, function (match) {
return symbolMap[match];
});
},
meridiemParse: /রাত|সকাল|দুপুর|বিকাল|রাত/,
meridiemHour : function (hour, meridiem) {
if (hour === 12) {
hour = 0;
}
if ((meridiem === 'রাত' && hour >= 4) ||
(meridiem === 'দুপুর' && hour < 5) ||
meridiem === 'বিকাল') {
return hour + 12;
} else {
return hour;
}
},
meridiem : function (hour, minute, isLower) {
if (hour < 4) {
return 'রাত';
} else if (hour < 10) {
return 'সকাল';
} else if (hour < 17) {
return 'দুপুর';
} else if (hour < 20) {
return 'বিকাল';
} else {
return 'রাত';
}
},
week : {
dow : 0, // Sunday is the first day of the week.
doy : 6 // The week that contains Jan 1st is the first week of the year.
}
});
return bn;
})));
/***/ }),
/* 201 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var symbolMap = {
'1': '༡',
'2': '༢',
'3': '༣',
'4': '༤',
'5': '༥',
'6': '༦',
'7': '༧',
'8': '༨',
'9': '༩',
'0': '༠'
},
numberMap = {
'༡': '1',
'༢': '2',
'༣': '3',
'༤': '4',
'༥': '5',
'༦': '6',
'༧': '7',
'༨': '8',
'༩': '9',
'༠': '0'
};
var bo = moment.defineLocale('bo', {
months : 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split('_'),
monthsShort : 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split('_'),
weekdays : 'གཟའ་ཉི་མ་_གཟའ་ཟླ་བ་_གཟའ་མིག་དམར་_གཟའ་ལྷག་པ་_གཟའ་ཕུར་བུ_གཟའ་པ་སངས་_གཟའ་སྤེན་པ་'.split('_'),
weekdaysShort : 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.split('_'),
weekdaysMin : 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.split('_'),
longDateFormat : {
LT : 'A h:mm',
LTS : 'A h:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY, A h:mm',
LLLL : 'dddd, D MMMM YYYY, A h:mm'
},
calendar : {
sameDay : '[དི་རིང] LT',
nextDay : '[སང་ཉིན] LT',
nextWeek : '[བདུན་ཕྲག་རྗེས་མ], LT',
lastDay : '[ཁ་སང] LT',
lastWeek : '[བདུན་ཕྲག་མཐའ་མ] dddd, LT',
sameElse : 'L'
},
relativeTime : {
future : '%s ལ་',
past : '%s སྔན་ལ',
s : 'ལམ་སང',
ss : '%d སྐར་ཆ།',
m : 'སྐར་མ་གཅིག',
mm : '%d སྐར་མ',
h : 'ཆུ་ཚོད་གཅིག',
hh : '%d ཆུ་ཚོད',
d : 'ཉིན་གཅིག',
dd : '%d ཉིན་',
M : 'ཟླ་བ་གཅིག',
MM : '%d ཟླ་བ',
y : 'ལོ་གཅིག',
yy : '%d ལོ'
},
preparse: function (string) {
return string.replace(/[༡༢༣༤༥༦༧༨༩༠]/g, function (match) {
return numberMap[match];
});
},
postformat: function (string) {
return string.replace(/\d/g, function (match) {
return symbolMap[match];
});
},
meridiemParse: /མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/,
meridiemHour : function (hour, meridiem) {
if (hour === 12) {
hour = 0;
}
if ((meridiem === 'མཚན་མོ' && hour >= 4) ||
(meridiem === 'ཉིན་གུང' && hour < 5) ||
meridiem === 'དགོང་དག') {
return hour + 12;
} else {
return hour;
}
},
meridiem : function (hour, minute, isLower) {
if (hour < 4) {
return 'མཚན་མོ';
} else if (hour < 10) {
return 'ཞོགས་ཀས';
} else if (hour < 17) {
return 'ཉིན་གུང';
} else if (hour < 20) {
return 'དགོང་དག';
} else {
return 'མཚན་མོ';
}
},
week : {
dow : 0, // Sunday is the first day of the week.
doy : 6 // The week that contains Jan 1st is the first week of the year.
}
});
return bo;
})));
/***/ }),
/* 202 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
function relativeTimeWithMutation(number, withoutSuffix, key) {
var format = {
'mm': 'munutenn',
'MM': 'miz',
'dd': 'devezh'
};
return number + ' ' + mutation(format[key], number);
}
function specialMutationForYears(number) {
switch (lastNumber(number)) {
case 1:
case 3:
case 4:
case 5:
case 9:
return number + ' bloaz';
default:
return number + ' vloaz';
}
}
function lastNumber(number) {
if (number > 9) {
return lastNumber(number % 10);
}
return number;
}
function mutation(text, number) {
if (number === 2) {
return softMutation(text);
}
return text;
}
function softMutation(text) {
var mutationTable = {
'm': 'v',
'b': 'v',
'd': 'z'
};
if (mutationTable[text.charAt(0)] === undefined) {
return text;
}
return mutationTable[text.charAt(0)] + text.substring(1);
}
var br = moment.defineLocale('br', {
months : 'Genver_C\'hwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu'.split('_'),
monthsShort : 'Gen_C\'hwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker'.split('_'),
weekdays : 'Sul_Lun_Meurzh_Merc\'her_Yaou_Gwener_Sadorn'.split('_'),
weekdaysShort : 'Sul_Lun_Meu_Mer_Yao_Gwe_Sad'.split('_'),
weekdaysMin : 'Su_Lu_Me_Mer_Ya_Gw_Sa'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'h[e]mm A',
LTS : 'h[e]mm:ss A',
L : 'DD/MM/YYYY',
LL : 'D [a viz] MMMM YYYY',
LLL : 'D [a viz] MMMM YYYY h[e]mm A',
LLLL : 'dddd, D [a viz] MMMM YYYY h[e]mm A'
},
calendar : {
sameDay : '[Hiziv da] LT',
nextDay : '[Warc\'hoazh da] LT',
nextWeek : 'dddd [da] LT',
lastDay : '[Dec\'h da] LT',
lastWeek : 'dddd [paset da] LT',
sameElse : 'L'
},
relativeTime : {
future : 'a-benn %s',
past : '%s \'zo',
s : 'un nebeud segondennoù',
ss : '%d eilenn',
m : 'ur vunutenn',
mm : relativeTimeWithMutation,
h : 'un eur',
hh : '%d eur',
d : 'un devezh',
dd : relativeTimeWithMutation,
M : 'ur miz',
MM : relativeTimeWithMutation,
y : 'ur bloaz',
yy : specialMutationForYears
},
dayOfMonthOrdinalParse: /\d{1,2}(añ|vet)/,
ordinal : function (number) {
var output = (number === 1) ? 'añ' : 'vet';
return number + output;
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return br;
})));
/***/ }),
/* 203 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
function translate(number, withoutSuffix, key) {
var result = number + ' ';
switch (key) {
case 'ss':
if (number === 1) {
result += 'sekunda';
} else if (number === 2 || number === 3 || number === 4) {
result += 'sekunde';
} else {
result += 'sekundi';
}
return result;
case 'm':
return withoutSuffix ? 'jedna minuta' : 'jedne minute';
case 'mm':
if (number === 1) {
result += 'minuta';
} else if (number === 2 || number === 3 || number === 4) {
result += 'minute';
} else {
result += 'minuta';
}
return result;
case 'h':
return withoutSuffix ? 'jedan sat' : 'jednog sata';
case 'hh':
if (number === 1) {
result += 'sat';
} else if (number === 2 || number === 3 || number === 4) {
result += 'sata';
} else {
result += 'sati';
}
return result;
case 'dd':
if (number === 1) {
result += 'dan';
} else {
result += 'dana';
}
return result;
case 'MM':
if (number === 1) {
result += 'mjesec';
} else if (number === 2 || number === 3 || number === 4) {
result += 'mjeseca';
} else {
result += 'mjeseci';
}
return result;
case 'yy':
if (number === 1) {
result += 'godina';
} else if (number === 2 || number === 3 || number === 4) {
result += 'godine';
} else {
result += 'godina';
}
return result;
}
}
var bs = moment.defineLocale('bs', {
months : 'januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar'.split('_'),
monthsShort : 'jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.'.split('_'),
monthsParseExact: true,
weekdays : 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'),
weekdaysShort : 'ned._pon._uto._sri._čet._pet._sub.'.split('_'),
weekdaysMin : 'ne_po_ut_sr_če_pe_su'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'H:mm',
LTS : 'H:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D. MMMM YYYY',
LLL : 'D. MMMM YYYY H:mm',
LLLL : 'dddd, D. MMMM YYYY H:mm'
},
calendar : {
sameDay : '[danas u] LT',
nextDay : '[sutra u] LT',
nextWeek : function () {
switch (this.day()) {
case 0:
return '[u] [nedjelju] [u] LT';
case 3:
return '[u] [srijedu] [u] LT';
case 6:
return '[u] [subotu] [u] LT';
case 1:
case 2:
case 4:
case 5:
return '[u] dddd [u] LT';
}
},
lastDay : '[jučer u] LT',
lastWeek : function () {
switch (this.day()) {
case 0:
case 3:
return '[prošlu] dddd [u] LT';
case 6:
return '[prošle] [subote] [u] LT';
case 1:
case 2:
case 4:
case 5:
return '[prošli] dddd [u] LT';
}
},
sameElse : 'L'
},
relativeTime : {
future : 'za %s',
past : 'prije %s',
s : 'par sekundi',
ss : translate,
m : translate,
mm : translate,
h : translate,
hh : translate,
d : 'dan',
dd : translate,
M : 'mjesec',
MM : translate,
y : 'godinu',
yy : translate
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
return bs;
})));
/***/ }),
/* 204 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var ca = moment.defineLocale('ca', {
months : {
standalone: 'gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre'.split('_'),
format: 'de gener_de febrer_de març_d\'abril_de maig_de juny_de juliol_d\'agost_de setembre_d\'octubre_de novembre_de desembre'.split('_'),
isFormat: /D[oD]?(\s)+MMMM/
},
monthsShort : 'gen._febr._març_abr._maig_juny_jul._ag._set._oct._nov._des.'.split('_'),
monthsParseExact : true,
weekdays : 'diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte'.split('_'),
weekdaysShort : 'dg._dl._dt._dc._dj._dv._ds.'.split('_'),
weekdaysMin : 'dg_dl_dt_dc_dj_dv_ds'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'H:mm',
LTS : 'H:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM [de] YYYY',
ll : 'D MMM YYYY',
LLL : 'D MMMM [de] YYYY [a les] H:mm',
lll : 'D MMM YYYY, H:mm',
LLLL : 'dddd D MMMM [de] YYYY [a les] H:mm',
llll : 'ddd D MMM YYYY, H:mm'
},
calendar : {
sameDay : function () {
return '[avui a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT';
},
nextDay : function () {
return '[demà a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT';
},
nextWeek : function () {
return 'dddd [a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT';
},
lastDay : function () {
return '[ahir a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT';
},
lastWeek : function () {
return '[el] dddd [passat a ' + ((this.hours() !== 1) ? 'les' : 'la') + '] LT';
},
sameElse : 'L'
},
relativeTime : {
future : 'd\'aquí %s',
past : 'fa %s',
s : 'uns segons',
ss : '%d segons',
m : 'un minut',
mm : '%d minuts',
h : 'una hora',
hh : '%d hores',
d : 'un dia',
dd : '%d dies',
M : 'un mes',
MM : '%d mesos',
y : 'un any',
yy : '%d anys'
},
dayOfMonthOrdinalParse: /\d{1,2}(r|n|t|è|a)/,
ordinal : function (number, period) {
var output = (number === 1) ? 'r' :
(number === 2) ? 'n' :
(number === 3) ? 'r' :
(number === 4) ? 't' : 'è';
if (period === 'w' || period === 'W') {
output = 'a';
}
return number + output;
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return ca;
})));
/***/ }),
/* 205 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var months = 'leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec'.split('_'),
monthsShort = 'led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro'.split('_');
function plural(n) {
return (n > 1) && (n < 5) && (~~(n / 10) !== 1);
}
function translate(number, withoutSuffix, key, isFuture) {
var result = number + ' ';
switch (key) {
case 's': // a few seconds / in a few seconds / a few seconds ago
return (withoutSuffix || isFuture) ? 'pár sekund' : 'pár sekundami';
case 'ss': // 9 seconds / in 9 seconds / 9 seconds ago
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'sekundy' : 'sekund');
} else {
return result + 'sekundami';
}
break;
case 'm': // a minute / in a minute / a minute ago
return withoutSuffix ? 'minuta' : (isFuture ? 'minutu' : 'minutou');
case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'minuty' : 'minut');
} else {
return result + 'minutami';
}
break;
case 'h': // an hour / in an hour / an hour ago
return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou');
case 'hh': // 9 hours / in 9 hours / 9 hours ago
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'hodiny' : 'hodin');
} else {
return result + 'hodinami';
}
break;
case 'd': // a day / in a day / a day ago
return (withoutSuffix || isFuture) ? 'den' : 'dnem';
case 'dd': // 9 days / in 9 days / 9 days ago
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'dny' : 'dní');
} else {
return result + 'dny';
}
break;
case 'M': // a month / in a month / a month ago
return (withoutSuffix || isFuture) ? 'měsíc' : 'měsícem';
case 'MM': // 9 months / in 9 months / 9 months ago
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'měsíce' : 'měsíců');
} else {
return result + 'měsíci';
}
break;
case 'y': // a year / in a year / a year ago
return (withoutSuffix || isFuture) ? 'rok' : 'rokem';
case 'yy': // 9 years / in 9 years / 9 years ago
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'roky' : 'let');
} else {
return result + 'lety';
}
break;
}
}
var cs = moment.defineLocale('cs', {
months : months,
monthsShort : monthsShort,
monthsParse : (function (months, monthsShort) {
var i, _monthsParse = [];
for (i = 0; i < 12; i++) {
// use custom parser to solve problem with July (červenec)
_monthsParse[i] = new RegExp('^' + months[i] + '$|^' + monthsShort[i] + '$', 'i');
}
return _monthsParse;
}(months, monthsShort)),
shortMonthsParse : (function (monthsShort) {
var i, _shortMonthsParse = [];
for (i = 0; i < 12; i++) {
_shortMonthsParse[i] = new RegExp('^' + monthsShort[i] + '$', 'i');
}
return _shortMonthsParse;
}(monthsShort)),
longMonthsParse : (function (months) {
var i, _longMonthsParse = [];
for (i = 0; i < 12; i++) {
_longMonthsParse[i] = new RegExp('^' + months[i] + '$', 'i');
}
return _longMonthsParse;
}(months)),
weekdays : 'neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota'.split('_'),
weekdaysShort : 'ne_po_út_st_čt_pá_so'.split('_'),
weekdaysMin : 'ne_po_út_st_čt_pá_so'.split('_'),
longDateFormat : {
LT: 'H:mm',
LTS : 'H:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D. MMMM YYYY',
LLL : 'D. MMMM YYYY H:mm',
LLLL : 'dddd D. MMMM YYYY H:mm',
l : 'D. M. YYYY'
},
calendar : {
sameDay: '[dnes v] LT',
nextDay: '[zítra v] LT',
nextWeek: function () {
switch (this.day()) {
case 0:
return '[v neděli v] LT';
case 1:
case 2:
return '[v] dddd [v] LT';
case 3:
return '[ve středu v] LT';
case 4:
return '[ve čtvrtek v] LT';
case 5:
return '[v pátek v] LT';
case 6:
return '[v sobotu v] LT';
}
},
lastDay: '[včera v] LT',
lastWeek: function () {
switch (this.day()) {
case 0:
return '[minulou neděli v] LT';
case 1:
case 2:
return '[minulé] dddd [v] LT';
case 3:
return '[minulou středu v] LT';
case 4:
case 5:
return '[minulý] dddd [v] LT';
case 6:
return '[minulou sobotu v] LT';
}
},
sameElse: 'L'
},
relativeTime : {
future : 'za %s',
past : 'před %s',
s : translate,
ss : translate,
m : translate,
mm : translate,
h : translate,
hh : translate,
d : translate,
dd : translate,
M : translate,
MM : translate,
y : translate,
yy : translate
},
dayOfMonthOrdinalParse : /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return cs;
})));
/***/ }),
/* 206 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var cv = moment.defineLocale('cv', {
months : 'кӑрлач_нарӑс_пуш_ака_май_ҫӗртме_утӑ_ҫурла_авӑн_юпа_чӳк_раштав'.split('_'),
monthsShort : 'кӑр_нар_пуш_ака_май_ҫӗр_утӑ_ҫур_авн_юпа_чӳк_раш'.split('_'),
weekdays : 'вырсарникун_тунтикун_ытларикун_юнкун_кӗҫнерникун_эрнекун_шӑматкун'.split('_'),
weekdaysShort : 'выр_тун_ытл_юн_кӗҫ_эрн_шӑм'.split('_'),
weekdaysMin : 'вр_тн_ыт_юн_кҫ_эр_шм'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD-MM-YYYY',
LL : 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]',
LLL : 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm',
LLLL : 'dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm'
},
calendar : {
sameDay: '[Паян] LT [сехетре]',
nextDay: '[Ыран] LT [сехетре]',
lastDay: '[Ӗнер] LT [сехетре]',
nextWeek: '[Ҫитес] dddd LT [сехетре]',
lastWeek: '[Иртнӗ] dddd LT [сехетре]',
sameElse: 'L'
},
relativeTime : {
future : function (output) {
var affix = /сехет$/i.exec(output) ? 'рен' : /ҫул$/i.exec(output) ? 'тан' : 'ран';
return output + affix;
},
past : '%s каялла',
s : 'пӗр-ик ҫеккунт',
ss : '%d ҫеккунт',
m : 'пӗр минут',
mm : '%d минут',
h : 'пӗр сехет',
hh : '%d сехет',
d : 'пӗр кун',
dd : '%d кун',
M : 'пӗр уйӑх',
MM : '%d уйӑх',
y : 'пӗр ҫул',
yy : '%d ҫул'
},
dayOfMonthOrdinalParse: /\d{1,2}-мӗш/,
ordinal : '%d-мӗш',
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
return cv;
})));
/***/ }),
/* 207 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var cy = moment.defineLocale('cy', {
months: 'Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr'.split('_'),
monthsShort: 'Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag'.split('_'),
weekdays: 'Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn'.split('_'),
weekdaysShort: 'Sul_Llun_Maw_Mer_Iau_Gwe_Sad'.split('_'),
weekdaysMin: 'Su_Ll_Ma_Me_Ia_Gw_Sa'.split('_'),
weekdaysParseExact : true,
// time formats are the same as en-gb
longDateFormat: {
LT: 'HH:mm',
LTS : 'HH:mm:ss',
L: 'DD/MM/YYYY',
LL: 'D MMMM YYYY',
LLL: 'D MMMM YYYY HH:mm',
LLLL: 'dddd, D MMMM YYYY HH:mm'
},
calendar: {
sameDay: '[Heddiw am] LT',
nextDay: '[Yfory am] LT',
nextWeek: 'dddd [am] LT',
lastDay: '[Ddoe am] LT',
lastWeek: 'dddd [diwethaf am] LT',
sameElse: 'L'
},
relativeTime: {
future: 'mewn %s',
past: '%s yn ôl',
s: 'ychydig eiliadau',
ss: '%d eiliad',
m: 'munud',
mm: '%d munud',
h: 'awr',
hh: '%d awr',
d: 'diwrnod',
dd: '%d diwrnod',
M: 'mis',
MM: '%d mis',
y: 'blwyddyn',
yy: '%d flynedd'
},
dayOfMonthOrdinalParse: /\d{1,2}(fed|ain|af|il|ydd|ed|eg)/,
// traditional ordinal numbers above 31 are not commonly used in colloquial Welsh
ordinal: function (number) {
var b = number,
output = '',
lookup = [
'', 'af', 'il', 'ydd', 'ydd', 'ed', 'ed', 'ed', 'fed', 'fed', 'fed', // 1af to 10fed
'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'eg', 'fed', 'eg', 'fed' // 11eg to 20fed
];
if (b > 20) {
if (b === 40 || b === 50 || b === 60 || b === 80 || b === 100) {
output = 'fed'; // not 30ain, 70ain or 90ain
} else {
output = 'ain';
}
} else if (b > 0) {
output = lookup[b];
}
return number + output;
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return cy;
})));
/***/ }),
/* 208 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var da = moment.defineLocale('da', {
months : 'januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december'.split('_'),
monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'),
weekdays : 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'),
weekdaysShort : 'søn_man_tir_ons_tor_fre_lør'.split('_'),
weekdaysMin : 'sø_ma_ti_on_to_fr_lø'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D. MMMM YYYY',
LLL : 'D. MMMM YYYY HH:mm',
LLLL : 'dddd [d.] D. MMMM YYYY [kl.] HH:mm'
},
calendar : {
sameDay : '[i dag kl.] LT',
nextDay : '[i morgen kl.] LT',
nextWeek : 'på dddd [kl.] LT',
lastDay : '[i går kl.] LT',
lastWeek : '[i] dddd[s kl.] LT',
sameElse : 'L'
},
relativeTime : {
future : 'om %s',
past : '%s siden',
s : 'få sekunder',
ss : '%d sekunder',
m : 'et minut',
mm : '%d minutter',
h : 'en time',
hh : '%d timer',
d : 'en dag',
dd : '%d dage',
M : 'en måned',
MM : '%d måneder',
y : 'et år',
yy : '%d år'
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return da;
})));
/***/ }),
/* 209 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
function processRelativeTime(number, withoutSuffix, key, isFuture) {
var format = {
'm': ['eine Minute', 'einer Minute'],
'h': ['eine Stunde', 'einer Stunde'],
'd': ['ein Tag', 'einem Tag'],
'dd': [number + ' Tage', number + ' Tagen'],
'M': ['ein Monat', 'einem Monat'],
'MM': [number + ' Monate', number + ' Monaten'],
'y': ['ein Jahr', 'einem Jahr'],
'yy': [number + ' Jahre', number + ' Jahren']
};
return withoutSuffix ? format[key][0] : format[key][1];
}
var de = moment.defineLocale('de', {
months : 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'),
monthsShort : 'Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'),
monthsParseExact : true,
weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'),
weekdaysShort : 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'),
weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT: 'HH:mm',
LTS: 'HH:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D. MMMM YYYY',
LLL : 'D. MMMM YYYY HH:mm',
LLLL : 'dddd, D. MMMM YYYY HH:mm'
},
calendar : {
sameDay: '[heute um] LT [Uhr]',
sameElse: 'L',
nextDay: '[morgen um] LT [Uhr]',
nextWeek: 'dddd [um] LT [Uhr]',
lastDay: '[gestern um] LT [Uhr]',
lastWeek: '[letzten] dddd [um] LT [Uhr]'
},
relativeTime : {
future : 'in %s',
past : 'vor %s',
s : 'ein paar Sekunden',
ss : '%d Sekunden',
m : processRelativeTime,
mm : '%d Minuten',
h : processRelativeTime,
hh : '%d Stunden',
d : processRelativeTime,
dd : processRelativeTime,
M : processRelativeTime,
MM : processRelativeTime,
y : processRelativeTime,
yy : processRelativeTime
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return de;
})));
/***/ }),
/* 210 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
function processRelativeTime(number, withoutSuffix, key, isFuture) {
var format = {
'm': ['eine Minute', 'einer Minute'],
'h': ['eine Stunde', 'einer Stunde'],
'd': ['ein Tag', 'einem Tag'],
'dd': [number + ' Tage', number + ' Tagen'],
'M': ['ein Monat', 'einem Monat'],
'MM': [number + ' Monate', number + ' Monaten'],
'y': ['ein Jahr', 'einem Jahr'],
'yy': [number + ' Jahre', number + ' Jahren']
};
return withoutSuffix ? format[key][0] : format[key][1];
}
var deAt = moment.defineLocale('de-at', {
months : 'Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'),
monthsShort : 'Jän._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'),
monthsParseExact : true,
weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'),
weekdaysShort : 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'),
weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT: 'HH:mm',
LTS: 'HH:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D. MMMM YYYY',
LLL : 'D. MMMM YYYY HH:mm',
LLLL : 'dddd, D. MMMM YYYY HH:mm'
},
calendar : {
sameDay: '[heute um] LT [Uhr]',
sameElse: 'L',
nextDay: '[morgen um] LT [Uhr]',
nextWeek: 'dddd [um] LT [Uhr]',
lastDay: '[gestern um] LT [Uhr]',
lastWeek: '[letzten] dddd [um] LT [Uhr]'
},
relativeTime : {
future : 'in %s',
past : 'vor %s',
s : 'ein paar Sekunden',
ss : '%d Sekunden',
m : processRelativeTime,
mm : '%d Minuten',
h : processRelativeTime,
hh : '%d Stunden',
d : processRelativeTime,
dd : processRelativeTime,
M : processRelativeTime,
MM : processRelativeTime,
y : processRelativeTime,
yy : processRelativeTime
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return deAt;
})));
/***/ }),
/* 211 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
function processRelativeTime(number, withoutSuffix, key, isFuture) {
var format = {
'm': ['eine Minute', 'einer Minute'],
'h': ['eine Stunde', 'einer Stunde'],
'd': ['ein Tag', 'einem Tag'],
'dd': [number + ' Tage', number + ' Tagen'],
'M': ['ein Monat', 'einem Monat'],
'MM': [number + ' Monate', number + ' Monaten'],
'y': ['ein Jahr', 'einem Jahr'],
'yy': [number + ' Jahre', number + ' Jahren']
};
return withoutSuffix ? format[key][0] : format[key][1];
}
var deCh = moment.defineLocale('de-ch', {
months : 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'),
monthsShort : 'Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'),
monthsParseExact : true,
weekdays : 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split('_'),
weekdaysShort : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'),
weekdaysMin : 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT: 'HH:mm',
LTS: 'HH:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D. MMMM YYYY',
LLL : 'D. MMMM YYYY HH:mm',
LLLL : 'dddd, D. MMMM YYYY HH:mm'
},
calendar : {
sameDay: '[heute um] LT [Uhr]',
sameElse: 'L',
nextDay: '[morgen um] LT [Uhr]',
nextWeek: 'dddd [um] LT [Uhr]',
lastDay: '[gestern um] LT [Uhr]',
lastWeek: '[letzten] dddd [um] LT [Uhr]'
},
relativeTime : {
future : 'in %s',
past : 'vor %s',
s : 'ein paar Sekunden',
ss : '%d Sekunden',
m : processRelativeTime,
mm : '%d Minuten',
h : processRelativeTime,
hh : '%d Stunden',
d : processRelativeTime,
dd : processRelativeTime,
M : processRelativeTime,
MM : processRelativeTime,
y : processRelativeTime,
yy : processRelativeTime
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return deCh;
})));
/***/ }),
/* 212 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var months = [
'ޖެނުއަރީ',
'ފެބްރުއަރީ',
'މާރިޗު',
'އޭޕްރީލު',
'މޭ',
'ޖޫން',
'ޖުލައި',
'އޯގަސްޓު',
'ސެޕްޓެމްބަރު',
'އޮކްޓޯބަރު',
'ނޮވެމްބަރު',
'ޑިސެމްބަރު'
], weekdays = [
'އާދިއްތަ',
'ހޯމަ',
'އަންގާރަ',
'ބުދަ',
'ބުރާސްފަތި',
'ހުކުރު',
'ހޮނިހިރު'
];
var dv = moment.defineLocale('dv', {
months : months,
monthsShort : months,
weekdays : weekdays,
weekdaysShort : weekdays,
weekdaysMin : 'އާދި_ހޯމަ_އަން_ބުދަ_ބުރާ_ހުކު_ހޮނި'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'D/M/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd D MMMM YYYY HH:mm'
},
meridiemParse: /މކ|މފ/,
isPM : function (input) {
return 'މފ' === input;
},
meridiem : function (hour, minute, isLower) {
if (hour < 12) {
return 'މކ';
} else {
return 'މފ';
}
},
calendar : {
sameDay : '[މިއަދު] LT',
nextDay : '[މާދަމާ] LT',
nextWeek : 'dddd LT',
lastDay : '[އިއްޔެ] LT',
lastWeek : '[ފާއިތުވި] dddd LT',
sameElse : 'L'
},
relativeTime : {
future : 'ތެރޭގައި %s',
past : 'ކުރިން %s',
s : 'ސިކުންތުކޮޅެއް',
ss : 'd% ސިކުންތު',
m : 'މިނިޓެއް',
mm : 'މިނިޓު %d',
h : 'ގަޑިއިރެއް',
hh : 'ގަޑިއިރު %d',
d : 'ދުވަހެއް',
dd : 'ދުވަސް %d',
M : 'މަހެއް',
MM : 'މަސް %d',
y : 'އަހަރެއް',
yy : 'އަހަރު %d'
},
preparse: function (string) {
return string.replace(/،/g, ',');
},
postformat: function (string) {
return string.replace(/,/g, '،');
},
week : {
dow : 7, // Sunday is the first day of the week.
doy : 12 // The week that contains Jan 1st is the first week of the year.
}
});
return dv;
})));
/***/ }),
/* 213 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
function isFunction(input) {
return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]';
}
var el = moment.defineLocale('el', {
monthsNominativeEl : 'Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος'.split('_'),
monthsGenitiveEl : 'Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου'.split('_'),
months : function (momentToFormat, format) {
if (!momentToFormat) {
return this._monthsNominativeEl;
} else if (typeof format === 'string' && /D/.test(format.substring(0, format.indexOf('MMMM')))) { // if there is a day number before 'MMMM'
return this._monthsGenitiveEl[momentToFormat.month()];
} else {
return this._monthsNominativeEl[momentToFormat.month()];
}
},
monthsShort : 'Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ'.split('_'),
weekdays : 'Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο'.split('_'),
weekdaysShort : 'Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ'.split('_'),
weekdaysMin : 'Κυ_Δε_Τρ_Τε_Πε_Πα_Σα'.split('_'),
meridiem : function (hours, minutes, isLower) {
if (hours > 11) {
return isLower ? 'μμ' : 'ΜΜ';
} else {
return isLower ? 'πμ' : 'ΠΜ';
}
},
isPM : function (input) {
return ((input + '').toLowerCase()[0] === 'μ');
},
meridiemParse : /[ΠΜ]\.?Μ?\.?/i,
longDateFormat : {
LT : 'h:mm A',
LTS : 'h:mm:ss A',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY h:mm A',
LLLL : 'dddd, D MMMM YYYY h:mm A'
},
calendarEl : {
sameDay : '[Σήμερα {}] LT',
nextDay : '[Αύριο {}] LT',
nextWeek : 'dddd [{}] LT',
lastDay : '[Χθες {}] LT',
lastWeek : function () {
switch (this.day()) {
case 6:
return '[το προηγούμενο] dddd [{}] LT';
default:
return '[την προηγούμενη] dddd [{}] LT';
}
},
sameElse : 'L'
},
calendar : function (key, mom) {
var output = this._calendarEl[key],
hours = mom && mom.hours();
if (isFunction(output)) {
output = output.apply(mom);
}
return output.replace('{}', (hours % 12 === 1 ? 'στη' : 'στις'));
},
relativeTime : {
future : 'σε %s',
past : '%s πριν',
s : 'λίγα δευτερόλεπτα',
ss : '%d δευτερόλεπτα',
m : 'ένα λεπτό',
mm : '%d λεπτά',
h : 'μία ώρα',
hh : '%d ώρες',
d : 'μία μέρα',
dd : '%d μέρες',
M : 'ένας μήνας',
MM : '%d μήνες',
y : 'ένας χρόνος',
yy : '%d χρόνια'
},
dayOfMonthOrdinalParse: /\d{1,2}η/,
ordinal: '%dη',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4st is the first week of the year.
}
});
return el;
})));
/***/ }),
/* 214 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var enAu = moment.defineLocale('en-au', {
months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
longDateFormat : {
LT : 'h:mm A',
LTS : 'h:mm:ss A',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY h:mm A',
LLLL : 'dddd, D MMMM YYYY h:mm A'
},
calendar : {
sameDay : '[Today at] LT',
nextDay : '[Tomorrow at] LT',
nextWeek : 'dddd [at] LT',
lastDay : '[Yesterday at] LT',
lastWeek : '[Last] dddd [at] LT',
sameElse : 'L'
},
relativeTime : {
future : 'in %s',
past : '%s ago',
s : 'a few seconds',
ss : '%d seconds',
m : 'a minute',
mm : '%d minutes',
h : 'an hour',
hh : '%d hours',
d : 'a day',
dd : '%d days',
M : 'a month',
MM : '%d months',
y : 'a year',
yy : '%d years'
},
dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
ordinal : function (number) {
var b = number % 10,
output = (~~(number % 100 / 10) === 1) ? 'th' :
(b === 1) ? 'st' :
(b === 2) ? 'nd' :
(b === 3) ? 'rd' : 'th';
return number + output;
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return enAu;
})));
/***/ }),
/* 215 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var enCa = moment.defineLocale('en-ca', {
months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
longDateFormat : {
LT : 'h:mm A',
LTS : 'h:mm:ss A',
L : 'YYYY-MM-DD',
LL : 'MMMM D, YYYY',
LLL : 'MMMM D, YYYY h:mm A',
LLLL : 'dddd, MMMM D, YYYY h:mm A'
},
calendar : {
sameDay : '[Today at] LT',
nextDay : '[Tomorrow at] LT',
nextWeek : 'dddd [at] LT',
lastDay : '[Yesterday at] LT',
lastWeek : '[Last] dddd [at] LT',
sameElse : 'L'
},
relativeTime : {
future : 'in %s',
past : '%s ago',
s : 'a few seconds',
ss : '%d seconds',
m : 'a minute',
mm : '%d minutes',
h : 'an hour',
hh : '%d hours',
d : 'a day',
dd : '%d days',
M : 'a month',
MM : '%d months',
y : 'a year',
yy : '%d years'
},
dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
ordinal : function (number) {
var b = number % 10,
output = (~~(number % 100 / 10) === 1) ? 'th' :
(b === 1) ? 'st' :
(b === 2) ? 'nd' :
(b === 3) ? 'rd' : 'th';
return number + output;
}
});
return enCa;
})));
/***/ }),
/* 216 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var enGb = moment.defineLocale('en-gb', {
months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd, D MMMM YYYY HH:mm'
},
calendar : {
sameDay : '[Today at] LT',
nextDay : '[Tomorrow at] LT',
nextWeek : 'dddd [at] LT',
lastDay : '[Yesterday at] LT',
lastWeek : '[Last] dddd [at] LT',
sameElse : 'L'
},
relativeTime : {
future : 'in %s',
past : '%s ago',
s : 'a few seconds',
ss : '%d seconds',
m : 'a minute',
mm : '%d minutes',
h : 'an hour',
hh : '%d hours',
d : 'a day',
dd : '%d days',
M : 'a month',
MM : '%d months',
y : 'a year',
yy : '%d years'
},
dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
ordinal : function (number) {
var b = number % 10,
output = (~~(number % 100 / 10) === 1) ? 'th' :
(b === 1) ? 'st' :
(b === 2) ? 'nd' :
(b === 3) ? 'rd' : 'th';
return number + output;
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return enGb;
})));
/***/ }),
/* 217 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var enIe = moment.defineLocale('en-ie', {
months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD-MM-YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd D MMMM YYYY HH:mm'
},
calendar : {
sameDay : '[Today at] LT',
nextDay : '[Tomorrow at] LT',
nextWeek : 'dddd [at] LT',
lastDay : '[Yesterday at] LT',
lastWeek : '[Last] dddd [at] LT',
sameElse : 'L'
},
relativeTime : {
future : 'in %s',
past : '%s ago',
s : 'a few seconds',
ss : '%d seconds',
m : 'a minute',
mm : '%d minutes',
h : 'an hour',
hh : '%d hours',
d : 'a day',
dd : '%d days',
M : 'a month',
MM : '%d months',
y : 'a year',
yy : '%d years'
},
dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
ordinal : function (number) {
var b = number % 10,
output = (~~(number % 100 / 10) === 1) ? 'th' :
(b === 1) ? 'st' :
(b === 2) ? 'nd' :
(b === 3) ? 'rd' : 'th';
return number + output;
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return enIe;
})));
/***/ }),
/* 218 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var enIl = moment.defineLocale('en-il', {
months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd, D MMMM YYYY HH:mm'
},
calendar : {
sameDay : '[Today at] LT',
nextDay : '[Tomorrow at] LT',
nextWeek : 'dddd [at] LT',
lastDay : '[Yesterday at] LT',
lastWeek : '[Last] dddd [at] LT',
sameElse : 'L'
},
relativeTime : {
future : 'in %s',
past : '%s ago',
s : 'a few seconds',
m : 'a minute',
mm : '%d minutes',
h : 'an hour',
hh : '%d hours',
d : 'a day',
dd : '%d days',
M : 'a month',
MM : '%d months',
y : 'a year',
yy : '%d years'
},
dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
ordinal : function (number) {
var b = number % 10,
output = (~~(number % 100 / 10) === 1) ? 'th' :
(b === 1) ? 'st' :
(b === 2) ? 'nd' :
(b === 3) ? 'rd' : 'th';
return number + output;
}
});
return enIl;
})));
/***/ }),
/* 219 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var enNz = moment.defineLocale('en-nz', {
months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
longDateFormat : {
LT : 'h:mm A',
LTS : 'h:mm:ss A',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY h:mm A',
LLLL : 'dddd, D MMMM YYYY h:mm A'
},
calendar : {
sameDay : '[Today at] LT',
nextDay : '[Tomorrow at] LT',
nextWeek : 'dddd [at] LT',
lastDay : '[Yesterday at] LT',
lastWeek : '[Last] dddd [at] LT',
sameElse : 'L'
},
relativeTime : {
future : 'in %s',
past : '%s ago',
s : 'a few seconds',
ss : '%d seconds',
m : 'a minute',
mm : '%d minutes',
h : 'an hour',
hh : '%d hours',
d : 'a day',
dd : '%d days',
M : 'a month',
MM : '%d months',
y : 'a year',
yy : '%d years'
},
dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
ordinal : function (number) {
var b = number % 10,
output = (~~(number % 100 / 10) === 1) ? 'th' :
(b === 1) ? 'st' :
(b === 2) ? 'nd' :
(b === 3) ? 'rd' : 'th';
return number + output;
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return enNz;
})));
/***/ }),
/* 220 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var eo = moment.defineLocale('eo', {
months : 'januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro'.split('_'),
monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aŭg_sep_okt_nov_dec'.split('_'),
weekdays : 'dimanĉo_lundo_mardo_merkredo_ĵaŭdo_vendredo_sabato'.split('_'),
weekdaysShort : 'dim_lun_mard_merk_ĵaŭ_ven_sab'.split('_'),
weekdaysMin : 'di_lu_ma_me_ĵa_ve_sa'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'YYYY-MM-DD',
LL : 'D[-a de] MMMM, YYYY',
LLL : 'D[-a de] MMMM, YYYY HH:mm',
LLLL : 'dddd, [la] D[-a de] MMMM, YYYY HH:mm'
},
meridiemParse: /[ap]\.t\.m/i,
isPM: function (input) {
return input.charAt(0).toLowerCase() === 'p';
},
meridiem : function (hours, minutes, isLower) {
if (hours > 11) {
return isLower ? 'p.t.m.' : 'P.T.M.';
} else {
return isLower ? 'a.t.m.' : 'A.T.M.';
}
},
calendar : {
sameDay : '[Hodiaŭ je] LT',
nextDay : '[Morgaŭ je] LT',
nextWeek : 'dddd [je] LT',
lastDay : '[Hieraŭ je] LT',
lastWeek : '[pasinta] dddd [je] LT',
sameElse : 'L'
},
relativeTime : {
future : 'post %s',
past : 'antaŭ %s',
s : 'sekundoj',
ss : '%d sekundoj',
m : 'minuto',
mm : '%d minutoj',
h : 'horo',
hh : '%d horoj',
d : 'tago',//ne 'diurno', ĉar estas uzita por proksimumo
dd : '%d tagoj',
M : 'monato',
MM : '%d monatoj',
y : 'jaro',
yy : '%d jaroj'
},
dayOfMonthOrdinalParse: /\d{1,2}a/,
ordinal : '%da',
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
return eo;
})));
/***/ }),
/* 221 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var monthsShortDot = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split('_'),
monthsShort = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_');
var monthsParse = [/^ene/i, /^feb/i, /^mar/i, /^abr/i, /^may/i, /^jun/i, /^jul/i, /^ago/i, /^sep/i, /^oct/i, /^nov/i, /^dic/i];
var monthsRegex = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;
var es = moment.defineLocale('es', {
months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'),
monthsShort : function (m, format) {
if (!m) {
return monthsShortDot;
} else if (/-MMM-/.test(format)) {
return monthsShort[m.month()];
} else {
return monthsShortDot[m.month()];
}
},
monthsRegex : monthsRegex,
monthsShortRegex : monthsRegex,
monthsStrictRegex : /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,
monthsShortStrictRegex : /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,
monthsParse : monthsParse,
longMonthsParse : monthsParse,
shortMonthsParse : monthsParse,
weekdays : 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'),
weekdaysShort : 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'),
weekdaysMin : 'do_lu_ma_mi_ju_vi_sá'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'H:mm',
LTS : 'H:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D [de] MMMM [de] YYYY',
LLL : 'D [de] MMMM [de] YYYY H:mm',
LLLL : 'dddd, D [de] MMMM [de] YYYY H:mm'
},
calendar : {
sameDay : function () {
return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
},
nextDay : function () {
return '[mañana a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
},
nextWeek : function () {
return 'dddd [a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
},
lastDay : function () {
return '[ayer a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
},
lastWeek : function () {
return '[el] dddd [pasado a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
},
sameElse : 'L'
},
relativeTime : {
future : 'en %s',
past : 'hace %s',
s : 'unos segundos',
ss : '%d segundos',
m : 'un minuto',
mm : '%d minutos',
h : 'una hora',
hh : '%d horas',
d : 'un día',
dd : '%d días',
M : 'un mes',
MM : '%d meses',
y : 'un año',
yy : '%d años'
},
dayOfMonthOrdinalParse : /\d{1,2}º/,
ordinal : '%dº',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return es;
})));
/***/ }),
/* 222 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var monthsShortDot = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split('_'),
monthsShort = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_');
var monthsParse = [/^ene/i, /^feb/i, /^mar/i, /^abr/i, /^may/i, /^jun/i, /^jul/i, /^ago/i, /^sep/i, /^oct/i, /^nov/i, /^dic/i];
var monthsRegex = /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;
var esDo = moment.defineLocale('es-do', {
months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'),
monthsShort : function (m, format) {
if (!m) {
return monthsShortDot;
} else if (/-MMM-/.test(format)) {
return monthsShort[m.month()];
} else {
return monthsShortDot[m.month()];
}
},
monthsRegex: monthsRegex,
monthsShortRegex: monthsRegex,
monthsStrictRegex: /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,
monthsShortStrictRegex: /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,
monthsParse: monthsParse,
longMonthsParse: monthsParse,
shortMonthsParse: monthsParse,
weekdays : 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'),
weekdaysShort : 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'),
weekdaysMin : 'do_lu_ma_mi_ju_vi_sá'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'h:mm A',
LTS : 'h:mm:ss A',
L : 'DD/MM/YYYY',
LL : 'D [de] MMMM [de] YYYY',
LLL : 'D [de] MMMM [de] YYYY h:mm A',
LLLL : 'dddd, D [de] MMMM [de] YYYY h:mm A'
},
calendar : {
sameDay : function () {
return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
},
nextDay : function () {
return '[mañana a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
},
nextWeek : function () {
return 'dddd [a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
},
lastDay : function () {
return '[ayer a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
},
lastWeek : function () {
return '[el] dddd [pasado a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
},
sameElse : 'L'
},
relativeTime : {
future : 'en %s',
past : 'hace %s',
s : 'unos segundos',
ss : '%d segundos',
m : 'un minuto',
mm : '%d minutos',
h : 'una hora',
hh : '%d horas',
d : 'un día',
dd : '%d días',
M : 'un mes',
MM : '%d meses',
y : 'un año',
yy : '%d años'
},
dayOfMonthOrdinalParse : /\d{1,2}º/,
ordinal : '%dº',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return esDo;
})));
/***/ }),
/* 223 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var monthsShortDot = 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split('_'),
monthsShort = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_');
var esUs = moment.defineLocale('es-us', {
months : 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'),
monthsShort : function (m, format) {
if (!m) {
return monthsShortDot;
} else if (/-MMM-/.test(format)) {
return monthsShort[m.month()];
} else {
return monthsShortDot[m.month()];
}
},
monthsParseExact : true,
weekdays : 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'),
weekdaysShort : 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'),
weekdaysMin : 'do_lu_ma_mi_ju_vi_sá'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'h:mm A',
LTS : 'h:mm:ss A',
L : 'MM/DD/YYYY',
LL : 'MMMM [de] D [de] YYYY',
LLL : 'MMMM [de] D [de] YYYY h:mm A',
LLLL : 'dddd, MMMM [de] D [de] YYYY h:mm A'
},
calendar : {
sameDay : function () {
return '[hoy a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
},
nextDay : function () {
return '[mañana a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
},
nextWeek : function () {
return 'dddd [a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
},
lastDay : function () {
return '[ayer a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
},
lastWeek : function () {
return '[el] dddd [pasado a la' + ((this.hours() !== 1) ? 's' : '') + '] LT';
},
sameElse : 'L'
},
relativeTime : {
future : 'en %s',
past : 'hace %s',
s : 'unos segundos',
ss : '%d segundos',
m : 'un minuto',
mm : '%d minutos',
h : 'una hora',
hh : '%d horas',
d : 'un día',
dd : '%d días',
M : 'un mes',
MM : '%d meses',
y : 'un año',
yy : '%d años'
},
dayOfMonthOrdinalParse : /\d{1,2}º/,
ordinal : '%dº',
week : {
dow : 0, // Sunday is the first day of the week.
doy : 6 // The week that contains Jan 1st is the first week of the year.
}
});
return esUs;
})));
/***/ }),
/* 224 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
function processRelativeTime(number, withoutSuffix, key, isFuture) {
var format = {
's' : ['mõne sekundi', 'mõni sekund', 'paar sekundit'],
'ss': [number + 'sekundi', number + 'sekundit'],
'm' : ['ühe minuti', 'üks minut'],
'mm': [number + ' minuti', number + ' minutit'],
'h' : ['ühe tunni', 'tund aega', 'üks tund'],
'hh': [number + ' tunni', number + ' tundi'],
'd' : ['ühe päeva', 'üks päev'],
'M' : ['kuu aja', 'kuu aega', 'üks kuu'],
'MM': [number + ' kuu', number + ' kuud'],
'y' : ['ühe aasta', 'aasta', 'üks aasta'],
'yy': [number + ' aasta', number + ' aastat']
};
if (withoutSuffix) {
return format[key][2] ? format[key][2] : format[key][1];
}
return isFuture ? format[key][0] : format[key][1];
}
var et = moment.defineLocale('et', {
months : 'jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember'.split('_'),
monthsShort : 'jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets'.split('_'),
weekdays : 'pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev'.split('_'),
weekdaysShort : 'P_E_T_K_N_R_L'.split('_'),
weekdaysMin : 'P_E_T_K_N_R_L'.split('_'),
longDateFormat : {
LT : 'H:mm',
LTS : 'H:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D. MMMM YYYY',
LLL : 'D. MMMM YYYY H:mm',
LLLL : 'dddd, D. MMMM YYYY H:mm'
},
calendar : {
sameDay : '[Täna,] LT',
nextDay : '[Homme,] LT',
nextWeek : '[Järgmine] dddd LT',
lastDay : '[Eile,] LT',
lastWeek : '[Eelmine] dddd LT',
sameElse : 'L'
},
relativeTime : {
future : '%s pärast',
past : '%s tagasi',
s : processRelativeTime,
ss : processRelativeTime,
m : processRelativeTime,
mm : processRelativeTime,
h : processRelativeTime,
hh : processRelativeTime,
d : processRelativeTime,
dd : '%d päeva',
M : processRelativeTime,
MM : processRelativeTime,
y : processRelativeTime,
yy : processRelativeTime
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return et;
})));
/***/ }),
/* 225 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var eu = moment.defineLocale('eu', {
months : 'urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua'.split('_'),
monthsShort : 'urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.'.split('_'),
monthsParseExact : true,
weekdays : 'igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata'.split('_'),
weekdaysShort : 'ig._al._ar._az._og._ol._lr.'.split('_'),
weekdaysMin : 'ig_al_ar_az_og_ol_lr'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'YYYY-MM-DD',
LL : 'YYYY[ko] MMMM[ren] D[a]',
LLL : 'YYYY[ko] MMMM[ren] D[a] HH:mm',
LLLL : 'dddd, YYYY[ko] MMMM[ren] D[a] HH:mm',
l : 'YYYY-M-D',
ll : 'YYYY[ko] MMM D[a]',
lll : 'YYYY[ko] MMM D[a] HH:mm',
llll : 'ddd, YYYY[ko] MMM D[a] HH:mm'
},
calendar : {
sameDay : '[gaur] LT[etan]',
nextDay : '[bihar] LT[etan]',
nextWeek : 'dddd LT[etan]',
lastDay : '[atzo] LT[etan]',
lastWeek : '[aurreko] dddd LT[etan]',
sameElse : 'L'
},
relativeTime : {
future : '%s barru',
past : 'duela %s',
s : 'segundo batzuk',
ss : '%d segundo',
m : 'minutu bat',
mm : '%d minutu',
h : 'ordu bat',
hh : '%d ordu',
d : 'egun bat',
dd : '%d egun',
M : 'hilabete bat',
MM : '%d hilabete',
y : 'urte bat',
yy : '%d urte'
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
return eu;
})));
/***/ }),
/* 226 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var symbolMap = {
'1': '۱',
'2': '۲',
'3': '۳',
'4': '۴',
'5': '۵',
'6': '۶',
'7': '۷',
'8': '۸',
'9': '۹',
'0': '۰'
}, numberMap = {
'۱': '1',
'۲': '2',
'۳': '3',
'۴': '4',
'۵': '5',
'۶': '6',
'۷': '7',
'۸': '8',
'۹': '9',
'۰': '0'
};
var fa = moment.defineLocale('fa', {
months : 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'),
monthsShort : 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split('_'),
weekdays : 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split('_'),
weekdaysShort : 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split('_'),
weekdaysMin : 'ی_د_س_چ_پ_ج_ش'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd, D MMMM YYYY HH:mm'
},
meridiemParse: /قبل از ظهر|بعد از ظهر/,
isPM: function (input) {
return /بعد از ظهر/.test(input);
},
meridiem : function (hour, minute, isLower) {
if (hour < 12) {
return 'قبل از ظهر';
} else {
return 'بعد از ظهر';
}
},
calendar : {
sameDay : '[امروز ساعت] LT',
nextDay : '[فردا ساعت] LT',
nextWeek : 'dddd [ساعت] LT',
lastDay : '[دیروز ساعت] LT',
lastWeek : 'dddd [پیش] [ساعت] LT',
sameElse : 'L'
},
relativeTime : {
future : 'در %s',
past : '%s پیش',
s : 'چند ثانیه',
ss : 'ثانیه d%',
m : 'یک دقیقه',
mm : '%d دقیقه',
h : 'یک ساعت',
hh : '%d ساعت',
d : 'یک روز',
dd : '%d روز',
M : 'یک ماه',
MM : '%d ماه',
y : 'یک سال',
yy : '%d سال'
},
preparse: function (string) {
return string.replace(/[۰-۹]/g, function (match) {
return numberMap[match];
}).replace(/،/g, ',');
},
postformat: function (string) {
return string.replace(/\d/g, function (match) {
return symbolMap[match];
}).replace(/,/g, '،');
},
dayOfMonthOrdinalParse: /\d{1,2}م/,
ordinal : '%dم',
week : {
dow : 6, // Saturday is the first day of the week.
doy : 12 // The week that contains Jan 1st is the first week of the year.
}
});
return fa;
})));
/***/ }),
/* 227 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var numbersPast = 'nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän'.split(' '),
numbersFuture = [
'nolla', 'yhden', 'kahden', 'kolmen', 'neljän', 'viiden', 'kuuden',
numbersPast[7], numbersPast[8], numbersPast[9]
];
function translate(number, withoutSuffix, key, isFuture) {
var result = '';
switch (key) {
case 's':
return isFuture ? 'muutaman sekunnin' : 'muutama sekunti';
case 'ss':
return isFuture ? 'sekunnin' : 'sekuntia';
case 'm':
return isFuture ? 'minuutin' : 'minuutti';
case 'mm':
result = isFuture ? 'minuutin' : 'minuuttia';
break;
case 'h':
return isFuture ? 'tunnin' : 'tunti';
case 'hh':
result = isFuture ? 'tunnin' : 'tuntia';
break;
case 'd':
return isFuture ? 'päivän' : 'päivä';
case 'dd':
result = isFuture ? 'päivän' : 'päivää';
break;
case 'M':
return isFuture ? 'kuukauden' : 'kuukausi';
case 'MM':
result = isFuture ? 'kuukauden' : 'kuukautta';
break;
case 'y':
return isFuture ? 'vuoden' : 'vuosi';
case 'yy':
result = isFuture ? 'vuoden' : 'vuotta';
break;
}
result = verbalNumber(number, isFuture) + ' ' + result;
return result;
}
function verbalNumber(number, isFuture) {
return number < 10 ? (isFuture ? numbersFuture[number] : numbersPast[number]) : number;
}
var fi = moment.defineLocale('fi', {
months : 'tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu'.split('_'),
monthsShort : 'tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu'.split('_'),
weekdays : 'sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai'.split('_'),
weekdaysShort : 'su_ma_ti_ke_to_pe_la'.split('_'),
weekdaysMin : 'su_ma_ti_ke_to_pe_la'.split('_'),
longDateFormat : {
LT : 'HH.mm',
LTS : 'HH.mm.ss',
L : 'DD.MM.YYYY',
LL : 'Do MMMM[ta] YYYY',
LLL : 'Do MMMM[ta] YYYY, [klo] HH.mm',
LLLL : 'dddd, Do MMMM[ta] YYYY, [klo] HH.mm',
l : 'D.M.YYYY',
ll : 'Do MMM YYYY',
lll : 'Do MMM YYYY, [klo] HH.mm',
llll : 'ddd, Do MMM YYYY, [klo] HH.mm'
},
calendar : {
sameDay : '[tänään] [klo] LT',
nextDay : '[huomenna] [klo] LT',
nextWeek : 'dddd [klo] LT',
lastDay : '[eilen] [klo] LT',
lastWeek : '[viime] dddd[na] [klo] LT',
sameElse : 'L'
},
relativeTime : {
future : '%s päästä',
past : '%s sitten',
s : translate,
ss : translate,
m : translate,
mm : translate,
h : translate,
hh : translate,
d : translate,
dd : translate,
M : translate,
MM : translate,
y : translate,
yy : translate
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return fi;
})));
/***/ }),
/* 228 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var fo = moment.defineLocale('fo', {
months : 'januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember'.split('_'),
monthsShort : 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'),
weekdays : 'sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur'.split('_'),
weekdaysShort : 'sun_mán_týs_mik_hós_frí_ley'.split('_'),
weekdaysMin : 'su_má_tý_mi_hó_fr_le'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd D. MMMM, YYYY HH:mm'
},
calendar : {
sameDay : '[Í dag kl.] LT',
nextDay : '[Í morgin kl.] LT',
nextWeek : 'dddd [kl.] LT',
lastDay : '[Í gjár kl.] LT',
lastWeek : '[síðstu] dddd [kl] LT',
sameElse : 'L'
},
relativeTime : {
future : 'um %s',
past : '%s síðani',
s : 'fá sekund',
ss : '%d sekundir',
m : 'ein minutt',
mm : '%d minuttir',
h : 'ein tími',
hh : '%d tímar',
d : 'ein dagur',
dd : '%d dagar',
M : 'ein mánaði',
MM : '%d mánaðir',
y : 'eitt ár',
yy : '%d ár'
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return fo;
})));
/***/ }),
/* 229 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var fr = moment.defineLocale('fr', {
months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'),
monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'),
monthsParseExact : true,
weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'),
weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'),
weekdaysMin : 'di_lu_ma_me_je_ve_sa'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd D MMMM YYYY HH:mm'
},
calendar : {
sameDay : '[Aujourd’hui à] LT',
nextDay : '[Demain à] LT',
nextWeek : 'dddd [à] LT',
lastDay : '[Hier à] LT',
lastWeek : 'dddd [dernier à] LT',
sameElse : 'L'
},
relativeTime : {
future : 'dans %s',
past : 'il y a %s',
s : 'quelques secondes',
ss : '%d secondes',
m : 'une minute',
mm : '%d minutes',
h : 'une heure',
hh : '%d heures',
d : 'un jour',
dd : '%d jours',
M : 'un mois',
MM : '%d mois',
y : 'un an',
yy : '%d ans'
},
dayOfMonthOrdinalParse: /\d{1,2}(er|)/,
ordinal : function (number, period) {
switch (period) {
// TODO: Return 'e' when day of month > 1. Move this case inside
// block for masculine words below.
// See https://github.com/moment/moment/issues/3375
case 'D':
return number + (number === 1 ? 'er' : '');
// Words with masculine grammatical gender: mois, trimestre, jour
default:
case 'M':
case 'Q':
case 'DDD':
case 'd':
return number + (number === 1 ? 'er' : 'e');
// Words with feminine grammatical gender: semaine
case 'w':
case 'W':
return number + (number === 1 ? 're' : 'e');
}
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return fr;
})));
/***/ }),
/* 230 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var frCa = moment.defineLocale('fr-ca', {
months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'),
monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'),
monthsParseExact : true,
weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'),
weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'),
weekdaysMin : 'di_lu_ma_me_je_ve_sa'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'YYYY-MM-DD',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd D MMMM YYYY HH:mm'
},
calendar : {
sameDay : '[Aujourd’hui à] LT',
nextDay : '[Demain à] LT',
nextWeek : 'dddd [à] LT',
lastDay : '[Hier à] LT',
lastWeek : 'dddd [dernier à] LT',
sameElse : 'L'
},
relativeTime : {
future : 'dans %s',
past : 'il y a %s',
s : 'quelques secondes',
ss : '%d secondes',
m : 'une minute',
mm : '%d minutes',
h : 'une heure',
hh : '%d heures',
d : 'un jour',
dd : '%d jours',
M : 'un mois',
MM : '%d mois',
y : 'un an',
yy : '%d ans'
},
dayOfMonthOrdinalParse: /\d{1,2}(er|e)/,
ordinal : function (number, period) {
switch (period) {
// Words with masculine grammatical gender: mois, trimestre, jour
default:
case 'M':
case 'Q':
case 'D':
case 'DDD':
case 'd':
return number + (number === 1 ? 'er' : 'e');
// Words with feminine grammatical gender: semaine
case 'w':
case 'W':
return number + (number === 1 ? 're' : 'e');
}
}
});
return frCa;
})));
/***/ }),
/* 231 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var frCh = moment.defineLocale('fr-ch', {
months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'),
monthsShort : 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'),
monthsParseExact : true,
weekdays : 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'),
weekdaysShort : 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'),
weekdaysMin : 'di_lu_ma_me_je_ve_sa'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd D MMMM YYYY HH:mm'
},
calendar : {
sameDay : '[Aujourd’hui à] LT',
nextDay : '[Demain à] LT',
nextWeek : 'dddd [à] LT',
lastDay : '[Hier à] LT',
lastWeek : 'dddd [dernier à] LT',
sameElse : 'L'
},
relativeTime : {
future : 'dans %s',
past : 'il y a %s',
s : 'quelques secondes',
ss : '%d secondes',
m : 'une minute',
mm : '%d minutes',
h : 'une heure',
hh : '%d heures',
d : 'un jour',
dd : '%d jours',
M : 'un mois',
MM : '%d mois',
y : 'un an',
yy : '%d ans'
},
dayOfMonthOrdinalParse: /\d{1,2}(er|e)/,
ordinal : function (number, period) {
switch (period) {
// Words with masculine grammatical gender: mois, trimestre, jour
default:
case 'M':
case 'Q':
case 'D':
case 'DDD':
case 'd':
return number + (number === 1 ? 'er' : 'e');
// Words with feminine grammatical gender: semaine
case 'w':
case 'W':
return number + (number === 1 ? 're' : 'e');
}
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return frCh;
})));
/***/ }),
/* 232 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var monthsShortWithDots = 'jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.'.split('_'),
monthsShortWithoutDots = 'jan_feb_mrt_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_');
var fy = moment.defineLocale('fy', {
months : 'jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber'.split('_'),
monthsShort : function (m, format) {
if (!m) {
return monthsShortWithDots;
} else if (/-MMM-/.test(format)) {
return monthsShortWithoutDots[m.month()];
} else {
return monthsShortWithDots[m.month()];
}
},
monthsParseExact : true,
weekdays : 'snein_moandei_tiisdei_woansdei_tongersdei_freed_sneon'.split('_'),
weekdaysShort : 'si._mo._ti._wo._to._fr._so.'.split('_'),
weekdaysMin : 'Si_Mo_Ti_Wo_To_Fr_So'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD-MM-YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd D MMMM YYYY HH:mm'
},
calendar : {
sameDay: '[hjoed om] LT',
nextDay: '[moarn om] LT',
nextWeek: 'dddd [om] LT',
lastDay: '[juster om] LT',
lastWeek: '[ôfrûne] dddd [om] LT',
sameElse: 'L'
},
relativeTime : {
future : 'oer %s',
past : '%s lyn',
s : 'in pear sekonden',
ss : '%d sekonden',
m : 'ien minút',
mm : '%d minuten',
h : 'ien oere',
hh : '%d oeren',
d : 'ien dei',
dd : '%d dagen',
M : 'ien moanne',
MM : '%d moannen',
y : 'ien jier',
yy : '%d jierren'
},
dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/,
ordinal : function (number) {
return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de');
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return fy;
})));
/***/ }),
/* 233 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var months = [
'Am Faoilleach', 'An Gearran', 'Am Màrt', 'An Giblean', 'An Cèitean', 'An t-Ògmhios', 'An t-Iuchar', 'An Lùnastal', 'An t-Sultain', 'An Dàmhair', 'An t-Samhain', 'An Dùbhlachd'
];
var monthsShort = ['Faoi', 'Gear', 'Màrt', 'Gibl', 'Cèit', 'Ògmh', 'Iuch', 'Lùn', 'Sult', 'Dàmh', 'Samh', 'Dùbh'];
var weekdays = ['Didòmhnaich', 'Diluain', 'Dimàirt', 'Diciadain', 'Diardaoin', 'Dihaoine', 'Disathairne'];
var weekdaysShort = ['Did', 'Dil', 'Dim', 'Dic', 'Dia', 'Dih', 'Dis'];
var weekdaysMin = ['Dò', 'Lu', 'Mà', 'Ci', 'Ar', 'Ha', 'Sa'];
var gd = moment.defineLocale('gd', {
months : months,
monthsShort : monthsShort,
monthsParseExact : true,
weekdays : weekdays,
weekdaysShort : weekdaysShort,
weekdaysMin : weekdaysMin,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd, D MMMM YYYY HH:mm'
},
calendar : {
sameDay : '[An-diugh aig] LT',
nextDay : '[A-màireach aig] LT',
nextWeek : 'dddd [aig] LT',
lastDay : '[An-dè aig] LT',
lastWeek : 'dddd [seo chaidh] [aig] LT',
sameElse : 'L'
},
relativeTime : {
future : 'ann an %s',
past : 'bho chionn %s',
s : 'beagan diogan',
ss : '%d diogan',
m : 'mionaid',
mm : '%d mionaidean',
h : 'uair',
hh : '%d uairean',
d : 'latha',
dd : '%d latha',
M : 'mìos',
MM : '%d mìosan',
y : 'bliadhna',
yy : '%d bliadhna'
},
dayOfMonthOrdinalParse : /\d{1,2}(d|na|mh)/,
ordinal : function (number) {
var output = number === 1 ? 'd' : number % 10 === 2 ? 'na' : 'mh';
return number + output;
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return gd;
})));
/***/ }),
/* 234 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var gl = moment.defineLocale('gl', {
months : 'xaneiro_febreiro_marzo_abril_maio_xuño_xullo_agosto_setembro_outubro_novembro_decembro'.split('_'),
monthsShort : 'xan._feb._mar._abr._mai._xuñ._xul._ago._set._out._nov._dec.'.split('_'),
monthsParseExact: true,
weekdays : 'domingo_luns_martes_mércores_xoves_venres_sábado'.split('_'),
weekdaysShort : 'dom._lun._mar._mér._xov._ven._sáb.'.split('_'),
weekdaysMin : 'do_lu_ma_mé_xo_ve_sá'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'H:mm',
LTS : 'H:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D [de] MMMM [de] YYYY',
LLL : 'D [de] MMMM [de] YYYY H:mm',
LLLL : 'dddd, D [de] MMMM [de] YYYY H:mm'
},
calendar : {
sameDay : function () {
return '[hoxe ' + ((this.hours() !== 1) ? 'ás' : 'á') + '] LT';
},
nextDay : function () {
return '[mañá ' + ((this.hours() !== 1) ? 'ás' : 'á') + '] LT';
},
nextWeek : function () {
return 'dddd [' + ((this.hours() !== 1) ? 'ás' : 'a') + '] LT';
},
lastDay : function () {
return '[onte ' + ((this.hours() !== 1) ? 'á' : 'a') + '] LT';
},
lastWeek : function () {
return '[o] dddd [pasado ' + ((this.hours() !== 1) ? 'ás' : 'a') + '] LT';
},
sameElse : 'L'
},
relativeTime : {
future : function (str) {
if (str.indexOf('un') === 0) {
return 'n' + str;
}
return 'en ' + str;
},
past : 'hai %s',
s : 'uns segundos',
ss : '%d segundos',
m : 'un minuto',
mm : '%d minutos',
h : 'unha hora',
hh : '%d horas',
d : 'un día',
dd : '%d días',
M : 'un mes',
MM : '%d meses',
y : 'un ano',
yy : '%d anos'
},
dayOfMonthOrdinalParse : /\d{1,2}º/,
ordinal : '%dº',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return gl;
})));
/***/ }),
/* 235 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
function processRelativeTime(number, withoutSuffix, key, isFuture) {
var format = {
's': ['thodde secondanim', 'thodde second'],
'ss': [number + ' secondanim', number + ' second'],
'm': ['eka mintan', 'ek minute'],
'mm': [number + ' mintanim', number + ' mintam'],
'h': ['eka horan', 'ek hor'],
'hh': [number + ' horanim', number + ' horam'],
'd': ['eka disan', 'ek dis'],
'dd': [number + ' disanim', number + ' dis'],
'M': ['eka mhoinean', 'ek mhoino'],
'MM': [number + ' mhoineanim', number + ' mhoine'],
'y': ['eka vorsan', 'ek voros'],
'yy': [number + ' vorsanim', number + ' vorsam']
};
return withoutSuffix ? format[key][0] : format[key][1];
}
var gomLatn = moment.defineLocale('gom-latn', {
months : 'Janer_Febrer_Mars_Abril_Mai_Jun_Julai_Agost_Setembr_Otubr_Novembr_Dezembr'.split('_'),
monthsShort : 'Jan._Feb._Mars_Abr._Mai_Jun_Jul._Ago._Set._Otu._Nov._Dez.'.split('_'),
monthsParseExact : true,
weekdays : 'Aitar_Somar_Mongllar_Budvar_Brestar_Sukrar_Son\'var'.split('_'),
weekdaysShort : 'Ait._Som._Mon._Bud._Bre._Suk._Son.'.split('_'),
weekdaysMin : 'Ai_Sm_Mo_Bu_Br_Su_Sn'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'A h:mm [vazta]',
LTS : 'A h:mm:ss [vazta]',
L : 'DD-MM-YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY A h:mm [vazta]',
LLLL : 'dddd, MMMM[achea] Do, YYYY, A h:mm [vazta]',
llll: 'ddd, D MMM YYYY, A h:mm [vazta]'
},
calendar : {
sameDay: '[Aiz] LT',
nextDay: '[Faleam] LT',
nextWeek: '[Ieta to] dddd[,] LT',
lastDay: '[Kal] LT',
lastWeek: '[Fatlo] dddd[,] LT',
sameElse: 'L'
},
relativeTime : {
future : '%s',
past : '%s adim',
s : processRelativeTime,
ss : processRelativeTime,
m : processRelativeTime,
mm : processRelativeTime,
h : processRelativeTime,
hh : processRelativeTime,
d : processRelativeTime,
dd : processRelativeTime,
M : processRelativeTime,
MM : processRelativeTime,
y : processRelativeTime,
yy : processRelativeTime
},
dayOfMonthOrdinalParse : /\d{1,2}(er)/,
ordinal : function (number, period) {
switch (period) {
// the ordinal 'er' only applies to day of the month
case 'D':
return number + 'er';
default:
case 'M':
case 'Q':
case 'DDD':
case 'd':
case 'w':
case 'W':
return number;
}
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
},
meridiemParse: /rati|sokalli|donparam|sanje/,
meridiemHour : function (hour, meridiem) {
if (hour === 12) {
hour = 0;
}
if (meridiem === 'rati') {
return hour < 4 ? hour : hour + 12;
} else if (meridiem === 'sokalli') {
return hour;
} else if (meridiem === 'donparam') {
return hour > 12 ? hour : hour + 12;
} else if (meridiem === 'sanje') {
return hour + 12;
}
},
meridiem : function (hour, minute, isLower) {
if (hour < 4) {
return 'rati';
} else if (hour < 12) {
return 'sokalli';
} else if (hour < 16) {
return 'donparam';
} else if (hour < 20) {
return 'sanje';
} else {
return 'rati';
}
}
});
return gomLatn;
})));
/***/ }),
/* 236 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var symbolMap = {
'1': '૧',
'2': '૨',
'3': '૩',
'4': '૪',
'5': '૫',
'6': '૬',
'7': '૭',
'8': '૮',
'9': '૯',
'0': '૦'
},
numberMap = {
'૧': '1',
'૨': '2',
'૩': '3',
'૪': '4',
'૫': '5',
'૬': '6',
'૭': '7',
'૮': '8',
'૯': '9',
'૦': '0'
};
var gu = moment.defineLocale('gu', {
months: 'જાન્યુઆરી_ફેબ્રુઆરી_માર્ચ_એપ્રિલ_મે_જૂન_જુલાઈ_ઑગસ્ટ_સપ્ટેમ્બર_ઑક્ટ્બર_નવેમ્બર_ડિસેમ્બર'.split('_'),
monthsShort: 'જાન્યુ._ફેબ્રુ._માર્ચ_એપ્રિ._મે_જૂન_જુલા._ઑગ._સપ્ટે._ઑક્ટ્._નવે._ડિસે.'.split('_'),
monthsParseExact: true,
weekdays: 'રવિવાર_સોમવાર_મંગળવાર_બુધ્વાર_ગુરુવાર_શુક્રવાર_શનિવાર'.split('_'),
weekdaysShort: 'રવિ_સોમ_મંગળ_બુધ્_ગુરુ_શુક્ર_શનિ'.split('_'),
weekdaysMin: 'ર_સો_મં_બુ_ગુ_શુ_શ'.split('_'),
longDateFormat: {
LT: 'A h:mm વાગ્યે',
LTS: 'A h:mm:ss વાગ્યે',
L: 'DD/MM/YYYY',
LL: 'D MMMM YYYY',
LLL: 'D MMMM YYYY, A h:mm વાગ્યે',
LLLL: 'dddd, D MMMM YYYY, A h:mm વાગ્યે'
},
calendar: {
sameDay: '[આજ] LT',
nextDay: '[કાલે] LT',
nextWeek: 'dddd, LT',
lastDay: '[ગઇકાલે] LT',
lastWeek: '[પાછલા] dddd, LT',
sameElse: 'L'
},
relativeTime: {
future: '%s મા',
past: '%s પેહલા',
s: 'અમુક પળો',
ss: '%d સેકંડ',
m: 'એક મિનિટ',
mm: '%d મિનિટ',
h: 'એક કલાક',
hh: '%d કલાક',
d: 'એક દિવસ',
dd: '%d દિવસ',
M: 'એક મહિનો',
MM: '%d મહિનો',
y: 'એક વર્ષ',
yy: '%d વર્ષ'
},
preparse: function (string) {
return string.replace(/[૧૨૩૪૫૬૭૮૯૦]/g, function (match) {
return numberMap[match];
});
},
postformat: function (string) {
return string.replace(/\d/g, function (match) {
return symbolMap[match];
});
},
// Gujarati notation for meridiems are quite fuzzy in practice. While there exists
// a rigid notion of a 'Pahar' it is not used as rigidly in modern Gujarati.
meridiemParse: /રાત|બપોર|સવાર|સાંજ/,
meridiemHour: function (hour, meridiem) {
if (hour === 12) {
hour = 0;
}
if (meridiem === 'રાત') {
return hour < 4 ? hour : hour + 12;
} else if (meridiem === 'સવાર') {
return hour;
} else if (meridiem === 'બપોર') {
return hour >= 10 ? hour : hour + 12;
} else if (meridiem === 'સાંજ') {
return hour + 12;
}
},
meridiem: function (hour, minute, isLower) {
if (hour < 4) {
return 'રાત';
} else if (hour < 10) {
return 'સવાર';
} else if (hour < 17) {
return 'બપોર';
} else if (hour < 20) {
return 'સાંજ';
} else {
return 'રાત';
}
},
week: {
dow: 0, // Sunday is the first day of the week.
doy: 6 // The week that contains Jan 1st is the first week of the year.
}
});
return gu;
})));
/***/ }),
/* 237 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var he = moment.defineLocale('he', {
months : 'ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר'.split('_'),
monthsShort : 'ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳'.split('_'),
weekdays : 'ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת'.split('_'),
weekdaysShort : 'א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳'.split('_'),
weekdaysMin : 'א_ב_ג_ד_ה_ו_ש'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D [ב]MMMM YYYY',
LLL : 'D [ב]MMMM YYYY HH:mm',
LLLL : 'dddd, D [ב]MMMM YYYY HH:mm',
l : 'D/M/YYYY',
ll : 'D MMM YYYY',
lll : 'D MMM YYYY HH:mm',
llll : 'ddd, D MMM YYYY HH:mm'
},
calendar : {
sameDay : '[היום ב־]LT',
nextDay : '[מחר ב־]LT',
nextWeek : 'dddd [בשעה] LT',
lastDay : '[אתמול ב־]LT',
lastWeek : '[ביום] dddd [האחרון בשעה] LT',
sameElse : 'L'
},
relativeTime : {
future : 'בעוד %s',
past : 'לפני %s',
s : 'מספר שניות',
ss : '%d שניות',
m : 'דקה',
mm : '%d דקות',
h : 'שעה',
hh : function (number) {
if (number === 2) {
return 'שעתיים';
}
return number + ' שעות';
},
d : 'יום',
dd : function (number) {
if (number === 2) {
return 'יומיים';
}
return number + ' ימים';
},
M : 'חודש',
MM : function (number) {
if (number === 2) {
return 'חודשיים';
}
return number + ' חודשים';
},
y : 'שנה',
yy : function (number) {
if (number === 2) {
return 'שנתיים';
} else if (number % 10 === 0 && number !== 10) {
return number + ' שנה';
}
return number + ' שנים';
}
},
meridiemParse: /אחה"צ|לפנה"צ|אחרי הצהריים|לפני הצהריים|לפנות בוקר|בבוקר|בערב/i,
isPM : function (input) {
return /^(אחה"צ|אחרי הצהריים|בערב)$/.test(input);
},
meridiem : function (hour, minute, isLower) {
if (hour < 5) {
return 'לפנות בוקר';
} else if (hour < 10) {
return 'בבוקר';
} else if (hour < 12) {
return isLower ? 'לפנה"צ' : 'לפני הצהריים';
} else if (hour < 18) {
return isLower ? 'אחה"צ' : 'אחרי הצהריים';
} else {
return 'בערב';
}
}
});
return he;
})));
/***/ }),
/* 238 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var symbolMap = {
'1': '१',
'2': '२',
'3': '३',
'4': '४',
'5': '५',
'6': '६',
'7': '७',
'8': '८',
'9': '९',
'0': '०'
},
numberMap = {
'१': '1',
'२': '2',
'३': '3',
'४': '4',
'५': '5',
'६': '6',
'७': '7',
'८': '8',
'९': '9',
'०': '0'
};
var hi = moment.defineLocale('hi', {
months : 'जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर'.split('_'),
monthsShort : 'जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.'.split('_'),
monthsParseExact: true,
weekdays : 'रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'),
weekdaysShort : 'रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि'.split('_'),
weekdaysMin : 'र_सो_मं_बु_गु_शु_श'.split('_'),
longDateFormat : {
LT : 'A h:mm बजे',
LTS : 'A h:mm:ss बजे',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY, A h:mm बजे',
LLLL : 'dddd, D MMMM YYYY, A h:mm बजे'
},
calendar : {
sameDay : '[आज] LT',
nextDay : '[कल] LT',
nextWeek : 'dddd, LT',
lastDay : '[कल] LT',
lastWeek : '[पिछले] dddd, LT',
sameElse : 'L'
},
relativeTime : {
future : '%s में',
past : '%s पहले',
s : 'कुछ ही क्षण',
ss : '%d सेकंड',
m : 'एक मिनट',
mm : '%d मिनट',
h : 'एक घंटा',
hh : '%d घंटे',
d : 'एक दिन',
dd : '%d दिन',
M : 'एक महीने',
MM : '%d महीने',
y : 'एक वर्ष',
yy : '%d वर्ष'
},
preparse: function (string) {
return string.replace(/[१२३४५६७८९०]/g, function (match) {
return numberMap[match];
});
},
postformat: function (string) {
return string.replace(/\d/g, function (match) {
return symbolMap[match];
});
},
// Hindi notation for meridiems are quite fuzzy in practice. While there exists
// a rigid notion of a 'Pahar' it is not used as rigidly in modern Hindi.
meridiemParse: /रात|सुबह|दोपहर|शाम/,
meridiemHour : function (hour, meridiem) {
if (hour === 12) {
hour = 0;
}
if (meridiem === 'रात') {
return hour < 4 ? hour : hour + 12;
} else if (meridiem === 'सुबह') {
return hour;
} else if (meridiem === 'दोपहर') {
return hour >= 10 ? hour : hour + 12;
} else if (meridiem === 'शाम') {
return hour + 12;
}
},
meridiem : function (hour, minute, isLower) {
if (hour < 4) {
return 'रात';
} else if (hour < 10) {
return 'सुबह';
} else if (hour < 17) {
return 'दोपहर';
} else if (hour < 20) {
return 'शाम';
} else {
return 'रात';
}
},
week : {
dow : 0, // Sunday is the first day of the week.
doy : 6 // The week that contains Jan 1st is the first week of the year.
}
});
return hi;
})));
/***/ }),
/* 239 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
function translate(number, withoutSuffix, key) {
var result = number + ' ';
switch (key) {
case 'ss':
if (number === 1) {
result += 'sekunda';
} else if (number === 2 || number === 3 || number === 4) {
result += 'sekunde';
} else {
result += 'sekundi';
}
return result;
case 'm':
return withoutSuffix ? 'jedna minuta' : 'jedne minute';
case 'mm':
if (number === 1) {
result += 'minuta';
} else if (number === 2 || number === 3 || number === 4) {
result += 'minute';
} else {
result += 'minuta';
}
return result;
case 'h':
return withoutSuffix ? 'jedan sat' : 'jednog sata';
case 'hh':
if (number === 1) {
result += 'sat';
} else if (number === 2 || number === 3 || number === 4) {
result += 'sata';
} else {
result += 'sati';
}
return result;
case 'dd':
if (number === 1) {
result += 'dan';
} else {
result += 'dana';
}
return result;
case 'MM':
if (number === 1) {
result += 'mjesec';
} else if (number === 2 || number === 3 || number === 4) {
result += 'mjeseca';
} else {
result += 'mjeseci';
}
return result;
case 'yy':
if (number === 1) {
result += 'godina';
} else if (number === 2 || number === 3 || number === 4) {
result += 'godine';
} else {
result += 'godina';
}
return result;
}
}
var hr = moment.defineLocale('hr', {
months : {
format: 'siječnja_veljače_ožujka_travnja_svibnja_lipnja_srpnja_kolovoza_rujna_listopada_studenoga_prosinca'.split('_'),
standalone: 'siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac'.split('_')
},
monthsShort : 'sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.'.split('_'),
monthsParseExact: true,
weekdays : 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'),
weekdaysShort : 'ned._pon._uto._sri._čet._pet._sub.'.split('_'),
weekdaysMin : 'ne_po_ut_sr_če_pe_su'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'H:mm',
LTS : 'H:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D. MMMM YYYY',
LLL : 'D. MMMM YYYY H:mm',
LLLL : 'dddd, D. MMMM YYYY H:mm'
},
calendar : {
sameDay : '[danas u] LT',
nextDay : '[sutra u] LT',
nextWeek : function () {
switch (this.day()) {
case 0:
return '[u] [nedjelju] [u] LT';
case 3:
return '[u] [srijedu] [u] LT';
case 6:
return '[u] [subotu] [u] LT';
case 1:
case 2:
case 4:
case 5:
return '[u] dddd [u] LT';
}
},
lastDay : '[jučer u] LT',
lastWeek : function () {
switch (this.day()) {
case 0:
case 3:
return '[prošlu] dddd [u] LT';
case 6:
return '[prošle] [subote] [u] LT';
case 1:
case 2:
case 4:
case 5:
return '[prošli] dddd [u] LT';
}
},
sameElse : 'L'
},
relativeTime : {
future : 'za %s',
past : 'prije %s',
s : 'par sekundi',
ss : translate,
m : translate,
mm : translate,
h : translate,
hh : translate,
d : 'dan',
dd : translate,
M : 'mjesec',
MM : translate,
y : 'godinu',
yy : translate
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
return hr;
})));
/***/ }),
/* 240 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var weekEndings = 'vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton'.split(' ');
function translate(number, withoutSuffix, key, isFuture) {
var num = number;
switch (key) {
case 's':
return (isFuture || withoutSuffix) ? 'néhány másodperc' : 'néhány másodperce';
case 'ss':
return num + (isFuture || withoutSuffix) ? ' másodperc' : ' másodperce';
case 'm':
return 'egy' + (isFuture || withoutSuffix ? ' perc' : ' perce');
case 'mm':
return num + (isFuture || withoutSuffix ? ' perc' : ' perce');
case 'h':
return 'egy' + (isFuture || withoutSuffix ? ' óra' : ' órája');
case 'hh':
return num + (isFuture || withoutSuffix ? ' óra' : ' órája');
case 'd':
return 'egy' + (isFuture || withoutSuffix ? ' nap' : ' napja');
case 'dd':
return num + (isFuture || withoutSuffix ? ' nap' : ' napja');
case 'M':
return 'egy' + (isFuture || withoutSuffix ? ' hónap' : ' hónapja');
case 'MM':
return num + (isFuture || withoutSuffix ? ' hónap' : ' hónapja');
case 'y':
return 'egy' + (isFuture || withoutSuffix ? ' év' : ' éve');
case 'yy':
return num + (isFuture || withoutSuffix ? ' év' : ' éve');
}
return '';
}
function week(isFuture) {
return (isFuture ? '' : '[múlt] ') + '[' + weekEndings[this.day()] + '] LT[-kor]';
}
var hu = moment.defineLocale('hu', {
months : 'január_február_március_április_május_június_július_augusztus_szeptember_október_november_december'.split('_'),
monthsShort : 'jan_feb_márc_ápr_máj_jún_júl_aug_szept_okt_nov_dec'.split('_'),
weekdays : 'vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat'.split('_'),
weekdaysShort : 'vas_hét_kedd_sze_csüt_pén_szo'.split('_'),
weekdaysMin : 'v_h_k_sze_cs_p_szo'.split('_'),
longDateFormat : {
LT : 'H:mm',
LTS : 'H:mm:ss',
L : 'YYYY.MM.DD.',
LL : 'YYYY. MMMM D.',
LLL : 'YYYY. MMMM D. H:mm',
LLLL : 'YYYY. MMMM D., dddd H:mm'
},
meridiemParse: /de|du/i,
isPM: function (input) {
return input.charAt(1).toLowerCase() === 'u';
},
meridiem : function (hours, minutes, isLower) {
if (hours < 12) {
return isLower === true ? 'de' : 'DE';
} else {
return isLower === true ? 'du' : 'DU';
}
},
calendar : {
sameDay : '[ma] LT[-kor]',
nextDay : '[holnap] LT[-kor]',
nextWeek : function () {
return week.call(this, true);
},
lastDay : '[tegnap] LT[-kor]',
lastWeek : function () {
return week.call(this, false);
},
sameElse : 'L'
},
relativeTime : {
future : '%s múlva',
past : '%s',
s : translate,
ss : translate,
m : translate,
mm : translate,
h : translate,
hh : translate,
d : translate,
dd : translate,
M : translate,
MM : translate,
y : translate,
yy : translate
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return hu;
})));
/***/ }),
/* 241 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var hyAm = moment.defineLocale('hy-am', {
months : {
format: 'հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի'.split('_'),
standalone: 'հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր'.split('_')
},
monthsShort : 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_'),
weekdays : 'կիրակի_երկուշաբթի_երեքշաբթի_չորեքշաբթի_հինգշաբթի_ուրբաթ_շաբաթ'.split('_'),
weekdaysShort : 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'),
weekdaysMin : 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D MMMM YYYY թ.',
LLL : 'D MMMM YYYY թ., HH:mm',
LLLL : 'dddd, D MMMM YYYY թ., HH:mm'
},
calendar : {
sameDay: '[այսօր] LT',
nextDay: '[վաղը] LT',
lastDay: '[երեկ] LT',
nextWeek: function () {
return 'dddd [օրը ժամը] LT';
},
lastWeek: function () {
return '[անցած] dddd [օրը ժամը] LT';
},
sameElse: 'L'
},
relativeTime : {
future : '%s հետո',
past : '%s առաջ',
s : 'մի քանի վայրկյան',
ss : '%d վայրկյան',
m : 'րոպե',
mm : '%d րոպե',
h : 'ժամ',
hh : '%d ժամ',
d : 'օր',
dd : '%d օր',
M : 'ամիս',
MM : '%d ամիս',
y : 'տարի',
yy : '%d տարի'
},
meridiemParse: /գիշերվա|առավոտվա|ցերեկվա|երեկոյան/,
isPM: function (input) {
return /^(ցերեկվա|երեկոյան)$/.test(input);
},
meridiem : function (hour) {
if (hour < 4) {
return 'գիշերվա';
} else if (hour < 12) {
return 'առավոտվա';
} else if (hour < 17) {
return 'ցերեկվա';
} else {
return 'երեկոյան';
}
},
dayOfMonthOrdinalParse: /\d{1,2}|\d{1,2}-(ին|րդ)/,
ordinal: function (number, period) {
switch (period) {
case 'DDD':
case 'w':
case 'W':
case 'DDDo':
if (number === 1) {
return number + '-ին';
}
return number + '-րդ';
default:
return number;
}
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
return hyAm;
})));
/***/ }),
/* 242 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var id = moment.defineLocale('id', {
months : 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember'.split('_'),
monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Agt_Sep_Okt_Nov_Des'.split('_'),
weekdays : 'Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu'.split('_'),
weekdaysShort : 'Min_Sen_Sel_Rab_Kam_Jum_Sab'.split('_'),
weekdaysMin : 'Mg_Sn_Sl_Rb_Km_Jm_Sb'.split('_'),
longDateFormat : {
LT : 'HH.mm',
LTS : 'HH.mm.ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY [pukul] HH.mm',
LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm'
},
meridiemParse: /pagi|siang|sore|malam/,
meridiemHour : function (hour, meridiem) {
if (hour === 12) {
hour = 0;
}
if (meridiem === 'pagi') {
return hour;
} else if (meridiem === 'siang') {
return hour >= 11 ? hour : hour + 12;
} else if (meridiem === 'sore' || meridiem === 'malam') {
return hour + 12;
}
},
meridiem : function (hours, minutes, isLower) {
if (hours < 11) {
return 'pagi';
} else if (hours < 15) {
return 'siang';
} else if (hours < 19) {
return 'sore';
} else {
return 'malam';
}
},
calendar : {
sameDay : '[Hari ini pukul] LT',
nextDay : '[Besok pukul] LT',
nextWeek : 'dddd [pukul] LT',
lastDay : '[Kemarin pukul] LT',
lastWeek : 'dddd [lalu pukul] LT',
sameElse : 'L'
},
relativeTime : {
future : 'dalam %s',
past : '%s yang lalu',
s : 'beberapa detik',
ss : '%d detik',
m : 'semenit',
mm : '%d menit',
h : 'sejam',
hh : '%d jam',
d : 'sehari',
dd : '%d hari',
M : 'sebulan',
MM : '%d bulan',
y : 'setahun',
yy : '%d tahun'
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
return id;
})));
/***/ }),
/* 243 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
function plural(n) {
if (n % 100 === 11) {
return true;
} else if (n % 10 === 1) {
return false;
}
return true;
}
function translate(number, withoutSuffix, key, isFuture) {
var result = number + ' ';
switch (key) {
case 's':
return withoutSuffix || isFuture ? 'nokkrar sekúndur' : 'nokkrum sekúndum';
case 'ss':
if (plural(number)) {
return result + (withoutSuffix || isFuture ? 'sekúndur' : 'sekúndum');
}
return result + 'sekúnda';
case 'm':
return withoutSuffix ? 'mínúta' : 'mínútu';
case 'mm':
if (plural(number)) {
return result + (withoutSuffix || isFuture ? 'mínútur' : 'mínútum');
} else if (withoutSuffix) {
return result + 'mínúta';
}
return result + 'mínútu';
case 'hh':
if (plural(number)) {
return result + (withoutSuffix || isFuture ? 'klukkustundir' : 'klukkustundum');
}
return result + 'klukkustund';
case 'd':
if (withoutSuffix) {
return 'dagur';
}
return isFuture ? 'dag' : 'degi';
case 'dd':
if (plural(number)) {
if (withoutSuffix) {
return result + 'dagar';
}
return result + (isFuture ? 'daga' : 'dögum');
} else if (withoutSuffix) {
return result + 'dagur';
}
return result + (isFuture ? 'dag' : 'degi');
case 'M':
if (withoutSuffix) {
return 'mánuður';
}
return isFuture ? 'mánuð' : 'mánuði';
case 'MM':
if (plural(number)) {
if (withoutSuffix) {
return result + 'mánuðir';
}
return result + (isFuture ? 'mánuði' : 'mánuðum');
} else if (withoutSuffix) {
return result + 'mánuður';
}
return result + (isFuture ? 'mánuð' : 'mánuði');
case 'y':
return withoutSuffix || isFuture ? 'ár' : 'ári';
case 'yy':
if (plural(number)) {
return result + (withoutSuffix || isFuture ? 'ár' : 'árum');
}
return result + (withoutSuffix || isFuture ? 'ár' : 'ári');
}
}
var is = moment.defineLocale('is', {
months : 'janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember'.split('_'),
monthsShort : 'jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des'.split('_'),
weekdays : 'sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur'.split('_'),
weekdaysShort : 'sun_mán_þri_mið_fim_fös_lau'.split('_'),
weekdaysMin : 'Su_Má_Þr_Mi_Fi_Fö_La'.split('_'),
longDateFormat : {
LT : 'H:mm',
LTS : 'H:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D. MMMM YYYY',
LLL : 'D. MMMM YYYY [kl.] H:mm',
LLLL : 'dddd, D. MMMM YYYY [kl.] H:mm'
},
calendar : {
sameDay : '[í dag kl.] LT',
nextDay : '[á morgun kl.] LT',
nextWeek : 'dddd [kl.] LT',
lastDay : '[í gær kl.] LT',
lastWeek : '[síðasta] dddd [kl.] LT',
sameElse : 'L'
},
relativeTime : {
future : 'eftir %s',
past : 'fyrir %s síðan',
s : translate,
ss : translate,
m : translate,
mm : translate,
h : 'klukkustund',
hh : translate,
d : translate,
dd : translate,
M : translate,
MM : translate,
y : translate,
yy : translate
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return is;
})));
/***/ }),
/* 244 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var it = moment.defineLocale('it', {
months : 'gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre'.split('_'),
monthsShort : 'gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic'.split('_'),
weekdays : 'domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato'.split('_'),
weekdaysShort : 'dom_lun_mar_mer_gio_ven_sab'.split('_'),
weekdaysMin : 'do_lu_ma_me_gi_ve_sa'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd D MMMM YYYY HH:mm'
},
calendar : {
sameDay: '[Oggi alle] LT',
nextDay: '[Domani alle] LT',
nextWeek: 'dddd [alle] LT',
lastDay: '[Ieri alle] LT',
lastWeek: function () {
switch (this.day()) {
case 0:
return '[la scorsa] dddd [alle] LT';
default:
return '[lo scorso] dddd [alle] LT';
}
},
sameElse: 'L'
},
relativeTime : {
future : function (s) {
return ((/^[0-9].+$/).test(s) ? 'tra' : 'in') + ' ' + s;
},
past : '%s fa',
s : 'alcuni secondi',
ss : '%d secondi',
m : 'un minuto',
mm : '%d minuti',
h : 'un\'ora',
hh : '%d ore',
d : 'un giorno',
dd : '%d giorni',
M : 'un mese',
MM : '%d mesi',
y : 'un anno',
yy : '%d anni'
},
dayOfMonthOrdinalParse : /\d{1,2}º/,
ordinal: '%dº',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return it;
})));
/***/ }),
/* 245 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var ja = moment.defineLocale('ja', {
months : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
weekdays : '日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日'.split('_'),
weekdaysShort : '日_月_火_水_木_金_土'.split('_'),
weekdaysMin : '日_月_火_水_木_金_土'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'YYYY/MM/DD',
LL : 'YYYY年M月D日',
LLL : 'YYYY年M月D日 HH:mm',
LLLL : 'YYYY年M月D日 dddd HH:mm',
l : 'YYYY/MM/DD',
ll : 'YYYY年M月D日',
lll : 'YYYY年M月D日 HH:mm',
llll : 'YYYY年M月D日(ddd) HH:mm'
},
meridiemParse: /午前|午後/i,
isPM : function (input) {
return input === '午後';
},
meridiem : function (hour, minute, isLower) {
if (hour < 12) {
return '午前';
} else {
return '午後';
}
},
calendar : {
sameDay : '[今日] LT',
nextDay : '[明日] LT',
nextWeek : function (now) {
if (now.week() < this.week()) {
return '[来週]dddd LT';
} else {
return 'dddd LT';
}
},
lastDay : '[昨日] LT',
lastWeek : function (now) {
if (this.week() < now.week()) {
return '[先週]dddd LT';
} else {
return 'dddd LT';
}
},
sameElse : 'L'
},
dayOfMonthOrdinalParse : /\d{1,2}日/,
ordinal : function (number, period) {
switch (period) {
case 'd':
case 'D':
case 'DDD':
return number + '日';
default:
return number;
}
},
relativeTime : {
future : '%s後',
past : '%s前',
s : '数秒',
ss : '%d秒',
m : '1分',
mm : '%d分',
h : '1時間',
hh : '%d時間',
d : '1日',
dd : '%d日',
M : '1ヶ月',
MM : '%dヶ月',
y : '1年',
yy : '%d年'
}
});
return ja;
})));
/***/ }),
/* 246 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var jv = moment.defineLocale('jv', {
months : 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_Nopember_Desember'.split('_'),
monthsShort : 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nop_Des'.split('_'),
weekdays : 'Minggu_Senen_Seloso_Rebu_Kemis_Jemuwah_Septu'.split('_'),
weekdaysShort : 'Min_Sen_Sel_Reb_Kem_Jem_Sep'.split('_'),
weekdaysMin : 'Mg_Sn_Sl_Rb_Km_Jm_Sp'.split('_'),
longDateFormat : {
LT : 'HH.mm',
LTS : 'HH.mm.ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY [pukul] HH.mm',
LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm'
},
meridiemParse: /enjing|siyang|sonten|ndalu/,
meridiemHour : function (hour, meridiem) {
if (hour === 12) {
hour = 0;
}
if (meridiem === 'enjing') {
return hour;
} else if (meridiem === 'siyang') {
return hour >= 11 ? hour : hour + 12;
} else if (meridiem === 'sonten' || meridiem === 'ndalu') {
return hour + 12;
}
},
meridiem : function (hours, minutes, isLower) {
if (hours < 11) {
return 'enjing';
} else if (hours < 15) {
return 'siyang';
} else if (hours < 19) {
return 'sonten';
} else {
return 'ndalu';
}
},
calendar : {
sameDay : '[Dinten puniko pukul] LT',
nextDay : '[Mbenjang pukul] LT',
nextWeek : 'dddd [pukul] LT',
lastDay : '[Kala wingi pukul] LT',
lastWeek : 'dddd [kepengker pukul] LT',
sameElse : 'L'
},
relativeTime : {
future : 'wonten ing %s',
past : '%s ingkang kepengker',
s : 'sawetawis detik',
ss : '%d detik',
m : 'setunggal menit',
mm : '%d menit',
h : 'setunggal jam',
hh : '%d jam',
d : 'sedinten',
dd : '%d dinten',
M : 'sewulan',
MM : '%d wulan',
y : 'setaun',
yy : '%d taun'
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
return jv;
})));
/***/ }),
/* 247 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var ka = moment.defineLocale('ka', {
months : {
standalone: 'იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი'.split('_'),
format: 'იანვარს_თებერვალს_მარტს_აპრილის_მაისს_ივნისს_ივლისს_აგვისტს_სექტემბერს_ოქტომბერს_ნოემბერს_დეკემბერს'.split('_')
},
monthsShort : 'იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ'.split('_'),
weekdays : {
standalone: 'კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი'.split('_'),
format: 'კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს'.split('_'),
isFormat: /(წინა|შემდეგ)/
},
weekdaysShort : 'კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ'.split('_'),
weekdaysMin : 'კვ_ორ_სა_ოთ_ხუ_პა_შა'.split('_'),
longDateFormat : {
LT : 'h:mm A',
LTS : 'h:mm:ss A',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY h:mm A',
LLLL : 'dddd, D MMMM YYYY h:mm A'
},
calendar : {
sameDay : '[დღეს] LT[-ზე]',
nextDay : '[ხვალ] LT[-ზე]',
lastDay : '[გუშინ] LT[-ზე]',
nextWeek : '[შემდეგ] dddd LT[-ზე]',
lastWeek : '[წინა] dddd LT-ზე',
sameElse : 'L'
},
relativeTime : {
future : function (s) {
return (/(წამი|წუთი|საათი|წელი)/).test(s) ?
s.replace(/ი$/, 'ში') :
s + 'ში';
},
past : function (s) {
if ((/(წამი|წუთი|საათი|დღე|თვე)/).test(s)) {
return s.replace(/(ი|ე)$/, 'ის წინ');
}
if ((/წელი/).test(s)) {
return s.replace(/წელი$/, 'წლის წინ');
}
},
s : 'რამდენიმე წამი',
ss : '%d წამი',
m : 'წუთი',
mm : '%d წუთი',
h : 'საათი',
hh : '%d საათი',
d : 'დღე',
dd : '%d დღე',
M : 'თვე',
MM : '%d თვე',
y : 'წელი',
yy : '%d წელი'
},
dayOfMonthOrdinalParse: /0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/,
ordinal : function (number) {
if (number === 0) {
return number;
}
if (number === 1) {
return number + '-ლი';
}
if ((number < 20) || (number <= 100 && (number % 20 === 0)) || (number % 100 === 0)) {
return 'მე-' + number;
}
return number + '-ე';
},
week : {
dow : 1,
doy : 7
}
});
return ka;
})));
/***/ }),
/* 248 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var suffixes = {
0: '-ші',
1: '-ші',
2: '-ші',
3: '-ші',
4: '-ші',
5: '-ші',
6: '-шы',
7: '-ші',
8: '-ші',
9: '-шы',
10: '-шы',
20: '-шы',
30: '-шы',
40: '-шы',
50: '-ші',
60: '-шы',
70: '-ші',
80: '-ші',
90: '-шы',
100: '-ші'
};
var kk = moment.defineLocale('kk', {
months : 'қаңтар_ақпан_наурыз_сәуір_мамыр_маусым_шілде_тамыз_қыркүйек_қазан_қараша_желтоқсан'.split('_'),
monthsShort : 'қаң_ақп_нау_сәу_мам_мау_шіл_там_қыр_қаз_қар_жел'.split('_'),
weekdays : 'жексенбі_дүйсенбі_сейсенбі_сәрсенбі_бейсенбі_жұма_сенбі'.split('_'),
weekdaysShort : 'жек_дүй_сей_сәр_бей_жұм_сен'.split('_'),
weekdaysMin : 'жк_дй_сй_ср_бй_жм_сн'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd, D MMMM YYYY HH:mm'
},
calendar : {
sameDay : '[Бүгін сағат] LT',
nextDay : '[Ертең сағат] LT',
nextWeek : 'dddd [сағат] LT',
lastDay : '[Кеше сағат] LT',
lastWeek : '[Өткен аптаның] dddd [сағат] LT',
sameElse : 'L'
},
relativeTime : {
future : '%s ішінде',
past : '%s бұрын',
s : 'бірнеше секунд',
ss : '%d секунд',
m : 'бір минут',
mm : '%d минут',
h : 'бір сағат',
hh : '%d сағат',
d : 'бір күн',
dd : '%d күн',
M : 'бір ай',
MM : '%d ай',
y : 'бір жыл',
yy : '%d жыл'
},
dayOfMonthOrdinalParse: /\d{1,2}-(ші|шы)/,
ordinal : function (number) {
var a = number % 10,
b = number >= 100 ? 100 : null;
return number + (suffixes[number] || suffixes[a] || suffixes[b]);
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
return kk;
})));
/***/ }),
/* 249 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var symbolMap = {
'1': '១',
'2': '២',
'3': '៣',
'4': '៤',
'5': '៥',
'6': '៦',
'7': '៧',
'8': '៨',
'9': '៩',
'0': '០'
}, numberMap = {
'១': '1',
'២': '2',
'៣': '3',
'៤': '4',
'៥': '5',
'៦': '6',
'៧': '7',
'៨': '8',
'៩': '9',
'០': '0'
};
var km = moment.defineLocale('km', {
months: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split(
'_'
),
monthsShort: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split(
'_'
),
weekdays: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'),
weekdaysShort: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'),
weekdaysMin: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'),
weekdaysParseExact: true,
longDateFormat: {
LT: 'HH:mm',
LTS: 'HH:mm:ss',
L: 'DD/MM/YYYY',
LL: 'D MMMM YYYY',
LLL: 'D MMMM YYYY HH:mm',
LLLL: 'dddd, D MMMM YYYY HH:mm'
},
meridiemParse: /ព្រឹក|ល្ងាច/,
isPM: function (input) {
return input === 'ល្ងាច';
},
meridiem: function (hour, minute, isLower) {
if (hour < 12) {
return 'ព្រឹក';
} else {
return 'ល្ងាច';
}
},
calendar: {
sameDay: '[ថ្ងៃនេះ ម៉ោង] LT',
nextDay: '[ស្អែក ម៉ោង] LT',
nextWeek: 'dddd [ម៉ោង] LT',
lastDay: '[ម្សិលមិញ ម៉ោង] LT',
lastWeek: 'dddd [សប្តាហ៍មុន] [ម៉ោង] LT',
sameElse: 'L'
},
relativeTime: {
future: '%sទៀត',
past: '%sមុន',
s: 'ប៉ុន្មានវិនាទី',
ss: '%d វិនាទី',
m: 'មួយនាទី',
mm: '%d នាទី',
h: 'មួយម៉ោង',
hh: '%d ម៉ោង',
d: 'មួយថ្ងៃ',
dd: '%d ថ្ងៃ',
M: 'មួយខែ',
MM: '%d ខែ',
y: 'មួយឆ្នាំ',
yy: '%d ឆ្នាំ'
},
dayOfMonthOrdinalParse : /ទី\d{1,2}/,
ordinal : 'ទី%d',
preparse: function (string) {
return string.replace(/[១២៣៤៥៦៧៨៩០]/g, function (match) {
return numberMap[match];
});
},
postformat: function (string) {
return string.replace(/\d/g, function (match) {
return symbolMap[match];
});
},
week: {
dow: 1, // Monday is the first day of the week.
doy: 4 // The week that contains Jan 4th is the first week of the year.
}
});
return km;
})));
/***/ }),
/* 250 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var symbolMap = {
'1': '೧',
'2': '೨',
'3': '೩',
'4': '೪',
'5': '೫',
'6': '೬',
'7': '೭',
'8': '೮',
'9': '೯',
'0': '೦'
},
numberMap = {
'೧': '1',
'೨': '2',
'೩': '3',
'೪': '4',
'೫': '5',
'೬': '6',
'೭': '7',
'೮': '8',
'೯': '9',
'೦': '0'
};
var kn = moment.defineLocale('kn', {
months : 'ಜನವರಿ_ಫೆಬ್ರವರಿ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂಬರ್_ಅಕ್ಟೋಬರ್_ನವೆಂಬರ್_ಡಿಸೆಂಬರ್'.split('_'),
monthsShort : 'ಜನ_ಫೆಬ್ರ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂ_ಅಕ್ಟೋ_ನವೆಂ_ಡಿಸೆಂ'.split('_'),
monthsParseExact: true,
weekdays : 'ಭಾನುವಾರ_ಸೋಮವಾರ_ಮಂಗಳವಾರ_ಬುಧವಾರ_ಗುರುವಾರ_ಶುಕ್ರವಾರ_ಶನಿವಾರ'.split('_'),
weekdaysShort : 'ಭಾನು_ಸೋಮ_ಮಂಗಳ_ಬುಧ_ಗುರು_ಶುಕ್ರ_ಶನಿ'.split('_'),
weekdaysMin : 'ಭಾ_ಸೋ_ಮಂ_ಬು_ಗು_ಶು_ಶ'.split('_'),
longDateFormat : {
LT : 'A h:mm',
LTS : 'A h:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY, A h:mm',
LLLL : 'dddd, D MMMM YYYY, A h:mm'
},
calendar : {
sameDay : '[ಇಂದು] LT',
nextDay : '[ನಾಳೆ] LT',
nextWeek : 'dddd, LT',
lastDay : '[ನಿನ್ನೆ] LT',
lastWeek : '[ಕೊನೆಯ] dddd, LT',
sameElse : 'L'
},
relativeTime : {
future : '%s ನಂತರ',
past : '%s ಹಿಂದೆ',
s : 'ಕೆಲವು ಕ್ಷಣಗಳು',
ss : '%d ಸೆಕೆಂಡುಗಳು',
m : 'ಒಂದು ನಿಮಿಷ',
mm : '%d ನಿಮಿಷ',
h : 'ಒಂದು ಗಂಟೆ',
hh : '%d ಗಂಟೆ',
d : 'ಒಂದು ದಿನ',
dd : '%d ದಿನ',
M : 'ಒಂದು ತಿಂಗಳು',
MM : '%d ತಿಂಗಳು',
y : 'ಒಂದು ವರ್ಷ',
yy : '%d ವರ್ಷ'
},
preparse: function (string) {
return string.replace(/[೧೨೩೪೫೬೭೮೯೦]/g, function (match) {
return numberMap[match];
});
},
postformat: function (string) {
return string.replace(/\d/g, function (match) {
return symbolMap[match];
});
},
meridiemParse: /ರಾತ್ರಿ|ಬೆಳಿಗ್ಗೆ|ಮಧ್ಯಾಹ್ನ|ಸಂಜೆ/,
meridiemHour : function (hour, meridiem) {
if (hour === 12) {
hour = 0;
}
if (meridiem === 'ರಾತ್ರಿ') {
return hour < 4 ? hour : hour + 12;
} else if (meridiem === 'ಬೆಳಿಗ್ಗೆ') {
return hour;
} else if (meridiem === 'ಮಧ್ಯಾಹ್ನ') {
return hour >= 10 ? hour : hour + 12;
} else if (meridiem === 'ಸಂಜೆ') {
return hour + 12;
}
},
meridiem : function (hour, minute, isLower) {
if (hour < 4) {
return 'ರಾತ್ರಿ';
} else if (hour < 10) {
return 'ಬೆಳಿಗ್ಗೆ';
} else if (hour < 17) {
return 'ಮಧ್ಯಾಹ್ನ';
} else if (hour < 20) {
return 'ಸಂಜೆ';
} else {
return 'ರಾತ್ರಿ';
}
},
dayOfMonthOrdinalParse: /\d{1,2}(ನೇ)/,
ordinal : function (number) {
return number + 'ನೇ';
},
week : {
dow : 0, // Sunday is the first day of the week.
doy : 6 // The week that contains Jan 1st is the first week of the year.
}
});
return kn;
})));
/***/ }),
/* 251 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var ko = moment.defineLocale('ko', {
months : '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'),
monthsShort : '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'),
weekdays : '일요일_월요일_화요일_수요일_목요일_금요일_토요일'.split('_'),
weekdaysShort : '일_월_화_수_목_금_토'.split('_'),
weekdaysMin : '일_월_화_수_목_금_토'.split('_'),
longDateFormat : {
LT : 'A h:mm',
LTS : 'A h:mm:ss',
L : 'YYYY.MM.DD.',
LL : 'YYYY년 MMMM D일',
LLL : 'YYYY년 MMMM D일 A h:mm',
LLLL : 'YYYY년 MMMM D일 dddd A h:mm',
l : 'YYYY.MM.DD.',
ll : 'YYYY년 MMMM D일',
lll : 'YYYY년 MMMM D일 A h:mm',
llll : 'YYYY년 MMMM D일 dddd A h:mm'
},
calendar : {
sameDay : '오늘 LT',
nextDay : '내일 LT',
nextWeek : 'dddd LT',
lastDay : '어제 LT',
lastWeek : '지난주 dddd LT',
sameElse : 'L'
},
relativeTime : {
future : '%s 후',
past : '%s 전',
s : '몇 초',
ss : '%d초',
m : '1분',
mm : '%d분',
h : '한 시간',
hh : '%d시간',
d : '하루',
dd : '%d일',
M : '한 달',
MM : '%d달',
y : '일 년',
yy : '%d년'
},
dayOfMonthOrdinalParse : /\d{1,2}(일|월|주)/,
ordinal : function (number, period) {
switch (period) {
case 'd':
case 'D':
case 'DDD':
return number + '일';
case 'M':
return number + '월';
case 'w':
case 'W':
return number + '주';
default:
return number;
}
},
meridiemParse : /오전|오후/,
isPM : function (token) {
return token === '오후';
},
meridiem : function (hour, minute, isUpper) {
return hour < 12 ? '오전' : '오후';
}
});
return ko;
})));
/***/ }),
/* 252 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var suffixes = {
0: '-чү',
1: '-чи',
2: '-чи',
3: '-чү',
4: '-чү',
5: '-чи',
6: '-чы',
7: '-чи',
8: '-чи',
9: '-чу',
10: '-чу',
20: '-чы',
30: '-чу',
40: '-чы',
50: '-чү',
60: '-чы',
70: '-чи',
80: '-чи',
90: '-чу',
100: '-чү'
};
var ky = moment.defineLocale('ky', {
months : 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_'),
monthsShort : 'янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек'.split('_'),
weekdays : 'Жекшемби_Дүйшөмбү_Шейшемби_Шаршемби_Бейшемби_Жума_Ишемби'.split('_'),
weekdaysShort : 'Жек_Дүй_Шей_Шар_Бей_Жум_Ише'.split('_'),
weekdaysMin : 'Жк_Дй_Шй_Шр_Бй_Жм_Иш'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd, D MMMM YYYY HH:mm'
},
calendar : {
sameDay : '[Бүгүн саат] LT',
nextDay : '[Эртең саат] LT',
nextWeek : 'dddd [саат] LT',
lastDay : '[Кече саат] LT',
lastWeek : '[Өткен аптанын] dddd [күнү] [саат] LT',
sameElse : 'L'
},
relativeTime : {
future : '%s ичинде',
past : '%s мурун',
s : 'бирнече секунд',
ss : '%d секунд',
m : 'бир мүнөт',
mm : '%d мүнөт',
h : 'бир саат',
hh : '%d саат',
d : 'бир күн',
dd : '%d күн',
M : 'бир ай',
MM : '%d ай',
y : 'бир жыл',
yy : '%d жыл'
},
dayOfMonthOrdinalParse: /\d{1,2}-(чи|чы|чү|чу)/,
ordinal : function (number) {
var a = number % 10,
b = number >= 100 ? 100 : null;
return number + (suffixes[number] || suffixes[a] || suffixes[b]);
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
return ky;
})));
/***/ }),
/* 253 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
function processRelativeTime(number, withoutSuffix, key, isFuture) {
var format = {
'm': ['eng Minutt', 'enger Minutt'],
'h': ['eng Stonn', 'enger Stonn'],
'd': ['een Dag', 'engem Dag'],
'M': ['ee Mount', 'engem Mount'],
'y': ['ee Joer', 'engem Joer']
};
return withoutSuffix ? format[key][0] : format[key][1];
}
function processFutureTime(string) {
var number = string.substr(0, string.indexOf(' '));
if (eifelerRegelAppliesToNumber(number)) {
return 'a ' + string;
}
return 'an ' + string;
}
function processPastTime(string) {
var number = string.substr(0, string.indexOf(' '));
if (eifelerRegelAppliesToNumber(number)) {
return 'viru ' + string;
}
return 'virun ' + string;
}
/**
* Returns true if the word before the given number loses the '-n' ending.
* e.g. 'an 10 Deeg' but 'a 5 Deeg'
*
* @param number {integer}
* @returns {boolean}
*/
function eifelerRegelAppliesToNumber(number) {
number = parseInt(number, 10);
if (isNaN(number)) {
return false;
}
if (number < 0) {
// Negative Number --> always true
return true;
} else if (number < 10) {
// Only 1 digit
if (4 <= number && number <= 7) {
return true;
}
return false;
} else if (number < 100) {
// 2 digits
var lastDigit = number % 10, firstDigit = number / 10;
if (lastDigit === 0) {
return eifelerRegelAppliesToNumber(firstDigit);
}
return eifelerRegelAppliesToNumber(lastDigit);
} else if (number < 10000) {
// 3 or 4 digits --> recursively check first digit
while (number >= 10) {
number = number / 10;
}
return eifelerRegelAppliesToNumber(number);
} else {
// Anything larger than 4 digits: recursively check first n-3 digits
number = number / 1000;
return eifelerRegelAppliesToNumber(number);
}
}
var lb = moment.defineLocale('lb', {
months: 'Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember'.split('_'),
monthsShort: 'Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split('_'),
monthsParseExact : true,
weekdays: 'Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg'.split('_'),
weekdaysShort: 'So._Mé._Dë._Më._Do._Fr._Sa.'.split('_'),
weekdaysMin: 'So_Mé_Dë_Më_Do_Fr_Sa'.split('_'),
weekdaysParseExact : true,
longDateFormat: {
LT: 'H:mm [Auer]',
LTS: 'H:mm:ss [Auer]',
L: 'DD.MM.YYYY',
LL: 'D. MMMM YYYY',
LLL: 'D. MMMM YYYY H:mm [Auer]',
LLLL: 'dddd, D. MMMM YYYY H:mm [Auer]'
},
calendar: {
sameDay: '[Haut um] LT',
sameElse: 'L',
nextDay: '[Muer um] LT',
nextWeek: 'dddd [um] LT',
lastDay: '[Gëschter um] LT',
lastWeek: function () {
// Different date string for 'Dënschdeg' (Tuesday) and 'Donneschdeg' (Thursday) due to phonological rule
switch (this.day()) {
case 2:
case 4:
return '[Leschten] dddd [um] LT';
default:
return '[Leschte] dddd [um] LT';
}
}
},
relativeTime : {
future : processFutureTime,
past : processPastTime,
s : 'e puer Sekonnen',
ss : '%d Sekonnen',
m : processRelativeTime,
mm : '%d Minutten',
h : processRelativeTime,
hh : '%d Stonnen',
d : processRelativeTime,
dd : '%d Deeg',
M : processRelativeTime,
MM : '%d Méint',
y : processRelativeTime,
yy : '%d Joer'
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal: '%d.',
week: {
dow: 1, // Monday is the first day of the week.
doy: 4 // The week that contains Jan 4th is the first week of the year.
}
});
return lb;
})));
/***/ }),
/* 254 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var lo = moment.defineLocale('lo', {
months : 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split('_'),
monthsShort : 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split('_'),
weekdays : 'ອາທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'),
weekdaysShort : 'ທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'),
weekdaysMin : 'ທ_ຈ_ອຄ_ພ_ພຫ_ສກ_ສ'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'ວັນdddd D MMMM YYYY HH:mm'
},
meridiemParse: /ຕອນເຊົ້າ|ຕອນແລງ/,
isPM: function (input) {
return input === 'ຕອນແລງ';
},
meridiem : function (hour, minute, isLower) {
if (hour < 12) {
return 'ຕອນເຊົ້າ';
} else {
return 'ຕອນແລງ';
}
},
calendar : {
sameDay : '[ມື້ນີ້ເວລາ] LT',
nextDay : '[ມື້ອື່ນເວລາ] LT',
nextWeek : '[ວັນ]dddd[ໜ້າເວລາ] LT',
lastDay : '[ມື້ວານນີ້ເວລາ] LT',
lastWeek : '[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT',
sameElse : 'L'
},
relativeTime : {
future : 'ອີກ %s',
past : '%sຜ່ານມາ',
s : 'ບໍ່ເທົ່າໃດວິນາທີ',
ss : '%d ວິນາທີ' ,
m : '1 ນາທີ',
mm : '%d ນາທີ',
h : '1 ຊົ່ວໂມງ',
hh : '%d ຊົ່ວໂມງ',
d : '1 ມື້',
dd : '%d ມື້',
M : '1 ເດືອນ',
MM : '%d ເດືອນ',
y : '1 ປີ',
yy : '%d ປີ'
},
dayOfMonthOrdinalParse: /(ທີ່)\d{1,2}/,
ordinal : function (number) {
return 'ທີ່' + number;
}
});
return lo;
})));
/***/ }),
/* 255 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var units = {
'ss' : 'sekundė_sekundžių_sekundes',
'm' : 'minutė_minutės_minutę',
'mm': 'minutės_minučių_minutes',
'h' : 'valanda_valandos_valandą',
'hh': 'valandos_valandų_valandas',
'd' : 'diena_dienos_dieną',
'dd': 'dienos_dienų_dienas',
'M' : 'mėnuo_mėnesio_mėnesį',
'MM': 'mėnesiai_mėnesių_mėnesius',
'y' : 'metai_metų_metus',
'yy': 'metai_metų_metus'
};
function translateSeconds(number, withoutSuffix, key, isFuture) {
if (withoutSuffix) {
return 'kelios sekundės';
} else {
return isFuture ? 'kelių sekundžių' : 'kelias sekundes';
}
}
function translateSingular(number, withoutSuffix, key, isFuture) {
return withoutSuffix ? forms(key)[0] : (isFuture ? forms(key)[1] : forms(key)[2]);
}
function special(number) {
return number % 10 === 0 || (number > 10 && number < 20);
}
function forms(key) {
return units[key].split('_');
}
function translate(number, withoutSuffix, key, isFuture) {
var result = number + ' ';
if (number === 1) {
return result + translateSingular(number, withoutSuffix, key[0], isFuture);
} else if (withoutSuffix) {
return result + (special(number) ? forms(key)[1] : forms(key)[0]);
} else {
if (isFuture) {
return result + forms(key)[1];
} else {
return result + (special(number) ? forms(key)[1] : forms(key)[2]);
}
}
}
var lt = moment.defineLocale('lt', {
months : {
format: 'sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio'.split('_'),
standalone: 'sausis_vasaris_kovas_balandis_gegužė_birželis_liepa_rugpjūtis_rugsėjis_spalis_lapkritis_gruodis'.split('_'),
isFormat: /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|MMMM?(\[[^\[\]]*\]|\s)+D[oD]?/
},
monthsShort : 'sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd'.split('_'),
weekdays : {
format: 'sekmadienį_pirmadienį_antradienį_trečiadienį_ketvirtadienį_penktadienį_šeštadienį'.split('_'),
standalone: 'sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis'.split('_'),
isFormat: /dddd HH:mm/
},
weekdaysShort : 'Sek_Pir_Ant_Tre_Ket_Pen_Šeš'.split('_'),
weekdaysMin : 'S_P_A_T_K_Pn_Š'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'YYYY-MM-DD',
LL : 'YYYY [m.] MMMM D [d.]',
LLL : 'YYYY [m.] MMMM D [d.], HH:mm [val.]',
LLLL : 'YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]',
l : 'YYYY-MM-DD',
ll : 'YYYY [m.] MMMM D [d.]',
lll : 'YYYY [m.] MMMM D [d.], HH:mm [val.]',
llll : 'YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]'
},
calendar : {
sameDay : '[Šiandien] LT',
nextDay : '[Rytoj] LT',
nextWeek : 'dddd LT',
lastDay : '[Vakar] LT',
lastWeek : '[Praėjusį] dddd LT',
sameElse : 'L'
},
relativeTime : {
future : 'po %s',
past : 'prieš %s',
s : translateSeconds,
ss : translate,
m : translateSingular,
mm : translate,
h : translateSingular,
hh : translate,
d : translateSingular,
dd : translate,
M : translateSingular,
MM : translate,
y : translateSingular,
yy : translate
},
dayOfMonthOrdinalParse: /\d{1,2}-oji/,
ordinal : function (number) {
return number + '-oji';
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return lt;
})));
/***/ }),
/* 256 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var units = {
'ss': 'sekundes_sekundēm_sekunde_sekundes'.split('_'),
'm': 'minūtes_minūtēm_minūte_minūtes'.split('_'),
'mm': 'minūtes_minūtēm_minūte_minūtes'.split('_'),
'h': 'stundas_stundām_stunda_stundas'.split('_'),
'hh': 'stundas_stundām_stunda_stundas'.split('_'),
'd': 'dienas_dienām_diena_dienas'.split('_'),
'dd': 'dienas_dienām_diena_dienas'.split('_'),
'M': 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'),
'MM': 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'),
'y': 'gada_gadiem_gads_gadi'.split('_'),
'yy': 'gada_gadiem_gads_gadi'.split('_')
};
/**
* @param withoutSuffix boolean true = a length of time; false = before/after a period of time.
*/
function format(forms, number, withoutSuffix) {
if (withoutSuffix) {
// E.g. "21 minūte", "3 minūtes".
return number % 10 === 1 && number % 100 !== 11 ? forms[2] : forms[3];
} else {
// E.g. "21 minūtes" as in "pēc 21 minūtes".
// E.g. "3 minūtēm" as in "pēc 3 minūtēm".
return number % 10 === 1 && number % 100 !== 11 ? forms[0] : forms[1];
}
}
function relativeTimeWithPlural(number, withoutSuffix, key) {
return number + ' ' + format(units[key], number, withoutSuffix);
}
function relativeTimeWithSingular(number, withoutSuffix, key) {
return format(units[key], number, withoutSuffix);
}
function relativeSeconds(number, withoutSuffix) {
return withoutSuffix ? 'dažas sekundes' : 'dažām sekundēm';
}
var lv = moment.defineLocale('lv', {
months : 'janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris'.split('_'),
monthsShort : 'jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec'.split('_'),
weekdays : 'svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena'.split('_'),
weekdaysShort : 'Sv_P_O_T_C_Pk_S'.split('_'),
weekdaysMin : 'Sv_P_O_T_C_Pk_S'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD.MM.YYYY.',
LL : 'YYYY. [gada] D. MMMM',
LLL : 'YYYY. [gada] D. MMMM, HH:mm',
LLLL : 'YYYY. [gada] D. MMMM, dddd, HH:mm'
},
calendar : {
sameDay : '[Šodien pulksten] LT',
nextDay : '[Rīt pulksten] LT',
nextWeek : 'dddd [pulksten] LT',
lastDay : '[Vakar pulksten] LT',
lastWeek : '[Pagājušā] dddd [pulksten] LT',
sameElse : 'L'
},
relativeTime : {
future : 'pēc %s',
past : 'pirms %s',
s : relativeSeconds,
ss : relativeTimeWithPlural,
m : relativeTimeWithSingular,
mm : relativeTimeWithPlural,
h : relativeTimeWithSingular,
hh : relativeTimeWithPlural,
d : relativeTimeWithSingular,
dd : relativeTimeWithPlural,
M : relativeTimeWithSingular,
MM : relativeTimeWithPlural,
y : relativeTimeWithSingular,
yy : relativeTimeWithPlural
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return lv;
})));
/***/ }),
/* 257 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var translator = {
words: { //Different grammatical cases
ss: ['sekund', 'sekunda', 'sekundi'],
m: ['jedan minut', 'jednog minuta'],
mm: ['minut', 'minuta', 'minuta'],
h: ['jedan sat', 'jednog sata'],
hh: ['sat', 'sata', 'sati'],
dd: ['dan', 'dana', 'dana'],
MM: ['mjesec', 'mjeseca', 'mjeseci'],
yy: ['godina', 'godine', 'godina']
},
correctGrammaticalCase: function (number, wordKey) {
return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]);
},
translate: function (number, withoutSuffix, key) {
var wordKey = translator.words[key];
if (key.length === 1) {
return withoutSuffix ? wordKey[0] : wordKey[1];
} else {
return number + ' ' + translator.correctGrammaticalCase(number, wordKey);
}
}
};
var me = moment.defineLocale('me', {
months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split('_'),
monthsShort: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'),
monthsParseExact : true,
weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split('_'),
weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'),
weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'),
weekdaysParseExact : true,
longDateFormat: {
LT: 'H:mm',
LTS : 'H:mm:ss',
L: 'DD.MM.YYYY',
LL: 'D. MMMM YYYY',
LLL: 'D. MMMM YYYY H:mm',
LLLL: 'dddd, D. MMMM YYYY H:mm'
},
calendar: {
sameDay: '[danas u] LT',
nextDay: '[sjutra u] LT',
nextWeek: function () {
switch (this.day()) {
case 0:
return '[u] [nedjelju] [u] LT';
case 3:
return '[u] [srijedu] [u] LT';
case 6:
return '[u] [subotu] [u] LT';
case 1:
case 2:
case 4:
case 5:
return '[u] dddd [u] LT';
}
},
lastDay : '[juče u] LT',
lastWeek : function () {
var lastWeekDays = [
'[prošle] [nedjelje] [u] LT',
'[prošlog] [ponedjeljka] [u] LT',
'[prošlog] [utorka] [u] LT',
'[prošle] [srijede] [u] LT',
'[prošlog] [četvrtka] [u] LT',
'[prošlog] [petka] [u] LT',
'[prošle] [subote] [u] LT'
];
return lastWeekDays[this.day()];
},
sameElse : 'L'
},
relativeTime : {
future : 'za %s',
past : 'prije %s',
s : 'nekoliko sekundi',
ss : translator.translate,
m : translator.translate,
mm : translator.translate,
h : translator.translate,
hh : translator.translate,
d : 'dan',
dd : translator.translate,
M : 'mjesec',
MM : translator.translate,
y : 'godinu',
yy : translator.translate
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
return me;
})));
/***/ }),
/* 258 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var mi = moment.defineLocale('mi', {
months: 'Kohi-tāte_Hui-tanguru_Poutū-te-rangi_Paenga-whāwhā_Haratua_Pipiri_Hōngoingoi_Here-turi-kōkā_Mahuru_Whiringa-ā-nuku_Whiringa-ā-rangi_Hakihea'.split('_'),
monthsShort: 'Kohi_Hui_Pou_Pae_Hara_Pipi_Hōngoi_Here_Mahu_Whi-nu_Whi-ra_Haki'.split('_'),
monthsRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,
monthsStrictRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,
monthsShortRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,
monthsShortStrictRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,2}/i,
weekdays: 'Rātapu_Mane_Tūrei_Wenerei_Tāite_Paraire_Hātarei'.split('_'),
weekdaysShort: 'Ta_Ma_Tū_We_Tāi_Pa_Hā'.split('_'),
weekdaysMin: 'Ta_Ma_Tū_We_Tāi_Pa_Hā'.split('_'),
longDateFormat: {
LT: 'HH:mm',
LTS: 'HH:mm:ss',
L: 'DD/MM/YYYY',
LL: 'D MMMM YYYY',
LLL: 'D MMMM YYYY [i] HH:mm',
LLLL: 'dddd, D MMMM YYYY [i] HH:mm'
},
calendar: {
sameDay: '[i teie mahana, i] LT',
nextDay: '[apopo i] LT',
nextWeek: 'dddd [i] LT',
lastDay: '[inanahi i] LT',
lastWeek: 'dddd [whakamutunga i] LT',
sameElse: 'L'
},
relativeTime: {
future: 'i roto i %s',
past: '%s i mua',
s: 'te hēkona ruarua',
ss: '%d hēkona',
m: 'he meneti',
mm: '%d meneti',
h: 'te haora',
hh: '%d haora',
d: 'he ra',
dd: '%d ra',
M: 'he marama',
MM: '%d marama',
y: 'he tau',
yy: '%d tau'
},
dayOfMonthOrdinalParse: /\d{1,2}º/,
ordinal: '%dº',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return mi;
})));
/***/ }),
/* 259 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var mk = moment.defineLocale('mk', {
months : 'јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември'.split('_'),
monthsShort : 'јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек'.split('_'),
weekdays : 'недела_понеделник_вторник_среда_четврток_петок_сабота'.split('_'),
weekdaysShort : 'нед_пон_вто_сре_чет_пет_саб'.split('_'),
weekdaysMin : 'нe_пo_вт_ср_че_пе_сa'.split('_'),
longDateFormat : {
LT : 'H:mm',
LTS : 'H:mm:ss',
L : 'D.MM.YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY H:mm',
LLLL : 'dddd, D MMMM YYYY H:mm'
},
calendar : {
sameDay : '[Денес во] LT',
nextDay : '[Утре во] LT',
nextWeek : '[Во] dddd [во] LT',
lastDay : '[Вчера во] LT',
lastWeek : function () {
switch (this.day()) {
case 0:
case 3:
case 6:
return '[Изминатата] dddd [во] LT';
case 1:
case 2:
case 4:
case 5:
return '[Изминатиот] dddd [во] LT';
}
},
sameElse : 'L'
},
relativeTime : {
future : 'после %s',
past : 'пред %s',
s : 'неколку секунди',
ss : '%d секунди',
m : 'минута',
mm : '%d минути',
h : 'час',
hh : '%d часа',
d : 'ден',
dd : '%d дена',
M : 'месец',
MM : '%d месеци',
y : 'година',
yy : '%d години'
},
dayOfMonthOrdinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/,
ordinal : function (number) {
var lastDigit = number % 10,
last2Digits = number % 100;
if (number === 0) {
return number + '-ев';
} else if (last2Digits === 0) {
return number + '-ен';
} else if (last2Digits > 10 && last2Digits < 20) {
return number + '-ти';
} else if (lastDigit === 1) {
return number + '-ви';
} else if (lastDigit === 2) {
return number + '-ри';
} else if (lastDigit === 7 || lastDigit === 8) {
return number + '-ми';
} else {
return number + '-ти';
}
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
return mk;
})));
/***/ }),
/* 260 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var ml = moment.defineLocale('ml', {
months : 'ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ'.split('_'),
monthsShort : 'ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.'.split('_'),
monthsParseExact : true,
weekdays : 'ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച'.split('_'),
weekdaysShort : 'ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി'.split('_'),
weekdaysMin : 'ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ'.split('_'),
longDateFormat : {
LT : 'A h:mm -നു',
LTS : 'A h:mm:ss -നു',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY, A h:mm -നു',
LLLL : 'dddd, D MMMM YYYY, A h:mm -നു'
},
calendar : {
sameDay : '[ഇന്ന്] LT',
nextDay : '[നാളെ] LT',
nextWeek : 'dddd, LT',
lastDay : '[ഇന്നലെ] LT',
lastWeek : '[കഴിഞ്ഞ] dddd, LT',
sameElse : 'L'
},
relativeTime : {
future : '%s കഴിഞ്ഞ്',
past : '%s മുൻപ്',
s : 'അൽപ നിമിഷങ്ങൾ',
ss : '%d സെക്കൻഡ്',
m : 'ഒരു മിനിറ്റ്',
mm : '%d മിനിറ്റ്',
h : 'ഒരു മണിക്കൂർ',
hh : '%d മണിക്കൂർ',
d : 'ഒരു ദിവസം',
dd : '%d ദിവസം',
M : 'ഒരു മാസം',
MM : '%d മാസം',
y : 'ഒരു വർഷം',
yy : '%d വർഷം'
},
meridiemParse: /രാത്രി|രാവിലെ|ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി/i,
meridiemHour : function (hour, meridiem) {
if (hour === 12) {
hour = 0;
}
if ((meridiem === 'രാത്രി' && hour >= 4) ||
meridiem === 'ഉച്ച കഴിഞ്ഞ്' ||
meridiem === 'വൈകുന്നേരം') {
return hour + 12;
} else {
return hour;
}
},
meridiem : function (hour, minute, isLower) {
if (hour < 4) {
return 'രാത്രി';
} else if (hour < 12) {
return 'രാവിലെ';
} else if (hour < 17) {
return 'ഉച്ച കഴിഞ്ഞ്';
} else if (hour < 20) {
return 'വൈകുന്നേരം';
} else {
return 'രാത്രി';
}
}
});
return ml;
})));
/***/ }),
/* 261 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
function translate(number, withoutSuffix, key, isFuture) {
switch (key) {
case 's':
return withoutSuffix ? 'хэдхэн секунд' : 'хэдхэн секундын';
case 'ss':
return number + (withoutSuffix ? ' секунд' : ' секундын');
case 'm':
case 'mm':
return number + (withoutSuffix ? ' минут' : ' минутын');
case 'h':
case 'hh':
return number + (withoutSuffix ? ' цаг' : ' цагийн');
case 'd':
case 'dd':
return number + (withoutSuffix ? ' өдөр' : ' өдрийн');
case 'M':
case 'MM':
return number + (withoutSuffix ? ' сар' : ' сарын');
case 'y':
case 'yy':
return number + (withoutSuffix ? ' жил' : ' жилийн');
default:
return number;
}
}
var mn = moment.defineLocale('mn', {
months : 'Нэгдүгээр сар_Хоёрдугаар сар_Гуравдугаар сар_Дөрөвдүгээр сар_Тавдугаар сар_Зургадугаар сар_Долдугаар сар_Наймдугаар сар_Есдүгээр сар_Аравдугаар сар_Арван нэгдүгээр сар_Арван хоёрдугаар сар'.split('_'),
monthsShort : '1 сар_2 сар_3 сар_4 сар_5 сар_6 сар_7 сар_8 сар_9 сар_10 сар_11 сар_12 сар'.split('_'),
monthsParseExact : true,
weekdays : 'Ням_Даваа_Мягмар_Лхагва_Пүрэв_Баасан_Бямба'.split('_'),
weekdaysShort : 'Ням_Дав_Мяг_Лха_Пүр_Баа_Бям'.split('_'),
weekdaysMin : 'Ня_Да_Мя_Лх_Пү_Ба_Бя'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'YYYY-MM-DD',
LL : 'YYYY оны MMMMын D',
LLL : 'YYYY оны MMMMын D HH:mm',
LLLL : 'dddd, YYYY оны MMMMын D HH:mm'
},
meridiemParse: /ҮӨ|ҮХ/i,
isPM : function (input) {
return input === 'ҮХ';
},
meridiem : function (hour, minute, isLower) {
if (hour < 12) {
return 'ҮӨ';
} else {
return 'ҮХ';
}
},
calendar : {
sameDay : '[Өнөөдөр] LT',
nextDay : '[Маргааш] LT',
nextWeek : '[Ирэх] dddd LT',
lastDay : '[Өчигдөр] LT',
lastWeek : '[Өнгөрсөн] dddd LT',
sameElse : 'L'
},
relativeTime : {
future : '%s дараа',
past : '%s өмнө',
s : translate,
ss : translate,
m : translate,
mm : translate,
h : translate,
hh : translate,
d : translate,
dd : translate,
M : translate,
MM : translate,
y : translate,
yy : translate
},
dayOfMonthOrdinalParse: /\d{1,2} өдөр/,
ordinal : function (number, period) {
switch (period) {
case 'd':
case 'D':
case 'DDD':
return number + ' өдөр';
default:
return number;
}
}
});
return mn;
})));
/***/ }),
/* 262 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var symbolMap = {
'1': '१',
'2': '२',
'3': '३',
'4': '४',
'5': '५',
'6': '६',
'7': '७',
'8': '८',
'9': '९',
'0': '०'
},
numberMap = {
'१': '1',
'२': '2',
'३': '3',
'४': '4',
'५': '5',
'६': '6',
'७': '7',
'८': '8',
'९': '9',
'०': '0'
};
function relativeTimeMr(number, withoutSuffix, string, isFuture)
{
var output = '';
if (withoutSuffix) {
switch (string) {
case 's': output = 'काही सेकंद'; break;
case 'ss': output = '%d सेकंद'; break;
case 'm': output = 'एक मिनिट'; break;
case 'mm': output = '%d मिनिटे'; break;
case 'h': output = 'एक तास'; break;
case 'hh': output = '%d तास'; break;
case 'd': output = 'एक दिवस'; break;
case 'dd': output = '%d दिवस'; break;
case 'M': output = 'एक महिना'; break;
case 'MM': output = '%d महिने'; break;
case 'y': output = 'एक वर्ष'; break;
case 'yy': output = '%d वर्षे'; break;
}
}
else {
switch (string) {
case 's': output = 'काही सेकंदां'; break;
case 'ss': output = '%d सेकंदां'; break;
case 'm': output = 'एका मिनिटा'; break;
case 'mm': output = '%d मिनिटां'; break;
case 'h': output = 'एका तासा'; break;
case 'hh': output = '%d तासां'; break;
case 'd': output = 'एका दिवसा'; break;
case 'dd': output = '%d दिवसां'; break;
case 'M': output = 'एका महिन्या'; break;
case 'MM': output = '%d महिन्यां'; break;
case 'y': output = 'एका वर्षा'; break;
case 'yy': output = '%d वर्षां'; break;
}
}
return output.replace(/%d/i, number);
}
var mr = moment.defineLocale('mr', {
months : 'जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर'.split('_'),
monthsShort: 'जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.'.split('_'),
monthsParseExact : true,
weekdays : 'रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'),
weekdaysShort : 'रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि'.split('_'),
weekdaysMin : 'र_सो_मं_बु_गु_शु_श'.split('_'),
longDateFormat : {
LT : 'A h:mm वाजता',
LTS : 'A h:mm:ss वाजता',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY, A h:mm वाजता',
LLLL : 'dddd, D MMMM YYYY, A h:mm वाजता'
},
calendar : {
sameDay : '[आज] LT',
nextDay : '[उद्या] LT',
nextWeek : 'dddd, LT',
lastDay : '[काल] LT',
lastWeek: '[मागील] dddd, LT',
sameElse : 'L'
},
relativeTime : {
future: '%sमध्ये',
past: '%sपूर्वी',
s: relativeTimeMr,
ss: relativeTimeMr,
m: relativeTimeMr,
mm: relativeTimeMr,
h: relativeTimeMr,
hh: relativeTimeMr,
d: relativeTimeMr,
dd: relativeTimeMr,
M: relativeTimeMr,
MM: relativeTimeMr,
y: relativeTimeMr,
yy: relativeTimeMr
},
preparse: function (string) {
return string.replace(/[१२३४५६७८९०]/g, function (match) {
return numberMap[match];
});
},
postformat: function (string) {
return string.replace(/\d/g, function (match) {
return symbolMap[match];
});
},
meridiemParse: /रात्री|सकाळी|दुपारी|सायंकाळी/,
meridiemHour : function (hour, meridiem) {
if (hour === 12) {
hour = 0;
}
if (meridiem === 'रात्री') {
return hour < 4 ? hour : hour + 12;
} else if (meridiem === 'सकाळी') {
return hour;
} else if (meridiem === 'दुपारी') {
return hour >= 10 ? hour : hour + 12;
} else if (meridiem === 'सायंकाळी') {
return hour + 12;
}
},
meridiem: function (hour, minute, isLower) {
if (hour < 4) {
return 'रात्री';
} else if (hour < 10) {
return 'सकाळी';
} else if (hour < 17) {
return 'दुपारी';
} else if (hour < 20) {
return 'सायंकाळी';
} else {
return 'रात्री';
}
},
week : {
dow : 0, // Sunday is the first day of the week.
doy : 6 // The week that contains Jan 1st is the first week of the year.
}
});
return mr;
})));
/***/ }),
/* 263 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var ms = moment.defineLocale('ms', {
months : 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split('_'),
monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'),
weekdays : 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'),
weekdaysShort : 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'),
weekdaysMin : 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'),
longDateFormat : {
LT : 'HH.mm',
LTS : 'HH.mm.ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY [pukul] HH.mm',
LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm'
},
meridiemParse: /pagi|tengahari|petang|malam/,
meridiemHour: function (hour, meridiem) {
if (hour === 12) {
hour = 0;
}
if (meridiem === 'pagi') {
return hour;
} else if (meridiem === 'tengahari') {
return hour >= 11 ? hour : hour + 12;
} else if (meridiem === 'petang' || meridiem === 'malam') {
return hour + 12;
}
},
meridiem : function (hours, minutes, isLower) {
if (hours < 11) {
return 'pagi';
} else if (hours < 15) {
return 'tengahari';
} else if (hours < 19) {
return 'petang';
} else {
return 'malam';
}
},
calendar : {
sameDay : '[Hari ini pukul] LT',
nextDay : '[Esok pukul] LT',
nextWeek : 'dddd [pukul] LT',
lastDay : '[Kelmarin pukul] LT',
lastWeek : 'dddd [lepas pukul] LT',
sameElse : 'L'
},
relativeTime : {
future : 'dalam %s',
past : '%s yang lepas',
s : 'beberapa saat',
ss : '%d saat',
m : 'seminit',
mm : '%d minit',
h : 'sejam',
hh : '%d jam',
d : 'sehari',
dd : '%d hari',
M : 'sebulan',
MM : '%d bulan',
y : 'setahun',
yy : '%d tahun'
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
return ms;
})));
/***/ }),
/* 264 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var msMy = moment.defineLocale('ms-my', {
months : 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split('_'),
monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'),
weekdays : 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'),
weekdaysShort : 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'),
weekdaysMin : 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'),
longDateFormat : {
LT : 'HH.mm',
LTS : 'HH.mm.ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY [pukul] HH.mm',
LLLL : 'dddd, D MMMM YYYY [pukul] HH.mm'
},
meridiemParse: /pagi|tengahari|petang|malam/,
meridiemHour: function (hour, meridiem) {
if (hour === 12) {
hour = 0;
}
if (meridiem === 'pagi') {
return hour;
} else if (meridiem === 'tengahari') {
return hour >= 11 ? hour : hour + 12;
} else if (meridiem === 'petang' || meridiem === 'malam') {
return hour + 12;
}
},
meridiem : function (hours, minutes, isLower) {
if (hours < 11) {
return 'pagi';
} else if (hours < 15) {
return 'tengahari';
} else if (hours < 19) {
return 'petang';
} else {
return 'malam';
}
},
calendar : {
sameDay : '[Hari ini pukul] LT',
nextDay : '[Esok pukul] LT',
nextWeek : 'dddd [pukul] LT',
lastDay : '[Kelmarin pukul] LT',
lastWeek : 'dddd [lepas pukul] LT',
sameElse : 'L'
},
relativeTime : {
future : 'dalam %s',
past : '%s yang lepas',
s : 'beberapa saat',
ss : '%d saat',
m : 'seminit',
mm : '%d minit',
h : 'sejam',
hh : '%d jam',
d : 'sehari',
dd : '%d hari',
M : 'sebulan',
MM : '%d bulan',
y : 'setahun',
yy : '%d tahun'
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
return msMy;
})));
/***/ }),
/* 265 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var mt = moment.defineLocale('mt', {
months : 'Jannar_Frar_Marzu_April_Mejju_Ġunju_Lulju_Awwissu_Settembru_Ottubru_Novembru_Diċembru'.split('_'),
monthsShort : 'Jan_Fra_Mar_Apr_Mej_Ġun_Lul_Aww_Set_Ott_Nov_Diċ'.split('_'),
weekdays : 'Il-Ħadd_It-Tnejn_It-Tlieta_L-Erbgħa_Il-Ħamis_Il-Ġimgħa_Is-Sibt'.split('_'),
weekdaysShort : 'Ħad_Tne_Tli_Erb_Ħam_Ġim_Sib'.split('_'),
weekdaysMin : 'Ħa_Tn_Tl_Er_Ħa_Ġi_Si'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd, D MMMM YYYY HH:mm'
},
calendar : {
sameDay : '[Illum fil-]LT',
nextDay : '[Għada fil-]LT',
nextWeek : 'dddd [fil-]LT',
lastDay : '[Il-bieraħ fil-]LT',
lastWeek : 'dddd [li għadda] [fil-]LT',
sameElse : 'L'
},
relativeTime : {
future : 'f’ %s',
past : '%s ilu',
s : 'ftit sekondi',
ss : '%d sekondi',
m : 'minuta',
mm : '%d minuti',
h : 'siegħa',
hh : '%d siegħat',
d : 'ġurnata',
dd : '%d ġranet',
M : 'xahar',
MM : '%d xhur',
y : 'sena',
yy : '%d sni'
},
dayOfMonthOrdinalParse : /\d{1,2}º/,
ordinal: '%dº',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return mt;
})));
/***/ }),
/* 266 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var symbolMap = {
'1': '၁',
'2': '၂',
'3': '၃',
'4': '၄',
'5': '၅',
'6': '၆',
'7': '၇',
'8': '၈',
'9': '၉',
'0': '၀'
}, numberMap = {
'၁': '1',
'၂': '2',
'၃': '3',
'၄': '4',
'၅': '5',
'၆': '6',
'၇': '7',
'၈': '8',
'၉': '9',
'၀': '0'
};
var my = moment.defineLocale('my', {
months: 'ဇန်နဝါရီ_ဖေဖော်ဝါရီ_မတ်_ဧပြီ_မေ_ဇွန်_ဇူလိုင်_သြဂုတ်_စက်တင်ဘာ_အောက်တိုဘာ_နိုဝင်ဘာ_ဒီဇင်ဘာ'.split('_'),
monthsShort: 'ဇန်_ဖေ_မတ်_ပြီ_မေ_ဇွန်_လိုင်_သြ_စက်_အောက်_နို_ဒီ'.split('_'),
weekdays: 'တနင်္ဂနွေ_တနင်္လာ_အင်္ဂါ_ဗုဒ္ဓဟူး_ကြာသပတေး_သောကြာ_စနေ'.split('_'),
weekdaysShort: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'),
weekdaysMin: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'),
longDateFormat: {
LT: 'HH:mm',
LTS: 'HH:mm:ss',
L: 'DD/MM/YYYY',
LL: 'D MMMM YYYY',
LLL: 'D MMMM YYYY HH:mm',
LLLL: 'dddd D MMMM YYYY HH:mm'
},
calendar: {
sameDay: '[ယနေ.] LT [မှာ]',
nextDay: '[မနက်ဖြန်] LT [မှာ]',
nextWeek: 'dddd LT [မှာ]',
lastDay: '[မနေ.က] LT [မှာ]',
lastWeek: '[ပြီးခဲ့သော] dddd LT [မှာ]',
sameElse: 'L'
},
relativeTime: {
future: 'လာမည့် %s မှာ',
past: 'လွန်ခဲ့သော %s က',
s: 'စက္ကန်.အနည်းငယ်',
ss : '%d စက္ကန့်',
m: 'တစ်မိနစ်',
mm: '%d မိနစ်',
h: 'တစ်နာရီ',
hh: '%d နာရီ',
d: 'တစ်ရက်',
dd: '%d ရက်',
M: 'တစ်လ',
MM: '%d လ',
y: 'တစ်နှစ်',
yy: '%d နှစ်'
},
preparse: function (string) {
return string.replace(/[၁၂၃၄၅၆၇၈၉၀]/g, function (match) {
return numberMap[match];
});
},
postformat: function (string) {
return string.replace(/\d/g, function (match) {
return symbolMap[match];
});
},
week: {
dow: 1, // Monday is the first day of the week.
doy: 4 // The week that contains Jan 1st is the first week of the year.
}
});
return my;
})));
/***/ }),
/* 267 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var nb = moment.defineLocale('nb', {
months : 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split('_'),
monthsShort : 'jan._feb._mars_april_mai_juni_juli_aug._sep._okt._nov._des.'.split('_'),
monthsParseExact : true,
weekdays : 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'),
weekdaysShort : 'sø._ma._ti._on._to._fr._lø.'.split('_'),
weekdaysMin : 'sø_ma_ti_on_to_fr_lø'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D. MMMM YYYY',
LLL : 'D. MMMM YYYY [kl.] HH:mm',
LLLL : 'dddd D. MMMM YYYY [kl.] HH:mm'
},
calendar : {
sameDay: '[i dag kl.] LT',
nextDay: '[i morgen kl.] LT',
nextWeek: 'dddd [kl.] LT',
lastDay: '[i går kl.] LT',
lastWeek: '[forrige] dddd [kl.] LT',
sameElse: 'L'
},
relativeTime : {
future : 'om %s',
past : '%s siden',
s : 'noen sekunder',
ss : '%d sekunder',
m : 'ett minutt',
mm : '%d minutter',
h : 'en time',
hh : '%d timer',
d : 'en dag',
dd : '%d dager',
M : 'en måned',
MM : '%d måneder',
y : 'ett år',
yy : '%d år'
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return nb;
})));
/***/ }),
/* 268 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var symbolMap = {
'1': '१',
'2': '२',
'3': '३',
'4': '४',
'5': '५',
'6': '६',
'7': '७',
'8': '८',
'9': '९',
'0': '०'
},
numberMap = {
'१': '1',
'२': '2',
'३': '3',
'४': '4',
'५': '5',
'६': '6',
'७': '7',
'८': '8',
'९': '9',
'०': '0'
};
var ne = moment.defineLocale('ne', {
months : 'जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर'.split('_'),
monthsShort : 'जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.'.split('_'),
monthsParseExact : true,
weekdays : 'आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार'.split('_'),
weekdaysShort : 'आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.'.split('_'),
weekdaysMin : 'आ._सो._मं._बु._बि._शु._श.'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'Aको h:mm बजे',
LTS : 'Aको h:mm:ss बजे',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY, Aको h:mm बजे',
LLLL : 'dddd, D MMMM YYYY, Aको h:mm बजे'
},
preparse: function (string) {
return string.replace(/[१२३४५६७८९०]/g, function (match) {
return numberMap[match];
});
},
postformat: function (string) {
return string.replace(/\d/g, function (match) {
return symbolMap[match];
});
},
meridiemParse: /राति|बिहान|दिउँसो|साँझ/,
meridiemHour : function (hour, meridiem) {
if (hour === 12) {
hour = 0;
}
if (meridiem === 'राति') {
return hour < 4 ? hour : hour + 12;
} else if (meridiem === 'बिहान') {
return hour;
} else if (meridiem === 'दिउँसो') {
return hour >= 10 ? hour : hour + 12;
} else if (meridiem === 'साँझ') {
return hour + 12;
}
},
meridiem : function (hour, minute, isLower) {
if (hour < 3) {
return 'राति';
} else if (hour < 12) {
return 'बिहान';
} else if (hour < 16) {
return 'दिउँसो';
} else if (hour < 20) {
return 'साँझ';
} else {
return 'राति';
}
},
calendar : {
sameDay : '[आज] LT',
nextDay : '[भोलि] LT',
nextWeek : '[आउँदो] dddd[,] LT',
lastDay : '[हिजो] LT',
lastWeek : '[गएको] dddd[,] LT',
sameElse : 'L'
},
relativeTime : {
future : '%sमा',
past : '%s अगाडि',
s : 'केही क्षण',
ss : '%d सेकेण्ड',
m : 'एक मिनेट',
mm : '%d मिनेट',
h : 'एक घण्टा',
hh : '%d घण्टा',
d : 'एक दिन',
dd : '%d दिन',
M : 'एक महिना',
MM : '%d महिना',
y : 'एक बर्ष',
yy : '%d बर्ष'
},
week : {
dow : 0, // Sunday is the first day of the week.
doy : 6 // The week that contains Jan 1st is the first week of the year.
}
});
return ne;
})));
/***/ }),
/* 269 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var monthsShortWithDots = 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split('_'),
monthsShortWithoutDots = 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_');
var monthsParse = [/^jan/i, /^feb/i, /^maart|mrt.?$/i, /^apr/i, /^mei$/i, /^jun[i.]?$/i, /^jul[i.]?$/i, /^aug/i, /^sep/i, /^okt/i, /^nov/i, /^dec/i];
var monthsRegex = /^(januari|februari|maart|april|mei|april|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;
var nl = moment.defineLocale('nl', {
months : 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split('_'),
monthsShort : function (m, format) {
if (!m) {
return monthsShortWithDots;
} else if (/-MMM-/.test(format)) {
return monthsShortWithoutDots[m.month()];
} else {
return monthsShortWithDots[m.month()];
}
},
monthsRegex: monthsRegex,
monthsShortRegex: monthsRegex,
monthsStrictRegex: /^(januari|februari|maart|mei|ju[nl]i|april|augustus|september|oktober|november|december)/i,
monthsShortStrictRegex: /^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,
monthsParse : monthsParse,
longMonthsParse : monthsParse,
shortMonthsParse : monthsParse,
weekdays : 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split('_'),
weekdaysShort : 'zo._ma._di._wo._do._vr._za.'.split('_'),
weekdaysMin : 'zo_ma_di_wo_do_vr_za'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD-MM-YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd D MMMM YYYY HH:mm'
},
calendar : {
sameDay: '[vandaag om] LT',
nextDay: '[morgen om] LT',
nextWeek: 'dddd [om] LT',
lastDay: '[gisteren om] LT',
lastWeek: '[afgelopen] dddd [om] LT',
sameElse: 'L'
},
relativeTime : {
future : 'over %s',
past : '%s geleden',
s : 'een paar seconden',
ss : '%d seconden',
m : 'één minuut',
mm : '%d minuten',
h : 'één uur',
hh : '%d uur',
d : 'één dag',
dd : '%d dagen',
M : 'één maand',
MM : '%d maanden',
y : 'één jaar',
yy : '%d jaar'
},
dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/,
ordinal : function (number) {
return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de');
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return nl;
})));
/***/ }),
/* 270 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var monthsShortWithDots = 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split('_'),
monthsShortWithoutDots = 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_');
var monthsParse = [/^jan/i, /^feb/i, /^maart|mrt.?$/i, /^apr/i, /^mei$/i, /^jun[i.]?$/i, /^jul[i.]?$/i, /^aug/i, /^sep/i, /^okt/i, /^nov/i, /^dec/i];
var monthsRegex = /^(januari|februari|maart|april|mei|april|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;
var nlBe = moment.defineLocale('nl-be', {
months : 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split('_'),
monthsShort : function (m, format) {
if (!m) {
return monthsShortWithDots;
} else if (/-MMM-/.test(format)) {
return monthsShortWithoutDots[m.month()];
} else {
return monthsShortWithDots[m.month()];
}
},
monthsRegex: monthsRegex,
monthsShortRegex: monthsRegex,
monthsStrictRegex: /^(januari|februari|maart|mei|ju[nl]i|april|augustus|september|oktober|november|december)/i,
monthsShortStrictRegex: /^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,
monthsParse : monthsParse,
longMonthsParse : monthsParse,
shortMonthsParse : monthsParse,
weekdays : 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split('_'),
weekdaysShort : 'zo._ma._di._wo._do._vr._za.'.split('_'),
weekdaysMin : 'zo_ma_di_wo_do_vr_za'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd D MMMM YYYY HH:mm'
},
calendar : {
sameDay: '[vandaag om] LT',
nextDay: '[morgen om] LT',
nextWeek: 'dddd [om] LT',
lastDay: '[gisteren om] LT',
lastWeek: '[afgelopen] dddd [om] LT',
sameElse: 'L'
},
relativeTime : {
future : 'over %s',
past : '%s geleden',
s : 'een paar seconden',
ss : '%d seconden',
m : 'één minuut',
mm : '%d minuten',
h : 'één uur',
hh : '%d uur',
d : 'één dag',
dd : '%d dagen',
M : 'één maand',
MM : '%d maanden',
y : 'één jaar',
yy : '%d jaar'
},
dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/,
ordinal : function (number) {
return number + ((number === 1 || number === 8 || number >= 20) ? 'ste' : 'de');
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return nlBe;
})));
/***/ }),
/* 271 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var nn = moment.defineLocale('nn', {
months : 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split('_'),
monthsShort : 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'),
weekdays : 'sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag'.split('_'),
weekdaysShort : 'sun_mån_tys_ons_tor_fre_lau'.split('_'),
weekdaysMin : 'su_må_ty_on_to_fr_lø'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D. MMMM YYYY',
LLL : 'D. MMMM YYYY [kl.] H:mm',
LLLL : 'dddd D. MMMM YYYY [kl.] HH:mm'
},
calendar : {
sameDay: '[I dag klokka] LT',
nextDay: '[I morgon klokka] LT',
nextWeek: 'dddd [klokka] LT',
lastDay: '[I går klokka] LT',
lastWeek: '[Føregåande] dddd [klokka] LT',
sameElse: 'L'
},
relativeTime : {
future : 'om %s',
past : '%s sidan',
s : 'nokre sekund',
ss : '%d sekund',
m : 'eit minutt',
mm : '%d minutt',
h : 'ein time',
hh : '%d timar',
d : 'ein dag',
dd : '%d dagar',
M : 'ein månad',
MM : '%d månader',
y : 'eit år',
yy : '%d år'
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return nn;
})));
/***/ }),
/* 272 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var symbolMap = {
'1': '੧',
'2': '੨',
'3': '੩',
'4': '੪',
'5': '੫',
'6': '੬',
'7': '੭',
'8': '੮',
'9': '੯',
'0': '੦'
},
numberMap = {
'੧': '1',
'੨': '2',
'੩': '3',
'੪': '4',
'੫': '5',
'੬': '6',
'੭': '7',
'੮': '8',
'੯': '9',
'੦': '0'
};
var paIn = moment.defineLocale('pa-in', {
// There are months name as per Nanakshahi Calender but they are not used as rigidly in modern Punjabi.
months : 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split('_'),
monthsShort : 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split('_'),
weekdays : 'ਐਤਵਾਰ_ਸੋਮਵਾਰ_ਮੰਗਲਵਾਰ_ਬੁਧਵਾਰ_ਵੀਰਵਾਰ_ਸ਼ੁੱਕਰਵਾਰ_ਸ਼ਨੀਚਰਵਾਰ'.split('_'),
weekdaysShort : 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'),
weekdaysMin : 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'),
longDateFormat : {
LT : 'A h:mm ਵਜੇ',
LTS : 'A h:mm:ss ਵਜੇ',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY, A h:mm ਵਜੇ',
LLLL : 'dddd, D MMMM YYYY, A h:mm ਵਜੇ'
},
calendar : {
sameDay : '[ਅਜ] LT',
nextDay : '[ਕਲ] LT',
nextWeek : 'dddd, LT',
lastDay : '[ਕਲ] LT',
lastWeek : '[ਪਿਛਲੇ] dddd, LT',
sameElse : 'L'
},
relativeTime : {
future : '%s ਵਿੱਚ',
past : '%s ਪਿਛਲੇ',
s : 'ਕੁਝ ਸਕਿੰਟ',
ss : '%d ਸਕਿੰਟ',
m : 'ਇਕ ਮਿੰਟ',
mm : '%d ਮਿੰਟ',
h : 'ਇੱਕ ਘੰਟਾ',
hh : '%d ਘੰਟੇ',
d : 'ਇੱਕ ਦਿਨ',
dd : '%d ਦਿਨ',
M : 'ਇੱਕ ਮਹੀਨਾ',
MM : '%d ਮਹੀਨੇ',
y : 'ਇੱਕ ਸਾਲ',
yy : '%d ਸਾਲ'
},
preparse: function (string) {
return string.replace(/[੧੨੩੪੫੬੭੮੯੦]/g, function (match) {
return numberMap[match];
});
},
postformat: function (string) {
return string.replace(/\d/g, function (match) {
return symbolMap[match];
});
},
// Punjabi notation for meridiems are quite fuzzy in practice. While there exists
// a rigid notion of a 'Pahar' it is not used as rigidly in modern Punjabi.
meridiemParse: /ਰਾਤ|ਸਵੇਰ|ਦੁਪਹਿਰ|ਸ਼ਾਮ/,
meridiemHour : function (hour, meridiem) {
if (hour === 12) {
hour = 0;
}
if (meridiem === 'ਰਾਤ') {
return hour < 4 ? hour : hour + 12;
} else if (meridiem === 'ਸਵੇਰ') {
return hour;
} else if (meridiem === 'ਦੁਪਹਿਰ') {
return hour >= 10 ? hour : hour + 12;
} else if (meridiem === 'ਸ਼ਾਮ') {
return hour + 12;
}
},
meridiem : function (hour, minute, isLower) {
if (hour < 4) {
return 'ਰਾਤ';
} else if (hour < 10) {
return 'ਸਵੇਰ';
} else if (hour < 17) {
return 'ਦੁਪਹਿਰ';
} else if (hour < 20) {
return 'ਸ਼ਾਮ';
} else {
return 'ਰਾਤ';
}
},
week : {
dow : 0, // Sunday is the first day of the week.
doy : 6 // The week that contains Jan 1st is the first week of the year.
}
});
return paIn;
})));
/***/ }),
/* 273 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var monthsNominative = 'styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień'.split('_'),
monthsSubjective = 'stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia'.split('_');
function plural(n) {
return (n % 10 < 5) && (n % 10 > 1) && ((~~(n / 10) % 10) !== 1);
}
function translate(number, withoutSuffix, key) {
var result = number + ' ';
switch (key) {
case 'ss':
return result + (plural(number) ? 'sekundy' : 'sekund');
case 'm':
return withoutSuffix ? 'minuta' : 'minutę';
case 'mm':
return result + (plural(number) ? 'minuty' : 'minut');
case 'h':
return withoutSuffix ? 'godzina' : 'godzinę';
case 'hh':
return result + (plural(number) ? 'godziny' : 'godzin');
case 'MM':
return result + (plural(number) ? 'miesiące' : 'miesięcy');
case 'yy':
return result + (plural(number) ? 'lata' : 'lat');
}
}
var pl = moment.defineLocale('pl', {
months : function (momentToFormat, format) {
if (!momentToFormat) {
return monthsNominative;
} else if (format === '') {
// Hack: if format empty we know this is used to generate
// RegExp by moment. Give then back both valid forms of months
// in RegExp ready format.
return '(' + monthsSubjective[momentToFormat.month()] + '|' + monthsNominative[momentToFormat.month()] + ')';
} else if (/D MMMM/.test(format)) {
return monthsSubjective[momentToFormat.month()];
} else {
return monthsNominative[momentToFormat.month()];
}
},
monthsShort : 'sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru'.split('_'),
weekdays : 'niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota'.split('_'),
weekdaysShort : 'ndz_pon_wt_śr_czw_pt_sob'.split('_'),
weekdaysMin : 'Nd_Pn_Wt_Śr_Cz_Pt_So'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd, D MMMM YYYY HH:mm'
},
calendar : {
sameDay: '[Dziś o] LT',
nextDay: '[Jutro o] LT',
nextWeek: function () {
switch (this.day()) {
case 0:
return '[W niedzielę o] LT';
case 2:
return '[We wtorek o] LT';
case 3:
return '[W środę o] LT';
case 6:
return '[W sobotę o] LT';
default:
return '[W] dddd [o] LT';
}
},
lastDay: '[Wczoraj o] LT',
lastWeek: function () {
switch (this.day()) {
case 0:
return '[W zeszłą niedzielę o] LT';
case 3:
return '[W zeszłą środę o] LT';
case 6:
return '[W zeszłą sobotę o] LT';
default:
return '[W zeszły] dddd [o] LT';
}
},
sameElse: 'L'
},
relativeTime : {
future : 'za %s',
past : '%s temu',
s : 'kilka sekund',
ss : translate,
m : translate,
mm : translate,
h : translate,
hh : translate,
d : '1 dzień',
dd : '%d dni',
M : 'miesiąc',
MM : translate,
y : 'rok',
yy : translate
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return pl;
})));
/***/ }),
/* 274 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var pt = moment.defineLocale('pt', {
months : 'janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro'.split('_'),
monthsShort : 'jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez'.split('_'),
weekdays : 'Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado'.split('_'),
weekdaysShort : 'Dom_Seg_Ter_Qua_Qui_Sex_Sáb'.split('_'),
weekdaysMin : 'Do_2ª_3ª_4ª_5ª_6ª_Sá'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D [de] MMMM [de] YYYY',
LLL : 'D [de] MMMM [de] YYYY HH:mm',
LLLL : 'dddd, D [de] MMMM [de] YYYY HH:mm'
},
calendar : {
sameDay: '[Hoje às] LT',
nextDay: '[Amanhã às] LT',
nextWeek: 'dddd [às] LT',
lastDay: '[Ontem às] LT',
lastWeek: function () {
return (this.day() === 0 || this.day() === 6) ?
'[Último] dddd [às] LT' : // Saturday + Sunday
'[Última] dddd [às] LT'; // Monday - Friday
},
sameElse: 'L'
},
relativeTime : {
future : 'em %s',
past : 'há %s',
s : 'segundos',
ss : '%d segundos',
m : 'um minuto',
mm : '%d minutos',
h : 'uma hora',
hh : '%d horas',
d : 'um dia',
dd : '%d dias',
M : 'um mês',
MM : '%d meses',
y : 'um ano',
yy : '%d anos'
},
dayOfMonthOrdinalParse: /\d{1,2}º/,
ordinal : '%dº',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return pt;
})));
/***/ }),
/* 275 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var ptBr = moment.defineLocale('pt-br', {
months : 'janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro'.split('_'),
monthsShort : 'jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez'.split('_'),
weekdays : 'Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado'.split('_'),
weekdaysShort : 'Dom_Seg_Ter_Qua_Qui_Sex_Sáb'.split('_'),
weekdaysMin : 'Do_2ª_3ª_4ª_5ª_6ª_Sá'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D [de] MMMM [de] YYYY',
LLL : 'D [de] MMMM [de] YYYY [às] HH:mm',
LLLL : 'dddd, D [de] MMMM [de] YYYY [às] HH:mm'
},
calendar : {
sameDay: '[Hoje às] LT',
nextDay: '[Amanhã às] LT',
nextWeek: 'dddd [às] LT',
lastDay: '[Ontem às] LT',
lastWeek: function () {
return (this.day() === 0 || this.day() === 6) ?
'[Último] dddd [às] LT' : // Saturday + Sunday
'[Última] dddd [às] LT'; // Monday - Friday
},
sameElse: 'L'
},
relativeTime : {
future : 'em %s',
past : 'há %s',
s : 'poucos segundos',
ss : '%d segundos',
m : 'um minuto',
mm : '%d minutos',
h : 'uma hora',
hh : '%d horas',
d : 'um dia',
dd : '%d dias',
M : 'um mês',
MM : '%d meses',
y : 'um ano',
yy : '%d anos'
},
dayOfMonthOrdinalParse: /\d{1,2}º/,
ordinal : '%dº'
});
return ptBr;
})));
/***/ }),
/* 276 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
function relativeTimeWithPlural(number, withoutSuffix, key) {
var format = {
'ss': 'secunde',
'mm': 'minute',
'hh': 'ore',
'dd': 'zile',
'MM': 'luni',
'yy': 'ani'
},
separator = ' ';
if (number % 100 >= 20 || (number >= 100 && number % 100 === 0)) {
separator = ' de ';
}
return number + separator + format[key];
}
var ro = moment.defineLocale('ro', {
months : 'ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie'.split('_'),
monthsShort : 'ian._febr._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.'.split('_'),
monthsParseExact: true,
weekdays : 'duminică_luni_marți_miercuri_joi_vineri_sâmbătă'.split('_'),
weekdaysShort : 'Dum_Lun_Mar_Mie_Joi_Vin_Sâm'.split('_'),
weekdaysMin : 'Du_Lu_Ma_Mi_Jo_Vi_Sâ'.split('_'),
longDateFormat : {
LT : 'H:mm',
LTS : 'H:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY H:mm',
LLLL : 'dddd, D MMMM YYYY H:mm'
},
calendar : {
sameDay: '[azi la] LT',
nextDay: '[mâine la] LT',
nextWeek: 'dddd [la] LT',
lastDay: '[ieri la] LT',
lastWeek: '[fosta] dddd [la] LT',
sameElse: 'L'
},
relativeTime : {
future : 'peste %s',
past : '%s în urmă',
s : 'câteva secunde',
ss : relativeTimeWithPlural,
m : 'un minut',
mm : relativeTimeWithPlural,
h : 'o oră',
hh : relativeTimeWithPlural,
d : 'o zi',
dd : relativeTimeWithPlural,
M : 'o lună',
MM : relativeTimeWithPlural,
y : 'un an',
yy : relativeTimeWithPlural
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
return ro;
})));
/***/ }),
/* 277 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
function plural(word, num) {
var forms = word.split('_');
return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]);
}
function relativeTimeWithPlural(number, withoutSuffix, key) {
var format = {
'ss': withoutSuffix ? 'секунда_секунды_секунд' : 'секунду_секунды_секунд',
'mm': withoutSuffix ? 'минута_минуты_минут' : 'минуту_минуты_минут',
'hh': 'час_часа_часов',
'dd': 'день_дня_дней',
'MM': 'месяц_месяца_месяцев',
'yy': 'год_года_лет'
};
if (key === 'm') {
return withoutSuffix ? 'минута' : 'минуту';
}
else {
return number + ' ' + plural(format[key], +number);
}
}
var monthsParse = [/^янв/i, /^фев/i, /^мар/i, /^апр/i, /^ма[йя]/i, /^июн/i, /^июл/i, /^авг/i, /^сен/i, /^окт/i, /^ноя/i, /^дек/i];
// http://new.gramota.ru/spravka/rules/139-prop : § 103
// Сокращения месяцев: http://new.gramota.ru/spravka/buro/search-answer?s=242637
// CLDR data: http://www.unicode.org/cldr/charts/28/summary/ru.html#1753
var ru = moment.defineLocale('ru', {
months : {
format: 'января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря'.split('_'),
standalone: 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split('_')
},
monthsShort : {
// по CLDR именно "июл." и "июн.", но какой смысл менять букву на точку ?
format: 'янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.'.split('_'),
standalone: 'янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.'.split('_')
},
weekdays : {
standalone: 'воскресенье_понедельник_вторник_среда_четверг_пятница_суббота'.split('_'),
format: 'воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу'.split('_'),
isFormat: /\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?\] ?dddd/
},
weekdaysShort : 'вс_пн_вт_ср_чт_пт_сб'.split('_'),
weekdaysMin : 'вс_пн_вт_ср_чт_пт_сб'.split('_'),
monthsParse : monthsParse,
longMonthsParse : monthsParse,
shortMonthsParse : monthsParse,
// полные названия с падежами, по три буквы, для некоторых, по 4 буквы, сокращения с точкой и без точки
monthsRegex: /^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i,
// копия предыдущего
monthsShortRegex: /^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i,
// полные названия с падежами
monthsStrictRegex: /^(январ[яь]|феврал[яь]|марта?|апрел[яь]|ма[яй]|июн[яь]|июл[яь]|августа?|сентябр[яь]|октябр[яь]|ноябр[яь]|декабр[яь])/i,
// Выражение, которое соотвествует только сокращённым формам
monthsShortStrictRegex: /^(янв\.|февр?\.|мар[т.]|апр\.|ма[яй]|июн[ья.]|июл[ья.]|авг\.|сент?\.|окт\.|нояб?\.|дек\.)/i,
longDateFormat : {
LT : 'H:mm',
LTS : 'H:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D MMMM YYYY г.',
LLL : 'D MMMM YYYY г., H:mm',
LLLL : 'dddd, D MMMM YYYY г., H:mm'
},
calendar : {
sameDay: '[Сегодня, в] LT',
nextDay: '[Завтра, в] LT',
lastDay: '[Вчера, в] LT',
nextWeek: function (now) {
if (now.week() !== this.week()) {
switch (this.day()) {
case 0:
return '[В следующее] dddd, [в] LT';
case 1:
case 2:
case 4:
return '[В следующий] dddd, [в] LT';
case 3:
case 5:
case 6:
return '[В следующую] dddd, [в] LT';
}
} else {
if (this.day() === 2) {
return '[Во] dddd, [в] LT';
} else {
return '[В] dddd, [в] LT';
}
}
},
lastWeek: function (now) {
if (now.week() !== this.week()) {
switch (this.day()) {
case 0:
return '[В прошлое] dddd, [в] LT';
case 1:
case 2:
case 4:
return '[В прошлый] dddd, [в] LT';
case 3:
case 5:
case 6:
return '[В прошлую] dddd, [в] LT';
}
} else {
if (this.day() === 2) {
return '[Во] dddd, [в] LT';
} else {
return '[В] dddd, [в] LT';
}
}
},
sameElse: 'L'
},
relativeTime : {
future : 'через %s',
past : '%s назад',
s : 'несколько секунд',
ss : relativeTimeWithPlural,
m : relativeTimeWithPlural,
mm : relativeTimeWithPlural,
h : 'час',
hh : relativeTimeWithPlural,
d : 'день',
dd : relativeTimeWithPlural,
M : 'месяц',
MM : relativeTimeWithPlural,
y : 'год',
yy : relativeTimeWithPlural
},
meridiemParse: /ночи|утра|дня|вечера/i,
isPM : function (input) {
return /^(дня|вечера)$/.test(input);
},
meridiem : function (hour, minute, isLower) {
if (hour < 4) {
return 'ночи';
} else if (hour < 12) {
return 'утра';
} else if (hour < 17) {
return 'дня';
} else {
return 'вечера';
}
},
dayOfMonthOrdinalParse: /\d{1,2}-(й|го|я)/,
ordinal: function (number, period) {
switch (period) {
case 'M':
case 'd':
case 'DDD':
return number + '-й';
case 'D':
return number + '-го';
case 'w':
case 'W':
return number + '-я';
default:
return number;
}
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return ru;
})));
/***/ }),
/* 278 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var months = [
'جنوري',
'فيبروري',
'مارچ',
'اپريل',
'مئي',
'جون',
'جولاءِ',
'آگسٽ',
'سيپٽمبر',
'آڪٽوبر',
'نومبر',
'ڊسمبر'
];
var days = [
'آچر',
'سومر',
'اڱارو',
'اربع',
'خميس',
'جمع',
'ڇنڇر'
];
var sd = moment.defineLocale('sd', {
months : months,
monthsShort : months,
weekdays : days,
weekdaysShort : days,
weekdaysMin : days,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd، D MMMM YYYY HH:mm'
},
meridiemParse: /صبح|شام/,
isPM : function (input) {
return 'شام' === input;
},
meridiem : function (hour, minute, isLower) {
if (hour < 12) {
return 'صبح';
}
return 'شام';
},
calendar : {
sameDay : '[اڄ] LT',
nextDay : '[سڀاڻي] LT',
nextWeek : 'dddd [اڳين هفتي تي] LT',
lastDay : '[ڪالهه] LT',
lastWeek : '[گزريل هفتي] dddd [تي] LT',
sameElse : 'L'
},
relativeTime : {
future : '%s پوء',
past : '%s اڳ',
s : 'چند سيڪنڊ',
ss : '%d سيڪنڊ',
m : 'هڪ منٽ',
mm : '%d منٽ',
h : 'هڪ ڪلاڪ',
hh : '%d ڪلاڪ',
d : 'هڪ ڏينهن',
dd : '%d ڏينهن',
M : 'هڪ مهينو',
MM : '%d مهينا',
y : 'هڪ سال',
yy : '%d سال'
},
preparse: function (string) {
return string.replace(/،/g, ',');
},
postformat: function (string) {
return string.replace(/,/g, '،');
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return sd;
})));
/***/ }),
/* 279 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var se = moment.defineLocale('se', {
months : 'ođđajagemánnu_guovvamánnu_njukčamánnu_cuoŋománnu_miessemánnu_geassemánnu_suoidnemánnu_borgemánnu_čakčamánnu_golggotmánnu_skábmamánnu_juovlamánnu'.split('_'),
monthsShort : 'ođđj_guov_njuk_cuo_mies_geas_suoi_borg_čakč_golg_skáb_juov'.split('_'),
weekdays : 'sotnabeaivi_vuossárga_maŋŋebárga_gaskavahkku_duorastat_bearjadat_lávvardat'.split('_'),
weekdaysShort : 'sotn_vuos_maŋ_gask_duor_bear_láv'.split('_'),
weekdaysMin : 's_v_m_g_d_b_L'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD.MM.YYYY',
LL : 'MMMM D. [b.] YYYY',
LLL : 'MMMM D. [b.] YYYY [ti.] HH:mm',
LLLL : 'dddd, MMMM D. [b.] YYYY [ti.] HH:mm'
},
calendar : {
sameDay: '[otne ti] LT',
nextDay: '[ihttin ti] LT',
nextWeek: 'dddd [ti] LT',
lastDay: '[ikte ti] LT',
lastWeek: '[ovddit] dddd [ti] LT',
sameElse: 'L'
},
relativeTime : {
future : '%s geažes',
past : 'maŋit %s',
s : 'moadde sekunddat',
ss: '%d sekunddat',
m : 'okta minuhta',
mm : '%d minuhtat',
h : 'okta diimmu',
hh : '%d diimmut',
d : 'okta beaivi',
dd : '%d beaivvit',
M : 'okta mánnu',
MM : '%d mánut',
y : 'okta jahki',
yy : '%d jagit'
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return se;
})));
/***/ }),
/* 280 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
/*jshint -W100*/
var si = moment.defineLocale('si', {
months : 'ජනවාරි_පෙබරවාරි_මාර්තු_අප්රේල්_මැයි_ජූනි_ජූලි_අගෝස්තු_සැප්තැම්බර්_ඔක්තෝබර්_නොවැම්බර්_දෙසැම්බර්'.split('_'),
monthsShort : 'ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ'.split('_'),
weekdays : 'ඉරිදා_සඳුදා_අඟහරුවාදා_බදාදා_බ්රහස්පතින්දා_සිකුරාදා_සෙනසුරාදා'.split('_'),
weekdaysShort : 'ඉරි_සඳු_අඟ_බදා_බ්රහ_සිකු_සෙන'.split('_'),
weekdaysMin : 'ඉ_ස_අ_බ_බ්ර_සි_සෙ'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'a h:mm',
LTS : 'a h:mm:ss',
L : 'YYYY/MM/DD',
LL : 'YYYY MMMM D',
LLL : 'YYYY MMMM D, a h:mm',
LLLL : 'YYYY MMMM D [වැනි] dddd, a h:mm:ss'
},
calendar : {
sameDay : '[අද] LT[ට]',
nextDay : '[හෙට] LT[ට]',
nextWeek : 'dddd LT[ට]',
lastDay : '[ඊයේ] LT[ට]',
lastWeek : '[පසුගිය] dddd LT[ට]',
sameElse : 'L'
},
relativeTime : {
future : '%sකින්',
past : '%sකට පෙර',
s : 'තත්පර කිහිපය',
ss : 'තත්පර %d',
m : 'මිනිත්තුව',
mm : 'මිනිත්තු %d',
h : 'පැය',
hh : 'පැය %d',
d : 'දිනය',
dd : 'දින %d',
M : 'මාසය',
MM : 'මාස %d',
y : 'වසර',
yy : 'වසර %d'
},
dayOfMonthOrdinalParse: /\d{1,2} වැනි/,
ordinal : function (number) {
return number + ' වැනි';
},
meridiemParse : /පෙර වරු|පස් වරු|පෙ.ව|ප.ව./,
isPM : function (input) {
return input === 'ප.ව.' || input === 'පස් වරු';
},
meridiem : function (hours, minutes, isLower) {
if (hours > 11) {
return isLower ? 'ප.ව.' : 'පස් වරු';
} else {
return isLower ? 'පෙ.ව.' : 'පෙර වරු';
}
}
});
return si;
})));
/***/ }),
/* 281 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var months = 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split('_'),
monthsShort = 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_');
function plural(n) {
return (n > 1) && (n < 5);
}
function translate(number, withoutSuffix, key, isFuture) {
var result = number + ' ';
switch (key) {
case 's': // a few seconds / in a few seconds / a few seconds ago
return (withoutSuffix || isFuture) ? 'pár sekúnd' : 'pár sekundami';
case 'ss': // 9 seconds / in 9 seconds / 9 seconds ago
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'sekundy' : 'sekúnd');
} else {
return result + 'sekundami';
}
break;
case 'm': // a minute / in a minute / a minute ago
return withoutSuffix ? 'minúta' : (isFuture ? 'minútu' : 'minútou');
case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'minúty' : 'minút');
} else {
return result + 'minútami';
}
break;
case 'h': // an hour / in an hour / an hour ago
return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou');
case 'hh': // 9 hours / in 9 hours / 9 hours ago
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'hodiny' : 'hodín');
} else {
return result + 'hodinami';
}
break;
case 'd': // a day / in a day / a day ago
return (withoutSuffix || isFuture) ? 'deň' : 'dňom';
case 'dd': // 9 days / in 9 days / 9 days ago
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'dni' : 'dní');
} else {
return result + 'dňami';
}
break;
case 'M': // a month / in a month / a month ago
return (withoutSuffix || isFuture) ? 'mesiac' : 'mesiacom';
case 'MM': // 9 months / in 9 months / 9 months ago
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'mesiace' : 'mesiacov');
} else {
return result + 'mesiacmi';
}
break;
case 'y': // a year / in a year / a year ago
return (withoutSuffix || isFuture) ? 'rok' : 'rokom';
case 'yy': // 9 years / in 9 years / 9 years ago
if (withoutSuffix || isFuture) {
return result + (plural(number) ? 'roky' : 'rokov');
} else {
return result + 'rokmi';
}
break;
}
}
var sk = moment.defineLocale('sk', {
months : months,
monthsShort : monthsShort,
weekdays : 'nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota'.split('_'),
weekdaysShort : 'ne_po_ut_st_št_pi_so'.split('_'),
weekdaysMin : 'ne_po_ut_st_št_pi_so'.split('_'),
longDateFormat : {
LT: 'H:mm',
LTS : 'H:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D. MMMM YYYY',
LLL : 'D. MMMM YYYY H:mm',
LLLL : 'dddd D. MMMM YYYY H:mm'
},
calendar : {
sameDay: '[dnes o] LT',
nextDay: '[zajtra o] LT',
nextWeek: function () {
switch (this.day()) {
case 0:
return '[v nedeľu o] LT';
case 1:
case 2:
return '[v] dddd [o] LT';
case 3:
return '[v stredu o] LT';
case 4:
return '[vo štvrtok o] LT';
case 5:
return '[v piatok o] LT';
case 6:
return '[v sobotu o] LT';
}
},
lastDay: '[včera o] LT',
lastWeek: function () {
switch (this.day()) {
case 0:
return '[minulú nedeľu o] LT';
case 1:
case 2:
return '[minulý] dddd [o] LT';
case 3:
return '[minulú stredu o] LT';
case 4:
case 5:
return '[minulý] dddd [o] LT';
case 6:
return '[minulú sobotu o] LT';
}
},
sameElse: 'L'
},
relativeTime : {
future : 'za %s',
past : 'pred %s',
s : translate,
ss : translate,
m : translate,
mm : translate,
h : translate,
hh : translate,
d : translate,
dd : translate,
M : translate,
MM : translate,
y : translate,
yy : translate
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return sk;
})));
/***/ }),
/* 282 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
function processRelativeTime(number, withoutSuffix, key, isFuture) {
var result = number + ' ';
switch (key) {
case 's':
return withoutSuffix || isFuture ? 'nekaj sekund' : 'nekaj sekundami';
case 'ss':
if (number === 1) {
result += withoutSuffix ? 'sekundo' : 'sekundi';
} else if (number === 2) {
result += withoutSuffix || isFuture ? 'sekundi' : 'sekundah';
} else if (number < 5) {
result += withoutSuffix || isFuture ? 'sekunde' : 'sekundah';
} else {
result += withoutSuffix || isFuture ? 'sekund' : 'sekund';
}
return result;
case 'm':
return withoutSuffix ? 'ena minuta' : 'eno minuto';
case 'mm':
if (number === 1) {
result += withoutSuffix ? 'minuta' : 'minuto';
} else if (number === 2) {
result += withoutSuffix || isFuture ? 'minuti' : 'minutama';
} else if (number < 5) {
result += withoutSuffix || isFuture ? 'minute' : 'minutami';
} else {
result += withoutSuffix || isFuture ? 'minut' : 'minutami';
}
return result;
case 'h':
return withoutSuffix ? 'ena ura' : 'eno uro';
case 'hh':
if (number === 1) {
result += withoutSuffix ? 'ura' : 'uro';
} else if (number === 2) {
result += withoutSuffix || isFuture ? 'uri' : 'urama';
} else if (number < 5) {
result += withoutSuffix || isFuture ? 'ure' : 'urami';
} else {
result += withoutSuffix || isFuture ? 'ur' : 'urami';
}
return result;
case 'd':
return withoutSuffix || isFuture ? 'en dan' : 'enim dnem';
case 'dd':
if (number === 1) {
result += withoutSuffix || isFuture ? 'dan' : 'dnem';
} else if (number === 2) {
result += withoutSuffix || isFuture ? 'dni' : 'dnevoma';
} else {
result += withoutSuffix || isFuture ? 'dni' : 'dnevi';
}
return result;
case 'M':
return withoutSuffix || isFuture ? 'en mesec' : 'enim mesecem';
case 'MM':
if (number === 1) {
result += withoutSuffix || isFuture ? 'mesec' : 'mesecem';
} else if (number === 2) {
result += withoutSuffix || isFuture ? 'meseca' : 'mesecema';
} else if (number < 5) {
result += withoutSuffix || isFuture ? 'mesece' : 'meseci';
} else {
result += withoutSuffix || isFuture ? 'mesecev' : 'meseci';
}
return result;
case 'y':
return withoutSuffix || isFuture ? 'eno leto' : 'enim letom';
case 'yy':
if (number === 1) {
result += withoutSuffix || isFuture ? 'leto' : 'letom';
} else if (number === 2) {
result += withoutSuffix || isFuture ? 'leti' : 'letoma';
} else if (number < 5) {
result += withoutSuffix || isFuture ? 'leta' : 'leti';
} else {
result += withoutSuffix || isFuture ? 'let' : 'leti';
}
return result;
}
}
var sl = moment.defineLocale('sl', {
months : 'januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december'.split('_'),
monthsShort : 'jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.'.split('_'),
monthsParseExact: true,
weekdays : 'nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota'.split('_'),
weekdaysShort : 'ned._pon._tor._sre._čet._pet._sob.'.split('_'),
weekdaysMin : 'ne_po_to_sr_če_pe_so'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'H:mm',
LTS : 'H:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D. MMMM YYYY',
LLL : 'D. MMMM YYYY H:mm',
LLLL : 'dddd, D. MMMM YYYY H:mm'
},
calendar : {
sameDay : '[danes ob] LT',
nextDay : '[jutri ob] LT',
nextWeek : function () {
switch (this.day()) {
case 0:
return '[v] [nedeljo] [ob] LT';
case 3:
return '[v] [sredo] [ob] LT';
case 6:
return '[v] [soboto] [ob] LT';
case 1:
case 2:
case 4:
case 5:
return '[v] dddd [ob] LT';
}
},
lastDay : '[včeraj ob] LT',
lastWeek : function () {
switch (this.day()) {
case 0:
return '[prejšnjo] [nedeljo] [ob] LT';
case 3:
return '[prejšnjo] [sredo] [ob] LT';
case 6:
return '[prejšnjo] [soboto] [ob] LT';
case 1:
case 2:
case 4:
case 5:
return '[prejšnji] dddd [ob] LT';
}
},
sameElse : 'L'
},
relativeTime : {
future : 'čez %s',
past : 'pred %s',
s : processRelativeTime,
ss : processRelativeTime,
m : processRelativeTime,
mm : processRelativeTime,
h : processRelativeTime,
hh : processRelativeTime,
d : processRelativeTime,
dd : processRelativeTime,
M : processRelativeTime,
MM : processRelativeTime,
y : processRelativeTime,
yy : processRelativeTime
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
return sl;
})));
/***/ }),
/* 283 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var sq = moment.defineLocale('sq', {
months : 'Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor'.split('_'),
monthsShort : 'Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj'.split('_'),
weekdays : 'E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë'.split('_'),
weekdaysShort : 'Die_Hën_Mar_Mër_Enj_Pre_Sht'.split('_'),
weekdaysMin : 'D_H_Ma_Më_E_P_Sh'.split('_'),
weekdaysParseExact : true,
meridiemParse: /PD|MD/,
isPM: function (input) {
return input.charAt(0) === 'M';
},
meridiem : function (hours, minutes, isLower) {
return hours < 12 ? 'PD' : 'MD';
},
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd, D MMMM YYYY HH:mm'
},
calendar : {
sameDay : '[Sot në] LT',
nextDay : '[Nesër në] LT',
nextWeek : 'dddd [në] LT',
lastDay : '[Dje në] LT',
lastWeek : 'dddd [e kaluar në] LT',
sameElse : 'L'
},
relativeTime : {
future : 'në %s',
past : '%s më parë',
s : 'disa sekonda',
ss : '%d sekonda',
m : 'një minutë',
mm : '%d minuta',
h : 'një orë',
hh : '%d orë',
d : 'një ditë',
dd : '%d ditë',
M : 'një muaj',
MM : '%d muaj',
y : 'një vit',
yy : '%d vite'
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return sq;
})));
/***/ }),
/* 284 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var translator = {
words: { //Different grammatical cases
ss: ['sekunda', 'sekunde', 'sekundi'],
m: ['jedan minut', 'jedne minute'],
mm: ['minut', 'minute', 'minuta'],
h: ['jedan sat', 'jednog sata'],
hh: ['sat', 'sata', 'sati'],
dd: ['dan', 'dana', 'dana'],
MM: ['mesec', 'meseca', 'meseci'],
yy: ['godina', 'godine', 'godina']
},
correctGrammaticalCase: function (number, wordKey) {
return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]);
},
translate: function (number, withoutSuffix, key) {
var wordKey = translator.words[key];
if (key.length === 1) {
return withoutSuffix ? wordKey[0] : wordKey[1];
} else {
return number + ' ' + translator.correctGrammaticalCase(number, wordKey);
}
}
};
var sr = moment.defineLocale('sr', {
months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split('_'),
monthsShort: 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'),
monthsParseExact: true,
weekdays: 'nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota'.split('_'),
weekdaysShort: 'ned._pon._uto._sre._čet._pet._sub.'.split('_'),
weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'),
weekdaysParseExact : true,
longDateFormat: {
LT: 'H:mm',
LTS : 'H:mm:ss',
L: 'DD.MM.YYYY',
LL: 'D. MMMM YYYY',
LLL: 'D. MMMM YYYY H:mm',
LLLL: 'dddd, D. MMMM YYYY H:mm'
},
calendar: {
sameDay: '[danas u] LT',
nextDay: '[sutra u] LT',
nextWeek: function () {
switch (this.day()) {
case 0:
return '[u] [nedelju] [u] LT';
case 3:
return '[u] [sredu] [u] LT';
case 6:
return '[u] [subotu] [u] LT';
case 1:
case 2:
case 4:
case 5:
return '[u] dddd [u] LT';
}
},
lastDay : '[juče u] LT',
lastWeek : function () {
var lastWeekDays = [
'[prošle] [nedelje] [u] LT',
'[prošlog] [ponedeljka] [u] LT',
'[prošlog] [utorka] [u] LT',
'[prošle] [srede] [u] LT',
'[prošlog] [četvrtka] [u] LT',
'[prošlog] [petka] [u] LT',
'[prošle] [subote] [u] LT'
];
return lastWeekDays[this.day()];
},
sameElse : 'L'
},
relativeTime : {
future : 'za %s',
past : 'pre %s',
s : 'nekoliko sekundi',
ss : translator.translate,
m : translator.translate,
mm : translator.translate,
h : translator.translate,
hh : translator.translate,
d : 'dan',
dd : translator.translate,
M : 'mesec',
MM : translator.translate,
y : 'godinu',
yy : translator.translate
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
return sr;
})));
/***/ }),
/* 285 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var translator = {
words: { //Different grammatical cases
ss: ['секунда', 'секунде', 'секунди'],
m: ['један минут', 'једне минуте'],
mm: ['минут', 'минуте', 'минута'],
h: ['један сат', 'једног сата'],
hh: ['сат', 'сата', 'сати'],
dd: ['дан', 'дана', 'дана'],
MM: ['месец', 'месеца', 'месеци'],
yy: ['година', 'године', 'година']
},
correctGrammaticalCase: function (number, wordKey) {
return number === 1 ? wordKey[0] : (number >= 2 && number <= 4 ? wordKey[1] : wordKey[2]);
},
translate: function (number, withoutSuffix, key) {
var wordKey = translator.words[key];
if (key.length === 1) {
return withoutSuffix ? wordKey[0] : wordKey[1];
} else {
return number + ' ' + translator.correctGrammaticalCase(number, wordKey);
}
}
};
var srCyrl = moment.defineLocale('sr-cyrl', {
months: 'јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар'.split('_'),
monthsShort: 'јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.'.split('_'),
monthsParseExact: true,
weekdays: 'недеља_понедељак_уторак_среда_четвртак_петак_субота'.split('_'),
weekdaysShort: 'нед._пон._уто._сре._чет._пет._суб.'.split('_'),
weekdaysMin: 'не_по_ут_ср_че_пе_су'.split('_'),
weekdaysParseExact : true,
longDateFormat: {
LT: 'H:mm',
LTS : 'H:mm:ss',
L: 'DD.MM.YYYY',
LL: 'D. MMMM YYYY',
LLL: 'D. MMMM YYYY H:mm',
LLLL: 'dddd, D. MMMM YYYY H:mm'
},
calendar: {
sameDay: '[данас у] LT',
nextDay: '[сутра у] LT',
nextWeek: function () {
switch (this.day()) {
case 0:
return '[у] [недељу] [у] LT';
case 3:
return '[у] [среду] [у] LT';
case 6:
return '[у] [суботу] [у] LT';
case 1:
case 2:
case 4:
case 5:
return '[у] dddd [у] LT';
}
},
lastDay : '[јуче у] LT',
lastWeek : function () {
var lastWeekDays = [
'[прошле] [недеље] [у] LT',
'[прошлог] [понедељка] [у] LT',
'[прошлог] [уторка] [у] LT',
'[прошле] [среде] [у] LT',
'[прошлог] [четвртка] [у] LT',
'[прошлог] [петка] [у] LT',
'[прошле] [суботе] [у] LT'
];
return lastWeekDays[this.day()];
},
sameElse : 'L'
},
relativeTime : {
future : 'за %s',
past : 'пре %s',
s : 'неколико секунди',
ss : translator.translate,
m : translator.translate,
mm : translator.translate,
h : translator.translate,
hh : translator.translate,
d : 'дан',
dd : translator.translate,
M : 'месец',
MM : translator.translate,
y : 'годину',
yy : translator.translate
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
return srCyrl;
})));
/***/ }),
/* 286 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var ss = moment.defineLocale('ss', {
months : "Bhimbidvwane_Indlovana_Indlov'lenkhulu_Mabasa_Inkhwekhweti_Inhlaba_Kholwane_Ingci_Inyoni_Imphala_Lweti_Ingongoni".split('_'),
monthsShort : 'Bhi_Ina_Inu_Mab_Ink_Inh_Kho_Igc_Iny_Imp_Lwe_Igo'.split('_'),
weekdays : 'Lisontfo_Umsombuluko_Lesibili_Lesitsatfu_Lesine_Lesihlanu_Umgcibelo'.split('_'),
weekdaysShort : 'Lis_Umb_Lsb_Les_Lsi_Lsh_Umg'.split('_'),
weekdaysMin : 'Li_Us_Lb_Lt_Ls_Lh_Ug'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'h:mm A',
LTS : 'h:mm:ss A',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY h:mm A',
LLLL : 'dddd, D MMMM YYYY h:mm A'
},
calendar : {
sameDay : '[Namuhla nga] LT',
nextDay : '[Kusasa nga] LT',
nextWeek : 'dddd [nga] LT',
lastDay : '[Itolo nga] LT',
lastWeek : 'dddd [leliphelile] [nga] LT',
sameElse : 'L'
},
relativeTime : {
future : 'nga %s',
past : 'wenteka nga %s',
s : 'emizuzwana lomcane',
ss : '%d mzuzwana',
m : 'umzuzu',
mm : '%d emizuzu',
h : 'lihora',
hh : '%d emahora',
d : 'lilanga',
dd : '%d emalanga',
M : 'inyanga',
MM : '%d tinyanga',
y : 'umnyaka',
yy : '%d iminyaka'
},
meridiemParse: /ekuseni|emini|entsambama|ebusuku/,
meridiem : function (hours, minutes, isLower) {
if (hours < 11) {
return 'ekuseni';
} else if (hours < 15) {
return 'emini';
} else if (hours < 19) {
return 'entsambama';
} else {
return 'ebusuku';
}
},
meridiemHour : function (hour, meridiem) {
if (hour === 12) {
hour = 0;
}
if (meridiem === 'ekuseni') {
return hour;
} else if (meridiem === 'emini') {
return hour >= 11 ? hour : hour + 12;
} else if (meridiem === 'entsambama' || meridiem === 'ebusuku') {
if (hour === 0) {
return 0;
}
return hour + 12;
}
},
dayOfMonthOrdinalParse: /\d{1,2}/,
ordinal : '%d',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return ss;
})));
/***/ }),
/* 287 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var sv = moment.defineLocale('sv', {
months : 'januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december'.split('_'),
monthsShort : 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'),
weekdays : 'söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag'.split('_'),
weekdaysShort : 'sön_mån_tis_ons_tor_fre_lör'.split('_'),
weekdaysMin : 'sö_må_ti_on_to_fr_lö'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'YYYY-MM-DD',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY [kl.] HH:mm',
LLLL : 'dddd D MMMM YYYY [kl.] HH:mm',
lll : 'D MMM YYYY HH:mm',
llll : 'ddd D MMM YYYY HH:mm'
},
calendar : {
sameDay: '[Idag] LT',
nextDay: '[Imorgon] LT',
lastDay: '[Igår] LT',
nextWeek: '[På] dddd LT',
lastWeek: '[I] dddd[s] LT',
sameElse: 'L'
},
relativeTime : {
future : 'om %s',
past : 'för %s sedan',
s : 'några sekunder',
ss : '%d sekunder',
m : 'en minut',
mm : '%d minuter',
h : 'en timme',
hh : '%d timmar',
d : 'en dag',
dd : '%d dagar',
M : 'en månad',
MM : '%d månader',
y : 'ett år',
yy : '%d år'
},
dayOfMonthOrdinalParse: /\d{1,2}(e|a)/,
ordinal : function (number) {
var b = number % 10,
output = (~~(number % 100 / 10) === 1) ? 'e' :
(b === 1) ? 'a' :
(b === 2) ? 'a' :
(b === 3) ? 'e' : 'e';
return number + output;
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return sv;
})));
/***/ }),
/* 288 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var sw = moment.defineLocale('sw', {
months : 'Januari_Februari_Machi_Aprili_Mei_Juni_Julai_Agosti_Septemba_Oktoba_Novemba_Desemba'.split('_'),
monthsShort : 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ago_Sep_Okt_Nov_Des'.split('_'),
weekdays : 'Jumapili_Jumatatu_Jumanne_Jumatano_Alhamisi_Ijumaa_Jumamosi'.split('_'),
weekdaysShort : 'Jpl_Jtat_Jnne_Jtan_Alh_Ijm_Jmos'.split('_'),
weekdaysMin : 'J2_J3_J4_J5_Al_Ij_J1'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd, D MMMM YYYY HH:mm'
},
calendar : {
sameDay : '[leo saa] LT',
nextDay : '[kesho saa] LT',
nextWeek : '[wiki ijayo] dddd [saat] LT',
lastDay : '[jana] LT',
lastWeek : '[wiki iliyopita] dddd [saat] LT',
sameElse : 'L'
},
relativeTime : {
future : '%s baadaye',
past : 'tokea %s',
s : 'hivi punde',
ss : 'sekunde %d',
m : 'dakika moja',
mm : 'dakika %d',
h : 'saa limoja',
hh : 'masaa %d',
d : 'siku moja',
dd : 'masiku %d',
M : 'mwezi mmoja',
MM : 'miezi %d',
y : 'mwaka mmoja',
yy : 'miaka %d'
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
return sw;
})));
/***/ }),
/* 289 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var symbolMap = {
'1': '௧',
'2': '௨',
'3': '௩',
'4': '௪',
'5': '௫',
'6': '௬',
'7': '௭',
'8': '௮',
'9': '௯',
'0': '௦'
}, numberMap = {
'௧': '1',
'௨': '2',
'௩': '3',
'௪': '4',
'௫': '5',
'௬': '6',
'௭': '7',
'௮': '8',
'௯': '9',
'௦': '0'
};
var ta = moment.defineLocale('ta', {
months : 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split('_'),
monthsShort : 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split('_'),
weekdays : 'ஞாயிற்றுக்கிழமை_திங்கட்கிழமை_செவ்வாய்கிழமை_புதன்கிழமை_வியாழக்கிழமை_வெள்ளிக்கிழமை_சனிக்கிழமை'.split('_'),
weekdaysShort : 'ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி'.split('_'),
weekdaysMin : 'ஞா_தி_செ_பு_வி_வெ_ச'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY, HH:mm',
LLLL : 'dddd, D MMMM YYYY, HH:mm'
},
calendar : {
sameDay : '[இன்று] LT',
nextDay : '[நாளை] LT',
nextWeek : 'dddd, LT',
lastDay : '[நேற்று] LT',
lastWeek : '[கடந்த வாரம்] dddd, LT',
sameElse : 'L'
},
relativeTime : {
future : '%s இல்',
past : '%s முன்',
s : 'ஒரு சில விநாடிகள்',
ss : '%d விநாடிகள்',
m : 'ஒரு நிமிடம்',
mm : '%d நிமிடங்கள்',
h : 'ஒரு மணி நேரம்',
hh : '%d மணி நேரம்',
d : 'ஒரு நாள்',
dd : '%d நாட்கள்',
M : 'ஒரு மாதம்',
MM : '%d மாதங்கள்',
y : 'ஒரு வருடம்',
yy : '%d ஆண்டுகள்'
},
dayOfMonthOrdinalParse: /\d{1,2}வது/,
ordinal : function (number) {
return number + 'வது';
},
preparse: function (string) {
return string.replace(/[௧௨௩௪௫௬௭௮௯௦]/g, function (match) {
return numberMap[match];
});
},
postformat: function (string) {
return string.replace(/\d/g, function (match) {
return symbolMap[match];
});
},
// refer http://ta.wikipedia.org/s/1er1
meridiemParse: /யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/,
meridiem : function (hour, minute, isLower) {
if (hour < 2) {
return ' யாமம்';
} else if (hour < 6) {
return ' வைகறை'; // வைகறை
} else if (hour < 10) {
return ' காலை'; // காலை
} else if (hour < 14) {
return ' நண்பகல்'; // நண்பகல்
} else if (hour < 18) {
return ' எற்பாடு'; // எற்பாடு
} else if (hour < 22) {
return ' மாலை'; // மாலை
} else {
return ' யாமம்';
}
},
meridiemHour : function (hour, meridiem) {
if (hour === 12) {
hour = 0;
}
if (meridiem === 'யாமம்') {
return hour < 2 ? hour : hour + 12;
} else if (meridiem === 'வைகறை' || meridiem === 'காலை') {
return hour;
} else if (meridiem === 'நண்பகல்') {
return hour >= 10 ? hour : hour + 12;
} else {
return hour + 12;
}
},
week : {
dow : 0, // Sunday is the first day of the week.
doy : 6 // The week that contains Jan 1st is the first week of the year.
}
});
return ta;
})));
/***/ }),
/* 290 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var te = moment.defineLocale('te', {
months : 'జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జూలై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్'.split('_'),
monthsShort : 'జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జూలై_ఆగ._సెప్._అక్టో._నవ._డిసె.'.split('_'),
monthsParseExact : true,
weekdays : 'ఆదివారం_సోమవారం_మంగళవారం_బుధవారం_గురువారం_శుక్రవారం_శనివారం'.split('_'),
weekdaysShort : 'ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని'.split('_'),
weekdaysMin : 'ఆ_సో_మం_బు_గు_శు_శ'.split('_'),
longDateFormat : {
LT : 'A h:mm',
LTS : 'A h:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY, A h:mm',
LLLL : 'dddd, D MMMM YYYY, A h:mm'
},
calendar : {
sameDay : '[నేడు] LT',
nextDay : '[రేపు] LT',
nextWeek : 'dddd, LT',
lastDay : '[నిన్న] LT',
lastWeek : '[గత] dddd, LT',
sameElse : 'L'
},
relativeTime : {
future : '%s లో',
past : '%s క్రితం',
s : 'కొన్ని క్షణాలు',
ss : '%d సెకన్లు',
m : 'ఒక నిమిషం',
mm : '%d నిమిషాలు',
h : 'ఒక గంట',
hh : '%d గంటలు',
d : 'ఒక రోజు',
dd : '%d రోజులు',
M : 'ఒక నెల',
MM : '%d నెలలు',
y : 'ఒక సంవత్సరం',
yy : '%d సంవత్సరాలు'
},
dayOfMonthOrdinalParse : /\d{1,2}వ/,
ordinal : '%dవ',
meridiemParse: /రాత్రి|ఉదయం|మధ్యాహ్నం|సాయంత్రం/,
meridiemHour : function (hour, meridiem) {
if (hour === 12) {
hour = 0;
}
if (meridiem === 'రాత్రి') {
return hour < 4 ? hour : hour + 12;
} else if (meridiem === 'ఉదయం') {
return hour;
} else if (meridiem === 'మధ్యాహ్నం') {
return hour >= 10 ? hour : hour + 12;
} else if (meridiem === 'సాయంత్రం') {
return hour + 12;
}
},
meridiem : function (hour, minute, isLower) {
if (hour < 4) {
return 'రాత్రి';
} else if (hour < 10) {
return 'ఉదయం';
} else if (hour < 17) {
return 'మధ్యాహ్నం';
} else if (hour < 20) {
return 'సాయంత్రం';
} else {
return 'రాత్రి';
}
},
week : {
dow : 0, // Sunday is the first day of the week.
doy : 6 // The week that contains Jan 1st is the first week of the year.
}
});
return te;
})));
/***/ }),
/* 291 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var tet = moment.defineLocale('tet', {
months : 'Janeiru_Fevereiru_Marsu_Abril_Maiu_Juñu_Jullu_Agustu_Setembru_Outubru_Novembru_Dezembru'.split('_'),
monthsShort : 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'),
weekdays : 'Domingu_Segunda_Tersa_Kuarta_Kinta_Sesta_Sabadu'.split('_'),
weekdaysShort : 'Dom_Seg_Ters_Kua_Kint_Sest_Sab'.split('_'),
weekdaysMin : 'Do_Seg_Te_Ku_Ki_Ses_Sa'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd, D MMMM YYYY HH:mm'
},
calendar : {
sameDay: '[Ohin iha] LT',
nextDay: '[Aban iha] LT',
nextWeek: 'dddd [iha] LT',
lastDay: '[Horiseik iha] LT',
lastWeek: 'dddd [semana kotuk] [iha] LT',
sameElse: 'L'
},
relativeTime : {
future : 'iha %s',
past : '%s liuba',
s : 'minutu balun',
ss : 'minutu %d',
m : 'minutu ida',
mm : 'minutu %d',
h : 'oras ida',
hh : 'oras %d',
d : 'loron ida',
dd : 'loron %d',
M : 'fulan ida',
MM : 'fulan %d',
y : 'tinan ida',
yy : 'tinan %d'
},
dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
ordinal : function (number) {
var b = number % 10,
output = (~~(number % 100 / 10) === 1) ? 'th' :
(b === 1) ? 'st' :
(b === 2) ? 'nd' :
(b === 3) ? 'rd' : 'th';
return number + output;
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return tet;
})));
/***/ }),
/* 292 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var suffixes = {
0: '-ум',
1: '-ум',
2: '-юм',
3: '-юм',
4: '-ум',
5: '-ум',
6: '-ум',
7: '-ум',
8: '-ум',
9: '-ум',
10: '-ум',
12: '-ум',
13: '-ум',
20: '-ум',
30: '-юм',
40: '-ум',
50: '-ум',
60: '-ум',
70: '-ум',
80: '-ум',
90: '-ум',
100: '-ум'
};
var tg = moment.defineLocale('tg', {
months : 'январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр'.split('_'),
monthsShort : 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'),
weekdays : 'якшанбе_душанбе_сешанбе_чоршанбе_панҷшанбе_ҷумъа_шанбе'.split('_'),
weekdaysShort : 'яшб_дшб_сшб_чшб_пшб_ҷум_шнб'.split('_'),
weekdaysMin : 'яш_дш_сш_чш_пш_ҷм_шб'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd, D MMMM YYYY HH:mm'
},
calendar : {
sameDay : '[Имрӯз соати] LT',
nextDay : '[Пагоҳ соати] LT',
lastDay : '[Дирӯз соати] LT',
nextWeek : 'dddd[и] [ҳафтаи оянда соати] LT',
lastWeek : 'dddd[и] [ҳафтаи гузашта соати] LT',
sameElse : 'L'
},
relativeTime : {
future : 'баъди %s',
past : '%s пеш',
s : 'якчанд сония',
m : 'як дақиқа',
mm : '%d дақиқа',
h : 'як соат',
hh : '%d соат',
d : 'як рӯз',
dd : '%d рӯз',
M : 'як моҳ',
MM : '%d моҳ',
y : 'як сол',
yy : '%d сол'
},
meridiemParse: /шаб|субҳ|рӯз|бегоҳ/,
meridiemHour: function (hour, meridiem) {
if (hour === 12) {
hour = 0;
}
if (meridiem === 'шаб') {
return hour < 4 ? hour : hour + 12;
} else if (meridiem === 'субҳ') {
return hour;
} else if (meridiem === 'рӯз') {
return hour >= 11 ? hour : hour + 12;
} else if (meridiem === 'бегоҳ') {
return hour + 12;
}
},
meridiem: function (hour, minute, isLower) {
if (hour < 4) {
return 'шаб';
} else if (hour < 11) {
return 'субҳ';
} else if (hour < 16) {
return 'рӯз';
} else if (hour < 19) {
return 'бегоҳ';
} else {
return 'шаб';
}
},
dayOfMonthOrdinalParse: /\d{1,2}-(ум|юм)/,
ordinal: function (number) {
var a = number % 10,
b = number >= 100 ? 100 : null;
return number + (suffixes[number] || suffixes[a] || suffixes[b]);
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1th is the first week of the year.
}
});
return tg;
})));
/***/ }),
/* 293 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var th = moment.defineLocale('th', {
months : 'มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม'.split('_'),
monthsShort : 'ม.ค._ก.พ._มี.ค._เม.ย._พ.ค._มิ.ย._ก.ค._ส.ค._ก.ย._ต.ค._พ.ย._ธ.ค.'.split('_'),
monthsParseExact: true,
weekdays : 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์'.split('_'),
weekdaysShort : 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์'.split('_'), // yes, three characters difference
weekdaysMin : 'อา._จ._อ._พ._พฤ._ศ._ส.'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'H:mm',
LTS : 'H:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY เวลา H:mm',
LLLL : 'วันddddที่ D MMMM YYYY เวลา H:mm'
},
meridiemParse: /ก่อนเที่ยง|หลังเที่ยง/,
isPM: function (input) {
return input === 'หลังเที่ยง';
},
meridiem : function (hour, minute, isLower) {
if (hour < 12) {
return 'ก่อนเที่ยง';
} else {
return 'หลังเที่ยง';
}
},
calendar : {
sameDay : '[วันนี้ เวลา] LT',
nextDay : '[พรุ่งนี้ เวลา] LT',
nextWeek : 'dddd[หน้า เวลา] LT',
lastDay : '[เมื่อวานนี้ เวลา] LT',
lastWeek : '[วัน]dddd[ที่แล้ว เวลา] LT',
sameElse : 'L'
},
relativeTime : {
future : 'อีก %s',
past : '%sที่แล้ว',
s : 'ไม่กี่วินาที',
ss : '%d วินาที',
m : '1 นาที',
mm : '%d นาที',
h : '1 ชั่วโมง',
hh : '%d ชั่วโมง',
d : '1 วัน',
dd : '%d วัน',
M : '1 เดือน',
MM : '%d เดือน',
y : '1 ปี',
yy : '%d ปี'
}
});
return th;
})));
/***/ }),
/* 294 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var tlPh = moment.defineLocale('tl-ph', {
months : 'Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre'.split('_'),
monthsShort : 'Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis'.split('_'),
weekdays : 'Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado'.split('_'),
weekdaysShort : 'Lin_Lun_Mar_Miy_Huw_Biy_Sab'.split('_'),
weekdaysMin : 'Li_Lu_Ma_Mi_Hu_Bi_Sab'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'MM/D/YYYY',
LL : 'MMMM D, YYYY',
LLL : 'MMMM D, YYYY HH:mm',
LLLL : 'dddd, MMMM DD, YYYY HH:mm'
},
calendar : {
sameDay: 'LT [ngayong araw]',
nextDay: '[Bukas ng] LT',
nextWeek: 'LT [sa susunod na] dddd',
lastDay: 'LT [kahapon]',
lastWeek: 'LT [noong nakaraang] dddd',
sameElse: 'L'
},
relativeTime : {
future : 'sa loob ng %s',
past : '%s ang nakalipas',
s : 'ilang segundo',
ss : '%d segundo',
m : 'isang minuto',
mm : '%d minuto',
h : 'isang oras',
hh : '%d oras',
d : 'isang araw',
dd : '%d araw',
M : 'isang buwan',
MM : '%d buwan',
y : 'isang taon',
yy : '%d taon'
},
dayOfMonthOrdinalParse: /\d{1,2}/,
ordinal : function (number) {
return number;
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return tlPh;
})));
/***/ }),
/* 295 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var numbersNouns = 'pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut'.split('_');
function translateFuture(output) {
var time = output;
time = (output.indexOf('jaj') !== -1) ?
time.slice(0, -3) + 'leS' :
(output.indexOf('jar') !== -1) ?
time.slice(0, -3) + 'waQ' :
(output.indexOf('DIS') !== -1) ?
time.slice(0, -3) + 'nem' :
time + ' pIq';
return time;
}
function translatePast(output) {
var time = output;
time = (output.indexOf('jaj') !== -1) ?
time.slice(0, -3) + 'Hu’' :
(output.indexOf('jar') !== -1) ?
time.slice(0, -3) + 'wen' :
(output.indexOf('DIS') !== -1) ?
time.slice(0, -3) + 'ben' :
time + ' ret';
return time;
}
function translate(number, withoutSuffix, string, isFuture) {
var numberNoun = numberAsNoun(number);
switch (string) {
case 'ss':
return numberNoun + ' lup';
case 'mm':
return numberNoun + ' tup';
case 'hh':
return numberNoun + ' rep';
case 'dd':
return numberNoun + ' jaj';
case 'MM':
return numberNoun + ' jar';
case 'yy':
return numberNoun + ' DIS';
}
}
function numberAsNoun(number) {
var hundred = Math.floor((number % 1000) / 100),
ten = Math.floor((number % 100) / 10),
one = number % 10,
word = '';
if (hundred > 0) {
word += numbersNouns[hundred] + 'vatlh';
}
if (ten > 0) {
word += ((word !== '') ? ' ' : '') + numbersNouns[ten] + 'maH';
}
if (one > 0) {
word += ((word !== '') ? ' ' : '') + numbersNouns[one];
}
return (word === '') ? 'pagh' : word;
}
var tlh = moment.defineLocale('tlh', {
months : 'tera’ jar wa’_tera’ jar cha’_tera’ jar wej_tera’ jar loS_tera’ jar vagh_tera’ jar jav_tera’ jar Soch_tera’ jar chorgh_tera’ jar Hut_tera’ jar wa’maH_tera’ jar wa’maH wa’_tera’ jar wa’maH cha’'.split('_'),
monthsShort : 'jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’'.split('_'),
monthsParseExact : true,
weekdays : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'),
weekdaysShort : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'),
weekdaysMin : 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd, D MMMM YYYY HH:mm'
},
calendar : {
sameDay: '[DaHjaj] LT',
nextDay: '[wa’leS] LT',
nextWeek: 'LLL',
lastDay: '[wa’Hu’] LT',
lastWeek: 'LLL',
sameElse: 'L'
},
relativeTime : {
future : translateFuture,
past : translatePast,
s : 'puS lup',
ss : translate,
m : 'wa’ tup',
mm : translate,
h : 'wa’ rep',
hh : translate,
d : 'wa’ jaj',
dd : translate,
M : 'wa’ jar',
MM : translate,
y : 'wa’ DIS',
yy : translate
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return tlh;
})));
/***/ }),
/* 296 */
/***/ (function(module, exports, __webpack_require__) {
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var suffixes = {
1: '\'inci',
5: '\'inci',
8: '\'inci',
70: '\'inci',
80: '\'inci',
2: '\'nci',
7: '\'nci',
20: '\'nci',
50: '\'nci',
3: '\'üncü',
4: '\'üncü',
100: '\'üncü',
6: '\'ncı',
9: '\'uncu',
10: '\'uncu',
30: '\'uncu',
60: '\'ıncı',
90: '\'ıncı'
};
var tr = moment.defineLocale('tr', {
months : 'Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık'.split('_'),
monthsShort : 'Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara'.split('_'),
weekdays : 'Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi'.split('_'),
weekdaysShort : 'Paz_Pts_Sal_Çar_Per_Cum_Cts'.split('_'),
weekdaysMin : 'Pz_Pt_Sa_Ça_Pe_Cu_Ct'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd, D MMMM YYYY HH:mm'
},
calendar : {
sameDay : '[bugün saat] LT',
nextDay : '[yarın saat] LT',
nextWeek : '[gelecek] dddd [saat] LT',
lastDay : '[dün] LT',
lastWeek : '[geçen] dddd [saat] LT',
sameElse : 'L'
},
relativeTime : {
future : '%s sonra',
past : '%s önce',
s : 'birkaç saniye',
ss : '%d saniye',
m : 'bir dakika',
mm : '%d dakika',
h : 'bir saat',
hh : '%d saat',
d : 'bir gün',
dd : '%d gün',
M : 'bir ay',
MM : '%d ay',
y : 'bir yıl',
yy : '%d yıl'
},
ordinal: function (number, period) {
switch (period) {
case 'd':
case 'D':
case 'Do':
case 'DD':
return number;
default:
if (number === 0) { // special case for zero
return number + '\'ıncı';
}
var a = number % 10,
b = number % 100 - a,
c = number >= 100 ? 100 : null;
return number + (suffixes[a] || suffixes[b] || suffixes[c]);
}
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
return tr;
})));
/***/ }),
/* 297 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
// After the year there should be a slash and the amount of years since December 26, 1979 in Roman numerals.
// This is currently too difficult (maybe even impossible) to add.
var tzl = moment.defineLocale('tzl', {
months : 'Januar_Fevraglh_Març_Avrïu_Mai_Gün_Julia_Guscht_Setemvar_Listopäts_Noemvar_Zecemvar'.split('_'),
monthsShort : 'Jan_Fev_Mar_Avr_Mai_Gün_Jul_Gus_Set_Lis_Noe_Zec'.split('_'),
weekdays : 'Súladi_Lúneçi_Maitzi_Márcuri_Xhúadi_Viénerçi_Sáturi'.split('_'),
weekdaysShort : 'Súl_Lún_Mai_Már_Xhú_Vié_Sát'.split('_'),
weekdaysMin : 'Sú_Lú_Ma_Má_Xh_Vi_Sá'.split('_'),
longDateFormat : {
LT : 'HH.mm',
LTS : 'HH.mm.ss',
L : 'DD.MM.YYYY',
LL : 'D. MMMM [dallas] YYYY',
LLL : 'D. MMMM [dallas] YYYY HH.mm',
LLLL : 'dddd, [li] D. MMMM [dallas] YYYY HH.mm'
},
meridiemParse: /d\'o|d\'a/i,
isPM : function (input) {
return 'd\'o' === input.toLowerCase();
},
meridiem : function (hours, minutes, isLower) {
if (hours > 11) {
return isLower ? 'd\'o' : 'D\'O';
} else {
return isLower ? 'd\'a' : 'D\'A';
}
},
calendar : {
sameDay : '[oxhi à] LT',
nextDay : '[demà à] LT',
nextWeek : 'dddd [à] LT',
lastDay : '[ieiri à] LT',
lastWeek : '[sür el] dddd [lasteu à] LT',
sameElse : 'L'
},
relativeTime : {
future : 'osprei %s',
past : 'ja%s',
s : processRelativeTime,
ss : processRelativeTime,
m : processRelativeTime,
mm : processRelativeTime,
h : processRelativeTime,
hh : processRelativeTime,
d : processRelativeTime,
dd : processRelativeTime,
M : processRelativeTime,
MM : processRelativeTime,
y : processRelativeTime,
yy : processRelativeTime
},
dayOfMonthOrdinalParse: /\d{1,2}\./,
ordinal : '%d.',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
function processRelativeTime(number, withoutSuffix, key, isFuture) {
var format = {
's': ['viensas secunds', '\'iensas secunds'],
'ss': [number + ' secunds', '' + number + ' secunds'],
'm': ['\'n míut', '\'iens míut'],
'mm': [number + ' míuts', '' + number + ' míuts'],
'h': ['\'n þora', '\'iensa þora'],
'hh': [number + ' þoras', '' + number + ' þoras'],
'd': ['\'n ziua', '\'iensa ziua'],
'dd': [number + ' ziuas', '' + number + ' ziuas'],
'M': ['\'n mes', '\'iens mes'],
'MM': [number + ' mesen', '' + number + ' mesen'],
'y': ['\'n ar', '\'iens ar'],
'yy': [number + ' ars', '' + number + ' ars']
};
return isFuture ? format[key][0] : (withoutSuffix ? format[key][0] : format[key][1]);
}
return tzl;
})));
/***/ }),
/* 298 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var tzm = moment.defineLocale('tzm', {
months : 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split('_'),
monthsShort : 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split('_'),
weekdays : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'),
weekdaysShort : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'),
weekdaysMin : 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS: 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd D MMMM YYYY HH:mm'
},
calendar : {
sameDay: '[ⴰⵙⴷⵅ ⴴ] LT',
nextDay: '[ⴰⵙⴽⴰ ⴴ] LT',
nextWeek: 'dddd [ⴴ] LT',
lastDay: '[ⴰⵚⴰⵏⵜ ⴴ] LT',
lastWeek: 'dddd [ⴴ] LT',
sameElse: 'L'
},
relativeTime : {
future : 'ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s',
past : 'ⵢⴰⵏ %s',
s : 'ⵉⵎⵉⴽ',
ss : '%d ⵉⵎⵉⴽ',
m : 'ⵎⵉⵏⵓⴺ',
mm : '%d ⵎⵉⵏⵓⴺ',
h : 'ⵙⴰⵄⴰ',
hh : '%d ⵜⴰⵙⵙⴰⵄⵉⵏ',
d : 'ⴰⵙⵙ',
dd : '%d oⵙⵙⴰⵏ',
M : 'ⴰⵢoⵓⵔ',
MM : '%d ⵉⵢⵢⵉⵔⵏ',
y : 'ⴰⵙⴳⴰⵙ',
yy : '%d ⵉⵙⴳⴰⵙⵏ'
},
week : {
dow : 6, // Saturday is the first day of the week.
doy : 12 // The week that contains Jan 1st is the first week of the year.
}
});
return tzm;
})));
/***/ }),
/* 299 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var tzmLatn = moment.defineLocale('tzm-latn', {
months : 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split('_'),
monthsShort : 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split('_'),
weekdays : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'),
weekdaysShort : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'),
weekdaysMin : 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd D MMMM YYYY HH:mm'
},
calendar : {
sameDay: '[asdkh g] LT',
nextDay: '[aska g] LT',
nextWeek: 'dddd [g] LT',
lastDay: '[assant g] LT',
lastWeek: 'dddd [g] LT',
sameElse: 'L'
},
relativeTime : {
future : 'dadkh s yan %s',
past : 'yan %s',
s : 'imik',
ss : '%d imik',
m : 'minuḍ',
mm : '%d minuḍ',
h : 'saɛa',
hh : '%d tassaɛin',
d : 'ass',
dd : '%d ossan',
M : 'ayowr',
MM : '%d iyyirn',
y : 'asgas',
yy : '%d isgasn'
},
week : {
dow : 6, // Saturday is the first day of the week.
doy : 12 // The week that contains Jan 1st is the first week of the year.
}
});
return tzmLatn;
})));
/***/ }),
/* 300 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js language configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var ugCn = moment.defineLocale('ug-cn', {
months: 'يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر'.split(
'_'
),
monthsShort: 'يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر'.split(
'_'
),
weekdays: 'يەكشەنبە_دۈشەنبە_سەيشەنبە_چارشەنبە_پەيشەنبە_جۈمە_شەنبە'.split(
'_'
),
weekdaysShort: 'يە_دۈ_سە_چا_پە_جۈ_شە'.split('_'),
weekdaysMin: 'يە_دۈ_سە_چا_پە_جۈ_شە'.split('_'),
longDateFormat: {
LT: 'HH:mm',
LTS: 'HH:mm:ss',
L: 'YYYY-MM-DD',
LL: 'YYYY-يىلىM-ئاينىڭD-كۈنى',
LLL: 'YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm',
LLLL: 'dddd، YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm'
},
meridiemParse: /يېرىم كېچە|سەھەر|چۈشتىن بۇرۇن|چۈش|چۈشتىن كېيىن|كەچ/,
meridiemHour: function (hour, meridiem) {
if (hour === 12) {
hour = 0;
}
if (
meridiem === 'يېرىم كېچە' ||
meridiem === 'سەھەر' ||
meridiem === 'چۈشتىن بۇرۇن'
) {
return hour;
} else if (meridiem === 'چۈشتىن كېيىن' || meridiem === 'كەچ') {
return hour + 12;
} else {
return hour >= 11 ? hour : hour + 12;
}
},
meridiem: function (hour, minute, isLower) {
var hm = hour * 100 + minute;
if (hm < 600) {
return 'يېرىم كېچە';
} else if (hm < 900) {
return 'سەھەر';
} else if (hm < 1130) {
return 'چۈشتىن بۇرۇن';
} else if (hm < 1230) {
return 'چۈش';
} else if (hm < 1800) {
return 'چۈشتىن كېيىن';
} else {
return 'كەچ';
}
},
calendar: {
sameDay: '[بۈگۈن سائەت] LT',
nextDay: '[ئەتە سائەت] LT',
nextWeek: '[كېلەركى] dddd [سائەت] LT',
lastDay: '[تۆنۈگۈن] LT',
lastWeek: '[ئالدىنقى] dddd [سائەت] LT',
sameElse: 'L'
},
relativeTime: {
future: '%s كېيىن',
past: '%s بۇرۇن',
s: 'نەچچە سېكونت',
ss: '%d سېكونت',
m: 'بىر مىنۇت',
mm: '%d مىنۇت',
h: 'بىر سائەت',
hh: '%d سائەت',
d: 'بىر كۈن',
dd: '%d كۈن',
M: 'بىر ئاي',
MM: '%d ئاي',
y: 'بىر يىل',
yy: '%d يىل'
},
dayOfMonthOrdinalParse: /\d{1,2}(-كۈنى|-ئاي|-ھەپتە)/,
ordinal: function (number, period) {
switch (period) {
case 'd':
case 'D':
case 'DDD':
return number + '-كۈنى';
case 'w':
case 'W':
return number + '-ھەپتە';
default:
return number;
}
},
preparse: function (string) {
return string.replace(/،/g, ',');
},
postformat: function (string) {
return string.replace(/,/g, '،');
},
week: {
// GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
dow: 1, // Monday is the first day of the week.
doy: 7 // The week that contains Jan 1st is the first week of the year.
}
});
return ugCn;
})));
/***/ }),
/* 301 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
function plural(word, num) {
var forms = word.split('_');
return num % 10 === 1 && num % 100 !== 11 ? forms[0] : (num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20) ? forms[1] : forms[2]);
}
function relativeTimeWithPlural(number, withoutSuffix, key) {
var format = {
'ss': withoutSuffix ? 'секунда_секунди_секунд' : 'секунду_секунди_секунд',
'mm': withoutSuffix ? 'хвилина_хвилини_хвилин' : 'хвилину_хвилини_хвилин',
'hh': withoutSuffix ? 'година_години_годин' : 'годину_години_годин',
'dd': 'день_дні_днів',
'MM': 'місяць_місяці_місяців',
'yy': 'рік_роки_років'
};
if (key === 'm') {
return withoutSuffix ? 'хвилина' : 'хвилину';
}
else if (key === 'h') {
return withoutSuffix ? 'година' : 'годину';
}
else {
return number + ' ' + plural(format[key], +number);
}
}
function weekdaysCaseReplace(m, format) {
var weekdays = {
'nominative': 'неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота'.split('_'),
'accusative': 'неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу'.split('_'),
'genitive': 'неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи'.split('_')
};
if (!m) {
return weekdays['nominative'];
}
var nounCase = (/(\[[ВвУу]\]) ?dddd/).test(format) ?
'accusative' :
((/\[?(?:минулої|наступної)? ?\] ?dddd/).test(format) ?
'genitive' :
'nominative');
return weekdays[nounCase][m.day()];
}
function processHoursFunction(str) {
return function () {
return str + 'о' + (this.hours() === 11 ? 'б' : '') + '] LT';
};
}
var uk = moment.defineLocale('uk', {
months : {
'format': 'січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня'.split('_'),
'standalone': 'січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень'.split('_')
},
monthsShort : 'січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд'.split('_'),
weekdays : weekdaysCaseReplace,
weekdaysShort : 'нд_пн_вт_ср_чт_пт_сб'.split('_'),
weekdaysMin : 'нд_пн_вт_ср_чт_пт_сб'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD.MM.YYYY',
LL : 'D MMMM YYYY р.',
LLL : 'D MMMM YYYY р., HH:mm',
LLLL : 'dddd, D MMMM YYYY р., HH:mm'
},
calendar : {
sameDay: processHoursFunction('[Сьогодні '),
nextDay: processHoursFunction('[Завтра '),
lastDay: processHoursFunction('[Вчора '),
nextWeek: processHoursFunction('[У] dddd ['),
lastWeek: function () {
switch (this.day()) {
case 0:
case 3:
case 5:
case 6:
return processHoursFunction('[Минулої] dddd [').call(this);
case 1:
case 2:
case 4:
return processHoursFunction('[Минулого] dddd [').call(this);
}
},
sameElse: 'L'
},
relativeTime : {
future : 'за %s',
past : '%s тому',
s : 'декілька секунд',
ss : relativeTimeWithPlural,
m : relativeTimeWithPlural,
mm : relativeTimeWithPlural,
h : 'годину',
hh : relativeTimeWithPlural,
d : 'день',
dd : relativeTimeWithPlural,
M : 'місяць',
MM : relativeTimeWithPlural,
y : 'рік',
yy : relativeTimeWithPlural
},
// M. E.: those two are virtually unused but a user might want to implement them for his/her website for some reason
meridiemParse: /ночі|ранку|дня|вечора/,
isPM: function (input) {
return /^(дня|вечора)$/.test(input);
},
meridiem : function (hour, minute, isLower) {
if (hour < 4) {
return 'ночі';
} else if (hour < 12) {
return 'ранку';
} else if (hour < 17) {
return 'дня';
} else {
return 'вечора';
}
},
dayOfMonthOrdinalParse: /\d{1,2}-(й|го)/,
ordinal: function (number, period) {
switch (period) {
case 'M':
case 'd':
case 'DDD':
case 'w':
case 'W':
return number + '-й';
case 'D':
return number + '-го';
default:
return number;
}
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
return uk;
})));
/***/ }),
/* 302 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var months = [
'جنوری',
'فروری',
'مارچ',
'اپریل',
'مئی',
'جون',
'جولائی',
'اگست',
'ستمبر',
'اکتوبر',
'نومبر',
'دسمبر'
];
var days = [
'اتوار',
'پیر',
'منگل',
'بدھ',
'جمعرات',
'جمعہ',
'ہفتہ'
];
var ur = moment.defineLocale('ur', {
months : months,
monthsShort : months,
weekdays : days,
weekdaysShort : days,
weekdaysMin : days,
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd، D MMMM YYYY HH:mm'
},
meridiemParse: /صبح|شام/,
isPM : function (input) {
return 'شام' === input;
},
meridiem : function (hour, minute, isLower) {
if (hour < 12) {
return 'صبح';
}
return 'شام';
},
calendar : {
sameDay : '[آج بوقت] LT',
nextDay : '[کل بوقت] LT',
nextWeek : 'dddd [بوقت] LT',
lastDay : '[گذشتہ روز بوقت] LT',
lastWeek : '[گذشتہ] dddd [بوقت] LT',
sameElse : 'L'
},
relativeTime : {
future : '%s بعد',
past : '%s قبل',
s : 'چند سیکنڈ',
ss : '%d سیکنڈ',
m : 'ایک منٹ',
mm : '%d منٹ',
h : 'ایک گھنٹہ',
hh : '%d گھنٹے',
d : 'ایک دن',
dd : '%d دن',
M : 'ایک ماہ',
MM : '%d ماہ',
y : 'ایک سال',
yy : '%d سال'
},
preparse: function (string) {
return string.replace(/،/g, ',');
},
postformat: function (string) {
return string.replace(/,/g, '،');
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return ur;
})));
/***/ }),
/* 303 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var uz = moment.defineLocale('uz', {
months : 'январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр'.split('_'),
monthsShort : 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'),
weekdays : 'Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба'.split('_'),
weekdaysShort : 'Якш_Душ_Сеш_Чор_Пай_Жум_Шан'.split('_'),
weekdaysMin : 'Як_Ду_Се_Чо_Па_Жу_Ша'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'D MMMM YYYY, dddd HH:mm'
},
calendar : {
sameDay : '[Бугун соат] LT [да]',
nextDay : '[Эртага] LT [да]',
nextWeek : 'dddd [куни соат] LT [да]',
lastDay : '[Кеча соат] LT [да]',
lastWeek : '[Утган] dddd [куни соат] LT [да]',
sameElse : 'L'
},
relativeTime : {
future : 'Якин %s ичида',
past : 'Бир неча %s олдин',
s : 'фурсат',
ss : '%d фурсат',
m : 'бир дакика',
mm : '%d дакика',
h : 'бир соат',
hh : '%d соат',
d : 'бир кун',
dd : '%d кун',
M : 'бир ой',
MM : '%d ой',
y : 'бир йил',
yy : '%d йил'
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 4th is the first week of the year.
}
});
return uz;
})));
/***/ }),
/* 304 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var uzLatn = moment.defineLocale('uz-latn', {
months : 'Yanvar_Fevral_Mart_Aprel_May_Iyun_Iyul_Avgust_Sentabr_Oktabr_Noyabr_Dekabr'.split('_'),
monthsShort : 'Yan_Fev_Mar_Apr_May_Iyun_Iyul_Avg_Sen_Okt_Noy_Dek'.split('_'),
weekdays : 'Yakshanba_Dushanba_Seshanba_Chorshanba_Payshanba_Juma_Shanba'.split('_'),
weekdaysShort : 'Yak_Dush_Sesh_Chor_Pay_Jum_Shan'.split('_'),
weekdaysMin : 'Ya_Du_Se_Cho_Pa_Ju_Sha'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'D MMMM YYYY, dddd HH:mm'
},
calendar : {
sameDay : '[Bugun soat] LT [da]',
nextDay : '[Ertaga] LT [da]',
nextWeek : 'dddd [kuni soat] LT [da]',
lastDay : '[Kecha soat] LT [da]',
lastWeek : '[O\'tgan] dddd [kuni soat] LT [da]',
sameElse : 'L'
},
relativeTime : {
future : 'Yaqin %s ichida',
past : 'Bir necha %s oldin',
s : 'soniya',
ss : '%d soniya',
m : 'bir daqiqa',
mm : '%d daqiqa',
h : 'bir soat',
hh : '%d soat',
d : 'bir kun',
dd : '%d kun',
M : 'bir oy',
MM : '%d oy',
y : 'bir yil',
yy : '%d yil'
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 7 // The week that contains Jan 1st is the first week of the year.
}
});
return uzLatn;
})));
/***/ }),
/* 305 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var vi = moment.defineLocale('vi', {
months : 'tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12'.split('_'),
monthsShort : 'Th01_Th02_Th03_Th04_Th05_Th06_Th07_Th08_Th09_Th10_Th11_Th12'.split('_'),
monthsParseExact : true,
weekdays : 'chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy'.split('_'),
weekdaysShort : 'CN_T2_T3_T4_T5_T6_T7'.split('_'),
weekdaysMin : 'CN_T2_T3_T4_T5_T6_T7'.split('_'),
weekdaysParseExact : true,
meridiemParse: /sa|ch/i,
isPM : function (input) {
return /^ch$/i.test(input);
},
meridiem : function (hours, minutes, isLower) {
if (hours < 12) {
return isLower ? 'sa' : 'SA';
} else {
return isLower ? 'ch' : 'CH';
}
},
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'DD/MM/YYYY',
LL : 'D MMMM [năm] YYYY',
LLL : 'D MMMM [năm] YYYY HH:mm',
LLLL : 'dddd, D MMMM [năm] YYYY HH:mm',
l : 'DD/M/YYYY',
ll : 'D MMM YYYY',
lll : 'D MMM YYYY HH:mm',
llll : 'ddd, D MMM YYYY HH:mm'
},
calendar : {
sameDay: '[Hôm nay lúc] LT',
nextDay: '[Ngày mai lúc] LT',
nextWeek: 'dddd [tuần tới lúc] LT',
lastDay: '[Hôm qua lúc] LT',
lastWeek: 'dddd [tuần rồi lúc] LT',
sameElse: 'L'
},
relativeTime : {
future : '%s tới',
past : '%s trước',
s : 'vài giây',
ss : '%d giây' ,
m : 'một phút',
mm : '%d phút',
h : 'một giờ',
hh : '%d giờ',
d : 'một ngày',
dd : '%d ngày',
M : 'một tháng',
MM : '%d tháng',
y : 'một năm',
yy : '%d năm'
},
dayOfMonthOrdinalParse: /\d{1,2}/,
ordinal : function (number) {
return number;
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return vi;
})));
/***/ }),
/* 306 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var xPseudo = moment.defineLocale('x-pseudo', {
months : 'J~áñúá~rý_F~ébrú~árý_~Márc~h_Áp~ríl_~Máý_~Júñé~_Júl~ý_Áú~gúst~_Sép~témb~ér_Ó~ctób~ér_Ñ~óvém~bér_~Décé~mbér'.split('_'),
monthsShort : 'J~áñ_~Féb_~Már_~Ápr_~Máý_~Júñ_~Júl_~Áúg_~Sép_~Óct_~Ñóv_~Déc'.split('_'),
monthsParseExact : true,
weekdays : 'S~úñdá~ý_Mó~ñdáý~_Túé~sdáý~_Wéd~ñésd~áý_T~húrs~dáý_~Fríd~áý_S~átúr~dáý'.split('_'),
weekdaysShort : 'S~úñ_~Móñ_~Túé_~Wéd_~Thú_~Frí_~Sát'.split('_'),
weekdaysMin : 'S~ú_Mó~_Tú_~Wé_T~h_Fr~_Sá'.split('_'),
weekdaysParseExact : true,
longDateFormat : {
LT : 'HH:mm',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd, D MMMM YYYY HH:mm'
},
calendar : {
sameDay : '[T~ódá~ý át] LT',
nextDay : '[T~ómó~rró~w át] LT',
nextWeek : 'dddd [át] LT',
lastDay : '[Ý~ést~érdá~ý át] LT',
lastWeek : '[L~ást] dddd [át] LT',
sameElse : 'L'
},
relativeTime : {
future : 'í~ñ %s',
past : '%s á~gó',
s : 'á ~féw ~sécó~ñds',
ss : '%d s~écóñ~ds',
m : 'á ~míñ~úté',
mm : '%d m~íñú~tés',
h : 'á~ñ hó~úr',
hh : '%d h~óúrs',
d : 'á ~dáý',
dd : '%d d~áýs',
M : 'á ~móñ~th',
MM : '%d m~óñt~hs',
y : 'á ~ýéár',
yy : '%d ý~éárs'
},
dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
ordinal : function (number) {
var b = number % 10,
output = (~~(number % 100 / 10) === 1) ? 'th' :
(b === 1) ? 'st' :
(b === 2) ? 'nd' :
(b === 3) ? 'rd' : 'th';
return number + output;
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return xPseudo;
})));
/***/ }),
/* 307 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var yo = moment.defineLocale('yo', {
months : 'Sẹ́rẹ́_Èrèlè_Ẹrẹ̀nà_Ìgbé_Èbibi_Òkùdu_Agẹmo_Ògún_Owewe_Ọ̀wàrà_Bélú_Ọ̀pẹ̀̀'.split('_'),
monthsShort : 'Sẹ́r_Èrl_Ẹrn_Ìgb_Èbi_Òkù_Agẹ_Ògú_Owe_Ọ̀wà_Bél_Ọ̀pẹ̀̀'.split('_'),
weekdays : 'Àìkú_Ajé_Ìsẹ́gun_Ọjọ́rú_Ọjọ́bọ_Ẹtì_Àbámẹ́ta'.split('_'),
weekdaysShort : 'Àìk_Ajé_Ìsẹ́_Ọjr_Ọjb_Ẹtì_Àbá'.split('_'),
weekdaysMin : 'Àì_Aj_Ìs_Ọr_Ọb_Ẹt_Àb'.split('_'),
longDateFormat : {
LT : 'h:mm A',
LTS : 'h:mm:ss A',
L : 'DD/MM/YYYY',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY h:mm A',
LLLL : 'dddd, D MMMM YYYY h:mm A'
},
calendar : {
sameDay : '[Ònì ni] LT',
nextDay : '[Ọ̀la ni] LT',
nextWeek : 'dddd [Ọsẹ̀ tón\'bọ] [ni] LT',
lastDay : '[Àna ni] LT',
lastWeek : 'dddd [Ọsẹ̀ tólọ́] [ni] LT',
sameElse : 'L'
},
relativeTime : {
future : 'ní %s',
past : '%s kọjá',
s : 'ìsẹjú aayá die',
ss :'aayá %d',
m : 'ìsẹjú kan',
mm : 'ìsẹjú %d',
h : 'wákati kan',
hh : 'wákati %d',
d : 'ọjọ́ kan',
dd : 'ọjọ́ %d',
M : 'osù kan',
MM : 'osù %d',
y : 'ọdún kan',
yy : 'ọdún %d'
},
dayOfMonthOrdinalParse : /ọjọ́\s\d{1,2}/,
ordinal : 'ọjọ́ %d',
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return yo;
})));
/***/ }),
/* 308 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var zhCn = moment.defineLocale('zh-cn', {
months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'),
monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
weekdaysShort : '周日_周一_周二_周三_周四_周五_周六'.split('_'),
weekdaysMin : '日_一_二_三_四_五_六'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'YYYY/MM/DD',
LL : 'YYYY年M月D日',
LLL : 'YYYY年M月D日Ah点mm分',
LLLL : 'YYYY年M月D日ddddAh点mm分',
l : 'YYYY/M/D',
ll : 'YYYY年M月D日',
lll : 'YYYY年M月D日 HH:mm',
llll : 'YYYY年M月D日dddd HH:mm'
},
meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
meridiemHour: function (hour, meridiem) {
if (hour === 12) {
hour = 0;
}
if (meridiem === '凌晨' || meridiem === '早上' ||
meridiem === '上午') {
return hour;
} else if (meridiem === '下午' || meridiem === '晚上') {
return hour + 12;
} else {
// '中午'
return hour >= 11 ? hour : hour + 12;
}
},
meridiem : function (hour, minute, isLower) {
var hm = hour * 100 + minute;
if (hm < 600) {
return '凌晨';
} else if (hm < 900) {
return '早上';
} else if (hm < 1130) {
return '上午';
} else if (hm < 1230) {
return '中午';
} else if (hm < 1800) {
return '下午';
} else {
return '晚上';
}
},
calendar : {
sameDay : '[今天]LT',
nextDay : '[明天]LT',
nextWeek : '[下]ddddLT',
lastDay : '[昨天]LT',
lastWeek : '[上]ddddLT',
sameElse : 'L'
},
dayOfMonthOrdinalParse: /\d{1,2}(日|月|周)/,
ordinal : function (number, period) {
switch (period) {
case 'd':
case 'D':
case 'DDD':
return number + '日';
case 'M':
return number + '月';
case 'w':
case 'W':
return number + '周';
default:
return number;
}
},
relativeTime : {
future : '%s内',
past : '%s前',
s : '几秒',
ss : '%d 秒',
m : '1 分钟',
mm : '%d 分钟',
h : '1 小时',
hh : '%d 小时',
d : '1 天',
dd : '%d 天',
M : '1 个月',
MM : '%d 个月',
y : '1 年',
yy : '%d 年'
},
week : {
// GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
return zhCn;
})));
/***/ }),
/* 309 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var zhHk = moment.defineLocale('zh-hk', {
months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'),
monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
weekdaysShort : '週日_週一_週二_週三_週四_週五_週六'.split('_'),
weekdaysMin : '日_一_二_三_四_五_六'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'YYYY/MM/DD',
LL : 'YYYY年M月D日',
LLL : 'YYYY年M月D日 HH:mm',
LLLL : 'YYYY年M月D日dddd HH:mm',
l : 'YYYY/M/D',
ll : 'YYYY年M月D日',
lll : 'YYYY年M月D日 HH:mm',
llll : 'YYYY年M月D日dddd HH:mm'
},
meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
meridiemHour : function (hour, meridiem) {
if (hour === 12) {
hour = 0;
}
if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') {
return hour;
} else if (meridiem === '中午') {
return hour >= 11 ? hour : hour + 12;
} else if (meridiem === '下午' || meridiem === '晚上') {
return hour + 12;
}
},
meridiem : function (hour, minute, isLower) {
var hm = hour * 100 + minute;
if (hm < 600) {
return '凌晨';
} else if (hm < 900) {
return '早上';
} else if (hm < 1130) {
return '上午';
} else if (hm < 1230) {
return '中午';
} else if (hm < 1800) {
return '下午';
} else {
return '晚上';
}
},
calendar : {
sameDay : '[今天]LT',
nextDay : '[明天]LT',
nextWeek : '[下]ddddLT',
lastDay : '[昨天]LT',
lastWeek : '[上]ddddLT',
sameElse : 'L'
},
dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/,
ordinal : function (number, period) {
switch (period) {
case 'd' :
case 'D' :
case 'DDD' :
return number + '日';
case 'M' :
return number + '月';
case 'w' :
case 'W' :
return number + '週';
default :
return number;
}
},
relativeTime : {
future : '%s內',
past : '%s前',
s : '幾秒',
ss : '%d 秒',
m : '1 分鐘',
mm : '%d 分鐘',
h : '1 小時',
hh : '%d 小時',
d : '1 天',
dd : '%d 天',
M : '1 個月',
MM : '%d 個月',
y : '1 年',
yy : '%d 年'
}
});
return zhHk;
})));
/***/ }),
/* 310 */
/***/ (function(module, exports, __webpack_require__) {
//! moment.js locale configuration
;(function (global, factory) {
true ? factory(__webpack_require__(1)) :
typeof define === 'function' && define.amd ? define(['../moment'], factory) :
factory(global.moment)
}(this, (function (moment) { 'use strict';
var zhTw = moment.defineLocale('zh-tw', {
months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'),
monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
weekdaysShort : '週日_週一_週二_週三_週四_週五_週六'.split('_'),
weekdaysMin : '日_一_二_三_四_五_六'.split('_'),
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'YYYY/MM/DD',
LL : 'YYYY年M月D日',
LLL : 'YYYY年M月D日 HH:mm',
LLLL : 'YYYY年M月D日dddd HH:mm',
l : 'YYYY/M/D',
ll : 'YYYY年M月D日',
lll : 'YYYY年M月D日 HH:mm',
llll : 'YYYY年M月D日dddd HH:mm'
},
meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
meridiemHour : function (hour, meridiem) {
if (hour === 12) {
hour = 0;
}
if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') {
return hour;
} else if (meridiem === '中午') {
return hour >= 11 ? hour : hour + 12;
} else if (meridiem === '下午' || meridiem === '晚上') {
return hour + 12;
}
},
meridiem : function (hour, minute, isLower) {
var hm = hour * 100 + minute;
if (hm < 600) {
return '凌晨';
} else if (hm < 900) {
return '早上';
} else if (hm < 1130) {
return '上午';
} else if (hm < 1230) {
return '中午';
} else if (hm < 1800) {
return '下午';
} else {
return '晚上';
}
},
calendar : {
sameDay : '[今天] LT',
nextDay : '[明天] LT',
nextWeek : '[下]dddd LT',
lastDay : '[昨天] LT',
lastWeek : '[上]dddd LT',
sameElse : 'L'
},
dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/,
ordinal : function (number, period) {
switch (period) {
case 'd' :
case 'D' :
case 'DDD' :
return number + '日';
case 'M' :
return number + '月';
case 'w' :
case 'W' :
return number + '週';
default :
return number;
}
},
relativeTime : {
future : '%s內',
past : '%s前',
s : '幾秒',
ss : '%d 秒',
m : '1 分鐘',
mm : '%d 分鐘',
h : '1 小時',
hh : '%d 小時',
d : '1 天',
dd : '%d 天',
M : '1 個月',
MM : '%d 個月',
y : '1 年',
yy : '%d 年'
}
});
return zhTw;
})));
/***/ }),
/* 311 */,
/* 312 */,
/* 313 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ModalController; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__app_app__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__modal__ = __webpack_require__(172);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__navigation_deep_linker__ = __webpack_require__(19);
/**
* @name ModalController
* @description
* A Modal is a content pane that goes over the user's current page.
* Usually it is used for making a choice or editing an item. A modal uses the
* `NavController` to
* {@link /docs/api/components/nav/NavController/#present present}
* itself in the root nav stack. It is added to the stack similar to how
* {@link /docs/api/components/nav/NavController/#push NavController.push}
* works.
*
* When a modal (or any other overlay such as an alert or actionsheet) is
* "presented" to a nav controller, the overlay is added to the app's root nav.
* After the modal has been presented, from within the component instance, the
* modal can later be closed or "dismissed" by using the ViewController's
* `dismiss` method. Additionally, you can dismiss any overlay by using `pop`
* on the root nav controller. Modals are not reusable. When a modal is dismissed
* it is destroyed.
*
* Data can be passed to a new modal through `Modal.create()` as the second
* argument. The data can then be accessed from the opened page by injecting
* `NavParams`. Note that the page, which opened as a modal, has no special
* "modal" logic within it, but uses `NavParams` no differently than a
* standard page.
*
* @usage
* ```ts
* import { ModalController, NavParams } from 'ionic-angular';
*
* @Component(...)
* class HomePage {
*
* constructor(public modalCtrl: ModalController) { }
*
* presentProfileModal() {
* const profileModal = this.modalCtrl.create(Profile, { userId: 8675309 });
* profileModal.present();
* }
*
* }
*
* @Component(...)
* class Profile {
*
* constructor(params: NavParams) {
* console.log('UserId', params.get('userId'));
* }
*
* }
* ```
*
* @advanced
*
* | Option | Type | Description |
* |-----------------------|------------|------------------------------------------------------------------------------------------------------------------|
* | showBackdrop |`boolean` | Whether to show the backdrop. Default true. |
* | enableBackdropDismiss |`boolean` | Whether the popover should be dismissed by tapping the backdrop. Default true. |
* | cssClass |`string` | Additional classes for custom styles, separated by spaces. |
*
* A modal can also emit data, which is useful when it is used to add or edit
* data. For example, a profile page could slide up in a modal, and on submit,
* the submit button could pass the updated profile data, then dismiss the
* modal.
*
* ```ts
* import { Component } from '@angular/core';
* import { ModalController, ViewController } from 'ionic-angular';
*
* @Component(...)
* class HomePage {
*
* constructor(public modalCtrl: ModalController) {
*
* }
*
* presentContactModal() {
* let contactModal = this.modalCtrl.create(ContactUs);
* contactModal.present();
* }
*
* presentProfileModal() {
* let profileModal = this.modalCtrl.create(Profile, { userId: 8675309 });
* profileModal.onDidDismiss(data => {
* console.log(data);
* });
* profileModal.present();
* }
*
* }
*
* @Component(...)
* class Profile {
*
* constructor(public viewCtrl: ViewController) {
*
* }
*
* dismiss() {
* let data = { 'foo': 'bar' };
* this.viewCtrl.dismiss(data);
* }
*
* }
* ```
*
* A common issue is that a developer may try to implement navigation in a modal, but when you try NavController.push(),
* you will notice that the status bar on iOS gets cut off. The proper way to implement navigation in a modal is to
* make the modal component a navigation container, and set the root page to the page you want to show in your modal.
*
* ```ts
* @Component({
* template: '<ion-nav [root]="rootPage" [rootParams]="rootParams"></ion-nav>'
* })
* export class MyModalWrapper {
* rootPage = 'MyModalContentPage'; // This is the page you want your modal to display
* rootParams;
*
* constructor(navParams: NavParams, private viewCtrl: ViewController) {
* this.rootParams = Object.assign({}, navParams.data, {viewCtrl: viewCtrl});
* // This line will send the view controller into your child views, so you can dismiss the modals from there.
* }
* }
* ```
* @demo /docs/demos/src/modal/
* @see {@link /docs/components#modals Modal Component Docs}
*/
var ModalController = (function () {
function ModalController(_app, config, deepLinker) {
this._app = _app;
this.config = config;
this.deepLinker = deepLinker;
}
/**
* Create a modal to display. See below for options.
*
* @param {object} component The Modal view
* @param {object} data Any data to pass to the Modal view
* @param {object} opts Modal options
*/
ModalController.prototype.create = function (component, data, opts) {
if (data === void 0) { data = {}; }
if (opts === void 0) { opts = {}; }
return new __WEBPACK_IMPORTED_MODULE_3__modal__["a" /* Modal */](this._app, component, data, opts, this.config, this.deepLinker);
};
ModalController.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
ModalController.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__app_app__["a" /* App */], },
{ type: __WEBPACK_IMPORTED_MODULE_2__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_4__navigation_deep_linker__["a" /* DeepLinker */], },
]; };
return ModalController;
}());
//# sourceMappingURL=modal-controller.js.map
/***/ }),
/* 314 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NavPopAnchor; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__navigation_deep_linker__ = __webpack_require__(19);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__navigation_view_controller__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__nav_pop__ = __webpack_require__(101);
/**
* @hidden
*/
var NavPopAnchor = (function () {
function NavPopAnchor(host, linker, viewCtrl) {
this.host = host;
this.linker = linker;
this.viewCtrl = viewCtrl;
}
NavPopAnchor.prototype.updateHref = function () {
if (this.host && this.viewCtrl) {
var previousView = this.host._nav.getPrevious(this.viewCtrl);
this._href = (previousView && this.linker.createUrl(this.host._nav, this.viewCtrl.component, this.viewCtrl.data)) || '#';
}
else {
this._href = '#';
}
};
NavPopAnchor.prototype.ngAfterContentInit = function () {
this.updateHref();
};
NavPopAnchor.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'a[navPop]',
host: {
'[attr.href]': '_href'
}
},] },
];
/** @nocollapse */
NavPopAnchor.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_3__nav_pop__["a" /* NavPop */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_1__navigation_deep_linker__["a" /* DeepLinker */], },
{ type: __WEBPACK_IMPORTED_MODULE_2__navigation_view_controller__["a" /* ViewController */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
]; };
return NavPopAnchor;
}());
//# sourceMappingURL=nav-pop-anchor.js.map
/***/ }),
/* 315 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NavPushAnchor; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__navigation_deep_linker__ = __webpack_require__(19);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__nav_push__ = __webpack_require__(102);
/**
* @hidden
*/
var NavPushAnchor = (function () {
function NavPushAnchor(host, linker) {
this.host = host;
this.linker = linker;
}
NavPushAnchor.prototype.updateHref = function () {
if (this.host && this.linker) {
this._href = this.linker.createUrl(this.host._nav, this.host.navPush, this.host.navParams) || '#';
}
else {
this._href = '#';
}
};
NavPushAnchor.prototype.ngAfterContentInit = function () {
this.updateHref();
};
NavPushAnchor.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'a[navPush]',
host: {
'[attr.href]': '_href'
}
},] },
];
/** @nocollapse */
NavPushAnchor.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_2__nav_push__["a" /* NavPush */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["w" /* Host */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_1__navigation_deep_linker__["a" /* DeepLinker */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
]; };
return NavPushAnchor;
}());
//# sourceMappingURL=nav-push-anchor.js.map
/***/ }),
/* 316 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Note; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ion__ = __webpack_require__(6);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name Note
* @module ionic
* @description
* A note is detailed item in an ion-item. It creates greyed out element that can be on the left or right side of an item.
* @usage
*
* ```html
* <ion-content>
* <ion-list>
* <ion-item>
* <ion-note item-start>
* Left Note
* </ion-note>
* My Item
* <ion-note item-end>
* Right Note
* </ion-note>
* </ion-item>
* </ion-list>
* </ion-content>
*```
* {@link /docs/api/components/api/components/item/item ion-item}
*/
var Note = (function (_super) {
__extends(Note, _super);
function Note(config, elementRef, renderer) {
return _super.call(this, config, elementRef, renderer, 'note') || this;
}
Note.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-note'
},] },
];
/** @nocollapse */
Note.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
]; };
return Note;
}(__WEBPACK_IMPORTED_MODULE_2__ion__["a" /* Ion */]));
//# sourceMappingURL=note.js.map
/***/ }),
/* 317 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PopoverController; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__app_app__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__popover__ = __webpack_require__(104);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__navigation_deep_linker__ = __webpack_require__(19);
/**
* @name PopoverController
* @description
* A Popover is a dialog that appears on top of the current page.
* It can be used for anything, but generally it is used for overflow
* actions that don't fit in the navigation bar.
*
* ### Creating
* A popover can be created by calling the `create` method. The view
* to display in the popover should be passed as the first argument.
* Any data to pass to the popover view can optionally be passed in
* the second argument. Options for the popover can optionally be
* passed in the third argument. See the [create](#create) method
* below for all available options.
*
* ### Presenting
* To present a popover, call the `present` method on a PopoverController instance.
* In order to position the popover relative to the element clicked, a click event
* needs to be passed into the options of the the `present method. If the event
* is not passed, the popover will be positioned in the center of the current
* view. See the [usage](#usage) section for an example of passing this event.
*
* ### Dismissing
* To dismiss the popover after creation, call the `dismiss()` method on the
* `Popover` instance. The popover can also be dismissed from within the popover's
* view by calling the `dismiss()` method on the [ViewController](../../navigation/ViewController).
* The `dismiss()` call accepts an optional parameter that will be passed to the callback described
* as follows. The `onDidDismiss(<func>)` function can be called to set up a callback action that will
* be performed after the popover is dismissed, receiving the parameter passed to `dismiss()`.
* The popover will dismiss when the backdrop is clicked by implicitly performing `dismiss(null)`,
* but this can be disabled by setting `enableBackdropDismiss` to `false` in the popover options.
*
* > Note that after the component is dismissed, it will not be usable anymore and
* another one must be created. This can be avoided by wrapping the creation and
* presentation of the component in a reusable function as shown in the [usage](#usage)
* section below.
*
* @usage
*
* To open a popover on the click of a button, pass `$event` to the method
* which creates and presents the popover:
*
* ```html
* <button ion-button icon-only (click)="presentPopover($event)">
* <ion-icon name="more"></ion-icon>
* </button>
* ```
*
* ```ts
* import { PopoverController } from 'ionic-angular';
*
* @Component({})
* class MyPage {
* constructor(public popoverCtrl: PopoverController) {}
*
* presentPopover(myEvent) {
* let popover = this.popoverCtrl.create(PopoverPage);
* popover.present({
* ev: myEvent
* });
* }
* }
* ```
*
* The `PopoverPage` will display inside of the popover, and
* can be anything. Below is an example of a page with items
* that close the popover on click.
*
* ```ts
* @Component({
* template: `
* <ion-list>
* <ion-list-header>Ionic</ion-list-header>
* <button ion-item (click)="close()">Learn Ionic</button>
* <button ion-item (click)="close()">Documentation</button>
* <button ion-item (click)="close()">Showcase</button>
* <button ion-item (click)="close()">GitHub Repo</button>
* </ion-list>
* `
* })
* class PopoverPage {
* constructor(public viewCtrl: ViewController) {}
*
* close() {
* this.viewCtrl.dismiss();
* }
* }
* ```
* @advanced
* Popover Options
*
* | Option | Type | Description |
* |-----------------------|------------|------------------------------------------------------------------------------------------------------------------|
* | cssClass |`string` | Additional classes for custom styles, separated by spaces. |
* | showBackdrop |`boolean` | Whether to show the backdrop. Default true. |
* | enableBackdropDismiss |`boolean` | Whether the popover should be dismissed by tapping the backdrop. Default true. |
*
*
*
* @demo /docs/demos/src/popover/
*/
var PopoverController = (function () {
function PopoverController(_app, config, _deepLinker) {
this._app = _app;
this.config = config;
this._deepLinker = _deepLinker;
}
/**
* Present a popover. See below for options
* @param {object} component The Popover
* @param {object} data Any data to pass to the Popover view
* @param {PopoverOptions} opts Popover options
*/
PopoverController.prototype.create = function (component, data, opts) {
if (data === void 0) { data = {}; }
if (opts === void 0) { opts = {}; }
return new __WEBPACK_IMPORTED_MODULE_3__popover__["a" /* Popover */](this._app, component, data, opts, this.config, this._deepLinker);
};
PopoverController.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
PopoverController.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__app_app__["a" /* App */], },
{ type: __WEBPACK_IMPORTED_MODULE_2__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_4__navigation_deep_linker__["a" /* DeepLinker */], },
]; };
return PopoverController;
}());
//# sourceMappingURL=popover-controller.js.map
/***/ }),
/* 318 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return RadioButton; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_form__ = __webpack_require__(20);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__ion__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__item_item__ = __webpack_require__(21);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__radio_group__ = __webpack_require__(106);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @description
* A radio button is a button that can be either checked or unchecked. A user can tap
* the button to check or uncheck it. It can also be checked from the template using
* the `checked` property.
*
* Use an element with a `radio-group` attribute to group a set of radio buttons. When
* radio buttons are inside a [radio group](../RadioGroup), exactly one radio button
* in the group can be checked at any time. If a radio button is not placed in a group,
* they will all have the ability to be checked at the same time.
*
* See the [Angular Forms Docs](https://angular.io/docs/ts/latest/guide/forms.html) for
* more information on forms and input.
*
* @usage
* ```html
* <ion-list radio-group [(ngModel)]="relationship">
* <ion-item>
* <ion-label>Friends</ion-label>
* <ion-radio value="friends" checked></ion-radio>
* </ion-item>
* <ion-item>
* <ion-label>Family</ion-label>
* <ion-radio value="family"></ion-radio>
* </ion-item>
* <ion-item>
* <ion-label>Enemies</ion-label>
* <ion-radio value="enemies" [disabled]="isDisabled"></ion-radio>
* </ion-item>
* </ion-list>
* ```
* @demo /docs/demos/src/radio/
* @see {@link /docs/components#radio Radio Component Docs}
* @see {@link ../RadioGroup RadioGroup API Docs}
*/
var RadioButton = (function (_super) {
__extends(RadioButton, _super);
function RadioButton(_form, config, elementRef, renderer, _item, _group) {
var _this = _super.call(this, config, elementRef, renderer, 'radio') || this;
_this._form = _form;
_this._item = _item;
_this._group = _group;
/**
* @internal
*/
_this._checked = false;
/**
* @internal
*/
_this._disabled = false;
/**
* @internal
*/
_this._value = null;
/**
* @output {any} Emitted when the radio button is selected.
*/
_this.ionSelect = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
_form.register(_this);
if (_group) {
// register with the radiogroup
_this.id = 'rb-' + _group.add(_this);
}
if (_item) {
// register the input inside of the item
// reset to the item's id instead of the radiogroup id
_this.id = 'rb-' + _item.registerInput('radio');
_this._labelId = 'lbl-' + _item.id;
_this._item.setElementClass('item-radio', true);
}
return _this;
}
Object.defineProperty(RadioButton.prototype, "color", {
/**
* @input {string} The color to use from your Sass `$colors` map.
* Default options are: `"primary"`, `"secondary"`, `"danger"`, `"light"`, and `"dark"`.
* For more information, see [Theming your App](/docs/theming/theming-your-app).
*/
set: function (val) {
this._setColor(val);
if (this._item) {
this._item._updateColor(val, 'item-radio');
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(RadioButton.prototype, "value", {
/**
* @input {any} The value of the radio button. Defaults to the generated id.
*/
get: function () {
// if the value is not defined then use it's unique id
return Object(__WEBPACK_IMPORTED_MODULE_4__util_util__["f" /* isBlank */])(this._value) ? this.id : this._value;
},
set: function (val) {
this._value = val;
},
enumerable: true,
configurable: true
});
Object.defineProperty(RadioButton.prototype, "checked", {
/**
* @input {boolean} If true, the element is selected, and other buttons in the group are unselected.
*/
get: function () {
return this._checked;
},
set: function (val) {
this._checked = Object(__WEBPACK_IMPORTED_MODULE_4__util_util__["o" /* isTrueProperty */])(val);
if (this._item) {
this._item.setElementClass('item-radio-checked', this._checked);
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(RadioButton.prototype, "disabled", {
/**
* @input {boolean} If true, the user cannot interact with this element.
*/
get: function () {
return this._disabled || (this._group != null && this._group.disabled);
},
set: function (val) {
this._disabled = Object(__WEBPACK_IMPORTED_MODULE_4__util_util__["o" /* isTrueProperty */])(val);
this._item && this._item.setElementClass('item-radio-disabled', this._disabled);
},
enumerable: true,
configurable: true
});
/**
* @hidden
*/
RadioButton.prototype.initFocus = function () {
this._elementRef.nativeElement.querySelector('button').focus();
};
/**
* @internal
*/
RadioButton.prototype._click = function (ev) {
(void 0) /* console.debug */;
ev.preventDefault();
ev.stopPropagation();
this.checked = true;
this.ionSelect.emit(this.value);
};
/**
* @internal
*/
RadioButton.prototype.ngOnInit = function () {
if (this._group && Object(__WEBPACK_IMPORTED_MODULE_4__util_util__["l" /* isPresent */])(this._group.value)) {
this.checked = Object(__WEBPACK_IMPORTED_MODULE_4__util_util__["g" /* isCheckedProperty */])(this._group.value, this.value);
}
if (this._group && this._group.disabled) {
this.disabled = this._group.disabled;
}
};
/**
* @internal
*/
RadioButton.prototype.ngOnDestroy = function () {
this._form.deregister(this);
this._group && this._group.remove(this);
};
RadioButton.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-radio',
template: '<div class="radio-icon" [class.radio-checked]="_checked"> ' +
'<div class="radio-inner"></div> ' +
'</div> ' +
'<button role="radio" ' +
'type="button" ' +
'ion-button="item-cover" ' +
'[id]="id" ' +
'[attr.aria-checked]="_checked" ' +
'[attr.aria-labelledby]="_labelId" ' +
'[attr.aria-disabled]="_disabled" ' +
'class="item-cover"> ' +
'</button>',
host: {
'[class.radio-disabled]': '_disabled'
},
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
},] },
];
/** @nocollapse */
RadioButton.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_2__util_form__["a" /* Form */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_5__item_item__["a" /* Item */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_6__radio_group__["a" /* RadioGroup */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
]; };
RadioButton.propDecorators = {
'color': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'ionSelect': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'value': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'checked': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'disabled': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'_click': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* HostListener */], args: ['click', ['$event'],] },],
};
return RadioButton;
}(__WEBPACK_IMPORTED_MODULE_3__ion__["a" /* Ion */]));
//# sourceMappingURL=radio-button.js.map
/***/ }),
/* 319 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Range; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_forms__ = __webpack_require__(16);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__platform_dom_controller__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__util_form__ = __webpack_require__(20);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__tap_click_haptic__ = __webpack_require__(47);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__util_base_input__ = __webpack_require__(29);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__item_item__ = __webpack_require__(21);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__platform_platform__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__util_dom__ = __webpack_require__(14);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__gestures_ui_event_manager__ = __webpack_require__(28);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name Range
* @description
* The Range slider lets users select from a range of values by moving
* the slider knob. It can accept dual knobs, but by default one knob
* controls the value of the range.
*
* ### Range Labels
* Labels can be placed on either side of the range by adding the
* `range-left` or `range-right` property to the element. The element
* doesn't have to be an `ion-label`, it can be added to any element
* to place it to the left or right of the range. See [usage](#usage)
* below for examples.
*
*
* ### Minimum and Maximum Values
* Minimum and maximum values can be passed to the range through the `min`
* and `max` properties, respectively. By default, the range sets the `min`
* to `0` and the `max` to `100`.
*
*
* ### Steps and Snaps
* The `step` property specifies the value granularity of the range's value.
* It can be useful to set the `step` when the value isn't in increments of `1`.
* Setting the `step` property will show tick marks on the range for each step.
* The `snaps` property can be set to automatically move the knob to the nearest
* tick mark based on the step property value.
*
*
* ### Dual Knobs
* Setting the `dualKnobs` property to `true` on the range component will
* enable two knobs on the range. If the range has two knobs, the value will
* be an object containing two properties: `lower` and `upper`.
*
*
* @usage
* ```html
* <ion-list>
* <ion-item>
* <ion-range [(ngModel)]="singleValue" color="danger" pin="true"></ion-range>
* </ion-item>
*
* <ion-item>
* <ion-range min="-200" max="200" [(ngModel)]="saturation" color="secondary">
* <ion-label range-left>-200</ion-label>
* <ion-label range-right>200</ion-label>
* </ion-range>
* </ion-item>
*
* <ion-item>
* <ion-range min="20" max="80" step="2" [(ngModel)]="brightness">
* <ion-icon small range-left name="sunny"></ion-icon>
* <ion-icon range-right name="sunny"></ion-icon>
* </ion-range>
* </ion-item>
*
* <ion-item>
* <ion-label>step=100, snaps, {{singleValue4}}</ion-label>
* <ion-range min="1000" max="2000" step="100" snaps="true" color="secondary" [(ngModel)]="singleValue4"></ion-range>
* </ion-item>
*
* <ion-item>
* <ion-label>dual, step=3, snaps, {{dualValue2 | json}}</ion-label>
* <ion-range dualKnobs="true" [(ngModel)]="dualValue2" min="21" max="72" step="3" snaps="true"></ion-range>
* </ion-item>
* </ion-list>
* ```
*
*
* @demo /docs/demos/src/range/
*/
var Range = (function (_super) {
__extends(Range, _super);
function Range(form, _haptic, item, config, _plt, elementRef, renderer, _dom, _cd) {
var _this = _super.call(this, config, elementRef, renderer, 'range', 0, form, item, null) || this;
_this._haptic = _haptic;
_this._plt = _plt;
_this._dom = _dom;
_this._cd = _cd;
_this._min = 0;
_this._max = 100;
_this._step = 1;
_this._valA = 0;
_this._valB = 0;
_this._ratioA = 0;
_this._ratioB = 0;
_this._events = new __WEBPACK_IMPORTED_MODULE_11__gestures_ui_event_manager__["a" /* UIEventManager */](_plt);
return _this;
}
Object.defineProperty(Range.prototype, "min", {
/**
* @input {number} Minimum integer value of the range. Defaults to `0`.
*/
get: function () {
return this._min;
},
set: function (val) {
val = Math.round(val);
if (!isNaN(val)) {
this._min = val;
this._inputUpdated();
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(Range.prototype, "max", {
/**
* @input {number} Maximum integer value of the range. Defaults to `100`.
*/
get: function () {
return this._max;
},
set: function (val) {
val = Math.round(val);
if (!isNaN(val)) {
this._max = val;
this._inputUpdated();
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(Range.prototype, "step", {
/**
* @input {number} Specifies the value granularity. Defaults to `1`.
*/
get: function () {
return this._step;
},
set: function (val) {
val = Math.round(val);
if (!isNaN(val) && val > 0) {
this._step = val;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(Range.prototype, "snaps", {
/**
* @input {boolean} If true, the knob snaps to tick marks evenly spaced based
* on the step property value. Defaults to `false`.
*/
get: function () {
return this._snaps;
},
set: function (val) {
this._snaps = Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Range.prototype, "pin", {
/**
* @input {boolean} If true, a pin with integer value is shown when the knob
* is pressed. Defaults to `false`.
*/
get: function () {
return this._pin;
},
set: function (val) {
this._pin = Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Range.prototype, "debounce", {
/**
* @input {number} How long, in milliseconds, to wait to trigger the
* `ionChange` event after each change in the range value. Default `0`.
*/
get: function () {
return this._debouncer.wait;
},
set: function (val) {
this._debouncer.wait = val;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Range.prototype, "dualKnobs", {
/**
* @input {boolean} Show two knobs. Defaults to `false`.
*/
get: function () {
return this._dual;
},
set: function (val) {
this._dual = Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Range.prototype, "ratio", {
/**
* Returns the ratio of the knob's is current location, which is a number
* between `0` and `1`. If two knobs are used, this property represents
* the lower value.
*/
get: function () {
if (this._dual) {
return Math.min(this._ratioA, this._ratioB);
}
return this._ratioA;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Range.prototype, "ratioUpper", {
/**
* Returns the ratio of the upper value's is current location, which is
* a number between `0` and `1`. If there is only one knob, then this
* will return `null`.
*/
get: function () {
if (this._dual) {
return Math.max(this._ratioA, this._ratioB);
}
return null;
},
enumerable: true,
configurable: true
});
/**
* @hidden
*/
Range.prototype.ngAfterContentInit = function () {
this._initialize();
// add touchstart/mousedown listeners
this._events.pointerEvents({
element: this._slider.nativeElement,
pointerDown: this._pointerDown.bind(this),
pointerMove: this._pointerMove.bind(this),
pointerUp: this._pointerUp.bind(this),
zone: true
});
// build all the ticks if there are any to show
this._createTicks();
};
/** @internal */
Range.prototype._pointerDown = function (ev) {
// TODO: we could stop listening for events instead of checking this._disabled.
// since there are a lot of events involved, this solution is
// enough for the moment
if (this._disabled) {
return false;
}
// trigger ionFocus event
this._fireFocus();
// prevent default so scrolling does not happen
ev.preventDefault();
ev.stopPropagation();
// get the start coordinates
var current = Object(__WEBPACK_IMPORTED_MODULE_10__util_dom__["f" /* pointerCoord */])(ev);
// get the full dimensions of the slider element
var rect = this._rect = this._plt.getElementBoundingClientRect(this._slider.nativeElement);
// figure out which knob they started closer to
var ratio = Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["a" /* clamp */])(0, (current.x - rect.left) / (rect.width), 1);
this._activeB = this._dual && (Math.abs(ratio - this._ratioA) > Math.abs(ratio - this._ratioB));
// update the active knob's position
this._update(current, rect, true);
// trigger a haptic start
this._haptic.gestureSelectionStart();
// return true so the pointer events
// know everything's still valid
return true;
};
/** @internal */
Range.prototype._pointerMove = function (ev) {
if (this._disabled) {
return;
}
// prevent default so scrolling does not happen
ev.preventDefault();
ev.stopPropagation();
// update the active knob's position
var hasChanged = this._update(Object(__WEBPACK_IMPORTED_MODULE_10__util_dom__["f" /* pointerCoord */])(ev), this._rect, true);
if (hasChanged && this._snaps) {
// trigger a haptic selection changed event
// if this is a snap range
this._haptic.gestureSelectionChanged();
}
};
/** @internal */
Range.prototype._pointerUp = function (ev) {
if (this._disabled) {
return;
}
// prevent default so scrolling does not happen
ev.preventDefault();
ev.stopPropagation();
// update the active knob's position
this._update(Object(__WEBPACK_IMPORTED_MODULE_10__util_dom__["f" /* pointerCoord */])(ev), this._rect, false);
// trigger a haptic end
this._haptic.gestureSelectionEnd();
// trigger ionBlur event
this._fireBlur();
};
/** @internal */
Range.prototype._update = function (current, rect, isPressed) {
// figure out where the pointer is currently at
// update the knob being interacted with
var ratio = Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["a" /* clamp */])(0, (current.x - rect.left) / (rect.width), 1);
var val = this._ratioToValue(ratio);
if (this._snaps) {
// snaps the ratio to the current value
ratio = this._valueToRatio(val);
}
// update which knob is pressed
this._pressed = isPressed;
var valChanged = false;
if (this._activeB) {
// when the pointer down started it was determined
// that knob B was the one they were interacting with
this._pressedB = isPressed;
this._pressedA = false;
this._ratioB = ratio;
valChanged = val === this._valB;
this._valB = val;
}
else {
// interacting with knob A
this._pressedA = isPressed;
this._pressedB = false;
this._ratioA = ratio;
valChanged = val === this._valA;
this._valA = val;
}
this._updateBar();
if (valChanged) {
return false;
}
// value has been updated
var value;
if (this._dual) {
// dual knobs have an lower and upper value
value = {
lower: Math.min(this._valA, this._valB),
upper: Math.max(this._valA, this._valB)
};
(void 0) /* console.debug */;
}
else {
// single knob only has one value
value = this._valA;
(void 0) /* console.debug */;
}
// Update input value
this.value = value;
return true;
};
/** @internal */
Range.prototype._updateBar = function () {
var ratioA = this._ratioA;
var ratioB = this._ratioB;
if (this._dual) {
this._barL = (Math.min(ratioA, ratioB) * 100) + "%";
this._barR = 100 - (Math.max(ratioA, ratioB) * 100) + "%";
}
else {
this._barL = '';
this._barR = 100 - (ratioA * 100) + "%";
}
this._updateTicks();
};
/** @internal */
Range.prototype._createTicks = function () {
var _this = this;
if (this._snaps) {
this._dom.write(function () {
// TODO: Fix to not use RAF
_this._ticks = [];
for (var value = _this._min; value <= _this._max; value += _this._step) {
var ratio = _this._valueToRatio(value);
_this._ticks.push({
ratio: ratio,
left: ratio * 100 + "%",
});
}
_this._updateTicks();
});
}
};
/** @internal */
Range.prototype._updateTicks = function () {
var ticks = this._ticks;
var ratio = this.ratio;
if (this._snaps && ticks) {
if (this._dual) {
var upperRatio = this.ratioUpper;
ticks.forEach(function (t) {
t.active = (t.ratio >= ratio && t.ratio <= upperRatio);
});
}
else {
ticks.forEach(function (t) {
t.active = (t.ratio <= ratio);
});
}
}
};
/** @hidden */
Range.prototype._keyChg = function (isIncrease, isKnobB) {
var step = this._step;
if (isKnobB) {
if (isIncrease) {
this._valB += step;
}
else {
this._valB -= step;
}
this._valB = Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["a" /* clamp */])(this._min, this._valB, this._max);
this._ratioB = this._valueToRatio(this._valB);
}
else {
if (isIncrease) {
this._valA += step;
}
else {
this._valA -= step;
}
this._valA = Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["a" /* clamp */])(this._min, this._valA, this._max);
this._ratioA = this._valueToRatio(this._valA);
}
this._updateBar();
};
/** @internal */
Range.prototype._ratioToValue = function (ratio) {
ratio = Math.round(((this._max - this._min) * ratio));
ratio = Math.round(ratio / this._step) * this._step + this._min;
return Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["a" /* clamp */])(this._min, ratio, this._max);
};
/** @internal */
Range.prototype._valueToRatio = function (value) {
value = Math.round((value - this._min) / this._step) * this._step;
value = value / (this._max - this._min);
return Object(__WEBPACK_IMPORTED_MODULE_2__util_util__["a" /* clamp */])(0, value, 1);
};
Range.prototype._inputNormalize = function (val) {
if (this._dual) {
return val;
}
else {
val = parseFloat(val);
return isNaN(val) ? undefined : val;
}
};
/**
* @hidden
*/
Range.prototype._inputUpdated = function () {
var val = this.value;
if (this._dual) {
this._valA = val.lower;
this._valB = val.upper;
this._ratioA = this._valueToRatio(val.lower);
this._ratioB = this._valueToRatio(val.upper);
}
else {
this._valA = val;
this._ratioA = this._valueToRatio(val);
}
this._updateBar();
this._cd.detectChanges();
};
/**
* @hidden
*/
Range.prototype.ngOnDestroy = function () {
_super.prototype.ngOnDestroy.call(this);
this._events.destroy();
};
Range.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-range',
template: '<ng-content select="[range-left]"></ng-content>' +
'<div class="range-slider" #slider>' +
'<div class="range-tick" *ngFor="let t of _ticks" [style.left]="t.left" [class.range-tick-active]="t.active" role="presentation"></div>' +
'<div class="range-bar" role="presentation"></div>' +
'<div class="range-bar range-bar-active" [style.left]="_barL" [style.right]="_barR" #bar role="presentation"></div>' +
'<div class="range-knob-handle" (ionIncrease)="_keyChg(true, false)" (ionDecrease)="_keyChg(false, false)" [ratio]="_ratioA" [val]="_valA" [pin]="_pin" [pressed]="_pressedA" [min]="_min" [max]="_max" [disabled]="_disabled" [labelId]="_labelId"></div>' +
'<div class="range-knob-handle" (ionIncrease)="_keyChg(true, true)" (ionDecrease)="_keyChg(false, true)" [ratio]="_ratioB" [val]="_valB" [pin]="_pin" [pressed]="_pressedB" [min]="_min" [max]="_max" [disabled]="_disabled" [labelId]="_labelId" *ngIf="_dual"></div>' +
'</div>' +
'<ng-content select="[range-right]"></ng-content>',
host: {
'[class.range-disabled]': '_disabled',
'[class.range-pressed]': '_pressed',
'[class.range-has-pin]': '_pin'
},
providers: [{ provide: __WEBPACK_IMPORTED_MODULE_1__angular_forms__["c" /* NG_VALUE_ACCESSOR */], useExisting: Range, multi: true }],
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
},] },
];
/** @nocollapse */
Range.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_5__util_form__["a" /* Form */], },
{ type: __WEBPACK_IMPORTED_MODULE_6__tap_click_haptic__["a" /* Haptic */], },
{ type: __WEBPACK_IMPORTED_MODULE_8__item_item__["a" /* Item */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_3__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_9__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_4__platform_dom_controller__["a" /* DomController */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["j" /* ChangeDetectorRef */], },
]; };
Range.propDecorators = {
'_slider': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_8" /* ViewChild */], args: ['slider',] },],
'min': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'max': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'step': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'snaps': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'pin': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'debounce': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'dualKnobs': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
};
return Range;
}(__WEBPACK_IMPORTED_MODULE_7__util_base_input__["a" /* BaseInput */]));
//# sourceMappingURL=range.js.map
/***/ }),
/* 320 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return RangeKnob; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__platform_key__ = __webpack_require__(23);
/**
* @hidden
*/
var RangeKnob = (function () {
function RangeKnob() {
this.ionIncrease = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
this.ionDecrease = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
}
Object.defineProperty(RangeKnob.prototype, "ratio", {
set: function (r) {
this._x = r * 100 + "%";
},
enumerable: true,
configurable: true
});
RangeKnob.prototype._keyup = function (ev) {
var keyCode = ev.keyCode;
if (keyCode === __WEBPACK_IMPORTED_MODULE_1__platform_key__["d" /* KEY_LEFT */] || keyCode === __WEBPACK_IMPORTED_MODULE_1__platform_key__["a" /* KEY_DOWN */]) {
(void 0) /* console.debug */;
this.ionDecrease.emit();
ev.preventDefault();
ev.stopPropagation();
}
else if (keyCode === __WEBPACK_IMPORTED_MODULE_1__platform_key__["e" /* KEY_RIGHT */] || keyCode === __WEBPACK_IMPORTED_MODULE_1__platform_key__["h" /* KEY_UP */]) {
(void 0) /* console.debug */;
this.ionIncrease.emit();
ev.preventDefault();
ev.stopPropagation();
}
};
RangeKnob.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: '.range-knob-handle',
template: '<div class="range-pin" *ngIf="pin" role="presentation">{{val}}</div>' +
'<div class="range-knob" role="presentation"></div>',
host: {
'[class.range-knob-pressed]': 'pressed',
'[class.range-knob-min]': 'val===min||val===undefined',
'[class.range-knob-max]': 'val===max',
'[style.left]': '_x',
'[attr.aria-valuenow]': 'val',
'[attr.aria-valuemin]': 'min',
'[attr.aria-valuemax]': 'max',
'[attr.aria-disabled]': 'disabled',
'[attr.aria-labelledby]': 'labelId',
'[tabindex]': 'disabled?-1:0',
'role': 'slider'
}
},] },
];
/** @nocollapse */
RangeKnob.ctorParameters = function () { return []; };
RangeKnob.propDecorators = {
'ratio': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'pressed': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'pin': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'min': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'max': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'val': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'disabled': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'labelId': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'ionIncrease': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'ionDecrease': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'_keyup': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* HostListener */], args: ['keydown', ['$event'],] },],
};
return RangeKnob;
}());
//# sourceMappingURL=range-knob.js.map
/***/ }),
/* 321 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return RefresherContent; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__refresher__ = __webpack_require__(107);
/**
* @hidden
*/
var RefresherContent = (function () {
function RefresherContent(r, _config) {
this.r = r;
this._config = _config;
}
/**
* @hidden
*/
RefresherContent.prototype.ngOnInit = function () {
if (!this.pullingIcon) {
this.pullingIcon = this._config.get('ionPullIcon', 'arrow-down');
}
if (!this.refreshingSpinner) {
this.refreshingSpinner = this._config.get('ionRefreshingSpinner', this._config.get('spinner', 'ios'));
}
};
RefresherContent.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-refresher-content',
template: '<div class="refresher-pulling">' +
'<div class="refresher-pulling-icon" *ngIf="pullingIcon">' +
'<ion-icon [name]="pullingIcon"></ion-icon>' +
'</div>' +
'<div class="refresher-pulling-text" [innerHTML]="pullingText" *ngIf="pullingText"></div>' +
'</div>' +
'<div class="refresher-refreshing">' +
'<div class="refresher-refreshing-icon">' +
'<ion-spinner [name]="refreshingSpinner"></ion-spinner>' +
'</div>' +
'<div class="refresher-refreshing-text" [innerHTML]="refreshingText" *ngIf="refreshingText"></div>' +
'</div>',
host: {
'[attr.state]': 'r.state'
},
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
},] },
];
/** @nocollapse */
RefresherContent.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_2__refresher__["a" /* Refresher */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
]; };
RefresherContent.propDecorators = {
'pullingIcon': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'pullingText': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'refreshingSpinner': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'refreshingText': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
};
return RefresherContent;
}());
//# sourceMappingURL=refresher-content.js.map
/***/ }),
/* 322 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Scroll; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_util__ = __webpack_require__(3);
/**
* @name Scroll
* @description
* Scroll is a non-flexboxed scroll area that can scroll horizontally or vertically. `ion-Scroll` Can be used in places where you may not need a full page scroller, but a highly customized one, such as image scubber or comment scroller.
* @usage
* ```html
* <ion-scroll scrollX="true">
* </ion-scroll>
*
* <ion-scroll scrollY="true">
* </ion-scroll>
*
* <ion-scroll scrollX="true" scrollY="true">
* </ion-scroll>
* ```
* @demo /docs/demos/src/scroll/
*/
var Scroll = (function () {
function Scroll() {
this._scrollX = false;
this._scrollY = false;
this._zoom = false;
this._maxZoom = 1;
/**
* @hidden
*/
this.maxScale = 3;
/**
* @hidden
*/
this.zoomDuration = 250;
}
Object.defineProperty(Scroll.prototype, "scrollX", {
/**
* @input {boolean} If true, scrolling along the X axis is enabled.
*/
get: function () {
return this._scrollX;
},
set: function (val) {
this._scrollX = Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Scroll.prototype, "scrollY", {
/**
* @input {boolean} If true, scrolling along the Y axis is enabled; requires the following CSS declaration: ion-scroll { white-space: nowrap; }
*/
get: function () {
return this._scrollY;
},
set: function (val) {
this._scrollY = Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Scroll.prototype, "zoom", {
/**
* @input {boolean} If true, zooming is enabled.
*/
get: function () {
return this._zoom;
},
set: function (val) {
this._zoom = Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Scroll.prototype, "maxZoom", {
/**
* @input {number} Set the max zoom amount.
*/
get: function () {
return this._maxZoom;
},
set: function (val) {
this._maxZoom = val;
},
enumerable: true,
configurable: true
});
/**
* @hidden
* Add a scroll event handler to the scroll element if it exists.
* @param {Function} handler The scroll handler to add to the scroll element.
* @returns {?Function} a function to remove the specified handler, otherwise
* undefined if the scroll element doesn't exist.
*/
Scroll.prototype.addScrollEventListener = function (handler) {
(void 0) /* assert */;
var ele = this._scrollContent.nativeElement;
ele.addEventListener('scroll', handler);
return function () {
ele.removeEventListener('scroll', handler);
};
};
Scroll.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-scroll',
template: '<div class="scroll-content" #scrollContent>' +
'<div class="scroll-zoom-wrapper">' +
'<ng-content></ng-content>' +
'</div>' +
'</div>',
host: {
'[class.scroll-x]': 'scrollX',
'[class.scroll-y]': 'scrollY'
},
changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* ChangeDetectionStrategy */].OnPush,
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
},] },
];
/** @nocollapse */
Scroll.ctorParameters = function () { return []; };
Scroll.propDecorators = {
'scrollX': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'scrollY': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'zoom': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'maxZoom': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'_scrollContent': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_8" /* ViewChild */], args: ['scrollContent', { read: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */] },] },],
};
return Scroll;
}());
//# sourceMappingURL=scroll.js.map
/***/ }),
/* 323 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Searchbar; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_forms__ = __webpack_require__(16);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_base_input__ = __webpack_require__(29);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__util_debouncer__ = __webpack_require__(147);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__platform_platform__ = __webpack_require__(4);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name Searchbar
* @module ionic
* @description
* Manages the display of a Searchbar which can be used to search or filter items.
*
* @usage
* ```html
* <ion-searchbar
* [(ngModel)]="myInput"
* [showCancelButton]="shouldShowCancel"
* (ionInput)="onInput($event)"
* (ionCancel)="onCancel($event)">
* </ion-searchbar>
* ```
*
* @demo /docs/demos/src/searchbar/
* @see {@link /docs/components#searchbar Searchbar Component Docs}
*/
var Searchbar = (function (_super) {
__extends(Searchbar, _super);
function Searchbar(config, _plt, elementRef, renderer, ngControl) {
var _this = _super.call(this, config, elementRef, renderer, 'searchbar', '', null, null, ngControl) || this;
_this._plt = _plt;
_this._shouldBlur = true;
_this._shouldAlignLeft = true;
_this._isCancelVisible = false;
_this._spellcheck = false;
_this._autocomplete = 'off';
_this._autocorrect = 'off';
_this._isActive = false;
_this._showCancelButton = false;
_this._animated = false;
_this._inputDebouncer = new __WEBPACK_IMPORTED_MODULE_5__util_debouncer__["a" /* TimeoutDebouncer */](0);
/**
* @input {string} Set the the cancel button text. Default: `"Cancel"`.
*/
_this.cancelButtonText = 'Cancel';
/**
* @input {string} Set the input's placeholder. Default `"Search"`.
*/
_this.placeholder = 'Search';
/**
* @input {string} Set the type of the input. Values: `"text"`, `"password"`, `"email"`, `"number"`, `"search"`, `"tel"`, `"url"`. Default `"search"`.
*/
_this.type = 'search';
/**
* @output {event} Emitted when the Searchbar input has changed, including when it's cleared.
*/
_this.ionInput = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* @output {event} Emitted when the cancel button is clicked.
*/
_this.ionCancel = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
/**
* @output {event} Emitted when the clear input button is clicked.
*/
_this.ionClear = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
_this.debounce = 250;
return _this;
}
Object.defineProperty(Searchbar.prototype, "showCancelButton", {
/**
* @input {boolean} If true, show the cancel button. Default `false`.
*/
get: function () {
return this._showCancelButton;
},
set: function (val) {
this._showCancelButton = Object(__WEBPACK_IMPORTED_MODULE_4__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Searchbar.prototype, "debounce", {
/**
* @input {number} How long, in milliseconds, to wait to trigger the `ionInput` event after each keystroke. Default `250`.
*/
get: function () {
return this._debouncer.wait;
},
set: function (val) {
this._debouncer.wait = val;
this._inputDebouncer.wait = val;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Searchbar.prototype, "autocomplete", {
/**
* @input {string} Set the input's autocomplete property. Values: `"on"`, `"off"`. Default `"off"`.
*/
set: function (val) {
this._autocomplete = (val === '' || val === 'on') ? 'on' : this._config.get('autocomplete', 'off');
},
enumerable: true,
configurable: true
});
Object.defineProperty(Searchbar.prototype, "autocorrect", {
/**
* @input {string} Set the input's autocorrect property. Values: `"on"`, `"off"`. Default `"off"`.
*/
set: function (val) {
this._autocorrect = (val === '' || val === 'on') ? 'on' : this._config.get('autocorrect', 'off');
},
enumerable: true,
configurable: true
});
Object.defineProperty(Searchbar.prototype, "spellcheck", {
/**
* @input {string|boolean} Set the input's spellcheck property. Values: `true`, `false`. Default `false`.
*/
set: function (val) {
this._spellcheck = (val === '' || val === 'true' || val === true) ? true : this._config.getBoolean('spellcheck', false);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Searchbar.prototype, "animated", {
/**
* @input {boolean} If true, enable searchbar animation. Default `false`.
*/
get: function () {
return this._animated;
},
set: function (val) {
this._animated = Object(__WEBPACK_IMPORTED_MODULE_4__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
/**
* @hidden
* On Initialization check for attributes
*/
Searchbar.prototype.ngOnInit = function () {
var showCancelButton = this.showCancelButton;
if (typeof showCancelButton === 'string') {
this.showCancelButton = (showCancelButton === '' || showCancelButton === 'true');
}
};
/**
* @hidden
*/
Searchbar.prototype._inputUpdated = function () {
var ele = this._searchbarInput.nativeElement;
var value = this._value;
// It is important not to re-assign the value if it is the same, because,
// otherwise, the caret is moved to the end of the input
if (ele.value !== value) {
ele.value = value;
}
this.positionElements();
};
/**
* @hidden
* Positions the input search icon, placeholder, and the cancel button
* based on the input value and if it is focused. (ios only)
*/
Searchbar.prototype.positionElements = function () {
var isAnimated = this._animated;
var prevAlignLeft = this._shouldAlignLeft;
var shouldAlignLeft = (!isAnimated || (this._value && this._value.toString().trim() !== '') || this._isFocus === true);
this._shouldAlignLeft = shouldAlignLeft;
if (this._mode !== 'ios') {
return;
}
if (prevAlignLeft !== shouldAlignLeft) {
this.positionPlaceholder();
}
if (isAnimated) {
this.positionCancelButton();
}
};
Searchbar.prototype.positionPlaceholder = function () {
var inputEle = this._searchbarInput.nativeElement;
var iconEle = this._searchbarIcon.nativeElement;
if (this._shouldAlignLeft) {
inputEle.removeAttribute('style');
iconEle.removeAttribute('style');
}
else {
// Create a dummy span to get the placeholder width
var doc = this._plt.doc();
var tempSpan = doc.createElement('span');
tempSpan.innerHTML = this.placeholder;
doc.body.appendChild(tempSpan);
// Get the width of the span then remove it
var textWidth = tempSpan.offsetWidth;
doc.body.removeChild(tempSpan);
// Set the input padding start
var inputLeft = 'calc(50% - ' + (textWidth / 2) + 'px)';
if (this._plt.isRTL) {
inputEle.style.paddingRight = inputLeft;
}
else {
inputEle.style.paddingLeft = inputLeft;
}
// Set the icon margin start
var iconLeft = 'calc(50% - ' + ((textWidth / 2) + 30) + 'px)';
if (this._plt.isRTL) {
iconEle.style.marginRight = iconLeft;
}
else {
iconEle.style.marginLeft = iconLeft;
}
}
};
/**
* @hidden
* Show the iOS Cancel button on focus, hide it offscreen otherwise
*/
Searchbar.prototype.positionCancelButton = function () {
var showShowCancel = this._isFocus;
if (showShowCancel !== this._isCancelVisible) {
var cancelStyleEle = this._cancelButton.nativeElement;
var cancelStyle = cancelStyleEle.style;
this._isCancelVisible = showShowCancel;
if (showShowCancel) {
if (this._plt.isRTL) {
cancelStyle.marginLeft = '0';
}
else {
cancelStyle.marginRight = '0';
}
}
else {
var offset = cancelStyleEle.offsetWidth;
if (offset > 0) {
if (this._plt.isRTL) {
cancelStyle.marginLeft = -offset + 'px';
}
else {
cancelStyle.marginRight = -offset + 'px';
}
}
}
}
};
/**
* @hidden
* Update the Searchbar input value when the input changes
*/
Searchbar.prototype.inputChanged = function (ev) {
var _this = this;
this.value = ev.target.value;
this._inputDebouncer.debounce(function () {
_this.ionInput.emit(ev);
});
};
/**
* @hidden
* Sets the Searchbar to focused and active on input focus.
*/
Searchbar.prototype.inputFocused = function () {
this._isActive = true;
this._fireFocus();
this.positionElements();
};
/**
* @hidden
* Sets the Searchbar to not focused and checks if it should align left
* based on whether there is a value in the searchbar or not.
*/
Searchbar.prototype.inputBlurred = function () {
// _shouldBlur determines if it should blur
// if we are clearing the input we still want to stay focused in the input
if (this._shouldBlur === false) {
this._searchbarInput.nativeElement.focus();
this._shouldBlur = true;
return;
}
this._fireBlur();
this.positionElements();
};
/**
* @hidden
* Clears the input field and triggers the control change.
*/
Searchbar.prototype.clearInput = function (ev) {
var _this = this;
this.ionClear.emit(ev);
// setTimeout() fixes https://github.com/ionic-team/ionic/issues/7527
// wait for 4 frames
setTimeout(function () {
var value = _this._value;
if (Object(__WEBPACK_IMPORTED_MODULE_4__util_util__["l" /* isPresent */])(value) && value !== '') {
_this.value = ''; // DOM WRITE
_this.ionInput.emit(ev);
}
}, 16 * 4);
this._shouldBlur = false;
};
/**
* @hidden
* Clears the input field and tells the input to blur since
* the clearInput function doesn't want the input to blur
* then calls the custom cancel function if the user passed one in.
*/
Searchbar.prototype.cancelSearchbar = function (ev) {
this.ionCancel.emit(ev);
this.clearInput(ev);
this._shouldBlur = true;
this._isActive = false;
};
Searchbar.prototype.setFocus = function () {
this._renderer.invokeElementMethod(this._searchbarInput.nativeElement, 'focus');
};
Searchbar.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-searchbar',
template: '<div class="searchbar-input-container">' +
'<button ion-button mode="md" (click)="cancelSearchbar($event)" (mousedown)="cancelSearchbar($event)" clear color="dark" class="searchbar-md-cancel" type="button">' +
'<ion-icon name="md-arrow-back"></ion-icon>' +
'</button>' +
'<div #searchbarIcon class="searchbar-search-icon"></div>' +
'<input #searchbarInput class="searchbar-input" (input)="inputChanged($event)" (blur)="inputBlurred()" (focus)="inputFocused()" ' +
'dir="auto" ' +
'[attr.placeholder]="placeholder" ' +
'[attr.type]="type" ' +
'[attr.autocomplete]="_autocomplete" ' +
'[attr.autocorrect]="_autocorrect" ' +
'[attr.spellcheck]="_spellcheck">' +
'<button ion-button clear class="searchbar-clear-icon" [mode]="_mode" (click)="clearInput($event)" (mousedown)="clearInput($event)" type="button"></button>' +
'</div>' +
'<button ion-button #cancelButton mode="ios" [tabindex]="_isActive ? 1 : -1" clear (click)="cancelSearchbar($event)" (mousedown)="cancelSearchbar($event)" class="searchbar-ios-cancel" type="button">{{cancelButtonText}}</button>',
host: {
'[class.searchbar-animated]': '_animated',
'[class.searchbar-has-value]': '_value',
'[class.searchbar-active]': '_isActive',
'[class.searchbar-show-cancel]': '_showCancelButton',
'[class.searchbar-left-aligned]': '_shouldAlignLeft',
'[class.searchbar-has-focus]': '_isFocus'
},
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None
},] },
];
/** @nocollapse */
Searchbar.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_2__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_6__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_forms__["d" /* NgControl */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
]; };
Searchbar.propDecorators = {
'cancelButtonText': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'showCancelButton': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'debounce': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'placeholder': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'autocomplete': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'autocorrect': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'spellcheck': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'type': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'animated': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'ionInput': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'ionCancel': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'ionClear': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'_searchbarInput': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_8" /* ViewChild */], args: ['searchbarInput',] },],
'_searchbarIcon': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_8" /* ViewChild */], args: ['searchbarIcon',] },],
'_cancelButton': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_8" /* ViewChild */], args: ['cancelButton', { read: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */] },] },],
};
return Searchbar;
}(__WEBPACK_IMPORTED_MODULE_3__util_base_input__["a" /* BaseInput */]));
//# sourceMappingURL=searchbar.js.map
/***/ }),
/* 324 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Segment; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_forms__ = __webpack_require__(16);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_base_input__ = __webpack_require__(29);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__segment_button__ = __webpack_require__(108);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name Segment
* @description
* A Segment is a group of buttons, sometimes known as Segmented Controls, that allow the user to interact with a compact group of a number of controls.
* Segments provide functionality similar to tabs, selecting one will unselect all others. You should use a tab bar instead of a segmented control when you want to let the user move back and forth between distinct pages in your app.
* You could use Angular's `ngModel` or `FormBuilder` API. For an overview on how `FormBuilder` works, checkout [Angular Forms](http://learnangular2.com/forms/), or [Angular FormBuilder](https://angular.io/docs/ts/latest/api/forms/index/FormBuilder-class.html)
*
*
* ```html
* <!-- Segment in a header -->
* <ion-header>
* <ion-toolbar>
* <ion-segment [(ngModel)]="icons" color="secondary">
* <ion-segment-button value="camera">
* <ion-icon name="camera"></ion-icon>
* </ion-segment-button>
* <ion-segment-button value="bookmark">
* <ion-icon name="bookmark"></ion-icon>
* </ion-segment-button>
* </ion-segment>
* </ion-toolbar>
* </ion-header>
*
* <ion-content>
* <!-- Segment in content -->
* <ion-segment [(ngModel)]="relationship" color="primary" (ionChange)="segmentChanged($event)">
* <ion-segment-button value="friends">
* Friends
* </ion-segment-button>
* <ion-segment-button value="enemies">
* Enemies
* </ion-segment-button>
* </ion-segment>
*
* <!-- Segment in a form -->
* <form [formGroup]="myForm">
* <ion-segment formControlName="mapStyle" color="danger">
* <ion-segment-button value="standard">
* Standard
* </ion-segment-button>
* <ion-segment-button value="hybrid">
* Hybrid
* </ion-segment-button>
* <ion-segment-button value="sat">
* Satellite
* </ion-segment-button>
* </ion-segment>
* </form>
* </ion-content>
* ```
*
*
* @demo /docs/demos/src/segment/
* @see {@link /docs/components#segment Segment Component Docs}
* @see [Angular Forms](http://learnangular2.com/forms/)
*/
var Segment = (function (_super) {
__extends(Segment, _super);
function Segment(config, elementRef, renderer, ngControl) {
return _super.call(this, config, elementRef, renderer, 'segment', null, null, null, ngControl) || this;
}
/**
* @hidden
*/
Segment.prototype.ngAfterContentInit = function () {
var _this = this;
this._initialize();
this._buttons.forEach(function (button) {
button.ionSelect.subscribe(function (selectedButton) {
_this.value = selectedButton.value;
_this._fireTouched();
});
});
};
/**
* @hidden
* Write a new value to the element.
*/
Segment.prototype._inputUpdated = function () {
if (!this._buttons) {
(void 0) /* assert */;
return;
}
var buttons = this._buttons.toArray();
var value = this.value;
for (var _i = 0, buttons_1 = buttons; _i < buttons_1.length; _i++) {
var button = buttons_1[_i];
button.isActive = (button.value === value);
}
};
Segment.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-segment',
host: {
'[class.segment-disabled]': '_disabled'
}
},] },
];
/** @nocollapse */
Segment.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_2__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_forms__["d" /* NgControl */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
]; };
Segment.propDecorators = {
'_buttons': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["r" /* ContentChildren */], args: [__WEBPACK_IMPORTED_MODULE_4__segment_button__["a" /* SegmentButton */],] },],
};
return Segment;
}(__WEBPACK_IMPORTED_MODULE_3__util_base_input__["a" /* BaseInput */]));
//# sourceMappingURL=segment.js.map
/***/ }),
/* 325 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Select; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_forms__ = __webpack_require__(16);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__action_sheet_action_sheet__ = __webpack_require__(77);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__alert_alert__ = __webpack_require__(79);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__popover_popover__ = __webpack_require__(104);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__app_app__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__navigation_deep_linker__ = __webpack_require__(19);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__util_form__ = __webpack_require__(20);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__util_base_input__ = __webpack_require__(29);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__item_item__ = __webpack_require__(21);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__option_option__ = __webpack_require__(103);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__select_popover_component__ = __webpack_require__(109);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name Select
* @description
* The `ion-select` component is similar to an HTML `<select>` element, however,
* Ionic's select component makes it easier for users to sort through and select
* the preferred option or options. When users tap the select component, a
* dialog will appear with all of the options in a large, easy to select list
* for users.
*
* The select component takes child `ion-option` components. If `ion-option` is not
* given a `value` attribute then it will use its text as the value.
*
* If `ngModel` is bound to `ion-select`, the selected value will be based on the
* bound value of the model. Otherwise, the `selected` attribute can be used on
* `ion-option` components.
*
* ### Interfaces
*
* By default, the `ion-select` uses the {@link ../../alert/AlertController AlertController API}
* to open up the overlay of options in an alert. The interface can be changed to use the
* {@link ../../action-sheet/ActionSheetController ActionSheetController API} or
* {@link ../../popover/PopoverController PopoverController API} by passing `action-sheet` or `popover`,
* respectively, to the `interface` property. Read on to the other sections for the limitations
* of the different interfaces.
*
* ### Single Value: Radio Buttons
*
* The standard `ion-select` component allows the user to select only one
* option. When selecting only one option the alert interface presents users with
* a radio button styled list of options. The action sheet interface can only be
* used with a single value select. If the number of options exceed 6, it will
* use the `alert` interface even if `action-sheet` is passed. The `ion-select`
* component's value receives the value of the selected option's value.
*
* ```html
* <ion-item>
* <ion-label>Gender</ion-label>
* <ion-select [(ngModel)]="gender">
* <ion-option value="f">Female</ion-option>
* <ion-option value="m">Male</ion-option>
* </ion-select>
* </ion-item>
* ```
*
* ### Multiple Value: Checkboxes
*
* By adding the `multiple="true"` attribute to `ion-select`, users are able
* to select multiple options. When multiple options can be selected, the alert
* overlay presents users with a checkbox styled list of options. The
* `ion-select multiple="true"` component's value receives an array of all the
* selected option values. In the example below, because each option is not given
* a `value`, then it'll use its text as the value instead.
*
* Note: the `action-sheet` and `popover` interfaces will not work with a multi-value select.
*
* ```html
* <ion-item>
* <ion-label>Toppings</ion-label>
* <ion-select [(ngModel)]="toppings" multiple="true">
* <ion-option>Bacon</ion-option>
* <ion-option>Black Olives</ion-option>
* <ion-option>Extra Cheese</ion-option>
* <ion-option>Mushrooms</ion-option>
* <ion-option>Pepperoni</ion-option>
* <ion-option>Sausage</ion-option>
* </ion-select>
* </ion-item>
* ```
*
* ### Select Buttons
* By default, the two buttons read `Cancel` and `OK`. Each button's text
* can be customized using the `cancelText` and `okText` attributes:
*
* ```html
* <ion-select okText="Okay" cancelText="Dismiss">
* ...
* </ion-select>
* ```
*
* The `action-sheet` and `popover` interfaces do not have an `OK` button, clicking
* on any of the options will automatically close the overlay and select
* that value.
*
* ### Select Options
*
* Since `ion-select` uses the `Alert`, `Action Sheet` and `Popover` interfaces, options can be
* passed to these components through the `selectOptions` property. This can be used
* to pass a custom title, subtitle, css class, and more. See the
* {@link ../../alert/AlertController/#create AlertController API docs},
* {@link ../../action-sheet/ActionSheetController/#create ActionSheetController API docs}, and
* {@link ../../popover/PopoverController/#create PopoverController API docs}
* for the properties that each interface accepts.
*
* For example, to change the `mode` of the overlay, pass it into `selectOptions`.
*
* ```html
* <ion-select [selectOptions]="selectOptions">
* ...
* </ion-select>
* ```
*
* ```ts
* this.selectOptions = {
* title: 'Pizza Toppings',
* subTitle: 'Select your toppings',
* mode: 'md'
* };
* ```
*
* ### Object Value References
*
* When using objects for select values, it is possible for the identities of these objects to
* change if they are coming from a server or database, while the selected value's identity
* remains the same. For example, this can occur when an existing record with the desired object value
* is loaded into the select, but the newly retrieved select options now have different identities. This will
* result in the select appearing to have no value at all, even though the original selection in still intact.
*
* Using the `compareWith` `Input` is the solution to this problem
*
* ```html
* <ion-item>
* <ion-label>Employee</ion-label>
* <ion-select [(ngModel)]="employee" [compareWith]="compareFn">
* <ion-option *ngFor="let employee of employees" [value]="employee">{{employee.name}}</ion-option>
* </ion-select>
* </ion-item>
* ```
*
* ```ts
* compareFn(e1: Employee, e2: Employee): boolean {
* return e1 && e2 ? e1.id === e2.id : e1 === e2;
* }
* ```
*
* @demo /docs/demos/src/select/
*/
var Select = (function (_super) {
__extends(Select, _super);
function Select(_app, form, config, elementRef, renderer, item, deepLinker) {
var _this = _super.call(this, config, elementRef, renderer, 'select', [], form, item, null) || this;
_this._app = _app;
_this.config = config;
_this.deepLinker = deepLinker;
_this._multi = false;
_this._texts = [];
_this._text = '';
_this._compareWith = __WEBPACK_IMPORTED_MODULE_10__util_util__["g" /* isCheckedProperty */];
/**
* @input {string} The text to display on the cancel button. Default: `Cancel`.
*/
_this.cancelText = 'Cancel';
/**
* @input {string} The text to display on the ok button. Default: `OK`.
*/
_this.okText = 'OK';
/**
* @input {any} Any additional options that the `alert` or `action-sheet` interface can take.
* See the [AlertController API docs](../../alert/AlertController/#create) and the
* [ActionSheetController API docs](../../action-sheet/ActionSheetController/#create) for the
* create options for each interface.
*/
_this.selectOptions = {};
/**
* @input {string} The interface the select should use: `action-sheet`, `popover` or `alert`. Default: `alert`.
*/
_this.interface = '';
/**
* @input {string} The text to display instead of the selected option's value.
*/
_this.selectedText = '';
/**
* @output {any} Emitted when the selection was cancelled.
*/
_this.ionCancel = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
return _this;
}
Object.defineProperty(Select.prototype, "compareWith", {
/**
* @input {Function} The function that will be called to compare object values
*/
set: function (fn) {
if (typeof fn !== 'function') {
throw new Error("compareWith must be a function, but received " + JSON.stringify(fn));
}
this._compareWith = fn;
},
enumerable: true,
configurable: true
});
Select.prototype._click = function (ev) {
ev.preventDefault();
ev.stopPropagation();
this.open(ev);
};
Select.prototype._keyup = function () {
this.open();
};
/**
* @hidden
*/
Select.prototype.getValues = function () {
var values = Array.isArray(this._value) ? this._value : [this._value];
(void 0) /* assert */;
return values;
};
/**
* Open the select interface.
*/
Select.prototype.open = function (ev) {
var _this = this;
if (this.isFocus() || this._disabled) {
return;
}
(void 0) /* console.debug */;
// the user may have assigned some options specifically for the alert
var selectOptions = Object(__WEBPACK_IMPORTED_MODULE_10__util_util__["b" /* deepCopy */])(this.selectOptions);
// make sure their buttons array is removed from the options
// and we create a new array for the alert's two buttons
selectOptions.buttons = [{
text: this.cancelText,
role: 'cancel',
handler: function () {
_this.ionCancel.emit(_this);
}
}];
// if the selectOptions didn't provide a title then use the label's text
if (!selectOptions.title && this._item) {
selectOptions.title = this._item.getLabelText();
}
var options = this._options.toArray();
if ((this.interface === 'action-sheet' || this.interface === 'popover') && this._multi) {
console.warn('Interface cannot be "' + this.interface + '" with a multi-value select. Using the "alert" interface.');
this.interface = 'alert';
}
if (this.interface === 'popover' && !ev) {
console.warn('Interface cannot be "popover" without UIEvent.');
this.interface = 'alert';
}
var overlay;
if (this.interface === 'action-sheet') {
selectOptions.buttons = selectOptions.buttons.concat(options.map(function (input) {
return {
role: (input.selected ? 'selected' : ''),
text: input.text,
handler: function () {
_this.value = input.value;
input.ionSelect.emit(input.value);
}
};
}));
var selectCssClass = 'select-action-sheet';
// If the user passed a cssClass for the select, add it
selectCssClass += selectOptions.cssClass ? ' ' + selectOptions.cssClass : '';
selectOptions.cssClass = selectCssClass;
overlay = new __WEBPACK_IMPORTED_MODULE_2__action_sheet_action_sheet__["a" /* ActionSheet */](this._app, selectOptions, this.config);
}
else if (this.interface === 'popover') {
var popoverOptions = options.map(function (input) { return ({
text: input.text,
checked: input.selected,
disabled: input.disabled,
value: input.value,
handler: function () {
_this.value = input.value;
input.ionSelect.emit(input.value);
}
}); });
var popoverCssClass = 'select-popover';
// If the user passed a cssClass for the select, add it
popoverCssClass += selectOptions.cssClass ? ' ' + selectOptions.cssClass : '';
overlay = new __WEBPACK_IMPORTED_MODULE_4__popover_popover__["a" /* Popover */](this._app, __WEBPACK_IMPORTED_MODULE_13__select_popover_component__["a" /* SelectPopover */], {
options: popoverOptions
}, {
cssClass: popoverCssClass
}, this.config, this.deepLinker);
// ev.target is readonly.
// place popover regarding to ion-select instead of .button-inner
Object.defineProperty(ev, 'target', { value: ev.currentTarget });
selectOptions.ev = ev;
}
else {
// default to use the alert interface
this.interface = 'alert';
// user cannot provide inputs from selectOptions
// alert inputs must be created by ionic from ion-options
selectOptions.inputs = this._options.map(function (input) {
return {
type: (_this._multi ? 'checkbox' : 'radio'),
label: input.text,
value: input.value,
checked: input.selected,
disabled: input.disabled,
handler: function (selectedOption) {
// Only emit the select event if it is being checked
// For multi selects this won't emit when unchecking
if (selectedOption.checked) {
input.ionSelect.emit(input.value);
}
}
};
});
var selectCssClass_1 = 'select-alert';
// create the alert instance from our built up selectOptions
overlay = new __WEBPACK_IMPORTED_MODULE_3__alert_alert__["a" /* Alert */](this._app, selectOptions, this.config);
if (this._multi) {
// use checkboxes
selectCssClass_1 += ' multiple-select-alert';
}
else {
// use radio buttons
selectCssClass_1 += ' single-select-alert';
}
// If the user passed a cssClass for the select, add it
selectCssClass_1 += selectOptions.cssClass ? ' ' + selectOptions.cssClass : '';
overlay.setCssClass(selectCssClass_1);
overlay.addButton({
text: this.okText,
handler: function (selectedValues) { return _this.value = selectedValues; }
});
}
overlay.present(selectOptions);
this._fireFocus();
overlay.onDidDismiss(function () {
_this._fireBlur();
_this._overlay = undefined;
});
this._overlay = overlay;
};
/**
* Close the select interface.
*/
Select.prototype.close = function () {
if (!this._overlay || !this.isFocus()) {
return;
}
return this._overlay.dismiss();
};
Object.defineProperty(Select.prototype, "multiple", {
/**
* @input {boolean} If true, the element can accept multiple values.
*/
get: function () {
return this._multi;
},
set: function (val) {
this._multi = Object(__WEBPACK_IMPORTED_MODULE_10__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Select.prototype, "text", {
/**
* @hidden
*/
get: function () {
return (this._multi ? this._texts : this._texts.join());
},
enumerable: true,
configurable: true
});
Object.defineProperty(Select.prototype, "options", {
/**
* @private
*/
set: function (val) {
this._options = val;
var values = this.getValues();
if (values.length === 0) {
// there are no values set at this point
// so check to see who should be selected
// we use writeValue() because we don't want to update ngModel
this.writeValue(val.filter(function (o) { return o.selected; }).map(function (o) { return o.value; }));
}
else {
this._updateText();
}
},
enumerable: true,
configurable: true
});
Select.prototype._inputShouldChange = function (val) {
return !Object(__WEBPACK_IMPORTED_MODULE_10__util_util__["c" /* deepEqual */])(this._value, val);
};
/**
* TODO: REMOVE THIS
* @hidden
*/
Select.prototype._inputChangeEvent = function () {
return this.value;
};
/**
* @hidden
*/
Select.prototype._updateText = function () {
var _this = this;
this._texts.length = 0;
if (this._options) {
this._options.forEach(function (option) {
// check this option if the option's value is in the values array
option.selected = _this.getValues().some(function (selectValue) {
return _this._compareWith(selectValue, option.value);
});
if (option.selected) {
_this._texts.push(option.text);
}
});
}
this._text = this._texts.join(', ');
};
/**
* @hidden
*/
Select.prototype._inputUpdated = function () {
this._updateText();
_super.prototype._inputUpdated.call(this);
};
Select.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-select',
template: '<div *ngIf="!_text" class="select-placeholder select-text">{{placeholder}}</div>' +
'<div *ngIf="_text" class="select-text">{{selectedText || _text}}</div>' +
'<div class="select-icon">' +
'<div class="select-icon-inner"></div>' +
'</div>' +
'<button aria-haspopup="true" ' +
'type="button" ' +
'[id]="id" ' +
'ion-button="item-cover" ' +
'[attr.aria-labelledby]="_labelId" ' +
'[attr.aria-disabled]="_disabled" ' +
'class="item-cover">' +
'</button>',
host: {
'[class.select-disabled]': '_disabled'
},
providers: [{ provide: __WEBPACK_IMPORTED_MODULE_1__angular_forms__["c" /* NG_VALUE_ACCESSOR */], useExisting: Select, multi: true }],
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
},] },
];
/** @nocollapse */
Select.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_5__app_app__["a" /* App */], },
{ type: __WEBPACK_IMPORTED_MODULE_8__util_form__["a" /* Form */], },
{ type: __WEBPACK_IMPORTED_MODULE_6__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_11__item_item__["a" /* Item */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_7__navigation_deep_linker__["a" /* DeepLinker */], },
]; };
Select.propDecorators = {
'cancelText': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'okText': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'placeholder': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'selectOptions': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'interface': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'selectedText': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'compareWith': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'ionCancel': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'_click': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* HostListener */], args: ['click', ['$event'],] },],
'_keyup': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* HostListener */], args: ['keyup.space',] },],
'multiple': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'options': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["r" /* ContentChildren */], args: [__WEBPACK_IMPORTED_MODULE_12__option_option__["a" /* Option */],] },],
};
return Select;
}(__WEBPACK_IMPORTED_MODULE_9__util_base_input__["a" /* BaseInput */]));
//# sourceMappingURL=select.js.map
/***/ }),
/* 326 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ShowWhen; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__display_when__ = __webpack_require__(110);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__platform_platform__ = __webpack_require__(4);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
*
* @name ShowWhen
* @description
* The `showWhen` attribute takes a string that represents a platform or screen orientation.
* The element the attribute is added to will only be shown when that platform or screen orientation is active.
*
* Complements the [hideWhen attribute](../HideWhen). If the `showWhen` attribute is used on an
* element that also has the `hideWhen` attribute, the element will not show if `hideWhen` evaluates
* to `true` or `showWhen` evaluates to `false`. If the `hidden` attribute is also added, the element
* will not show if `hidden` evaluates to `true`.
*
* View the [Platform API docs](../../../platform/Platform) for more information on the different
* platforms you can use.
*
* @usage
* ```html
* <div showWhen="android">
* I am visible on Android!
* </div>
*
* <div showWhen="ios">
* I am visible on iOS!
* </div>
*
* <div showWhen="android,ios">
* I am visible on Android and iOS!
* </div>
*
* <div showWhen="portrait">
* I am visible on Portrait!
* </div>
*
* <div showWhen="landscape">
* I am visible on Landscape!
* </div>
* ```
* @demo /docs/demos/src/show-when/
* @see {@link ../HideWhen HideWhen API Docs}
* @see {@link ../../../platform/Platform Platform API Docs}
*/
var ShowWhen = (function (_super) {
__extends(ShowWhen, _super);
function ShowWhen(showWhen, plt, zone) {
return _super.call(this, showWhen, plt, zone) || this;
}
// ngOnDestroy is implemented in DisplayWhen
ShowWhen.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: '[showWhen]',
host: {
'[class.hidden-show-when]': '!isMatch'
}
},] },
];
/** @nocollapse */
ShowWhen.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["g" /* Attribute */], args: ['showWhen',] },] },
{ type: __WEBPACK_IMPORTED_MODULE_2__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["M" /* NgZone */], },
]; };
return ShowWhen;
}(__WEBPACK_IMPORTED_MODULE_1__display_when__["a" /* DisplayWhen */]));
//# sourceMappingURL=show-when.js.map
/***/ }),
/* 327 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HideWhen; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__platform_platform__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__display_when__ = __webpack_require__(110);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name HideWhen
* @description
* The `hideWhen` attribute takes a string that represents a plaform or screen orientation.
* The element the attribute is added to will only be hidden when that platform or screen orientation is active.
*
* Complements the [showWhen attribute](../ShowWhen). If the `hideWhen` attribute is used on an
* element that also has the `showWhen` attribute, the element will not show if `hideWhen` evaluates
* to `true` or `showWhen` evaluates to `false`. If the `hidden` attribute is also added, the element
* will not show if `hidden` evaluates to `true`.
*
* View the [Platform API docs](../../../platform/Platform) for more information on the different
* platforms you can use.
*
* @usage
* ```html
* <div hideWhen="android">
* I am hidden on Android!
* </div>
*
* <div hideWhen="ios">
* I am hidden on iOS!
* </div>
*
* <div hideWhen="android,ios">
* I am hidden on Android and iOS!
* </div>
*
* <div hideWhen="portrait">
* I am hidden on Portrait!
* </div>
*
* <div hideWhen="landscape">
* I am hidden on Landscape!
* </div>
* ```
*
* @demo /docs/demos/src/hide-when/
* @see {@link ../ShowWhen ShowWhen API Docs}
* @see {@link ../../../platform/Platform Platform API Docs}
*/
var HideWhen = (function (_super) {
__extends(HideWhen, _super);
function HideWhen(hideWhen, plt, zone) {
return _super.call(this, hideWhen, plt, zone) || this;
}
HideWhen.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: '[hideWhen]',
host: {
'[class.hidden-hide-when]': 'isMatch'
}
},] },
];
/** @nocollapse */
HideWhen.ctorParameters = function () { return [
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["g" /* Attribute */], args: ['hideWhen',] },] },
{ type: __WEBPACK_IMPORTED_MODULE_1__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["M" /* NgZone */], },
]; };
return HideWhen;
}(__WEBPACK_IMPORTED_MODULE_2__display_when__["a" /* DisplayWhen */]));
//# sourceMappingURL=hide-when.js.map
/***/ }),
/* 328 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Slide; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__slides__ = __webpack_require__(111);
/**
* @name Slide
* @description
* The Slide component is a child component of [Slides](../Slides). The template
* should be written as `ion-slide`. Any slide content should be written
* in this component and it should be used in conjunction with [Slides](../Slides).
*
* See the [Slides API Docs](../Slides) for more usage information.
*
* @demo /docs/demos/src/slides/
* @see {@link /docs/api/components/slides/Slides/ Slides API Docs}
*/
var Slide = (function () {
function Slide(elementRef, renderer, _slides) {
this._slides = _slides;
renderer.setElementClass(elementRef.nativeElement, 'swiper-slide', true);
_slides.update(10);
}
/**
* @hidden
*/
Slide.prototype.ngOnDestroy = function () {
this._slides.update(10);
};
Slide.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-slide',
template: '<div class="slide-zoom">' +
'<ng-content></ng-content>' +
'</div>',
changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* ChangeDetectionStrategy */].OnPush,
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
},] },
];
/** @nocollapse */
Slide.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__slides__["a" /* Slides */], },
]; };
return Slide;
}());
//# sourceMappingURL=slide.js.map
/***/ }),
/* 329 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (immutable) */ __webpack_exports__["b"] = parallaxSetTranslate;
/* harmony export (immutable) */ __webpack_exports__["a"] = parallaxSetTransition;
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__swiper_utils__ = __webpack_require__(17);
/*=========================
Parallax
===========================*/
function setParallaxTransform(s, el, progress) {
var p;
var pX;
var pY;
var rtlFactor = s._rtl ? -1 : 1;
p = el.getAttribute('data-swiper-parallax') || '0';
pX = el.getAttribute('data-swiper-parallax-x');
pY = el.getAttribute('data-swiper-parallax-y');
if (pX || pY) {
pX = pX || '0';
pY = pY || '0';
}
else {
if (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s)) {
pX = p;
pY = '0';
}
else {
pY = p;
pX = '0';
}
}
if ((pX).indexOf('%') >= 0) {
pX = parseInt(pX, 10) * progress * rtlFactor + '%';
}
else {
pX = pX * progress * rtlFactor + 'px';
}
if ((pY).indexOf('%') >= 0) {
pY = parseInt(pY, 10) * progress + '%';
}
else {
pY = pY * progress + 'px';
}
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["n" /* transform */])(el, 'translate3d(' + pX + ', ' + pY + ',0px)');
}
function parallaxSetTranslate(s) {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["c" /* eachChild */])(s.container, '[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]', function (el) {
setParallaxTransform(s, el, s.progress);
});
for (var i = 0; i < s._slides.length; i++) {
var slide = s._slides[i];
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["c" /* eachChild */])(slide, '[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]', function () {
var progress = Math.min(Math.max(slide.progress, -1), 1);
setParallaxTransform(s, slide, progress);
});
}
}
function parallaxSetTransition(s, duration) {
if (typeof duration === 'undefined')
duration = s.speed;
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["c" /* eachChild */])(s.container, '[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]', function (el) {
var parallaxDuration = parseInt(el.getAttribute('data-swiper-parallax-duration'), 10) || duration;
if (duration === 0)
parallaxDuration = 0;
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["o" /* transition */])(el, parallaxDuration);
});
}
//# sourceMappingURL=swiper-parallax.js.map
/***/ }),
/* 330 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (immutable) */ __webpack_exports__["a"] = isCordova;
/* harmony export (immutable) */ __webpack_exports__["b"] = isElectron;
/* harmony export (immutable) */ __webpack_exports__["c"] = isIos;
/* harmony export (immutable) */ __webpack_exports__["e"] = isSafari;
/* unused harmony export isWKWebView */
/* harmony export (immutable) */ __webpack_exports__["d"] = isIosUIWebView;
function isCordova(plt) {
var win = plt.win();
return !!(win['cordova'] || win['PhoneGap'] || win['phonegap']);
}
function isElectron(plt) {
return plt.testUserAgent('Electron');
}
function isIos(plt) {
// shortcut function to be reused internally
// checks navigator.platform to see if it's an actual iOS device
// this does not use the user-agent string because it is often spoofed
// an actual iPad will return true, a chrome dev tools iPad will return false
return plt.testNavigatorPlatform('iphone|ipad|ipod');
}
function isSafari(plt) {
return plt.testUserAgent('Safari');
}
function isWKWebView(plt) {
return isIos(plt) && !!plt.win()['webkit'];
}
function isIosUIWebView(plt) {
return isIos(plt) && !isWKWebView(plt) && !isSafari(plt);
}
//# sourceMappingURL=platform-utils.js.map
/***/ }),
/* 331 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (immutable) */ __webpack_exports__["a"] = initZoom;
/* harmony export (immutable) */ __webpack_exports__["b"] = resetZoomEvents;
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__swiper_utils__ = __webpack_require__(17);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__swiper_transition__ = __webpack_require__(112);
function initZoom(s, plt) {
s._supportGestures = ('ongesturestart' in plt.win());
s._zoom = {
// "Global" Props
scale: 1,
currentScale: 1,
isScaling: false,
gesture: {
slide: undefined,
slideWidth: undefined,
slideHeight: undefined,
image: undefined,
imageWrap: undefined,
zoomMax: s.zoomMax
},
image: {
isTouched: undefined,
isMoved: undefined,
currentX: undefined,
currentY: undefined,
minX: undefined,
minY: undefined,
maxX: undefined,
maxY: undefined,
width: undefined,
height: undefined,
startX: undefined,
startY: undefined,
touchesStart: {},
touchesCurrent: {}
},
velocity: {
x: undefined,
y: undefined,
prevPositionX: undefined,
prevPositionY: undefined,
prevTime: undefined
},
unRegs: []
};
resetZoomEvents(s, plt);
return function () {
detachZoomEvents(s);
};
}
// Calc Scale From Multi-touches
function getDistanceBetweenTouches(ev) {
if (ev.targetTouches.length < 2)
return 1;
var x1 = ev.targetTouches[0].pageX, y1 = ev.targetTouches[0].pageY, x2 = ev.targetTouches[1].pageX, y2 = ev.targetTouches[1].pageY;
return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
}
// Events
function onGestureStart(s, _plt, ev) {
var z = s._zoom;
s.originalEvent = ev;
if (!s._supportGestures) {
if (ev.type !== 'touchstart' || ev.type === 'touchstart' && ev.targetTouches.length < 2) {
return;
}
z.gesture.scaleStart = getDistanceBetweenTouches(ev);
}
if (!z.gesture.slide) {
if (ev.currentTarget && ev.currentTarget.classList.contains(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].slide)) {
z.gesture.slide = ev.currentTarget;
}
if (!z.gesture.slide) {
z.gesture.slide = s._slides[s._activeIndex];
}
z.gesture.image = z.gesture.slide.querySelector('img, svg, canvas, ion-img');
if (z.gesture.image) {
z.gesture.imageWrap = z.gesture.image.closest('.' + __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].zoomContainer);
if (!z.gesture.imageWrap) {
z.gesture.image = undefined;
return;
}
z.gesture.zoomMax = parseInt(z.gesture.imageWrap.getAttribute('data-swiper-zoom') || s.zoomMax, 10);
}
}
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["o" /* transition */])(z.gesture.image, 0);
z.isScaling = true;
}
function onGestureChange(s, _plt, ev) {
var z = s._zoom;
s.originalEvent = ev;
if (!s._supportGestures) {
if (ev.type !== 'touchmove' || ev.type === 'touchmove' && ev.targetTouches.length < 2) {
return;
}
z.gesture.scaleMove = getDistanceBetweenTouches(ev);
}
if (!z.gesture.image)
return;
if (s._supportGestures) {
z.scale = ev.scale * z.currentScale;
}
else {
z.scale = (z.gesture.scaleMove / z.gesture.scaleStart) * z.currentScale;
}
if (z.scale > z.gesture.zoomMax) {
z.scale = z.gesture.zoomMax - 1 + Math.pow((z.scale - z.gesture.zoomMax + 1), 0.5);
}
if (z.scale < s.zoomMin) {
z.scale = s.zoomMin + 1 - Math.pow((s.zoomMin - z.scale + 1), 0.5);
}
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["n" /* transform */])(z.gesture.image, 'translate3d(0,0,0) scale(' + z.scale + ')');
}
function onGestureEnd(s, _plt, ev) {
var z = s._zoom;
s.originalEvent = ev;
if (!s._supportGestures) {
if (ev.type !== 'touchend' || ev.type === 'touchend' && ev.changedTouches.length < 2) {
return;
}
}
if (!z.gesture.image)
return;
z.scale = Math.max(Math.min(z.scale, z.gesture.zoomMax), s.zoomMin);
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["o" /* transition */])(z.gesture.image, s.speed);
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["n" /* transform */])(z.gesture.image, 'translate3d(0,0,0) scale(' + z.scale + ')');
z.currentScale = z.scale;
z.isScaling = false;
if (z.scale === 1) {
z.gesture.slide = undefined;
}
}
function onTouchStart(s, plt, ev) {
var z = s._zoom;
s.originalEvent = ev;
if (!z.gesture.image || z.image.isTouched)
return;
if (plt.is('android')) {
ev.preventDefault();
}
z.image.isTouched = true;
z.image.touchesStart.x = ev.type === 'touchstart' ? ev.targetTouches[0].pageX : ev.pageX;
z.image.touchesStart.y = ev.type === 'touchstart' ? ev.targetTouches[0].pageY : ev.pageY;
}
function onTouchMove(s, plt, ev) {
var z = s._zoom;
s.originalEvent = ev;
if (!z.gesture.image)
return;
s._allowClick = false;
if (!z.image.isTouched || !z.gesture.slide)
return;
if (!z.image.isMoved) {
z.image.width = z.gesture.image.offsetWidth;
z.image.height = z.gesture.image.offsetHeight;
z.image.startX = Object(__WEBPACK_IMPORTED_MODULE_1__swiper_transition__["a" /* getTranslate */])(s, plt, z.gesture.imageWrap, 'x') || 0;
z.image.startY = Object(__WEBPACK_IMPORTED_MODULE_1__swiper_transition__["a" /* getTranslate */])(s, plt, z.gesture.imageWrap, 'y') || 0;
z.gesture.slideWidth = z.gesture.slide.offsetWidth;
z.gesture.slideHeight = z.gesture.slide.offsetHeight;
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["o" /* transition */])(z.gesture.imageWrap, 0);
if (s._rtl) {
z.image.startX = -z.image.startX;
z.image.startY = -z.image.startY;
}
}
// Define if we need image drag
var scaledWidth = z.image.width * z.scale;
var scaledHeight = z.image.height * z.scale;
if (scaledWidth < z.gesture.slideWidth && scaledHeight < z.gesture.slideHeight) {
return;
}
z.image.minX = Math.min((z.gesture.slideWidth / 2 - scaledWidth / 2), 0);
z.image.maxX = -z.image.minX;
z.image.minY = Math.min((z.gesture.slideHeight / 2 - scaledHeight / 2), 0);
z.image.maxY = -z.image.minY;
z.image.touchesCurrent.x = ev.type === 'touchmove' ? ev.targetTouches[0].pageX : ev.pageX;
z.image.touchesCurrent.y = ev.type === 'touchmove' ? ev.targetTouches[0].pageY : ev.pageY;
if (!z.image.isMoved && !z.isScaling) {
if (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) &&
(Math.floor(z.image.minX) === Math.floor(z.image.startX) && z.image.touchesCurrent.x < z.image.touchesStart.x) ||
(Math.floor(z.image.maxX) === Math.floor(z.image.startX) && z.image.touchesCurrent.x > z.image.touchesStart.x)) {
z.image.isTouched = false;
return;
}
else if (!Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) &&
(Math.floor(z.image.minY) === Math.floor(z.image.startY) && z.image.touchesCurrent.y < z.image.touchesStart.y) ||
(Math.floor(z.image.maxY) === Math.floor(z.image.startY) && z.image.touchesCurrent.y > z.image.touchesStart.y)) {
z.image.isTouched = false;
return;
}
}
ev.preventDefault();
ev.stopPropagation();
z.image.isMoved = true;
z.image.currentX = z.image.touchesCurrent.x - z.image.touchesStart.x + z.image.startX;
z.image.currentY = z.image.touchesCurrent.y - z.image.touchesStart.y + z.image.startY;
if (z.image.currentX < z.image.minX) {
z.image.currentX = z.image.minX + 1 - Math.pow((z.image.minX - z.image.currentX + 1), 0.8);
}
if (z.image.currentX > z.image.maxX) {
z.image.currentX = z.image.maxX - 1 + Math.pow((z.image.currentX - z.image.maxX + 1), 0.8);
}
if (z.image.currentY < z.image.minY) {
z.image.currentY = z.image.minY + 1 - Math.pow((z.image.minY - z.image.currentY + 1), 0.8);
}
if (z.image.currentY > z.image.maxY) {
z.image.currentY = z.image.maxY - 1 + Math.pow((z.image.currentY - z.image.maxY + 1), 0.8);
}
// Velocity
if (!z.velocity.prevPositionX)
z.velocity.prevPositionX = z.image.touchesCurrent.x;
if (!z.velocity.prevPositionY)
z.velocity.prevPositionY = z.image.touchesCurrent.y;
if (!z.velocity.prevTime)
z.velocity.prevTime = Date.now();
z.velocity.x = (z.image.touchesCurrent.x - z.velocity.prevPositionX) / (Date.now() - z.velocity.prevTime) / 2;
z.velocity.y = (z.image.touchesCurrent.y - z.velocity.prevPositionY) / (Date.now() - z.velocity.prevTime) / 2;
if (Math.abs(z.image.touchesCurrent.x - z.velocity.prevPositionX) < 2)
z.velocity.x = 0;
if (Math.abs(z.image.touchesCurrent.y - z.velocity.prevPositionY) < 2)
z.velocity.y = 0;
z.velocity.prevPositionX = z.image.touchesCurrent.x;
z.velocity.prevPositionY = z.image.touchesCurrent.y;
z.velocity.prevTime = Date.now();
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["n" /* transform */])(z.gesture.imageWrap, 'translate3d(' + z.image.currentX + 'px, ' + z.image.currentY + 'px,0)');
}
function onTouchEnd(s) {
var z = s._zoom;
if (!z.gesture.image)
return;
if (!z.image.isTouched || !z.image.isMoved) {
z.image.isTouched = false;
z.image.isMoved = false;
return;
}
z.image.isTouched = false;
z.image.isMoved = false;
var momentumDurationX = 300;
var momentumDurationY = 300;
var momentumDistanceX = z.velocity.x * momentumDurationX;
var newPositionX = z.image.currentX + momentumDistanceX;
var momentumDistanceY = z.velocity.y * momentumDurationY;
var newPositionY = z.image.currentY + momentumDistanceY;
// Fix duration
if (z.velocity.x !== 0)
momentumDurationX = Math.abs((newPositionX - z.image.currentX) / z.velocity.x);
if (z.velocity.y !== 0)
momentumDurationY = Math.abs((newPositionY - z.image.currentY) / z.velocity.y);
var momentumDuration = Math.max(momentumDurationX, momentumDurationY);
z.image.currentX = newPositionX;
z.image.currentY = newPositionY;
// Define if we need image drag
var scaledWidth = z.image.width * z.scale;
var scaledHeight = z.image.height * z.scale;
z.image.minX = Math.min((z.gesture.slideWidth / 2 - scaledWidth / 2), 0);
z.image.maxX = -z.image.minX;
z.image.minY = Math.min((z.gesture.slideHeight / 2 - scaledHeight / 2), 0);
z.image.maxY = -z.image.minY;
z.image.currentX = Math.max(Math.min(z.image.currentX, z.image.maxX), z.image.minX);
z.image.currentY = Math.max(Math.min(z.image.currentY, z.image.maxY), z.image.minY);
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["o" /* transition */])(z.gesture.imageWrap, momentumDuration);
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["n" /* transform */])(z.gesture.imageWrap, 'translate3d(' + z.image.currentX + 'px, ' + z.image.currentY + 'px,0)');
}
function onTransitionEnd(s) {
var z = s._zoom;
if (z.gesture.slide && s._previousIndex !== s._activeIndex) {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["n" /* transform */])(z.gesture.image, 'translate3d(0,0,0) scale(1)');
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["n" /* transform */])(z.gesture.imageWrap, 'translate3d(0,0,0)');
z.gesture.slide = z.gesture.image = z.gesture.imageWrap = undefined;
z.scale = z.currentScale = 1;
}
}
function toggleZoom(s, plt) {
var z = s._zoom;
var ev = s.originalEvent;
if (!z.gesture.slide) {
z.gesture.slide = s.clickedSlide ? s.clickedSlide : s._slides[s._activeIndex];
z.gesture.image = z.gesture.slide.querySelector('img, svg, canvas, ion-img');
z.gesture.imageWrap = z.gesture.image && z.gesture.image.closest('.' + __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].zoomContainer);
}
if (!z.gesture.imageWrap)
return;
var touchX;
var touchY;
var offsetX;
var offsetY;
var diffX;
var diffY;
var translateX;
var translateY;
var imageWidth;
var imageHeight;
var scaledWidth;
var scaledHeight;
var translateMinX;
var translateMinY;
var translateMaxX;
var translateMaxY;
var slideWidth;
var slideHeight;
if (typeof z.image.touchesStart.x === 'undefined' && ev) {
touchX = ev.type === 'touchend' ? ev.changedTouches[0].pageX : ev.pageX;
touchY = ev.type === 'touchend' ? ev.changedTouches[0].pageY : ev.pageY;
}
else {
touchX = z.image.touchesStart.x;
touchY = z.image.touchesStart.y;
}
if (z.scale && z.scale !== 1) {
// Zoom Out
z.scale = z.currentScale = 1;
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["o" /* transition */])(z.gesture.imageWrap, 300);
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["n" /* transform */])(z.gesture.imageWrap, 'translate3d(0,0,0)');
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["o" /* transition */])(z.gesture.image, 300);
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["n" /* transform */])(z.gesture.image, 'translate3d(0,0,0) scale(1)');
z.gesture.slide = undefined;
}
else {
// Zoom In
z.scale = z.currentScale = parseInt(z.gesture.imageWrap.getAttribute('data-swiper-zoom') || s.zoomMax, 10);
if (ev) {
slideWidth = z.gesture.slide.offsetWidth;
slideHeight = z.gesture.slide.offsetHeight;
var slideOffsets = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["j" /* offset */])(z.gesture.slide, plt);
offsetX = slideOffsets.left;
offsetY = slideOffsets.top;
diffX = offsetX + slideWidth / 2 - touchX;
diffY = offsetY + slideHeight / 2 - touchY;
imageWidth = z.gesture.image.offsetWidth;
imageHeight = z.gesture.image.offsetHeight;
scaledWidth = imageWidth * z.scale;
scaledHeight = imageHeight * z.scale;
translateMinX = Math.min((slideWidth / 2 - scaledWidth / 2), 0);
translateMinY = Math.min((slideHeight / 2 - scaledHeight / 2), 0);
translateMaxX = -translateMinX;
translateMaxY = -translateMinY;
translateX = diffX * z.scale;
translateY = diffY * z.scale;
if (translateX < translateMinX) {
translateX = translateMinX;
}
if (translateX > translateMaxX) {
translateX = translateMaxX;
}
if (translateY < translateMinY) {
translateY = translateMinY;
}
if (translateY > translateMaxY) {
translateY = translateMaxY;
}
}
else {
translateX = 0;
translateY = 0;
}
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["o" /* transition */])(z.gesture.imageWrap, 300);
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["n" /* transform */])(z.gesture.imageWrap, 'translate3d(' + translateX + 'px, ' + translateY + 'px,0)');
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["o" /* transition */])(z.gesture.image, 300);
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["n" /* transform */])(z.gesture.image, 'translate3d(0,0,0) scale(' + z.scale + ')');
}
}
function resetZoomEvents(s, plt) {
detachZoomEvents(s);
var unRegs = s._zoom.unRegs;
var evtOpts = { passive: s._touchEvents.start === 'touchstart', zone: false };
var slides = s._slides;
var slide;
// Scale image
if (s._supportGestures) {
for (var i = 0; i < slides.length; i++) {
slide = slides[i];
// gesturestart
plt.registerListener(slide, 'gesturestart', function (ev) {
onGestureStart(s, plt, ev);
}, evtOpts, unRegs);
// gesturechange
plt.registerListener(slide, 'gesturechange', function (ev) {
onGestureChange(s, plt, ev);
}, evtOpts, unRegs);
// gestureend
plt.registerListener(slide, 'gestureend', function (ev) {
onGestureEnd(s, plt, ev);
}, evtOpts, unRegs);
}
}
else if (s._touchEvents.start === 'touchstart') {
for (var i = 0; i < slides.length; i++) {
slide = slides[i];
// touchstart
plt.registerListener(slide, s._touchEvents.start, function (ev) {
onGestureStart(s, plt, ev);
}, evtOpts, unRegs);
// touchmove
plt.registerListener(slide, s._touchEvents.move, function (ev) {
onGestureChange(s, plt, ev);
}, evtOpts, unRegs);
// touchend
plt.registerListener(slide, s._touchEvents.end, function (ev) {
onGestureEnd(s, plt, ev);
}, evtOpts, unRegs);
}
}
// Move image
var touchStartSub = s.ionSlideTouchStart.subscribe(function (ev) {
onTouchStart(s, plt, ev);
});
unRegs.push(function () { touchStartSub.unsubscribe(); });
for (var i = 0; i < slides.length; i++) {
slide = slides[i];
if (slide.querySelector('.' + __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].zoomContainer)) {
plt.registerListener(slide, 's.touchEvents.move', function (ev) {
onTouchMove(s, plt, ev);
}, evtOpts, unRegs);
}
}
var touchEndSub = s.ionSlideTouchEnd.subscribe(function () {
onTouchEnd(s);
});
unRegs.push(function () { touchEndSub.unsubscribe(); });
// Scale Out
var transEndSub = s.ionSlideTouchEnd.subscribe(function () {
onTransitionEnd(s);
});
unRegs.push(function () { transEndSub.unsubscribe(); });
if (s.zoomToggle) {
var doubleTapSub = s.ionSlideDoubleTap.subscribe(function () {
toggleZoom(s, plt);
});
unRegs.push(function () { doubleTapSub.unsubscribe(); });
}
}
function detachZoomEvents(s) {
s._zoom.unRegs.forEach(function (unReg) {
unReg();
});
s._zoom.unRegs.length = 0;
}
//# sourceMappingURL=swiper-zoom.js.map
/***/ }),
/* 332 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Spinner; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ion__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_util__ = __webpack_require__(3);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name Spinner
* @description
* The `ion-spinner` component provides a variety of animated SVG spinners.
* Spinners enables you to give users feedback that the app is actively
* processing/thinking/waiting/chillin’ out, or whatever you’d like it to indicate.
* By default, the `ion-refresher` feature uses this spinner component while it's
* the refresher is in the `refreshing` state.
*
* Ionic offers a handful of spinners out of the box, and by default, it will use
* the appropriate spinner for the platform on which it’s running.
*
* <table class="table spinner-table">
* <tr>
* <th>
* <code>ios</code>
* </th>
* <td>
* <ion-spinner name="ios"></ion-spinner>
* </td>
* </tr>
* <tr>
* <th>
* <code>ios-small</code>
* </th>
* <td>
* <ion-spinner name="ios-small"></ion-spinner>
* </td>
* </tr>
* <tr>
* <th>
* <code>bubbles</code>
* </th>
* <td>
* <ion-spinner name="bubbles"></ion-spinner>
* </td>
* </tr>
* <tr>
* <th>
* <code>circles</code>
* </th>
* <td>
* <ion-spinner name="circles"></ion-spinner>
* </td>
* </tr>
* <tr>
* <th>
* <code>crescent</code>
* </th>
* <td>
* <ion-spinner name="crescent"></ion-spinner>
* </td>
* </tr>
* <tr>
* <th>
* <code>dots</code>
* </th>
* <td>
* <ion-spinner name="dots"></ion-spinner>
* </td>
* </tr>
* </table>
*
* @usage
* The following code would use the default spinner for the platform it's
* running from. If it's neither iOS or Android, it'll default to use `ios`.
*
* ```html
* <ion-spinner></ion-spinner>
* ```
*
* By setting the `name` property, you can specify which predefined spinner to
* use, no matter what the platform is.
*
* ```html
* <ion-spinner name="bubbles"></ion-spinner>
* ```
*
* ## Styling SVG with CSS
* One cool thing about SVG is its ability to be styled with CSS! One thing to note
* is that some of the CSS properties on an SVG element have different names. For
* example, SVG uses the term `stroke` instead of `border`, and `fill` instead
* of `background-color`.
*
* ```css
* ion-spinner * {
* width: 28px;
* height: 28px;
* stroke: #444;
* fill: #222;
* }
* ```
*/
var Spinner = (function (_super) {
__extends(Spinner, _super);
function Spinner(config, elementRef, renderer) {
var _this = _super.call(this, config, elementRef, renderer, 'spinner') || this;
_this._dur = null;
_this._paused = false;
return _this;
}
Object.defineProperty(Spinner.prototype, "name", {
/**
* @input {string} SVG spinner name.
*/
get: function () {
return this._name;
},
set: function (val) {
this._name = val;
this.load();
},
enumerable: true,
configurable: true
});
Object.defineProperty(Spinner.prototype, "duration", {
/**
* @input {string} How long it takes it to do one loop.
*/
get: function () {
return this._dur;
},
set: function (val) {
this._dur = val;
this.load();
},
enumerable: true,
configurable: true
});
Object.defineProperty(Spinner.prototype, "paused", {
/**
* @input {boolean} If true, pause the animation.
*/
get: function () {
return this._paused;
},
set: function (val) {
this._paused = Object(__WEBPACK_IMPORTED_MODULE_3__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
/**
* @hidden
*/
Spinner.prototype.ngOnInit = function () {
this._init = true;
this.load();
};
/**
* @hidden
*/
Spinner.prototype.load = function () {
if (this._init) {
this._l = [];
this._c = [];
var name = this._name || this._config.get('spinner', 'ios');
var spinner = SPINNERS[name];
if (spinner) {
if (spinner.lines) {
for (var i = 0, l = spinner.lines; i < l; i++) {
this._l.push(this._loadEle(spinner, i, l));
}
}
else if (spinner.circles) {
for (var i = 0, l = spinner.circles; i < l; i++) {
this._c.push(this._loadEle(spinner, i, l));
}
}
this.setElementClass("spinner-" + name, true);
this.setElementClass("spinner-" + this._mode + "-" + name, true);
}
}
};
Spinner.prototype._loadEle = function (spinner, index, total) {
var duration = this._dur || spinner.dur;
var data = spinner.fn(duration, index, total);
data.style.animationDuration = duration + 'ms';
return data;
};
Spinner.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-spinner',
template: '<svg viewBox="0 0 64 64" *ngFor="let i of _c" [ngStyle]="i.style">' +
'<circle [attr.r]="i.r" transform="translate(32,32)"></circle>' +
'</svg>' +
'<svg viewBox="0 0 64 64" *ngFor="let i of _l" [ngStyle]="i.style">' +
'<line [attr.y1]="i.y1" [attr.y2]="i.y2" transform="translate(32,32)"></line>' +
'</svg>',
host: {
'[class.spinner-paused]': '_paused'
},
changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* ChangeDetectionStrategy */].OnPush,
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
},] },
];
/** @nocollapse */
Spinner.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
]; };
Spinner.propDecorators = {
'name': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'duration': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'paused': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
};
return Spinner;
}(__WEBPACK_IMPORTED_MODULE_2__ion__["a" /* Ion */]));
var SPINNERS = {
ios: {
dur: 1000,
lines: 12,
fn: function (dur, index, total) {
var transform = 'rotate(' + (30 * index + (index < 6 ? 180 : -180)) + 'deg)';
var animationDelay = -(dur - ((dur / total) * index)) + 'ms';
return {
y1: 17,
y2: 29,
style: {
transform: transform,
webkitTransform: transform,
animationDelay: animationDelay,
webkitAnimationDelay: animationDelay
}
};
}
},
'ios-small': {
dur: 1000,
lines: 12,
fn: function (dur, index, total) {
var transform = 'rotate(' + (30 * index + (index < 6 ? 180 : -180)) + 'deg)';
var animationDelay = -(dur - ((dur / total) * index)) + 'ms';
return {
y1: 12,
y2: 20,
style: {
transform: transform,
webkitTransform: transform,
animationDelay: animationDelay,
webkitAnimationDelay: animationDelay
}
};
}
},
bubbles: {
dur: 1000,
circles: 9,
fn: function (dur, index, total) {
var animationDelay = -(dur - ((dur / total) * index)) + 'ms';
return {
r: 5,
style: {
top: (9 * Math.sin(2 * Math.PI * index / total)) + 'px',
left: (9 * Math.cos(2 * Math.PI * index / total)) + 'px',
animationDelay: animationDelay,
webkitAnimationDelay: animationDelay
}
};
}
},
circles: {
dur: 1000,
circles: 8,
fn: function (dur, index, total) {
var animationDelay = -(dur - ((dur / total) * index)) + 'ms';
return {
r: 5,
style: {
top: (9 * Math.sin(2 * Math.PI * index / total)) + 'px',
left: (9 * Math.cos(2 * Math.PI * index / total)) + 'px',
animationDelay: animationDelay,
webkitAnimationDelay: animationDelay
}
};
}
},
crescent: {
dur: 750,
circles: 1,
fn: function () {
return {
r: 26,
style: {}
};
}
},
dots: {
dur: 750,
circles: 3,
fn: function (_dur, index) {
var animationDelay = -(110 * index) + 'ms';
return {
r: 6,
style: {
left: (9 - (9 * index)) + 'px',
animationDelay: animationDelay,
webkitAnimationDelay: animationDelay
}
};
}
}
};
//# sourceMappingURL=spinner.js.map
/***/ }),
/* 333 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Tab; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__app_app__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__navigation_deep_linker__ = __webpack_require__(19);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__platform_dom_controller__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__gestures_gesture_controller__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__navigation_nav_controller_base__ = __webpack_require__(53);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__platform_platform__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__tabs__ = __webpack_require__(116);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__transitions_transition_controller__ = __webpack_require__(55);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name Tab
* @description
* The Tab component, written `<ion-tab>`, is styled based on the mode and should
* be used in conjunction with the [Tabs](../Tabs/) component.
*
* Each `ion-tab` is a declarative component for a [NavController](../../../navigation/NavController/).
* Basically, each tab is a `NavController`. For more information on using
* navigation controllers take a look at the [NavController API Docs](../../../navigation/NavController/).
*
* See the [Tabs API Docs](../Tabs/) for more details on configuring Tabs.
*
* @usage
*
* To add a basic tab, you can use the following markup where the `root` property
* is the page you want to load for that tab, `tabTitle` is the optional text to
* display on the tab, and `tabIcon` is the optional [icon](../../icon/Icon/).
*
* ```html
* <ion-tabs>
* <ion-tab [root]="chatRoot" tabTitle="Chat" tabIcon="chat"></ion-tab>
* </ion-tabs>
* ```
*
* Then, in your class you can set `chatRoot` to an imported class:
*
* ```ts
* import { ChatPage } from '../chat/chat';
*
* export class Tabs {
* // here we'll set the property of chatRoot to
* // the imported class of ChatPage
* chatRoot = ChatPage;
*
* constructor() {
*
* }
* }
* ```
*
* You can also pass some parameters to the root page of the tab through
* `rootParams`. Below we pass `chatParams` to the Chat tab:
*
* ```html
* <ion-tabs>
* <ion-tab [root]="chatRoot" [rootParams]="chatParams" tabTitle="Chat" tabIcon="chat"></ion-tab>
* </ion-tabs>
* ```
*
* ```ts
* export class Tabs {
* chatRoot = ChatPage;
*
* // set some user information on chatParams
* chatParams = {
* user1: 'admin',
* user2: 'ionic'
* };
*
* constructor() {
*
* }
* }
* ```
*
* And in `ChatPage` you can get the data from `NavParams`:
*
* ```ts
* export class ChatPage {
* constructor(navParams: NavParams) {
* console.log('Passed params', navParams.data);
* }
* }
* ```
*
* Sometimes you may want to call a method instead of navigating to a new
* page. You can use the `(ionSelect)` event to call a method on your class when
* the tab is selected. Below is an example of presenting a modal from one of
* the tabs.
*
* ```html
* <ion-tabs>
* <ion-tab (ionSelect)="chat()" tabTitle="Show Modal"></ion-tab>
* </ion-tabs>pop
* ```
*
* ```ts
* export class Tabs {
* constructor(public modalCtrl: ModalController) {
*
* }
*
* chat() {
* let modal = this.modalCtrl.create(ChatPage);
* modal.present();
* }
* }
* ```
*
*
* @demo /docs/demos/src/tabs/
* @see {@link /docs/components#tabs Tabs Component Docs}
* @see {@link ../../tabs/Tabs Tabs API Docs}
* @see {@link ../../nav/Nav Nav API Docs}
* @see {@link ../../nav/NavController NavController API Docs}
*/
var Tab = (function (_super) {
__extends(Tab, _super);
function Tab(parent, app, config, plt, elementRef, zone, renderer, cfr, _cd, gestureCtrl, transCtrl, linker, _dom, errHandler) {
var _this =
// A Tab is a NavController for its child pages
_super.call(this, parent, app, config, plt, elementRef, zone, renderer, cfr, gestureCtrl, transCtrl, linker, _dom, errHandler) || this;
_this._cd = _cd;
_this.linker = linker;
_this._dom = _dom;
/**
* @hidden
*/
_this._isEnabled = true;
/**
* @hidden
*/
_this._isShown = true;
/**
* @output {Tab} Emitted when the current tab is selected.
*/
_this.ionSelect = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
_this.id = parent.add(_this);
_this._tabsHideOnSubPages = config.getBoolean('tabsHideOnSubPages');
_this._tabId = 'tabpanel-' + _this.id;
_this._btnId = 'tab-' + _this.id;
return _this;
}
Object.defineProperty(Tab.prototype, "enabled", {
/**
* @input {boolean} If true, enable the tab. If false,
* the user cannot interact with this element.
* Default: `true`.
*/
get: function () {
return this._isEnabled;
},
set: function (val) {
this._isEnabled = Object(__WEBPACK_IMPORTED_MODULE_6__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Tab.prototype, "show", {
/**
* @input {boolean} If true, the tab button is visible within the
* tabbar. Default: `true`.
*/
get: function () {
return this._isShown;
},
set: function (val) {
this._isShown = Object(__WEBPACK_IMPORTED_MODULE_6__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Tab.prototype, "tabsHideOnSubPages", {
/**
* @input {boolean} If true, hide the tabs on child pages.
*/
get: function () {
return this._tabsHideOnSubPages;
},
set: function (val) {
this._tabsHideOnSubPages = Object(__WEBPACK_IMPORTED_MODULE_6__util_util__["o" /* isTrueProperty */])(val);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Tab.prototype, "_vp", {
/**
* @hidden
*/
set: function (val) {
this.setViewport(val);
},
enumerable: true,
configurable: true
});
/**
* @hidden
*/
Tab.prototype.ngOnInit = function () {
this.tabBadgeStyle = this.tabBadgeStyle ? this.tabBadgeStyle : 'default';
};
/**
* @hidden
*/
Tab.prototype.load = function (opts) {
var _this = this;
var segment = this._segment;
if (segment || (!this._loaded && this.root)) {
this.setElementClass('show-tab', true);
// okay, first thing we need to do if check if the view already exists
var nameToUse = segment && segment.name ? segment.name : this.root;
var dataToUse = segment ? segment.data : this.rootParams;
var numViews = this.length() - 1;
for (var i = numViews; i >= 0; i--) {
var viewController = this.getByIndex(i);
if (viewController && (viewController.id === nameToUse || viewController.component === nameToUse)) {
if (i === numViews) {
// this is the last view in the stack and it's the same
// as the segment so there's no change needed
return Promise.resolve();
}
else {
// it's not the exact view as the end
// let's have this nav go back to this exact view
return this.popTo(viewController, {
animate: false,
updateUrl: false,
});
}
}
}
var promise = null;
if (segment && segment.defaultHistory && segment.defaultHistory.length && this._views.length === 0) {
promise = this.linker.initViews(segment).then(function (views) {
return _this.setPages(views, opts);
});
}
else {
promise = this.push(nameToUse, dataToUse, opts);
}
return promise.then(function () {
_this._segment = null;
_this._loaded = true;
});
}
else {
// if this is not the Tab's initial load then we need
// to refresh the tabbar and content dimensions to be sure
// they're lined up correctly
this._dom.read(function () {
_this.resize();
});
return Promise.resolve();
}
};
/**
* @hidden
*/
Tab.prototype.resize = function () {
var active = this.getActive();
if (!active) {
return;
}
var content = active.getIONContent();
content && content.resize();
};
/**
* @hidden
*/
Tab.prototype._viewAttachToDOM = function (viewCtrl, componentRef, viewport) {
var isTabSubPage = (this._tabsHideOnSubPages && viewCtrl.index > 0);
if (isTabSubPage) {
viewport = this.parent.portal;
}
_super.prototype._viewAttachToDOM.call(this, viewCtrl, componentRef, viewport);
if (isTabSubPage) {
// add the .tab-subpage css class to tabs pages that should act like subpages
var pageEleRef = viewCtrl.pageRef();
if (pageEleRef) {
this._renderer.setElementClass(pageEleRef.nativeElement, 'tab-subpage', true);
}
}
};
/**
* @hidden
*/
Tab.prototype.setSelected = function (isSelected) {
this.isSelected = isSelected;
this.setElementClass('show-tab', isSelected);
this.setElementAttribute('aria-hidden', (!isSelected).toString());
if (isSelected) {
// this is the selected tab, detect changes
this._cd.reattach();
}
else {
// this tab is not selected, do not detect changes
this._cd.detach();
}
};
Object.defineProperty(Tab.prototype, "index", {
/**
* @hidden
*/
get: function () {
return this.parent.getIndex(this);
},
enumerable: true,
configurable: true
});
/**
* @hidden
*/
Tab.prototype.updateHref = function (component, data) {
if (this.btn && this.linker) {
var href = this.linker.createUrl(this.parent, component, data) || '#';
this.btn.updateHref(href);
}
};
/**
* @hidden
*/
Tab.prototype.ngOnDestroy = function () {
this.destroy();
};
/**
* @hidden
*/
Tab.prototype.getType = function () {
return 'tab';
};
Tab.prototype.goToRoot = function (opts) {
return this.setRoot(this.root, this.rootParams, opts, null);
};
Tab.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-tab',
template: '<div #viewport></div><div class="nav-decor"></div>',
host: {
'[attr.id]': '_tabId',
'[attr.aria-labelledby]': '_btnId',
'role': 'tabpanel'
},
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
},] },
];
/** @nocollapse */
Tab.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_9__tabs__["a" /* Tabs */], },
{ type: __WEBPACK_IMPORTED_MODULE_1__app_app__["a" /* App */], },
{ type: __WEBPACK_IMPORTED_MODULE_2__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_8__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["M" /* NgZone */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["o" /* ComponentFactoryResolver */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["j" /* ChangeDetectorRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_5__gestures_gesture_controller__["l" /* GestureController */], },
{ type: __WEBPACK_IMPORTED_MODULE_10__transitions_transition_controller__["a" /* TransitionController */], },
{ type: __WEBPACK_IMPORTED_MODULE_3__navigation_deep_linker__["a" /* DeepLinker */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_4__platform_dom_controller__["a" /* DomController */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["u" /* ErrorHandler */], },
]; };
Tab.propDecorators = {
'root': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'rootParams': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'tabUrlPath': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'tabTitle': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'tabIcon': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'tabBadge': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'tabBadgeStyle': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'enabled': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'show': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'tabsHideOnSubPages': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'ionSelect': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'_vp': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_8" /* ViewChild */], args: ['viewport', { read: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_10" /* ViewContainerRef */] },] },],
};
return Tab;
}(__WEBPACK_IMPORTED_MODULE_7__navigation_nav_controller_base__["a" /* NavControllerBase */]));
//# sourceMappingURL=tab.js.map
/***/ }),
/* 334 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TabButton; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ion__ = __webpack_require__(6);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
*/
var TabButton = (function (_super) {
__extends(TabButton, _super);
function TabButton(config, elementRef, renderer) {
var _this = _super.call(this, config, elementRef, renderer) || this;
_this.ionSelect = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* EventEmitter */]();
_this.disHover = (config.get('hoverCSS') === false);
_this.layout = config.get('tabsLayout');
return _this;
}
TabButton.prototype.ngOnInit = function () {
this.tab.btn = this;
this.layout = this.tab.parent.tabsLayout || this.layout;
this.hasTitle = !!this.tab.tabTitle;
this.hasIcon = !!this.tab.tabIcon && this.layout !== 'icon-hide';
this.hasTitleOnly = (this.hasTitle && !this.hasIcon);
this.hasIconOnly = (this.hasIcon && !this.hasTitle);
this.hasBadge = !!this.tab.tabBadge;
};
TabButton.prototype.onClick = function () {
this.ionSelect.emit(this.tab);
return false;
};
TabButton.prototype.updateHref = function (href) {
this.setElementAttribute('href', href);
};
TabButton.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: '.tab-button',
template: '<ion-icon *ngIf="tab.tabIcon" [name]="tab.tabIcon" [isActive]="tab.isSelected" class="tab-button-icon"></ion-icon>' +
'<span *ngIf="tab.tabTitle" class="tab-button-text">{{tab.tabTitle}}</span>' +
'<ion-badge *ngIf="tab.tabBadge" class="tab-badge" [color]="tab.tabBadgeStyle">{{tab.tabBadge}}</ion-badge>' +
'<div class="button-effect"></div>',
host: {
'[attr.id]': 'tab._btnId',
'[attr.aria-controls]': 'tab._tabId',
'[attr.aria-selected]': 'tab.isSelected',
'[class.has-title]': 'hasTitle',
'[class.has-icon]': 'hasIcon',
'[class.has-title-only]': 'hasTitleOnly',
'[class.icon-only]': 'hasIconOnly',
'[class.has-badge]': 'hasBadge',
'[class.disable-hover]': 'disHover',
'[class.tab-disabled]': '!tab.enabled',
'[class.tab-hidden]': '!tab.show',
}
},] },
];
/** @nocollapse */
TabButton.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
]; };
TabButton.propDecorators = {
'tab': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'ionSelect': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* Output */] },],
'onClick': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* HostListener */], args: ['click',] },],
};
return TabButton;
}(__WEBPACK_IMPORTED_MODULE_2__ion__["a" /* Ion */]));
//# sourceMappingURL=tab-button.js.map
/***/ }),
/* 335 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Toast; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__app_app_constants__ = __webpack_require__(44);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__toast_component__ = __webpack_require__(118);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__toast_transitions__ = __webpack_require__(482);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__navigation_view_controller__ = __webpack_require__(7);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
*/
var Toast = (function (_super) {
__extends(Toast, _super);
function Toast(app, opts, config) {
if (opts === void 0) { opts = {}; }
var _this = this;
opts.dismissOnPageChange = Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["l" /* isPresent */])(opts.dismissOnPageChange) ? !!opts.dismissOnPageChange : false;
_this = _super.call(this, __WEBPACK_IMPORTED_MODULE_2__toast_component__["a" /* ToastCmp */], opts, null) || this;
_this._app = app;
// set the position to the bottom if not provided
if (!opts.position || !_this.isValidPosition(opts.position)) {
opts.position = TOAST_POSITION_BOTTOM;
}
_this.isOverlay = true;
config.setTransition('toast-slide-in', __WEBPACK_IMPORTED_MODULE_3__toast_transitions__["c" /* ToastSlideIn */]);
config.setTransition('toast-slide-out', __WEBPACK_IMPORTED_MODULE_3__toast_transitions__["d" /* ToastSlideOut */]);
config.setTransition('toast-md-slide-in', __WEBPACK_IMPORTED_MODULE_3__toast_transitions__["a" /* ToastMdSlideIn */]);
config.setTransition('toast-md-slide-out', __WEBPACK_IMPORTED_MODULE_3__toast_transitions__["b" /* ToastMdSlideOut */]);
config.setTransition('toast-wp-slide-out', __WEBPACK_IMPORTED_MODULE_3__toast_transitions__["f" /* ToastWpPopOut */]);
config.setTransition('toast-wp-slide-in', __WEBPACK_IMPORTED_MODULE_3__toast_transitions__["e" /* ToastWpPopIn */]);
return _this;
}
/**
* @hidden
*/
Toast.prototype.getTransitionName = function (direction) {
var key = 'toast' + (direction === 'back' ? 'Leave' : 'Enter');
return this._nav && this._nav.config.get(key);
};
/**
* @hidden
*/
Toast.prototype.isValidPosition = function (position) {
return position === TOAST_POSITION_TOP || position === TOAST_POSITION_MIDDLE || position === TOAST_POSITION_BOTTOM;
};
/**
* @param {string} message Toast message content
*/
Toast.prototype.setMessage = function (message) {
this.data.message = message;
return this;
};
/**
* @param {number} dur Toast message duration
*/
Toast.prototype.setDuration = function (dur) {
this.data.duration = dur;
return this;
};
/**
* @param {'top'|'middle'|'bottom'} pos Toast message position
*/
Toast.prototype.setPosition = function (pos) {
this.data.position = pos;
return this;
};
/**
* @param {string} cssClass Toast message CSS class
*/
Toast.prototype.setCssClass = function (cssClass) {
this.data.cssClass = cssClass;
return this;
};
/**
* @param {boolean} closeButton Toast message close button
*/
Toast.prototype.setShowCloseButton = function (closeButton) {
this.data.showCloseButton = closeButton;
return this;
};
/**
* Present the toast instance.
*
* @param {NavOptions} [navOptions={}] Nav options to go with this transition.
* @returns {Promise} Returns a promise which is resolved when the transition has completed.
*/
Toast.prototype.present = function (navOptions) {
if (navOptions === void 0) { navOptions = {}; }
navOptions.disableApp = false;
navOptions.keyboardClose = false;
return this._app.present(this, navOptions, __WEBPACK_IMPORTED_MODULE_1__app_app_constants__["d" /* PORTAL_TOAST */]);
};
/**
* Dismiss all toast components which have been presented.
*/
Toast.prototype.dismissAll = function () {
this._nav && this._nav.popAll();
};
return Toast;
}(__WEBPACK_IMPORTED_MODULE_4__navigation_view_controller__["a" /* ViewController */]));
var TOAST_POSITION_TOP = 'top';
var TOAST_POSITION_MIDDLE = 'middle';
var TOAST_POSITION_BOTTOM = 'bottom';
//# sourceMappingURL=toast.js.map
/***/ }),
/* 336 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ToastController; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__app_app__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__toast__ = __webpack_require__(335);
/**
* @name ToastController
* @description
* A Toast is a subtle notification commonly used in modern applications.
* It can be used to provide feedback about an operation or to
* display a system message. The toast appears on top of the app's content,
* and can be dismissed by the app to resume user interaction with
* the app.
*
* ### Creating
* All of the toast options should be passed in the first argument of
* the create method: `create(opts)`. The message to display should be
* passed in the `message` property. The `showCloseButton` option can be set to
* true in order to display a close button on the toast. See the [create](#create)
* method below for all available options.
*
* ### Positioning
* Toasts can be positioned at the top, bottom or middle of the
* view port. The position can be passed to the `Toast.create(opts)` method.
* The position option is a string, and the values accepted are `top`, `bottom` and `middle`.
* If the position is not specified, the toast will be displayed at the bottom of the view port.
*
* ### Dismissing
* The toast can be dismissed automatically after a specific amount of time
* by passing the number of milliseconds to display it in the `duration` of
* the toast options. If `showCloseButton` is set to true, then the close button
* will dismiss the toast. To dismiss the toast after creation, call the `dismiss()`
* method on the Toast instance. The `onDidDismiss` function can be called to perform an action after the toast
* is dismissed.
*
* @usage
* ```ts
* import { ToastController } from 'ionic-angular';
*
* constructor(public toastCtrl: ToastController) { }
*
* presentToast() {
* const toast = this.toastCtrl.create({
* message: 'User was added successfully',
* duration: 3000,
* position: 'top'
* });
*
* toast.onDidDismiss(() => {
* console.log('Dismissed toast');
* });
*
* toast.present();
* }
* ```
* @advanced
* | Property | Type | Default | Description |
* |-----------------------|-----------|-----------------|---------------------------------------------------------------------------------------------------------------|
* | message | `string` | - | The message for the toast. Long strings will wrap and the toast container will expand. |
* | duration | `number` | - | How many milliseconds to wait before hiding the toast. By default, it will show until `dismiss()` is called. |
* | position | `string` | "bottom" | The position of the toast on the screen. Accepted values: "top", "middle", "bottom". |
* | cssClass | `string` | - | Additional classes for custom styles, separated by spaces. |
* | showCloseButton | `boolean` | false | Whether or not to show a button to close the toast. |
* | closeButtonText | `string` | "Close" | Text to display in the close button. |
* | dismissOnPageChange | `boolean` | false | Whether to dismiss the toast when navigating to a new page. |
*
* @demo /docs/demos/src/toast/
*/
var ToastController = (function () {
function ToastController(_app, config) {
this._app = _app;
this.config = config;
}
/**
* Create a new toast component. See options below
* @param {ToastOptions} opts Toast options. See the below table for available options.
*/
ToastController.prototype.create = function (opts) {
if (opts === void 0) { opts = {}; }
return new __WEBPACK_IMPORTED_MODULE_3__toast__["a" /* Toast */](this._app, opts, this.config);
};
ToastController.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
ToastController.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__app_app__["a" /* App */], },
{ type: __WEBPACK_IMPORTED_MODULE_2__config_config__["a" /* Config */], },
]; };
return ToastController;
}());
//# sourceMappingURL=toast-controller.js.map
/***/ }),
/* 337 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Toggle; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_forms__ = __webpack_require__(16);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__platform_dom_controller__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_form__ = __webpack_require__(20);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__gestures_gesture_controller__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__tap_click_haptic__ = __webpack_require__(47);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__util_base_input__ = __webpack_require__(29);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__item_item__ = __webpack_require__(21);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__platform_key__ = __webpack_require__(23);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__platform_platform__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__toggle_gesture__ = __webpack_require__(483);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name Toggle
* @description
* A toggle technically is the same thing as an HTML checkbox input,
* except it looks different and is easier to use on a touch device.
* Toggles can also have colors assigned to them, by adding any color
* attribute.
*
* See the [Angular Docs](https://angular.io/docs/ts/latest/guide/forms.html)
* for more info on forms and inputs.
*
* @usage
* ```html
*
* <ion-list>
*
* <ion-item>
* <ion-label>Pepperoni</ion-label>
* <ion-toggle [(ngModel)]="pepperoni"></ion-toggle>
* </ion-item>
*
* <ion-item>
* <ion-label>Sausage</ion-label>
* <ion-toggle [(ngModel)]="sausage" disabled="true"></ion-toggle>
* </ion-item>
*
* <ion-item>
* <ion-label>Mushrooms</ion-label>
* <ion-toggle [(ngModel)]="mushrooms"></ion-toggle>
* </ion-item>
*
* </ion-list>
* ```
*
* @demo /docs/demos/src/toggle/
* @see {@link /docs/components#toggle Toggle Component Docs}
*/
var Toggle = (function (_super) {
__extends(Toggle, _super);
function Toggle(form, config, _plt, elementRef, renderer, _haptic, item, _gestureCtrl, _domCtrl, _zone) {
var _this = _super.call(this, config, elementRef, renderer, 'toggle', false, form, item, null) || this;
_this._plt = _plt;
_this._haptic = _haptic;
_this._gestureCtrl = _gestureCtrl;
_this._domCtrl = _domCtrl;
_this._zone = _zone;
_this._activated = false;
return _this;
}
Object.defineProperty(Toggle.prototype, "checked", {
/**
* @input {boolean} If true, the element is selected.
*/
get: function () {
return this.value;
},
set: function (val) {
this.value = val;
},
enumerable: true,
configurable: true
});
/**
* @hidden
*/
Toggle.prototype.ngAfterContentInit = function () {
this._initialize();
this._gesture = new __WEBPACK_IMPORTED_MODULE_12__toggle_gesture__["a" /* ToggleGesture */](this._plt, this, this._gestureCtrl, this._domCtrl);
this._gesture.listen();
};
/**
* @hidden
*/
Toggle.prototype._inputUpdated = function () { };
/**
* @hidden
*/
Toggle.prototype._inputNormalize = function (val) {
return Object(__WEBPACK_IMPORTED_MODULE_7__util_util__["o" /* isTrueProperty */])(val);
};
/**
* @hidden
*/
Toggle.prototype._onDragStart = function (startX) {
var _this = this;
(void 0) /* assert */;
(void 0) /* console.debug */;
this._zone.run(function () {
_this._startX = startX;
_this._fireFocus();
_this._activated = true;
});
};
/**
* @hidden
*/
Toggle.prototype._onDragMove = function (currentX) {
var _this = this;
if (!this._startX) {
(void 0) /* assert */;
return;
}
if (this._shouldToggle(currentX, -15)) {
this._zone.run(function () {
_this.value = !_this.value;
_this._startX = currentX;
_this._haptic.selection();
});
}
};
/**
* @hidden
*/
Toggle.prototype._onDragEnd = function (endX) {
var _this = this;
if (!this._startX) {
(void 0) /* assert */;
return;
}
(void 0) /* console.debug */;
this._zone.run(function () {
if (_this._shouldToggle(endX, 4)) {
_this.value = !_this.value;
_this._haptic.selection();
}
_this._activated = false;
_this._fireBlur();
_this._startX = null;
});
};
/**
* @hidden
*/
Toggle.prototype._shouldToggle = function (currentX, margin) {
var isLTR = !this._plt.isRTL;
var startX = this._startX;
if (this._value) {
return (isLTR && (startX + margin > currentX)) ||
(!isLTR && (startX - margin < currentX));
}
else {
return (isLTR && (startX - margin < currentX)) ||
(!isLTR && (startX + margin > currentX));
}
};
/**
* @hidden
*/
Toggle.prototype._keyup = function (ev) {
if (ev.keyCode === __WEBPACK_IMPORTED_MODULE_10__platform_key__["f" /* KEY_SPACE */] || ev.keyCode === __WEBPACK_IMPORTED_MODULE_10__platform_key__["b" /* KEY_ENTER */]) {
(void 0) /* console.debug */;
ev.preventDefault();
ev.stopPropagation();
this.value = !this.value;
}
};
/**
* @hidden
*/
Toggle.prototype.ngOnDestroy = function () {
_super.prototype.ngOnDestroy.call(this);
this._gesture && this._gesture.destroy();
};
Toggle.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-toggle',
template: '<div class="toggle-icon">' +
'<div class="toggle-inner"></div>' +
'</div>' +
'<button role="checkbox" ' +
'type="button" ' +
'ion-button="item-cover" ' +
'[id]="id" ' +
'[attr.aria-checked]="_value" ' +
'[attr.aria-labelledby]="_labelId" ' +
'[attr.aria-disabled]="_disabled" ' +
'class="item-cover" disable-activated>' +
'</button>',
host: {
'[class.toggle-disabled]': '_disabled',
'[class.toggle-checked]': '_value',
'[class.toggle-activated]': '_activated',
},
providers: [{ provide: __WEBPACK_IMPORTED_MODULE_1__angular_forms__["c" /* NG_VALUE_ACCESSOR */], useExisting: Toggle, multi: true }],
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
},] },
];
/** @nocollapse */
Toggle.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_4__util_form__["a" /* Form */], },
{ type: __WEBPACK_IMPORTED_MODULE_2__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_11__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_6__tap_click_haptic__["a" /* Haptic */], },
{ type: __WEBPACK_IMPORTED_MODULE_9__item_item__["a" /* Item */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_5__gestures_gesture_controller__["l" /* GestureController */], },
{ type: __WEBPACK_IMPORTED_MODULE_3__platform_dom_controller__["a" /* DomController */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["M" /* NgZone */], },
]; };
Toggle.propDecorators = {
'checked': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'_keyup': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["y" /* HostListener */], args: ['keyup', ['$event'],] },],
};
return Toggle;
}(__WEBPACK_IMPORTED_MODULE_8__util_base_input__["a" /* BaseInput */]));
//# sourceMappingURL=toggle.js.map
/***/ }),
/* 338 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Footer; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ion__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__navigation_view_controller__ = __webpack_require__(7);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name Footer
* @description
* Footer is a root component of a page that sits at the bottom of the page.
* Footer can be a wrapper for `ion-toolbar` to make sure the content area is sized correctly.
*
* @usage
*
* ```html
* <ion-content></ion-content>
*
* <ion-footer>
* <ion-toolbar>
* <ion-title>Footer</ion-title>
* </ion-toolbar>
* </ion-footer>
* ```
*
*/
var Footer = (function (_super) {
__extends(Footer, _super);
function Footer(config, elementRef, renderer, viewCtrl) {
var _this = _super.call(this, config, elementRef, renderer, 'footer') || this;
viewCtrl && viewCtrl._setFooter(_this);
return _this;
}
Footer.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-footer'
},] },
];
/** @nocollapse */
Footer.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_3__navigation_view_controller__["a" /* ViewController */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
]; };
return Footer;
}(__WEBPACK_IMPORTED_MODULE_2__ion__["a" /* Ion */]));
//# sourceMappingURL=toolbar-footer.js.map
/***/ }),
/* 339 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Header; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ion__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__navigation_view_controller__ = __webpack_require__(7);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name Header
* @description
* Header is a parent component that holds the navbar and toolbar component.
* It's important to note that `ion-header` needs to be one of the three root elements of a page
*
* @usage
*
* ```html
* <ion-header>
* <ion-navbar>
* <ion-title>Page1</ion-title>
* </ion-navbar>
*
* <ion-toolbar>
* <ion-title>Subheader</ion-title>
* </ion-toolbar>
* </ion-header>
*
* <ion-content></ion-content>
* ```
*
*/
var Header = (function (_super) {
__extends(Header, _super);
function Header(config, elementRef, renderer, viewCtrl) {
var _this = _super.call(this, config, elementRef, renderer, 'header') || this;
viewCtrl && viewCtrl._setHeader(_this);
return _this;
}
Header.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-header'
},] },
];
/** @nocollapse */
Header.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_3__navigation_view_controller__["a" /* ViewController */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
]; };
return Header;
}(__WEBPACK_IMPORTED_MODULE_2__ion__["a" /* Ion */]));
//# sourceMappingURL=toolbar-header.js.map
/***/ }),
/* 340 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ToolbarItem; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__button_button__ = __webpack_require__(45);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__ion__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__navbar__ = __webpack_require__(49);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__toolbar__ = __webpack_require__(67);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
*/
var ToolbarItem = (function (_super) {
__extends(ToolbarItem, _super);
function ToolbarItem(config, elementRef, renderer, toolbar, navbar) {
var _this = _super.call(this, config, elementRef, renderer, 'bar-buttons') || this;
_this.inToolbar = !!(toolbar || navbar);
return _this;
}
Object.defineProperty(ToolbarItem.prototype, "_buttons", {
set: function (buttons) {
if (this.inToolbar) {
buttons.forEach(function (button) {
button.setRole('bar-button');
});
}
},
enumerable: true,
configurable: true
});
ToolbarItem.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-buttons,[menuToggle]'
},] },
];
/** @nocollapse */
ToolbarItem.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_2__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_5__toolbar__["a" /* Toolbar */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_4__navbar__["a" /* Navbar */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["z" /* Inject */], args: [Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_14" /* forwardRef */])(function () { return __WEBPACK_IMPORTED_MODULE_4__navbar__["a" /* Navbar */]; }),] },] },
]; };
ToolbarItem.propDecorators = {
'_buttons': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["r" /* ContentChildren */], args: [__WEBPACK_IMPORTED_MODULE_1__button_button__["a" /* Button */],] },],
};
return ToolbarItem;
}(__WEBPACK_IMPORTED_MODULE_3__ion__["a" /* Ion */]));
//# sourceMappingURL=toolbar-item.js.map
/***/ }),
/* 341 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ToolbarTitle; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ion__ = __webpack_require__(6);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__navbar__ = __webpack_require__(49);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__toolbar__ = __webpack_require__(67);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name Title
* @description
* `ion-title` is a component that sets the title of the `Toolbar` or `Navbar`
*
* @usage
*
* ```html
* <ion-header>
*
* <ion-navbar>
* <ion-title>Settings</ion-title>
* </ion-navbar>
*
* </ion-header>
* ```
*
* Or to create a navbar with a toolbar as a subheader:
*
* ```html
* <ion-header>
*
* <ion-navbar>
* <ion-title>Main Header</ion-title>
* </ion-navbar>
*
* <ion-toolbar>
* <ion-title>Subheader</ion-title>
* </ion-toolbar>
*
* </ion-header>
* ```
*
* @demo /docs/demos/src/title/
*/
var ToolbarTitle = (function (_super) {
__extends(ToolbarTitle, _super);
function ToolbarTitle(config, elementRef, renderer, toolbar, navbar) {
var _this = _super.call(this, config, elementRef, renderer, 'title') || this;
toolbar && toolbar._setTitle(_this);
navbar && navbar._setTitle(_this);
return _this;
}
/**
* @hidden
*/
ToolbarTitle.prototype.getTitleText = function () {
return this._elementRef.nativeElement.textContent;
};
ToolbarTitle.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */], args: [{
selector: 'ion-title',
template: '<div class="toolbar-title" [ngClass]="\'toolbar-title-\' + _mode">' +
'<ng-content></ng-content>' +
'</div>',
changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* ChangeDetectionStrategy */].OnPush,
encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_11" /* ViewEncapsulation */].None,
},] },
];
/** @nocollapse */
ToolbarTitle.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_4__toolbar__["a" /* Toolbar */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] },] },
{ type: __WEBPACK_IMPORTED_MODULE_3__navbar__["a" /* Navbar */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["z" /* Inject */], args: [Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_14" /* forwardRef */])(function () { return __WEBPACK_IMPORTED_MODULE_3__navbar__["a" /* Navbar */]; }),] },] },
]; };
return ToolbarTitle;
}(__WEBPACK_IMPORTED_MODULE_2__ion__["a" /* Ion */]));
//# sourceMappingURL=toolbar-title.js.map
/***/ }),
/* 342 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Thumbnail; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/**
* @name Thumbnail
* @module ionic
* @description
* A Thumbnail is a component that creates a squared image for an item.
* Thumbnails can be place on the left or right side of an item with the `item-start` or `item-end` directive.
* @see {@link /docs/components/#thumbnail-list Thumbnail Component Docs}
*/
var Thumbnail = (function () {
function Thumbnail() {
}
Thumbnail.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: 'ion-thumbnail'
},] },
];
/** @nocollapse */
Thumbnail.ctorParameters = function () { return []; };
return Thumbnail;
}());
//# sourceMappingURL=thumbnail.js.map
/***/ }),
/* 343 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Typography; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__ion__ = __webpack_require__(6);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name Typography
* @module ionic
* @description
*
* The Typography component is a simple component that can be used to style the text color of any element.
* The `ion-text` attribute should be added to the element in order to pass a color from the Sass `$colors`
* map and change the text color of that element.
*
* @usage
*
* ```html
* <h1 ion-text color="secondary">H1: The quick brown fox jumps over the lazy dog</h1>
*
* <h2 ion-text color="primary">H2: The quick brown fox jumps over the lazy dog</h2>
*
* <h3 ion-text color="light">H3: The quick brown fox jumps over the lazy dog</h3>
*
* <h4 ion-text color="danger">H4: The quick brown fox jumps over the lazy dog</h4>
*
* <h5 ion-text color="dark">H5: The quick brown fox jumps over the lazy dog</h5>
*
* <h6 ion-text [color]="dynamicColor">H6: The quick brown fox jumps over the lazy dog</h6>
*
* <p>
* I saw a werewolf with a Chinese menu in his hand.
* Walking through the <sub ion-text color="danger">streets</sub> of Soho in the rain.
* He <i ion-text color="primary">was</i> looking for a place called Lee Ho Fook's.
* Gonna get a <a ion-text color="secondary">big dish of beef chow mein.</a>
* </p>
*
* <p>
* He's the hairy-handed gent who ran amuck in Kent.
* Lately he's <sup ion-text color="primary">been</sup> overheard in Mayfair.
* Better stay away from him.
* He'll rip your lungs out, Jim.
* I'd like to meet his tailor.
* </p>
* ```
*
*/
var Typography = (function (_super) {
__extends(Typography, _super);
function Typography(config, elementRef, renderer) {
return _super.call(this, config, elementRef, renderer, 'text') || this;
}
Typography.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: '[ion-text]'
},] },
];
/** @nocollapse */
Typography.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
]; };
return Typography;
}(__WEBPACK_IMPORTED_MODULE_2__ion__["a" /* Ion */]));
//# sourceMappingURL=typography.js.map
/***/ }),
/* 344 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return VirtualScroll; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__virtual_util__ = __webpack_require__(484);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__content_content__ = __webpack_require__(24);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__platform_dom_controller__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__platform_platform__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__navigation_view_controller__ = __webpack_require__(7);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__virtual_item__ = __webpack_require__(121);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__virtual_footer__ = __webpack_require__(119);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__virtual_header__ = __webpack_require__(120);
/**
* @name VirtualScroll
* @description
* Virtual Scroll displays a virtual, "infinite" list. An array of records
* is passed to the virtual scroll containing the data to create templates
* for. The template created for each record, referred to as a cell, can
* consist of items, headers, and footers.
*
* For performance reasons, not every record in the list is rendered at once;
* instead a small subset of records (enough to fill the viewport) are rendered
* and reused as the user scrolls.
*
* ### The Basics
*
* The array of records should be passed to the `virtualScroll` property.
* The data given to the `virtualScroll` property must be an array. An item
* template with the `*virtualItem` property is required in the `virtualScroll`.
* The `virtualScroll` and `*virtualItem` properties can be added to any element.
*
* ```html
* <ion-list [virtualScroll]="items">
*
* <ion-item *virtualItem="let item">
* {% raw %}{{ item }}{% endraw %}
* </ion-item>
*
* </ion-list>
* ```
*
*
* ### Section Headers and Footers
*
* Section headers and footers are optional. They can be dynamically created
* from developer-defined functions. For example, a large list of contacts
* usually has a divider for each letter in the alphabet. Developers provide
* their own custom function to be called on each record. The logic in the
* custom function should determine whether to create the section template
* and what data to provide to the template. The custom function should
* return `null` if a template shouldn't be created.
*
* ```html
* <ion-list [virtualScroll]="items" [headerFn]="myHeaderFn">
*
* <ion-item-divider *virtualHeader="let header">
* Header: {% raw %}{{ header }}{% endraw %}
* </ion-item-divider>
*
* <ion-item *virtualItem="let item">
* Item: {% raw %}{{ item }}{% endraw %}
* </ion-item>
*
* </ion-list>
* ```
*
* Below is an example of a custom function called on every record. It
* gets passed the individual record, the record's index number,
* and the entire array of records. In this example, after every 20
* records a header will be inserted. So between the 19th and 20th records,
* between the 39th and 40th, and so on, a `<ion-item-divider>` will
* be created and the template's data will come from the function's
* returned data.
*
* ```ts
* myHeaderFn(record, recordIndex, records) {
* if (recordIndex % 20 === 0) {
* return 'Header ' + recordIndex;
* }
* return null;
* }
* ```
*
*
* ### Approximate Widths and Heights
*
* If the height of items in the virtual scroll are not close to the
* default size of 40px, it is extremely important to provide a value for
* approxItemHeight height. An exact pixel-perfect size is not necessary,
* but without an estimate the virtual scroll will not render correctly.
*
* The approximate width and height of each template is used to help
* determine how many cells should be created, and to help calculate
* the height of the scrollable area. Note that the actual rendered size
* of each cell comes from the app's CSS, whereas this approximation
* is only used to help calculate initial dimensions.
*
* It's also important to know that Ionic's default item sizes have
* slightly different heights between platforms, which is perfectly fine.
*
*
* ### Images Within Virtual Scroll
*
* HTTP requests, image decoding, and image rendering can cause jank while
* scrolling. In order to better control images, Ionic provides `<ion-img>`
* to manage HTTP requests and image rendering. While scrolling through items
* quickly, `<ion-img>` knows when and when not to make requests, when and
* when not to render images, and only loads the images that are viewable
* after scrolling. [Read more about `ion-img`.](../../img/Img/)
*
* It's also important for app developers to ensure image sizes are locked in,
* and after images have fully loaded they do not change size and affect any
* other element sizes. Simply put, to ensure rendering bugs are not introduced,
* it's vital that elements within a virtual item does not dynamically change.
*
* For virtual scrolling, the natural effects of the `<img>` are not desirable
* features. We recommend using the `<ion-img>` component over the native
* `<img>` element because when an `<img>` element is added to the DOM, it
* immediately makes a HTTP request for the image file. Additionally, `<img>`
* renders whenever it wants which could be while the user is scrolling. However,
* `<ion-img>` is governed by the containing `ion-content` and does not render
* images while scrolling quickly.
*
* ```html
* <ion-list [virtualScroll]="items">
*
* <ion-item *virtualItem="let item">
* <ion-avatar item-start>
* <ion-img [src]="item.avatarUrl"></ion-img>
* </ion-avatar>
* {% raw %} {{ item.firstName }} {{ item.lastName }}{% endraw %}
* </ion-item>
*
* </ion-list>
* ```
*
*
* ### Custom Components
*
* If a custom component is going to be used within Virtual Scroll, it's best
* to wrap it with a good old `<div>` to ensure the component is rendered
* correctly. Since each custom component's implementation and internals can be
* quite different, wrapping within a `<div>` is a safe way to make sure
* dimensions are measured correctly.
*
* ```html
* <ion-list [virtualScroll]="items">
*
* <div *virtualItem="let item">
* <my-custom-item [item]="item">
* {% raw %} {{ item }}{% endraw %}
* </my-custom-item>
* </div>
*
* </ion-list>
* ```
*
*
* ## Virtual Scroll Performance Tips
*
* #### iOS Cordova WKWebView
*
* When deploying to iOS with Cordova, it's highly recommended to use the
* [WKWebView plugin](http://blog.ionic.io/cordova-ios-performance-improvements-drop-in-speed-with-wkwebview/)
* in order to take advantage of iOS's higher performimg webview. Additionally,
* WKWebView is superior at scrolling efficiently in comparision to the older
* UIWebView.
*
* #### Lock in element dimensions and locations
*
* In order for virtual scroll to efficiently size and locate every item, it's
* very important every element within each virtual item does not dynamically
* change its dimensions or location. The best way to ensure size and location
* does not change, it's recommended each virtual item has locked in its size
* via CSS.
*
* #### Use `ion-img` for images
*
* When including images within Virtual Scroll, be sure to use
* [`ion-img`](../img/Img/) rather than the standard `<img>` HTML element.
* With `ion-img`, images are lazy loaded so only the viewable ones are
* rendered, and HTTP requests are efficiently controlled while scrolling.
*
* #### Set Approximate Widths and Heights
*
* As mentioned above, all elements should lock in their dimensions. However,
* virtual scroll isn't aware of the dimensions until after they have been
* rendered. For the initial render, virtual scroll still needs to set
* how many items should be built. With "approx" property inputs, such as
* `approxItemHeight`, we're able to give virtual scroll an approximate size,
* therefore allowing virtual scroll to decide how many items should be
* created.
*
* #### Changing dataset should use `virtualTrackBy`
*
* It is possible for the identities of elements in the iterator to change
* while the data does not. This can happen, for example, if the iterator
* produced from an RPC to the server, and that RPC is re-run. Even if the
* "data" hasn't changed, the second response will produce objects with
* different identities, and Ionic will tear down the entire DOM and rebuild
* it. This is an expensive operation and should be avoided if possible.
*
* #### Efficient headers and footer functions
*
* Each virtual item must stay extremely efficient, but one way to really
* kill its performance is to perform any DOM operations within section header
* and footer functions. These functions are called for every record in the
* dataset, so please make sure they're performant.
*
*/
var VirtualScroll = (function () {
function VirtualScroll(_iterableDiffers, _elementRef, _renderer, _zone, _cd, _content, _plt, _ctrl, _config, _dom) {
var _this = this;
this._iterableDiffers = _iterableDiffers;
this._elementRef = _elementRef;
this._renderer = _renderer;
this._zone = _zone;
this._cd = _cd;
this._content = _content;
this._plt = _plt;
this._ctrl = _ctrl;
this._config = _config;
this._dom = _dom;
this._init = false;
this._lastEle = false;
this._records = [];
this._cells = [];
this._nodes = [];
this._vHeight = 0;
this._lastCheck = 0;
this._recordSize = 0;
this._data = {
scrollTop: 0,
};
this._queue = 1 /* NoChanges */;
/**
* @input {number} The buffer ratio is used to decide how many cells
* should get created when initially rendered. The number is a
* multiplier against the viewable area's height. For example, if it
* takes `20` cells to fill up the height of the viewable area, then
* with a buffer ratio of `3` it will create `60` cells that are
* available for reuse while scrolling. For better performance, it's
* better to have more cells than what are required to fill the
* viewable area. Default is `3`.
*/
this.bufferRatio = 3;
/**
* @input {string} The approximate width of each item template's cell.
* This dimension is used to help determine how many cells should
* be created when initialized, and to help calculate the height of
* the scrollable area. This value can use either `px` or `%` units.
* Note that the actual rendered size of each cell comes from the
* app's CSS, whereas this approximation is used to help calculate
* initial dimensions before the item has been rendered. Default is
* `100%`.
*/
this.approxItemWidth = '100%';
/**
* @input {string} The approximate width of each header template's cell.
* This dimension is used to help determine how many cells should
* be created when initialized, and to help calculate the height of
* the scrollable area. This value can use either `px` or `%` units.
* Note that the actual rendered size of each cell comes from the
* app's CSS, whereas this approximation is used to help calculate
* initial dimensions. Default is `100%`.
*/
this.approxHeaderWidth = '100%';
/**
* @input {string} The approximate height of each header template's cell.
* This dimension is used to help determine how many cells should
* be created when initialized, and to help calculate the height of
* the scrollable area. This height value can only use `px` units.
* Note that the actual rendered size of each cell comes from the
* app's CSS, whereas this approximation is used to help calculate
* initial dimensions before the item has been rendered. Default is `40px`.
*/
this.approxHeaderHeight = '40px';
/**
* @input {string} The approximate width of each footer template's cell.
* This dimension is used to help determine how many cells should
* be created when initialized, and to help calculate the height of
* the scrollable area. This value can use either `px` or `%` units.
* Note that the actual rendered size of each cell comes from the
* app's CSS, whereas this approximation is used to help calculate
* initial dimensions before the item has been rendered. Default is `100%`.
*/
this.approxFooterWidth = '100%';
/**
* @input {string} The approximate height of each footer template's cell.
* This dimension is used to help determine how many cells should
* be created when initialized, and to help calculate the height of
* the scrollable area. This height value can only use `px` units.
* Note that the actual rendered size of each cell comes from the
* app's CSS, whereas this approximation is used to help calculate
* initial dimensions before the item has been rendered. Default is `40px`.
*/
this.approxFooterHeight = '40px';
// hide the virtual scroll element with opacity so we don't
// see jank as it loads up, but we're still able to read
// dimensions because it's still rendered and only opacity hidden
this.setElementClass('virtual-loading', true);
// wait for the content to be rendered and has readable dimensions
var readSub = _ctrl.readReady.subscribe(function () {
readSub.unsubscribe();
_this.readUpdate(true);
});
// wait for the content to be writable
var writeSub = _ctrl.writeReady.subscribe(function () {
writeSub.unsubscribe();
_this._init = true;
_this.writeUpdate(true);
_this._listeners();
});
}
Object.defineProperty(VirtualScroll.prototype, "virtualScroll", {
get: function () {
return this._records;
},
/**
* @input {array} The data that builds the templates within the virtual scroll.
* This is the same data that you'd pass to `*ngFor`. It's important to note
* that when this data has changed, then the entire virtual scroll is reset,
* which is an expensive operation and should be avoided if possible.
*/
set: function (val) {
this._records = val;
},
enumerable: true,
configurable: true
});
Object.defineProperty(VirtualScroll.prototype, "headerFn", {
/**
* @input {function} Section headers and the data used within its given
* template can be dynamically created by passing a function to `headerFn`.
* For example, a large list of contacts usually has dividers between each
* letter in the alphabet. App's can provide their own custom `headerFn`
* which is called with each record within the dataset. The logic within
* the header function can decide if the header template should be used,
* and what data to give to the header template. The function must return
* `null` if a header cell shouldn't be created.
*/
set: function (val) {
if (Object(__WEBPACK_IMPORTED_MODULE_5__util_util__["i" /* isFunction */])(val)) {
this._hdrFn = val.bind((this._ctrl._cmp) || this);
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(VirtualScroll.prototype, "footerFn", {
/**
* @input {function} Section footers and the data used within its given
* template can be dynamically created by passing a function to `footerFn`.
* The logic within the footer function can decide if the footer template
* should be used, and what data to give to the footer template. The function
* must return `null` if a footer cell shouldn't be created.
*/
set: function (val) {
if (Object(__WEBPACK_IMPORTED_MODULE_5__util_util__["i" /* isFunction */])(val)) {
this._ftrFn = val.bind((this._ctrl._cmp) || this);
}
},
enumerable: true,
configurable: true
});
/**
* @hidden
*/
VirtualScroll.prototype.firstRecord = function () {
var cells = this._cells;
return (cells.length > 0) ? cells[0].record : 0;
};
/**
* @hidden
*/
VirtualScroll.prototype.lastRecord = function () {
var cells = this._cells;
return (cells.length > 0) ? cells[cells.length - 1].record : 0;
};
/**
* @hidden
*/
VirtualScroll.prototype.ngOnChanges = function (changes) {
if ('virtualScroll' in changes) {
// React on virtualScroll changes only once all inputs have been initialized
var value = changes['virtualScroll'].currentValue;
if (!Object(__WEBPACK_IMPORTED_MODULE_5__util_util__["l" /* isPresent */])(this._differ) && Object(__WEBPACK_IMPORTED_MODULE_5__util_util__["l" /* isPresent */])(value)) {
try {
this._differ = this._iterableDiffers.find(value).create(this.virtualTrackBy);
}
catch (e) {
throw new Error("Cannot find a differ supporting object '" + value + "'. VirtualScroll only supports binding to Iterables such as Arrays.");
}
}
}
};
/**
* @hidden
*/
VirtualScroll.prototype.ngDoCheck = function () {
// only continue if we've already initialized
if (!this._init) {
return;
}
// and if there actually are changes
var changes = Object(__WEBPACK_IMPORTED_MODULE_5__util_util__["l" /* isPresent */])(this._differ) ? this._differ.diff(this.virtualScroll) : null;
if (!Object(__WEBPACK_IMPORTED_MODULE_5__util_util__["l" /* isPresent */])(changes)) {
return;
}
var needClean = false;
var lastRecord = this._recordSize;
changes.forEachOperation(function (_, pindex, cindex) {
// add new record after current position
if (pindex === null && (cindex < lastRecord)) {
(void 0) /* console.debug */;
needClean = true;
return;
}
// remove record after current position
if (pindex < lastRecord && cindex === null) {
(void 0) /* console.debug */;
needClean = true;
return;
}
});
this._recordSize = this._records ? this._records.length : 0;
this.readUpdate(needClean);
this.writeUpdate(needClean);
};
/**
* @hidden
*/
VirtualScroll.prototype.readUpdate = function (needClean) {
if (needClean) {
// reset everything
(void 0) /* console.debug */;
this._cells.length = 0;
// this._nodes.length = 0;
// this._itmTmp.viewContainer.clear();
// ******** DOM READ ****************
this.calcDimensions();
}
else {
(void 0) /* console.debug */;
}
};
/**
* @hidden
*/
VirtualScroll.prototype.writeUpdate = function (needClean) {
(void 0) /* console.debug */;
var data = this._data;
var stopAtHeight = (data.scrollTop + data.renderHeight);
data.scrollDiff = SCROLL_DIFFERENCE_MINIMUM + 1;
Object(__WEBPACK_IMPORTED_MODULE_1__virtual_util__["f" /* processRecords */])(stopAtHeight, this._records, this._cells, this._hdrFn, this._ftrFn, this._data);
// ******** DOM WRITE ****************
this.renderVirtual(needClean);
};
/**
* @hidden
*/
VirtualScroll.prototype.calcDimensions = function () {
Object(__WEBPACK_IMPORTED_MODULE_1__virtual_util__["b" /* calcDimensions */])(this._data, this._elementRef.nativeElement, this.approxItemWidth, this.approxItemHeight, this.approxHeaderWidth, this.approxHeaderHeight, this.approxFooterWidth, this.approxFooterHeight, this.bufferRatio);
};
/**
* @hidden
* DOM WRITE
*/
VirtualScroll.prototype.renderVirtual = function (needClean) {
var _this = this;
this._plt.raf(function () {
var nodes = _this._nodes;
var cells = _this._cells;
var data = _this._data;
var records = _this._records;
if (needClean) {
// ******** DOM WRITE ****************
Object(__WEBPACK_IMPORTED_MODULE_1__virtual_util__["g" /* updateDimensions */])(_this._plt, nodes, cells, data, true);
data.topCell = 0;
data.bottomCell = (cells.length - 1);
}
Object(__WEBPACK_IMPORTED_MODULE_1__virtual_util__["a" /* adjustRendered */])(cells, data);
_this._zone.run(function () {
Object(__WEBPACK_IMPORTED_MODULE_1__virtual_util__["e" /* populateNodeData */])(data.topCell, data.bottomCell, true, cells, records, nodes, _this._itmTmp.viewContainer, _this._itmTmp.templateRef, _this._hdrTmp && _this._hdrTmp.templateRef, _this._ftrTmp && _this._ftrTmp.templateRef);
});
if (needClean) {
_this._cd.detectChanges();
}
// at this point, this fn was called from within another
// requestAnimationFrame, so the next dom reads/writes within the next frame
// wait a frame before trying to read and calculate the dimensions
// ******** DOM READ ****************
_this._dom.read(function () { return Object(__WEBPACK_IMPORTED_MODULE_1__virtual_util__["d" /* initReadNodes */])(_this._plt, nodes, cells, data); });
_this._dom.write(function () {
// update the bound context for each node
Object(__WEBPACK_IMPORTED_MODULE_1__virtual_util__["h" /* updateNodeContext */])(nodes, cells, data);
// ******** DOM WRITE ****************
_this._stepChangeDetection();
// ******** DOM WRITE ****************
_this._stepDOMWrite();
// ******** DOM WRITE ****************
_this._content.imgsUpdate();
// First time load
if (!_this._lastEle) {
// add an element at the end so :last-child css doesn't get messed up
// ******** DOM WRITE ****************
var ele = _this._elementRef.nativeElement;
var lastEle = _this._renderer.createElement(ele, 'div');
lastEle.className = 'virtual-last';
_this._lastEle = true;
// ******** DOM WRITE ****************
_this.setElementClass('virtual-scroll', true);
// ******** DOM WRITE ****************
_this.setElementClass('virtual-loading', false);
}
(void 0) /* assert */;
});
});
};
/**
* @hidden
*/
VirtualScroll.prototype.resize = function () {
// only continue if we've already initialized
if (!this._init) {
return;
}
// check if component is rendered in the dom currently
if (this._elementRef.nativeElement.offsetParent === null) {
return;
}
(void 0) /* console.debug */;
this.calcDimensions();
this.writeUpdate(false);
};
/**
* @hidden
*/
VirtualScroll.prototype._stepDOMWrite = function () {
var cells = this._cells;
var nodes = this._nodes;
// ******** DOM WRITE ****************
Object(__WEBPACK_IMPORTED_MODULE_1__virtual_util__["i" /* writeToNodes */])(this._plt, nodes, cells, this._recordSize);
// ******** DOM WRITE ****************
this._setHeight(Object(__WEBPACK_IMPORTED_MODULE_1__virtual_util__["c" /* estimateHeight */])(this._recordSize, cells[cells.length - 1], this._vHeight, 0.25));
// we're done here, good work
this._queue = 1 /* NoChanges */;
};
/**
* @hidden
*/
VirtualScroll.prototype._stepChangeDetection = function () {
// we need to do some change detection in this frame
// we've got work painting do, let's throw it in the
// domWrite callback so everyone plays nice
// ******** DOM WRITE ****************
var nodes = this._nodes;
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].hasChanges) {
nodes[i].view.detectChanges();
}
}
// on the next frame we need write to the dom nodes manually
this._queue = 3 /* DomWrite */;
};
/**
* @hidden
*/
VirtualScroll.prototype._stepNoChanges = function () {
var data = this._data;
// let's see if we've scroll far enough to require another check
var diff = data.scrollDiff = (data.scrollTop - this._lastCheck);
if (Math.abs(diff) < SCROLL_DIFFERENCE_MINIMUM) {
return;
}
var cells = this._cells;
var nodes = this._nodes;
var records = this._records;
// don't bother updating if the scrollTop hasn't changed much
this._lastCheck = data.scrollTop;
if (diff > 0) {
// load data we may not have processed yet
var stopAtHeight = (data.scrollTop + data.renderHeight);
Object(__WEBPACK_IMPORTED_MODULE_1__virtual_util__["f" /* processRecords */])(stopAtHeight, records, cells, this._hdrFn, this._ftrFn, data);
}
// ******** DOM READ ****************
Object(__WEBPACK_IMPORTED_MODULE_1__virtual_util__["g" /* updateDimensions */])(this._plt, nodes, cells, data, false);
Object(__WEBPACK_IMPORTED_MODULE_1__virtual_util__["a" /* adjustRendered */])(cells, data);
var hasChanges = Object(__WEBPACK_IMPORTED_MODULE_1__virtual_util__["e" /* populateNodeData */])(data.topCell, data.bottomCell, diff > 0, cells, records, nodes, this._itmTmp.viewContainer, this._itmTmp.templateRef, this._hdrTmp && this._hdrTmp.templateRef, this._ftrTmp && this._ftrTmp.templateRef);
if (hasChanges) {
// queue making updates in the next frame
this._queue = 2 /* ChangeDetection */;
// update the bound context for each node
Object(__WEBPACK_IMPORTED_MODULE_1__virtual_util__["h" /* updateNodeContext */])(nodes, cells, data);
}
};
/**
* @hidden
*/
VirtualScroll.prototype.scrollUpdate = function (ev) {
var _this = this;
// set the scroll top from the scroll event
this._data.scrollTop = ev.scrollTop;
// there is a queue system so that we can
// spread out the work over multiple frames
var queue = this._queue;
if (queue === 1 /* NoChanges */) {
// no dom writes or change detection to take care of
this._stepNoChanges();
}
else if (queue === 2 /* ChangeDetection */) {
this._dom.write(function () { return _this._stepChangeDetection(); });
}
else {
(void 0) /* assert */;
// there are DOM writes we need to take care of in this frame
this._dom.write(function () { return _this._stepDOMWrite(); });
}
};
/**
* @hidden
* DOM WRITE
*/
VirtualScroll.prototype.scrollEnd = function () {
var _this = this;
// ******** DOM READ ****************
Object(__WEBPACK_IMPORTED_MODULE_1__virtual_util__["g" /* updateDimensions */])(this._plt, this._nodes, this._cells, this._data, false);
Object(__WEBPACK_IMPORTED_MODULE_1__virtual_util__["a" /* adjustRendered */])(this._cells, this._data);
Object(__WEBPACK_IMPORTED_MODULE_1__virtual_util__["e" /* populateNodeData */])(this._data.topCell, this._data.bottomCell, true, this._cells, this._records, this._nodes, this._itmTmp.viewContainer, this._itmTmp.templateRef, this._hdrTmp && this._hdrTmp.templateRef, this._ftrTmp && this._ftrTmp.templateRef);
// ******** DOM WRITE ***************
this._dom.write(function () {
// update the bound context for each node
Object(__WEBPACK_IMPORTED_MODULE_1__virtual_util__["h" /* updateNodeContext */])(_this._nodes, _this._cells, _this._data);
// ******** DOM WRITE ***************
_this._stepChangeDetection();
// ******** DOM WRITE ****************
_this._stepDOMWrite();
});
};
/**
* @hidden
* NO DOM
*/
VirtualScroll.prototype._listeners = function () {
(void 0) /* assert */;
if (!this._scrollSub) {
if (this._config.getBoolean('virtualScrollEventAssist')) {
// use JS scrolling for iOS UIWebView
// goal is to completely remove this when iOS
// fully supports scroll events
// listen to JS scroll events
this._content.enableJsScroll();
}
this._resizeSub = this._plt.resize.subscribe(this.resize.bind(this));
this._scrollSub = this._content.ionScroll.subscribe(this.scrollUpdate.bind(this));
this._scrollEndSub = this._content.ionScrollEnd.subscribe(this.scrollEnd.bind(this));
}
};
/**
* @hidden
* DOM WRITE
*/
VirtualScroll.prototype._setHeight = function (newVirtualHeight) {
if (newVirtualHeight !== this._vHeight) {
// ******** DOM WRITE ****************
this._renderer.setElementStyle(this._elementRef.nativeElement, 'height', newVirtualHeight > 0 ? newVirtualHeight + 'px' : '');
this._vHeight = newVirtualHeight;
(void 0) /* console.debug */;
}
};
/**
* @hidden
*/
VirtualScroll.prototype.ngAfterContentInit = function () {
(void 0) /* assert */;
if (!this.approxItemHeight) {
this.approxItemHeight = '40px';
console.warn('Virtual Scroll: Please provide an "approxItemHeight" input to ensure proper virtual scroll rendering');
}
};
/**
* @hidden
*/
VirtualScroll.prototype.setElementClass = function (className, add) {
this._renderer.setElementClass(this._elementRef.nativeElement, className, add);
};
/**
* @hidden
*/
VirtualScroll.prototype.ngOnDestroy = function () {
this._resizeSub && this._resizeSub.unsubscribe();
this._scrollSub && this._scrollSub.unsubscribe();
this._scrollEndSub && this._scrollEndSub.unsubscribe();
this._resizeSub = this._scrollEndSub = this._scrollSub = null;
this._hdrFn = this._ftrFn = this._records = this._cells = this._nodes = this._data = null;
};
VirtualScroll.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: '[virtualScroll]'
},] },
];
/** @nocollapse */
VirtualScroll.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["E" /* IterableDiffers */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["M" /* NgZone */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["j" /* ChangeDetectorRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_3__content_content__["a" /* Content */], },
{ type: __WEBPACK_IMPORTED_MODULE_6__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_7__navigation_view_controller__["a" /* ViewController */], },
{ type: __WEBPACK_IMPORTED_MODULE_2__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_4__platform_dom_controller__["a" /* DomController */], },
]; };
VirtualScroll.propDecorators = {
'_itmTmp': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* ContentChild */], args: [__WEBPACK_IMPORTED_MODULE_8__virtual_item__["a" /* VirtualItem */],] },],
'_hdrTmp': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* ContentChild */], args: [__WEBPACK_IMPORTED_MODULE_10__virtual_header__["a" /* VirtualHeader */],] },],
'_ftrTmp': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* ContentChild */], args: [__WEBPACK_IMPORTED_MODULE_9__virtual_footer__["a" /* VirtualFooter */],] },],
'virtualScroll': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'bufferRatio': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'approxItemWidth': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'approxItemHeight': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'approxHeaderWidth': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'approxHeaderHeight': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'approxFooterWidth': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'approxFooterHeight': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'headerFn': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'footerFn': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
'virtualTrackBy': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["D" /* Input */] },],
};
return VirtualScroll;
}());
var SCROLL_DIFFERENCE_MINIMUM = 40;
//# sourceMappingURL=virtual-scroll.js.map
/***/ }),
/* 345 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TapClick; });
/* unused harmony export isActivatable */
/* harmony export (immutable) */ __webpack_exports__["b"] = setupTapClick;
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__activator__ = __webpack_require__(346);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__components_app_app__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__platform_dom_controller__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__gestures_gesture_controller__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__platform_platform__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__util_dom__ = __webpack_require__(14);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__gestures_pointer_events__ = __webpack_require__(137);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__ripple__ = __webpack_require__(486);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__gestures_ui_event_manager__ = __webpack_require__(28);
/**
* @hidden
*/
var TapClick = (function () {
function TapClick(config, plt, dom, app, gestureCtrl) {
this.plt = plt;
this.app = app;
this.gestureCtrl = gestureCtrl;
this.disableClick = 0;
this.events = new __WEBPACK_IMPORTED_MODULE_10__gestures_ui_event_manager__["a" /* UIEventManager */](plt);
var activator = config.get('activator');
if (activator === 'ripple') {
this.activator = new __WEBPACK_IMPORTED_MODULE_9__ripple__["a" /* RippleActivator */](app, config, dom);
}
else if (activator === 'highlight') {
this.activator = new __WEBPACK_IMPORTED_MODULE_1__activator__["a" /* Activator */](app, config, dom);
}
this.usePolyfill = config.getBoolean('tapPolyfill');
(void 0) /* console.debug */;
var doc = plt.doc();
this.events.listen(doc, 'click', this.click.bind(this), { passive: false, capture: true });
this.pointerEvents = this.events.pointerEvents({
element: doc,
pointerDown: this.pointerStart.bind(this),
pointerMove: this.pointerMove.bind(this),
pointerUp: this.pointerEnd.bind(this),
passive: true
});
this.pointerEvents.mouseWait = DISABLE_NATIVE_CLICK_AMOUNT;
}
TapClick.prototype.pointerStart = function (ev) {
if (this.startCoord) {
return false;
}
if (!this.app.isEnabled()) {
return false;
}
this.lastTouchEnd = 0;
this.dispatchClick = true;
if (this.plt.doc() === ev.target) {
this.startCoord = Object(__WEBPACK_IMPORTED_MODULE_7__util_dom__["f" /* pointerCoord */])(ev);
return true;
}
this.activatableEle = getActivatableTarget(ev.target);
if (!this.activatableEle) {
this.startCoord = null;
return false;
}
this.startCoord = Object(__WEBPACK_IMPORTED_MODULE_7__util_dom__["f" /* pointerCoord */])(ev);
this.activator && this.activator.downAction(ev, this.activatableEle, this.startCoord);
return true;
};
TapClick.prototype.pointerMove = function (ev) {
if (this.startCoord && this.shouldCancelEvent(ev)) {
this.pointerCancel(ev);
}
};
TapClick.prototype.pointerEnd = function (ev, pointerEventType) {
if (!this.dispatchClick)
return;
(void 0) /* runInDev */;
if (!this.startCoord) {
return;
}
if (this.activator && ev.target !== this.plt.doc()) {
var activatableEle = getActivatableTarget(ev.target) || this.activatableEle;
if (activatableEle) {
this.activator.upAction(ev, activatableEle, this.startCoord);
}
}
if (this.usePolyfill && pointerEventType === __WEBPACK_IMPORTED_MODULE_8__gestures_pointer_events__["a" /* POINTER_EVENT_TYPE_TOUCH */] && this.app.isEnabled()) {
this.handleTapPolyfill(ev);
}
this.startCoord = null;
this.activatableEle = null;
};
TapClick.prototype.pointerCancel = function (ev) {
(void 0) /* console.debug */;
this.startCoord = null;
this.activatableEle = null;
this.dispatchClick = false;
this.activator && this.activator.clearState(false);
this.pointerEvents.stop();
};
TapClick.prototype.shouldCancelEvent = function (ev) {
return (this.app.isScrolling() ||
this.gestureCtrl.isCaptured() ||
Object(__WEBPACK_IMPORTED_MODULE_7__util_dom__["d" /* hasPointerMoved */])(POINTER_TOLERANCE, this.startCoord, Object(__WEBPACK_IMPORTED_MODULE_7__util_dom__["f" /* pointerCoord */])(ev)));
};
TapClick.prototype.click = function (ev) {
if (this.shouldCancelClick(ev)) {
ev.preventDefault();
ev.stopPropagation();
return;
}
if (this.activator && this.plt.doc() !== ev.target) {
// cool, a click is gonna happen, let's tell the activator
// so the element can get the given "active" style
var activatableEle = getActivatableTarget(ev.target);
if (activatableEle) {
this.activator.clickAction(ev, activatableEle, this.startCoord);
}
}
(void 0) /* runInDev */;
};
TapClick.prototype.shouldCancelClick = function (ev) {
if (this.usePolyfill) {
if (!ev.isIonicTap && this.isDisabledNativeClick()) {
(void 0) /* console.debug */;
return true;
}
}
else if (!this.dispatchClick) {
(void 0) /* console.debug */;
return true;
}
if (!this.app.isEnabled()) {
(void 0) /* console.debug */;
return true;
}
if (this.gestureCtrl.isCaptured()) {
(void 0) /* console.debug */;
return true;
}
return false;
};
TapClick.prototype.profileClickDelay = function (ev) {
if (this.lastTouchEnd) {
var diff = Date.now() - this.lastTouchEnd;
if (diff < 100) {
(void 0) /* console.debug */;
}
else {
console.warn("SLOW click dispatched. Delay(ms):", diff, ev);
}
this.lastTouchEnd = null;
}
else {
(void 0) /* console.debug */;
}
};
TapClick.prototype.handleTapPolyfill = function (ev) {
(void 0) /* assert */;
// only dispatch mouse click events from a touchend event
// when tapPolyfill config is true, and the startCoordand endCoord
// are not too far off from each other
var endCoord = Object(__WEBPACK_IMPORTED_MODULE_7__util_dom__["f" /* pointerCoord */])(ev);
if (Object(__WEBPACK_IMPORTED_MODULE_7__util_dom__["d" /* hasPointerMoved */])(POINTER_TOLERANCE, this.startCoord, endCoord)) {
(void 0) /* console.debug */;
return;
}
// prevent native mouse click events for XX amount of time
this.disableClick = Date.now() + DISABLE_NATIVE_CLICK_AMOUNT;
if (this.app.isScrolling()) {
// do not fire off a click event while the app was scrolling
(void 0) /* console.debug */;
}
else {
// dispatch a mouse click event
(void 0) /* console.debug */;
var clickEvent = this.plt.doc().createEvent('MouseEvents');
clickEvent.initMouseEvent('click', true, true, this.plt.win(), 1, 0, 0, endCoord.x, endCoord.y, false, false, false, false, 0, null);
clickEvent.isIonicTap = true;
ev.target.dispatchEvent(clickEvent);
}
};
TapClick.prototype.isDisabledNativeClick = function () {
return this.disableClick > Date.now();
};
TapClick.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
TapClick.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_3__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_6__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_4__platform_dom_controller__["a" /* DomController */], },
{ type: __WEBPACK_IMPORTED_MODULE_2__components_app_app__["a" /* App */], },
{ type: __WEBPACK_IMPORTED_MODULE_5__gestures_gesture_controller__["l" /* GestureController */], },
]; };
return TapClick;
}());
function getActivatableTarget(ele) {
var targetEle = ele;
for (var x = 0; x < 10; x++) {
if (!targetEle)
break;
if (isActivatable(targetEle)) {
return targetEle;
}
targetEle = targetEle.parentElement;
}
return null;
}
/**
* @hidden
*/
function isActivatable(ele) {
if (ACTIVATABLE_ELEMENTS.indexOf(ele.tagName) > -1) {
return true;
}
for (var i = 0, l = ACTIVATABLE_ATTRIBUTES.length; i < l; i++) {
if (ele.hasAttribute && ele.hasAttribute(ACTIVATABLE_ATTRIBUTES[i])) {
return true;
}
}
return false;
}
var ACTIVATABLE_ELEMENTS = ['A', 'BUTTON'];
var ACTIVATABLE_ATTRIBUTES = ['tappable', 'ion-button'];
var POINTER_TOLERANCE = 100;
var DISABLE_NATIVE_CLICK_AMOUNT = 2500;
/**
* @hidden
*/
function setupTapClick(config, plt, dom, app, gestureCtrl) {
return function () {
return new TapClick(config, plt, dom, app, gestureCtrl);
};
}
//# sourceMappingURL=tap-click.js.map
/***/ }),
/* 346 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Activator; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__activator_base__ = __webpack_require__(347);
var Activator = (function () {
function Activator(app, config, dom) {
this.app = app;
this.dom = dom;
this._queue = [];
this._active = [];
this.activatedDelay = ADD_ACTIVATED_DEFERS;
this.clearDelay = CLEAR_STATE_DEFERS;
this._css = config.get('activatedClass', 'activated');
}
Activator.prototype.clickAction = function (ev, activatableEle, _startCoord) {
if (Object(__WEBPACK_IMPORTED_MODULE_0__activator_base__["a" /* isActivatedDisabled */])(ev, activatableEle)) {
return;
}
// a click happened, so immediately deactive all activated elements
this._scheduleClear();
this._queue.length = 0;
for (var i = 0; i < this._active.length; i++) {
this._active[i].classList.remove(this._css);
}
this._active.length = 0;
// then immediately activate this element
if (activatableEle && activatableEle.parentNode) {
this._active.push(activatableEle);
activatableEle.classList.add(this._css);
}
};
Activator.prototype.downAction = function (ev, activatableEle, _startCoord) {
var _this = this;
// the user just pressed down
if (Object(__WEBPACK_IMPORTED_MODULE_0__activator_base__["a" /* isActivatedDisabled */])(ev, activatableEle)) {
return;
}
this.unscheduleClear();
this.deactivate(true);
// queue to have this element activated
this._queue.push(activatableEle);
this._activeDefer = this.dom.write(function () {
_this._activeDefer = null;
var activatableEle;
for (var i = 0; i < _this._queue.length; i++) {
activatableEle = _this._queue[i];
_this._active.push(activatableEle);
activatableEle.classList.add(_this._css);
}
_this._queue.length = 0;
}, this.activatedDelay);
};
// the user was pressing down, then just let up
Activator.prototype.upAction = function (_ev, _activatableEle, _startCoord) {
this._scheduleClear();
};
Activator.prototype._scheduleClear = function () {
var _this = this;
if (this._clearDefer) {
return;
}
this._clearDefer = this.dom.write(function () {
_this.clearState(true);
_this._clearDefer = null;
}, this.clearDelay);
};
Activator.prototype.unscheduleClear = function () {
if (this._clearDefer) {
this._clearDefer();
this._clearDefer = null;
}
};
// all states should return to normal
Activator.prototype.clearState = function (animated) {
var _this = this;
if (!this.app.isEnabled()) {
// the app is actively disabled, so don't bother deactivating anything.
// this makes it easier on the GPU so it doesn't have to redraw any
// buttons during a transition. This will retry in XX milliseconds.
this.dom.write(function () {
_this.clearState(animated);
}, 600);
}
else {
// not actively transitioning, good to deactivate any elements
this.deactivate(animated);
}
};
// remove the active class from all active elements
Activator.prototype.deactivate = function (animated) {
this._clearDeferred();
this._queue.length = 0;
var ele;
for (var i = 0; i < this._active.length; i++) {
ele = this._active[i];
ele.style[this.dom.plt.Css.transition] = animated ? '' : 'none';
ele.classList.remove(this._css);
}
this._active.length = 0;
};
Activator.prototype._clearDeferred = function () {
// Clear any active deferral
if (this._activeDefer) {
this._activeDefer();
this._activeDefer = null;
}
};
return Activator;
}());
var ADD_ACTIVATED_DEFERS = 80;
var CLEAR_STATE_DEFERS = 80;
//# sourceMappingURL=activator.js.map
/***/ }),
/* 347 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export ActivatorBase */
/* harmony export (immutable) */ __webpack_exports__["a"] = isActivatedDisabled;
var ActivatorBase = (function () {
function ActivatorBase() {
}
return ActivatorBase;
}());
function isActivatedDisabled(ev, activatableEle) {
if (!activatableEle || !activatableEle.parentNode) {
return true;
}
if (!ev) {
return false;
}
if (ev.defaultPrevented) {
return true;
}
var targetEle = ev.target;
for (var i = 0; i < 4; i++) {
if (!targetEle) {
break;
}
if (targetEle.hasAttribute('disable-activated')) {
return true;
}
targetEle = targetEle.parentElement;
}
return false;
}
//# sourceMappingURL=activator-base.js.map
/***/ }),
/* 348 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Events; });
/* unused harmony export setupEvents */
/* harmony export (immutable) */ __webpack_exports__["b"] = setupProvideEvents;
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__scroll_view__ = __webpack_require__(148);
/**
* @name Events
* @description
* Events is a publish-subscribe style event system for sending and responding to application-level
* events across your app.
*
* @usage
* ```ts
* import { Events } from 'ionic-angular';
*
* // first page (publish an event when a user is created)
* constructor(public events: Events) { }
*
* createUser(user) {
* console.log('User created!')
* this.events.publish('user:created', user, Date.now());
* }
*
*
* // second page (listen for the user created event after function is called)
* constructor(public events: Events) {
* events.subscribe('user:created', (user, time) => {
* // user and time are the same arguments passed in `events.publish(user, time)`
* console.log('Welcome', user, 'at', time);
* });
* }
*
* ```
* @demo /docs/demos/src/events/
*/
var Events = (function () {
function Events() {
this._channels = [];
}
/**
* Subscribe to an event topic. Events that get posted to that topic will trigger the provided handler.
*
* @param {string} topic the topic to subscribe to
* @param {function} handler the event handler
*/
Events.prototype.subscribe = function (topic) {
var _this = this;
var handlers = [];
for (var _i = 1; _i < arguments.length; _i++) {
handlers[_i - 1] = arguments[_i];
}
if (!this._channels[topic]) {
this._channels[topic] = [];
}
handlers.forEach(function (handler) {
_this._channels[topic].push(handler);
});
};
/**
* Unsubscribe from the given topic. Your handler will no longer receive events published to this topic.
*
* @param {string} topic the topic to unsubscribe from
* @param {function} handler the event handler
*
* @return true if a handler was removed
*/
Events.prototype.unsubscribe = function (topic, handler) {
if (handler === void 0) { handler = null; }
var t = this._channels[topic];
if (!t) {
// Wasn't found, wasn't removed
return false;
}
if (!handler) {
// Remove all handlers for this topic
delete this._channels[topic];
return true;
}
// We need to find and remove a specific handler
var i = t.indexOf(handler);
if (i < 0) {
// Wasn't found, wasn't removed
return false;
}
t.splice(i, 1);
// If the channel is empty now, remove it from the channel map
if (!t.length) {
delete this._channels[topic];
}
return true;
};
/**
* Publish an event to the given topic.
*
* @param {string} topic the topic to publish to
* @param {any} eventData the data to send as the event
*/
Events.prototype.publish = function (topic) {
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var t = this._channels[topic];
if (!t) {
return null;
}
var responses = [];
t.forEach(function (handler) {
responses.push(handler.apply(void 0, args));
});
return responses;
};
return Events;
}());
/**
* @hidden
*/
function setupEvents(plt, dom) {
var events = new Events();
var win = plt.win();
var doc = plt.doc();
// start listening for resizes XXms after the app starts
plt.timeout(function () {
win.addEventListener('online', function (ev) {
events.publish('app:online', ev);
}, false);
win.addEventListener('offline', function (ev) {
events.publish('app:offline', ev);
}, false);
win.addEventListener('orientationchange', function (ev) {
events.publish('app:rotated', ev);
});
// When that status taps, we respond
win.addEventListener('statusTap', function () {
// TODO: Make this more better
var el = doc.elementFromPoint(plt.width() / 2, plt.height() / 2);
if (!el) {
return;
}
var contentEle = el.closest('.scroll-content');
if (contentEle) {
var style = contentEle.style;
var scroll = new __WEBPACK_IMPORTED_MODULE_0__scroll_view__["a" /* ScrollView */](null, plt, dom);
scroll._el = contentEle;
// We need to stop scrolling if it's happening and scroll up
style['WebkitBackfaceVisibility'] = 'hidden';
style['WebkitTransform'] = 'translate3d(0,0,0)';
dom.write(function () {
style.overflow = 'hidden';
function finish() {
style.overflow = '';
style['WebkitBackfaceVisibility'] = '';
style['WebkitTransform'] = '';
}
var didScrollTimeout = plt.timeout(function () {
finish();
}, 400);
scroll.scrollTo(0, 0, 300).then(function () {
plt.cancelTimeout(didScrollTimeout);
finish();
});
});
}
});
}, 2000);
return events;
}
/**
* @hidden
*/
function setupProvideEvents(plt, dom) {
return function () {
return setupEvents(plt, dom);
};
}
//# sourceMappingURL=events.js.map
/***/ }),
/* 349 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export PLATFORM_CONFIGS */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PlatformConfigToken; });
/* harmony export (immutable) */ __webpack_exports__["b"] = providePlatformConfigs;
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__platform_utils__ = __webpack_require__(330);
var PLATFORM_CONFIGS = {
/**
* core
*/
'core': {
settings: {
mode: 'md',
keyboardHeight: 290
}
},
/**
* mobile
*/
'mobile': {},
/**
* phablet
*/
'phablet': {
isMatch: function (plt) {
var smallest = Math.min(plt.width(), plt.height());
var largest = Math.max(plt.width(), plt.height());
return (smallest > 390 && smallest < 520) &&
(largest > 620 && largest < 800);
}
},
/**
* tablet
*/
'tablet': {
isMatch: function (plt) {
var smallest = Math.min(plt.width(), plt.height());
var largest = Math.max(plt.width(), plt.height());
return (smallest > 460 && smallest < 820) &&
(largest > 780 && largest < 1400);
}
},
/**
* android
*/
'android': {
superset: 'mobile',
subsets: [
'phablet',
'tablet'
],
settings: {
activator: function (plt) {
// md mode defaults to use ripple activator
// however, under-powered devices shouldn't use ripple
// if this a linux device, and is using Android Chrome v36 (Android 5.0)
// or above then use ripple, otherwise do not use a ripple effect
if (plt.testNavigatorPlatform('linux')) {
var chromeVersion = plt.matchUserAgentVersion(/Chrome\/(\d+).(\d+)?/);
if (chromeVersion) {
// linux android device using modern android chrome browser gets ripple
if (parseInt(chromeVersion.major, 10) < 36 || plt.version().major < 5) {
return 'none';
}
else {
return 'ripple';
}
}
// linux android device not using chrome browser checks just android's version
if (plt.version().major < 5) {
return 'none';
}
}
// fallback to always use ripple
return 'ripple';
},
autoFocusAssist: 'immediate',
inputCloning: true,
scrollAssist: true,
hoverCSS: false,
keyboardHeight: 300,
mode: 'md',
},
isMatch: function (plt) {
return plt.isPlatformMatch('android', ['android', 'silk'], ['windows phone']);
},
versionParser: function (plt) {
return plt.matchUserAgentVersion(/Android (\d+).(\d+)?/);
}
},
/**
* ios
*/
'ios': {
superset: 'mobile',
subsets: [
'ipad',
'iphone'
],
settings: {
autoFocusAssist: 'delay',
hideCaretOnScroll: true,
hoverCSS: false,
inputBlurring: __WEBPACK_IMPORTED_MODULE_1__platform_utils__["c" /* isIos */],
inputCloning: __WEBPACK_IMPORTED_MODULE_1__platform_utils__["c" /* isIos */],
keyboardHeight: 250,
mode: 'ios',
statusbarPadding: __WEBPACK_IMPORTED_MODULE_1__platform_utils__["a" /* isCordova */],
swipeBackEnabled: __WEBPACK_IMPORTED_MODULE_1__platform_utils__["c" /* isIos */],
tapPolyfill: __WEBPACK_IMPORTED_MODULE_1__platform_utils__["d" /* isIosUIWebView */],
virtualScrollEventAssist: __WEBPACK_IMPORTED_MODULE_1__platform_utils__["d" /* isIosUIWebView */],
disableScrollAssist: __WEBPACK_IMPORTED_MODULE_1__platform_utils__["c" /* isIos */],
scrollAssist: __WEBPACK_IMPORTED_MODULE_1__platform_utils__["c" /* isIos */],
keyboardResizes: keyboardResizes,
},
isMatch: function (plt) {
return plt.isPlatformMatch('ios', ['iphone', 'ipad', 'ipod'], ['windows phone']);
},
versionParser: function (plt) {
return plt.matchUserAgentVersion(/OS (\d+)_(\d+)?/);
}
},
/**
* ipad
*/
'ipad': {
superset: 'tablet',
settings: {
keyboardHeight: 500,
},
isMatch: function (plt) {
return plt.isPlatformMatch('ipad');
}
},
/**
* iphone
*/
'iphone': {
subsets: [
'phablet'
],
isMatch: function (plt) {
return plt.isPlatformMatch('iphone');
}
},
/**
* Windows
*/
'windows': {
superset: 'mobile',
subsets: [
'phablet',
'tablet'
],
settings: {
mode: 'wp',
autoFocusAssist: 'immediate',
hoverCSS: false
},
isMatch: function (plt) {
return plt.isPlatformMatch('windows', ['windows phone']);
},
versionParser: function (plt) {
return plt.matchUserAgentVersion(/Windows Phone (\d+).(\d+)?/);
}
},
/**
* cordova
*/
'cordova': {
isEngine: true,
initialize: function (plt) {
// prepare a custom "ready" for cordova "deviceready"
plt.prepareReady = function () {
// 1) ionic bootstrapped
plt.windowLoad(function (win, doc) {
// 2) window onload triggered or completed
doc.addEventListener('deviceready', function () {
// 3) cordova deviceready event triggered
// add cordova listeners to emit platform events
doc.addEventListener('backbutton', function (ev) {
plt.zone.run(function () {
plt.backButton.emit(ev);
});
});
doc.addEventListener('pause', function (ev) {
plt.zone.run(function () {
plt.pause.emit(ev);
});
});
doc.addEventListener('resume', function (ev) {
plt.zone.run(function () {
plt.resume.emit(ev);
});
});
// cordova has its own exitApp method
plt.exitApp = function () {
win['navigator']['app'].exitApp();
};
// cordova has fully loaded and we've added listeners
plt.triggerReady('cordova');
});
});
};
},
isMatch: function (plt) {
return Object(__WEBPACK_IMPORTED_MODULE_1__platform_utils__["a" /* isCordova */])(plt);
}
},
/**
* electron
*/
'electron': {
superset: 'core',
initialize: function (plt) {
plt.prepareReady = function () {
// 1) ionic bootstrapped
plt.windowLoad(function () {
plt.triggerReady('electron');
});
};
},
isMatch: function (plt) {
return Object(__WEBPACK_IMPORTED_MODULE_1__platform_utils__["b" /* isElectron */])(plt);
}
}
};
function keyboardResizes(plt) {
var win = plt.win();
if (win.Ionic && win.Ionic.keyboardResizes === true) {
return true;
}
return false;
}
var PlatformConfigToken = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["B" /* InjectionToken */]('PLTCONFIG');
function providePlatformConfigs() {
return PLATFORM_CONFIGS;
}
//# sourceMappingURL=platform-registry.js.map
/***/ }),
/* 350 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export MODE_IOS */
/* unused harmony export MODE_MD */
/* unused harmony export MODE_WP */
/* harmony export (immutable) */ __webpack_exports__["a"] = registerModeConfigs;
var MODE_IOS = {
activator: 'highlight',
actionSheetEnter: 'action-sheet-slide-in',
actionSheetLeave: 'action-sheet-slide-out',
alertEnter: 'alert-pop-in',
alertLeave: 'alert-pop-out',
backButtonText: 'Back',
backButtonIcon: 'ios-arrow-back',
iconMode: 'ios',
loadingEnter: 'loading-pop-in',
loadingLeave: 'loading-pop-out',
menuType: 'reveal',
modalEnter: 'modal-slide-in',
modalLeave: 'modal-slide-out',
pageTransition: 'ios-transition',
pickerEnter: 'picker-slide-in',
pickerLeave: 'picker-slide-out',
pickerRotateFactor: -0.46,
pickerScaleFactor: 1,
popoverEnter: 'popover-pop-in',
popoverLeave: 'popover-pop-out',
spinner: 'ios',
tabsHighlight: false,
tabsPlacement: 'bottom',
tabsHideOnSubPages: false,
toastEnter: 'toast-slide-in',
toastLeave: 'toast-slide-out',
};
var MODE_MD = {
activator: 'ripple',
actionSheetEnter: 'action-sheet-md-slide-in',
actionSheetLeave: 'action-sheet-md-slide-out',
alertEnter: 'alert-md-pop-in',
alertLeave: 'alert-md-pop-out',
backButtonText: '',
backButtonIcon: 'md-arrow-back',
iconMode: 'md',
loadingEnter: 'loading-md-pop-in',
loadingLeave: 'loading-md-pop-out',
menuType: 'overlay',
modalEnter: 'modal-md-slide-in',
modalLeave: 'modal-md-slide-out',
pageTransition: 'md-transition',
pickerEnter: 'picker-slide-in',
pickerLeave: 'picker-slide-out',
pickerRotateFactor: 0,
pickerScaleFactor: 0.81,
popoverEnter: 'popover-md-pop-in',
popoverLeave: 'popover-md-pop-out',
spinner: 'crescent',
tabsHighlight: false,
tabsPlacement: 'bottom',
tabsHideOnSubPages: false,
toastEnter: 'toast-md-slide-in',
toastLeave: 'toast-md-slide-out',
};
var MODE_WP = {
activator: 'highlight',
actionSheetEnter: 'action-sheet-wp-slide-in',
actionSheetLeave: 'action-sheet-wp-slide-out',
alertEnter: 'alert-wp-pop-in',
alertLeave: 'alert-wp-pop-out',
backButtonText: '',
backButtonIcon: 'ios-arrow-back',
iconMode: 'ios',
loadingEnter: 'loading-wp-pop-in',
loadingLeave: 'loading-wp-pop-out',
menuType: 'overlay',
modalEnter: 'modal-md-slide-in',
modalLeave: 'modal-md-slide-out',
pageTransition: 'wp-transition',
pickerEnter: 'picker-slide-in',
pickerLeave: 'picker-slide-out',
pickerRotateFactor: 0,
pickerScaleFactor: 0.81,
popoverEnter: 'popover-md-pop-in',
popoverLeave: 'popover-md-pop-out',
spinner: 'circles',
tabsHighlight: false,
tabsPlacement: 'top',
tabsHideOnSubPages: true,
toastEnter: 'toast-wp-slide-in',
toastLeave: 'toast-wp-slide-out',
};
function registerModeConfigs(config) {
return function () {
// iOS Mode Settings
config.setModeConfig('ios', MODE_IOS);
// Material Design Mode Settings
config.setModeConfig('md', MODE_MD);
// Windows Mode Settings
config.setModeConfig('wp', MODE_WP);
};
}
//# sourceMappingURL=mode-registry.js.map
/***/ }),
/* 351 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return IonicGestureConfig; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_platform_browser__ = __webpack_require__(33);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
* This class overrides the default Angular gesture config.
*/
var IonicGestureConfig = (function (_super) {
__extends(IonicGestureConfig, _super);
function IonicGestureConfig() {
return _super !== null && _super.apply(this, arguments) || this;
}
IonicGestureConfig.prototype.buildHammer = function (element) {
var mc = new window.Hammer(element);
for (var eventName in this.overrides) {
mc.get(eventName).set(this.overrides[eventName]);
}
return mc;
};
IonicGestureConfig.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
IonicGestureConfig.ctorParameters = function () { return []; };
return IonicGestureConfig;
}(__WEBPACK_IMPORTED_MODULE_1__angular_platform_browser__["e" /* HammerGestureConfig */]));
//# sourceMappingURL=gesture-config.js.map
/***/ }),
/* 352 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return StatusBar; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__ionic_native_core__ = __webpack_require__(59);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
/**
* @name Status Bar
* @description
* Manage the appearance of the native status bar.
*
* Requires Cordova plugin: `cordova-plugin-statusbar`. For more info, please see the [StatusBar plugin docs](https://github.com/apache/cordova-plugin-statusbar).
*
* @usage
* ```typescript
* import { StatusBar } from '@ionic-native/status-bar';
*
* constructor(private statusBar: StatusBar) { }
*
* ...
*
* // let status bar overlay webview
* this.statusBar.overlaysWebView(true);
*
* // set status bar to white
* this.statusBar.backgroundColorByHexString('#ffffff');
* ```
*
*/
var StatusBar = (function (_super) {
__extends(StatusBar, _super);
function StatusBar() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Set whether the status bar overlays the main app view. The default
* is true.
*
* @param {boolean} doesOverlay Whether the status bar overlays the main app view.
*/
/**
* Set whether the status bar overlays the main app view. The default
* is true.
*
* @param {boolean} doesOverlay Whether the status bar overlays the main app view.
*/
StatusBar.prototype.overlaysWebView = /**
* Set whether the status bar overlays the main app view. The default
* is true.
*
* @param {boolean} doesOverlay Whether the status bar overlays the main app view.
*/
function (doesOverlay) { };
;
/**
* Use the default statusbar (dark text, for light backgrounds).
*/
/**
* Use the default statusbar (dark text, for light backgrounds).
*/
StatusBar.prototype.styleDefault = /**
* Use the default statusbar (dark text, for light backgrounds).
*/
function () { };
;
/**
* Use the lightContent statusbar (light text, for dark backgrounds).
*/
/**
* Use the lightContent statusbar (light text, for dark backgrounds).
*/
StatusBar.prototype.styleLightContent = /**
* Use the lightContent statusbar (light text, for dark backgrounds).
*/
function () { };
;
/**
* Use the blackTranslucent statusbar (light text, for dark backgrounds).
*/
/**
* Use the blackTranslucent statusbar (light text, for dark backgrounds).
*/
StatusBar.prototype.styleBlackTranslucent = /**
* Use the blackTranslucent statusbar (light text, for dark backgrounds).
*/
function () { };
;
/**
* Use the blackOpaque statusbar (light text, for dark backgrounds).
*/
/**
* Use the blackOpaque statusbar (light text, for dark backgrounds).
*/
StatusBar.prototype.styleBlackOpaque = /**
* Use the blackOpaque statusbar (light text, for dark backgrounds).
*/
function () { };
;
/**
* Set the status bar to a specific named color. Valid options:
* black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown.
*
* iOS note: you must call StatusBar.overlaysWebView(false) to enable color changing.
*
* @param {string} colorName The name of the color (from above)
*/
/**
* Set the status bar to a specific named color. Valid options:
* black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown.
*
* iOS note: you must call StatusBar.overlaysWebView(false) to enable color changing.
*
* @param {string} colorName The name of the color (from above)
*/
StatusBar.prototype.backgroundColorByName = /**
* Set the status bar to a specific named color. Valid options:
* black, darkGray, lightGray, white, gray, red, green, blue, cyan, yellow, magenta, orange, purple, brown.
*
* iOS note: you must call StatusBar.overlaysWebView(false) to enable color changing.
*
* @param {string} colorName The name of the color (from above)
*/
function (colorName) { };
;
/**
* Set the status bar to a specific hex color (CSS shorthand supported!).
*
* iOS note: you must call StatusBar.overlaysWebView(false) to enable color changing.
*
* @param {string} hexString The hex value of the color.
*/
/**
* Set the status bar to a specific hex color (CSS shorthand supported!).
*
* iOS note: you must call StatusBar.overlaysWebView(false) to enable color changing.
*
* @param {string} hexString The hex value of the color.
*/
StatusBar.prototype.backgroundColorByHexString = /**
* Set the status bar to a specific hex color (CSS shorthand supported!).
*
* iOS note: you must call StatusBar.overlaysWebView(false) to enable color changing.
*
* @param {string} hexString The hex value of the color.
*/
function (hexString) { };
;
/**
* Hide the StatusBar
*/
/**
* Hide the StatusBar
*/
StatusBar.prototype.hide = /**
* Hide the StatusBar
*/
function () { };
;
/**
* Show the StatusBar
*/
/**
* Show the StatusBar
*/
StatusBar.prototype.show = /**
* Show the StatusBar
*/
function () { };
;
StatusBar.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
StatusBar.ctorParameters = function () { return []; };
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])({
sync: true
}),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Boolean]),
__metadata("design:returntype", void 0)
], StatusBar.prototype, "overlaysWebView", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])({
sync: true
}),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], StatusBar.prototype, "styleDefault", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])({
sync: true
}),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], StatusBar.prototype, "styleLightContent", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])({
sync: true
}),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], StatusBar.prototype, "styleBlackTranslucent", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])({
sync: true
}),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], StatusBar.prototype, "styleBlackOpaque", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])({
sync: true
}),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], StatusBar.prototype, "backgroundColorByName", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])({
sync: true
}),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], StatusBar.prototype, "backgroundColorByHexString", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])({
sync: true
}),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], StatusBar.prototype, "hide", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])({
sync: true
}),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], StatusBar.prototype, "show", null);
__decorate([
__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["c" /* CordovaProperty */],
__metadata("design:type", Boolean)
], StatusBar.prototype, "isVisible", void 0);
/**
* @name Status Bar
* @description
* Manage the appearance of the native status bar.
*
* Requires Cordova plugin: `cordova-plugin-statusbar`. For more info, please see the [StatusBar plugin docs](https://github.com/apache/cordova-plugin-statusbar).
*
* @usage
* ```typescript
* import { StatusBar } from '@ionic-native/status-bar';
*
* constructor(private statusBar: StatusBar) { }
*
* ...
*
* // let status bar overlay webview
* this.statusBar.overlaysWebView(true);
*
* // set status bar to white
* this.statusBar.backgroundColorByHexString('#ffffff');
* ```
*
*/
StatusBar = __decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["e" /* Plugin */])({
pluginName: 'StatusBar',
plugin: 'cordova-plugin-statusbar',
pluginRef: 'StatusBar',
repo: 'https://github.com/apache/cordova-plugin-statusbar',
platforms: ['Android', 'iOS', 'Windows', 'Windows Phone']
})
], StatusBar);
return StatusBar;
}(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["d" /* IonicNativePlugin */]));
//# sourceMappingURL=index.js.map
/***/ }),
/* 353 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SplashScreen; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__ionic_native_core__ = __webpack_require__(59);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
/**
* @name Splash Screen
* @description This plugin displays and hides a splash screen during application launch. The methods below allows showing and hiding the splashscreen after the app has loaded.
* @usage
* ```typescript
* import { SplashScreen } from '@ionic-native/splash-screen';
*
* constructor(private splashScreen: SplashScreen) { }
*
* ...
*
* this.splashScreen.show();
*
* this.splashScreen.hide();
* ```
*/
var SplashScreen = (function (_super) {
__extends(SplashScreen, _super);
function SplashScreen() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Shows the splashscreen
*/
/**
* Shows the splashscreen
*/
SplashScreen.prototype.show = /**
* Shows the splashscreen
*/
function () { };
/**
* Hides the splashscreen
*/
/**
* Hides the splashscreen
*/
SplashScreen.prototype.hide = /**
* Hides the splashscreen
*/
function () { };
SplashScreen.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
SplashScreen.ctorParameters = function () { return []; };
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])({
sync: true
}),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], SplashScreen.prototype, "show", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])({
sync: true
}),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], SplashScreen.prototype, "hide", null);
/**
* @name Splash Screen
* @description This plugin displays and hides a splash screen during application launch. The methods below allows showing and hiding the splashscreen after the app has loaded.
* @usage
* ```typescript
* import { SplashScreen } from '@ionic-native/splash-screen';
*
* constructor(private splashScreen: SplashScreen) { }
*
* ...
*
* this.splashScreen.show();
*
* this.splashScreen.hide();
* ```
*/
SplashScreen = __decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["e" /* Plugin */])({
pluginName: 'SplashScreen',
plugin: 'cordova-plugin-splashscreen',
pluginRef: 'navigator.splashscreen',
repo: 'https://github.com/apache/cordova-plugin-splashscreen',
platforms: ['Amazon Fire OS', 'Android', 'BlackBerry 10', 'iOS', 'Tizen', 'Ubuntu', 'Windows', 'Windows Phone']
})
], SplashScreen);
return SplashScreen;
}(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["d" /* IonicNativePlugin */]));
//# sourceMappingURL=index.js.map
/***/ }),
/* 354 */,
/* 355 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export VERSION */
/* unused harmony export RESOURCE_CACHE_PROVIDER */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return platformBrowserDynamic; });
/* unused harmony export ɵCompilerImpl */
/* unused harmony export ɵplatformCoreDynamic */
/* unused harmony export ɵINTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS */
/* unused harmony export ɵResourceLoaderImpl */
/* unused harmony export ɵa */
/* unused harmony export ɵb */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_compiler__ = __webpack_require__(356);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_common__ = __webpack_require__(43);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_platform_browser__ = __webpack_require__(33);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_tslib__ = __webpack_require__(31);
/**
* @license Angular v5.0.3
* (c) 2010-2017 Google, Inc. https://angular.io/
* License: MIT
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var MODULE_SUFFIX = '';
var builtinExternalReferences = createBuiltinExternalReferencesMap();
var JitReflector = (function () {
function JitReflector() {
this.builtinExternalReferences = new Map();
this.reflectionCapabilities = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["_23" /* ɵReflectionCapabilities */]();
}
/**
* @param {?} type
* @param {?} cmpMetadata
* @return {?}
*/
JitReflector.prototype.componentModuleUrl = /**
* @param {?} type
* @param {?} cmpMetadata
* @return {?}
*/
function (type, cmpMetadata) {
var /** @type {?} */ moduleId = cmpMetadata.moduleId;
if (typeof moduleId === 'string') {
var /** @type {?} */ scheme = Object(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["z" /* getUrlScheme */])(moduleId);
return scheme ? moduleId : "package:" + moduleId + MODULE_SUFFIX;
}
else if (moduleId !== null && moduleId !== void 0) {
throw Object(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["A" /* syntaxError */])("moduleId should be a string in \"" + Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_48" /* ɵstringify */])(type) + "\". See https://goo.gl/wIDDiL for more information.\n" +
"If you're using Webpack you should inline the template and the styles, see https://goo.gl/X2J8zc.");
}
return "./" + Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_48" /* ɵstringify */])(type);
};
/**
* @param {?} typeOrFunc
* @return {?}
*/
JitReflector.prototype.parameters = /**
* @param {?} typeOrFunc
* @return {?}
*/
function (typeOrFunc) {
return this.reflectionCapabilities.parameters(typeOrFunc);
};
/**
* @param {?} typeOrFunc
* @return {?}
*/
JitReflector.prototype.annotations = /**
* @param {?} typeOrFunc
* @return {?}
*/
function (typeOrFunc) {
return this.reflectionCapabilities.annotations(typeOrFunc);
};
/**
* @param {?} typeOrFunc
* @return {?}
*/
JitReflector.prototype.propMetadata = /**
* @param {?} typeOrFunc
* @return {?}
*/
function (typeOrFunc) {
return this.reflectionCapabilities.propMetadata(typeOrFunc);
};
/**
* @param {?} type
* @param {?} lcProperty
* @return {?}
*/
JitReflector.prototype.hasLifecycleHook = /**
* @param {?} type
* @param {?} lcProperty
* @return {?}
*/
function (type, lcProperty) {
return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty);
};
/**
* @param {?} ref
* @return {?}
*/
JitReflector.prototype.resolveExternalReference = /**
* @param {?} ref
* @return {?}
*/
function (ref) {
return builtinExternalReferences.get(ref) || ref.runtime;
};
return JitReflector;
}());
/**
* @return {?}
*/
function createBuiltinExternalReferencesMap() {
var /** @type {?} */ map = new Map();
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ANALYZE_FOR_ENTRY_COMPONENTS, __WEBPACK_IMPORTED_MODULE_1__angular_core__["a" /* ANALYZE_FOR_ENTRY_COMPONENTS */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ElementRef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["t" /* ElementRef */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].NgModuleRef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["K" /* NgModuleRef */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ViewContainerRef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_10" /* ViewContainerRef */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ChangeDetectorRef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["j" /* ChangeDetectorRef */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].QueryList, __WEBPACK_IMPORTED_MODULE_1__angular_core__["T" /* QueryList */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].TemplateRef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_5" /* TemplateRef */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].CodegenComponentFactoryResolver, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_19" /* ɵCodegenComponentFactoryResolver */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ComponentFactoryResolver, __WEBPACK_IMPORTED_MODULE_1__angular_core__["o" /* ComponentFactoryResolver */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ComponentFactory, __WEBPACK_IMPORTED_MODULE_1__angular_core__["n" /* ComponentFactory */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ComponentRef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["p" /* ComponentRef */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].NgModuleFactory, __WEBPACK_IMPORTED_MODULE_1__angular_core__["J" /* NgModuleFactory */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].createModuleFactory, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_26" /* ɵcmf */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].moduleDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_37" /* ɵmod */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].moduleProviderDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_38" /* ɵmpd */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].RegisterModuleFactoryFn, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_47" /* ɵregisterModuleFactory */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].Injector, __WEBPACK_IMPORTED_MODULE_1__angular_core__["C" /* Injector */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ViewEncapsulation, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_11" /* ViewEncapsulation */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ChangeDetectionStrategy, __WEBPACK_IMPORTED_MODULE_1__angular_core__["i" /* ChangeDetectionStrategy */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].SecurityContext, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_0" /* SecurityContext */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].LOCALE_ID, __WEBPACK_IMPORTED_MODULE_1__angular_core__["G" /* LOCALE_ID */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].TRANSLATIONS_FORMAT, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_4" /* TRANSLATIONS_FORMAT */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].inlineInterpolate, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_31" /* ɵinlineInterpolate */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].interpolate, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_32" /* ɵinterpolate */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].EMPTY_ARRAY, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_21" /* ɵEMPTY_ARRAY */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].EMPTY_MAP, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_22" /* ɵEMPTY_MAP */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].Renderer, __WEBPACK_IMPORTED_MODULE_1__angular_core__["V" /* Renderer */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].viewDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_51" /* ɵvid */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].elementDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_29" /* ɵeld */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].anchorDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_24" /* ɵand */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].textDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_49" /* ɵted */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].directiveDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_28" /* ɵdid */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].providerDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_45" /* ɵprd */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].queryDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_46" /* ɵqud */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].pureArrayDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_41" /* ɵpad */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].pureObjectDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_43" /* ɵpod */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].purePipeDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_44" /* ɵppd */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].pipeDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_42" /* ɵpid */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].nodeValue, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_40" /* ɵnov */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].ngContentDef, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_39" /* ɵncd */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].unwrapValue, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_50" /* ɵunv */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].createRendererType2, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_27" /* ɵcrt */]);
map.set(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["j" /* Identifiers */].createComponentFactory, __WEBPACK_IMPORTED_MODULE_1__angular_core__["_25" /* ɵccf */]);
return map;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var ERROR_COLLECTOR_TOKEN = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["B" /* InjectionToken */]('ErrorCollector');
/**
* A default provider for {\@link PACKAGE_ROOT_URL} that maps to '/'.
*/
var DEFAULT_PACKAGE_URL_PROVIDER = {
provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["P" /* PACKAGE_ROOT_URL */],
useValue: '/'
};
var _NO_RESOURCE_LOADER = {
get: /**
* @param {?} url
* @return {?}
*/
function (url) {
throw new Error("No ResourceLoader implementation has been provided. Can't read the url \"" + url + "\"");
}
};
var baseHtmlParser = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["B" /* InjectionToken */]('HtmlParser');
var CompilerImpl = (function () {
function CompilerImpl(injector, _metadataResolver, templateParser, styleCompiler, viewCompiler, ngModuleCompiler, summaryResolver, compileReflector, compilerConfig, console) {
this._metadataResolver = _metadataResolver;
this._delegate = new __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["k" /* JitCompiler */](_metadataResolver, templateParser, styleCompiler, viewCompiler, ngModuleCompiler, summaryResolver, compileReflector, compilerConfig, console, this.getExtraNgModuleProviders.bind(this));
this.injector = injector;
}
/**
* @return {?}
*/
CompilerImpl.prototype.getExtraNgModuleProviders = /**
* @return {?}
*/
function () {
return [this._metadataResolver.getProviderMetadata(new __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["r" /* ProviderMeta */](__WEBPACK_IMPORTED_MODULE_1__angular_core__["k" /* Compiler */], { useValue: this }))];
};
/**
* @template T
* @param {?} moduleType
* @return {?}
*/
CompilerImpl.prototype.compileModuleSync = /**
* @template T
* @param {?} moduleType
* @return {?}
*/
function (moduleType) {
return /** @type {?} */ (this._delegate.compileModuleSync(moduleType));
};
/**
* @template T
* @param {?} moduleType
* @return {?}
*/
CompilerImpl.prototype.compileModuleAsync = /**
* @template T
* @param {?} moduleType
* @return {?}
*/
function (moduleType) {
return /** @type {?} */ (this._delegate.compileModuleAsync(moduleType));
};
/**
* @template T
* @param {?} moduleType
* @return {?}
*/
CompilerImpl.prototype.compileModuleAndAllComponentsSync = /**
* @template T
* @param {?} moduleType
* @return {?}
*/
function (moduleType) {
var /** @type {?} */ result = this._delegate.compileModuleAndAllComponentsSync(moduleType);
return {
ngModuleFactory: /** @type {?} */ (result.ngModuleFactory),
componentFactories: /** @type {?} */ (result.componentFactories),
};
};
/**
* @template T
* @param {?} moduleType
* @return {?}
*/
CompilerImpl.prototype.compileModuleAndAllComponentsAsync = /**
* @template T
* @param {?} moduleType
* @return {?}
*/
function (moduleType) {
return this._delegate.compileModuleAndAllComponentsAsync(moduleType)
.then(function (result) {
return ({
ngModuleFactory: /** @type {?} */ (result.ngModuleFactory),
componentFactories: /** @type {?} */ (result.componentFactories),
});
});
};
/**
* @param {?} summaries
* @return {?}
*/
CompilerImpl.prototype.loadAotSummaries = /**
* @param {?} summaries
* @return {?}
*/
function (summaries) { this._delegate.loadAotSummaries(summaries); };
/**
* @param {?} ref
* @return {?}
*/
CompilerImpl.prototype.hasAotSummary = /**
* @param {?} ref
* @return {?}
*/
function (ref) { return this._delegate.hasAotSummary(ref); };
/**
* @template T
* @param {?} component
* @return {?}
*/
CompilerImpl.prototype.getComponentFactory = /**
* @template T
* @param {?} component
* @return {?}
*/
function (component) {
return /** @type {?} */ (this._delegate.getComponentFactory(component));
};
/**
* @return {?}
*/
CompilerImpl.prototype.clearCache = /**
* @return {?}
*/
function () { this._delegate.clearCache(); };
/**
* @param {?} type
* @return {?}
*/
CompilerImpl.prototype.clearCacheFor = /**
* @param {?} type
* @return {?}
*/
function (type) { this._delegate.clearCacheFor(type); };
return CompilerImpl;
}());
/**
* A set of providers that provide `JitCompiler` and its dependencies to use for
* template compilation.
*/
var COMPILER_PROVIDERS = /** @type {?} */ ([
{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */], useValue: new JitReflector() },
{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["s" /* ResourceLoader */], useValue: _NO_RESOURCE_LOADER },
{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["l" /* JitSummaryResolver */], deps: [] },
{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["v" /* SummaryResolver */], useExisting: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["l" /* JitSummaryResolver */] },
{ provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_20" /* ɵConsole */], deps: [] },
{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["m" /* Lexer */], deps: [] },
{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["p" /* Parser */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["m" /* Lexer */]] },
{
provide: baseHtmlParser,
useClass: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["h" /* HtmlParser */],
deps: [],
},
{
provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["i" /* I18NHtmlParser */],
useFactory: function (parser, translations, format, config, console) {
translations = translations || '';
var /** @type {?} */ missingTranslation = translations ? /** @type {?} */ ((config.missingTranslation)) : __WEBPACK_IMPORTED_MODULE_1__angular_core__["H" /* MissingTranslationStrategy */].Ignore;
return new __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["i" /* I18NHtmlParser */](parser, translations, format, missingTranslation, console);
},
deps: [
baseHtmlParser,
[new __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */](), new __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */](__WEBPACK_IMPORTED_MODULE_1__angular_core__["_3" /* TRANSLATIONS */])],
[new __WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */](), new __WEBPACK_IMPORTED_MODULE_1__angular_core__["z" /* Inject */](__WEBPACK_IMPORTED_MODULE_1__angular_core__["_4" /* TRANSLATIONS_FORMAT */])],
[__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */]],
[__WEBPACK_IMPORTED_MODULE_1__angular_core__["_20" /* ɵConsole */]],
]
},
{
provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["h" /* HtmlParser */],
useExisting: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["i" /* I18NHtmlParser */],
},
{
provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["w" /* TemplateParser */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */],
__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["p" /* Parser */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["g" /* ElementSchemaRegistry */],
__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["i" /* I18NHtmlParser */], __WEBPACK_IMPORTED_MODULE_1__angular_core__["_20" /* ɵConsole */]]
},
{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["d" /* DirectiveNormalizer */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["s" /* ResourceLoader */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["x" /* UrlResolver */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["h" /* HtmlParser */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */]] },
{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["a" /* CompileMetadataResolver */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["h" /* HtmlParser */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["o" /* NgModuleResolver */],
__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["e" /* DirectiveResolver */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["q" /* PipeResolver */],
__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["v" /* SummaryResolver */],
__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["g" /* ElementSchemaRegistry */],
__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["d" /* DirectiveNormalizer */], __WEBPACK_IMPORTED_MODULE_1__angular_core__["_20" /* ɵConsole */],
[__WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["t" /* StaticSymbolCache */]],
__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */],
[__WEBPACK_IMPORTED_MODULE_1__angular_core__["N" /* Optional */], ERROR_COLLECTOR_TOKEN]] },
DEFAULT_PACKAGE_URL_PROVIDER,
{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["u" /* StyleCompiler */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["x" /* UrlResolver */]] },
{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["y" /* ViewCompiler */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */]] },
{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["n" /* NgModuleCompiler */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */]] },
{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */], useValue: new __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */]() },
{ provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["k" /* Compiler */], useClass: CompilerImpl, deps: [__WEBPACK_IMPORTED_MODULE_1__angular_core__["C" /* Injector */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["a" /* CompileMetadataResolver */],
__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["w" /* TemplateParser */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["u" /* StyleCompiler */],
__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["y" /* ViewCompiler */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["n" /* NgModuleCompiler */],
__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["v" /* SummaryResolver */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */], __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */],
__WEBPACK_IMPORTED_MODULE_1__angular_core__["_20" /* ɵConsole */]] },
{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["f" /* DomElementSchemaRegistry */], deps: [] },
{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["g" /* ElementSchemaRegistry */], useExisting: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["f" /* DomElementSchemaRegistry */] },
{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["x" /* UrlResolver */], deps: [__WEBPACK_IMPORTED_MODULE_1__angular_core__["P" /* PACKAGE_ROOT_URL */]] },
{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["e" /* DirectiveResolver */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */]] },
{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["q" /* PipeResolver */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */]] },
{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["o" /* NgModuleResolver */], deps: [__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["b" /* CompileReflector */]] },
]);
var JitCompilerFactory = (function () {
function JitCompilerFactory(defaultOptions) {
var /** @type {?} */ compilerOptions = {
useJit: true,
defaultEncapsulation: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_11" /* ViewEncapsulation */].Emulated,
missingTranslation: __WEBPACK_IMPORTED_MODULE_1__angular_core__["H" /* MissingTranslationStrategy */].Warning,
enableLegacyTemplate: false,
};
this._defaultOptions = [compilerOptions].concat(defaultOptions);
}
/**
* @param {?=} options
* @return {?}
*/
JitCompilerFactory.prototype.createCompiler = /**
* @param {?=} options
* @return {?}
*/
function (options) {
if (options === void 0) { options = []; }
var /** @type {?} */ opts = _mergeOptions(this._defaultOptions.concat(options));
var /** @type {?} */ injector = __WEBPACK_IMPORTED_MODULE_1__angular_core__["C" /* Injector */].create([
COMPILER_PROVIDERS, {
provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */],
useFactory: function () {
return new __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["c" /* CompilerConfig */]({
// let explicit values from the compiler options overwrite options
// from the app providers
useJit: opts.useJit,
jitDevMode: Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_16" /* isDevMode */])(),
// let explicit values from the compiler options overwrite options
// from the app providers
defaultEncapsulation: opts.defaultEncapsulation,
missingTranslation: opts.missingTranslation,
enableLegacyTemplate: opts.enableLegacyTemplate,
preserveWhitespaces: opts.preserveWhitespaces,
});
},
deps: []
},
/** @type {?} */ ((opts.providers))
]);
return injector.get(__WEBPACK_IMPORTED_MODULE_1__angular_core__["k" /* Compiler */]);
};
return JitCompilerFactory;
}());
/**
* @param {?} optionsArr
* @return {?}
*/
function _mergeOptions(optionsArr) {
return {
useJit: _lastDefined(optionsArr.map(function (options) { return options.useJit; })),
defaultEncapsulation: _lastDefined(optionsArr.map(function (options) { return options.defaultEncapsulation; })),
providers: _mergeArrays(optionsArr.map(function (options) { return /** @type {?} */ ((options.providers)); })),
missingTranslation: _lastDefined(optionsArr.map(function (options) { return options.missingTranslation; })),
enableLegacyTemplate: _lastDefined(optionsArr.map(function (options) { return options.enableLegacyTemplate; })),
preserveWhitespaces: _lastDefined(optionsArr.map(function (options) { return options.preserveWhitespaces; })),
};
}
/**
* @template T
* @param {?} args
* @return {?}
*/
function _lastDefined(args) {
for (var /** @type {?} */ i = args.length - 1; i >= 0; i--) {
if (args[i] !== undefined) {
return args[i];
}
}
return undefined;
}
/**
* @param {?} parts
* @return {?}
*/
function _mergeArrays(parts) {
var /** @type {?} */ result = [];
parts.forEach(function (part) { return part && result.push.apply(result, part); });
return result;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* A platform that included corePlatform and the compiler.
*
* \@experimental
*/
var platformCoreDynamic = Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_13" /* createPlatformFactory */])(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_17" /* platformCore */], 'coreDynamic', [
{ provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["h" /* COMPILER_OPTIONS */], useValue: {}, multi: true },
{ provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["l" /* CompilerFactory */], useClass: JitCompilerFactory, deps: [__WEBPACK_IMPORTED_MODULE_1__angular_core__["h" /* COMPILER_OPTIONS */]] },
]);
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var ResourceLoaderImpl = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_4_tslib__["b" /* __extends */])(ResourceLoaderImpl, _super);
function ResourceLoaderImpl() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @param {?} url
* @return {?}
*/
ResourceLoaderImpl.prototype.get = /**
* @param {?} url
* @return {?}
*/
function (url) {
var /** @type {?} */ resolve;
var /** @type {?} */ reject;
var /** @type {?} */ promise = new Promise(function (res, rej) {
resolve = res;
reject = rej;
});
var /** @type {?} */ xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = 'text';
xhr.onload = function () {
// responseText is the old-school way of retrieving response (supported by IE8 & 9)
// response/responseType properties were introduced in ResourceLoader Level2 spec (supported
// by IE10)
var /** @type {?} */ response = xhr.response || xhr.responseText;
// normalize IE9 bug (http://bugs.jquery.com/ticket/1450)
var /** @type {?} */ status = xhr.status === 1223 ? 204 : xhr.status;
// fix status code when it is 0 (0 status is undocumented).
// Occurs when accessing file resources or on Android 4.1 stock browser
// while retrieving files from application cache.
if (status === 0) {
status = response ? 200 : 0;
}
if (200 <= status && status <= 300) {
resolve(response);
}
else {
reject("Failed to load " + url);
}
};
xhr.onerror = function () { reject("Failed to load " + url); };
xhr.send();
return promise;
};
ResourceLoaderImpl.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
ResourceLoaderImpl.ctorParameters = function () { return []; };
return ResourceLoaderImpl;
}(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["s" /* ResourceLoader */]));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS = [
__WEBPACK_IMPORTED_MODULE_3__angular_platform_browser__["g" /* ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS */],
{
provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["h" /* COMPILER_OPTIONS */],
useValue: { providers: [{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["s" /* ResourceLoader */], useClass: ResourceLoaderImpl, deps: [] }] },
multi: true
},
{ provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Q" /* PLATFORM_ID */], useValue: __WEBPACK_IMPORTED_MODULE_2__angular_common__["i" /* ɵPLATFORM_BROWSER_ID */] },
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* An implementation of ResourceLoader that uses a template cache to avoid doing an actual
* ResourceLoader.
*
* The template cache needs to be built and loaded into window.$templateCache
* via a separate mechanism.
*/
var CachedResourceLoader = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_4_tslib__["b" /* __extends */])(CachedResourceLoader, _super);
function CachedResourceLoader() {
var _this = _super.call(this) || this;
_this._cache = (/** @type {?} */ (__WEBPACK_IMPORTED_MODULE_1__angular_core__["_30" /* ɵglobal */])).$templateCache;
if (_this._cache == null) {
throw new Error('CachedResourceLoader: Template cache was not found in $templateCache.');
}
return _this;
}
/**
* @param {?} url
* @return {?}
*/
CachedResourceLoader.prototype.get = /**
* @param {?} url
* @return {?}
*/
function (url) {
if (this._cache.hasOwnProperty(url)) {
return Promise.resolve(this._cache[url]);
}
else {
return /** @type {?} */ (Promise.reject('CachedResourceLoader: Did not find cached template for ' + url));
}
};
return CachedResourceLoader;
}(__WEBPACK_IMPORTED_MODULE_0__angular_compiler__["s" /* ResourceLoader */]));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @module
* @description
* Entry point for all public APIs of the common package.
*/
/**
* \@stable
*/
var VERSION = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["_7" /* Version */]('5.0.3');
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* \@experimental
*/
var RESOURCE_CACHE_PROVIDER = [{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_compiler__["s" /* ResourceLoader */], useClass: CachedResourceLoader, deps: [] }];
/**
* \@stable
*/
var platformBrowserDynamic = Object(__WEBPACK_IMPORTED_MODULE_1__angular_core__["_13" /* createPlatformFactory */])(platformCoreDynamic, 'browserDynamic', INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS);
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @module
* @description
* Entry point for all public APIs of this package.
*/
// This file only reexports content of the `src` folder. Keep it that way.
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Generated bundle index. Do not edit.
*/
//# sourceMappingURL=platform-browser-dynamic.js.map
/***/ }),
/* 356 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export core */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return CompilerConfig; });
/* unused harmony export preserveWhitespacesDefault */
/* unused harmony export isLoweredSymbol */
/* unused harmony export createLoweredSymbol */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return Identifiers; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return JitCompiler; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return DirectiveResolver; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return PipeResolver; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return NgModuleResolver; });
/* unused harmony export DEFAULT_INTERPOLATION_CONFIG */
/* unused harmony export InterpolationConfig */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return NgModuleCompiler; });
/* unused harmony export AssertNotNull */
/* unused harmony export BinaryOperator */
/* unused harmony export BinaryOperatorExpr */
/* unused harmony export BuiltinMethod */
/* unused harmony export BuiltinVar */
/* unused harmony export CastExpr */
/* unused harmony export ClassStmt */
/* unused harmony export CommaExpr */
/* unused harmony export CommentStmt */
/* unused harmony export ConditionalExpr */
/* unused harmony export DeclareFunctionStmt */
/* unused harmony export DeclareVarStmt */
/* unused harmony export ExpressionStatement */
/* unused harmony export ExternalExpr */
/* unused harmony export ExternalReference */
/* unused harmony export FunctionExpr */
/* unused harmony export IfStmt */
/* unused harmony export InstantiateExpr */
/* unused harmony export InvokeFunctionExpr */
/* unused harmony export InvokeMethodExpr */
/* unused harmony export LiteralArrayExpr */
/* unused harmony export LiteralExpr */
/* unused harmony export LiteralMapExpr */
/* unused harmony export NotExpr */
/* unused harmony export ReadKeyExpr */
/* unused harmony export ReadPropExpr */
/* unused harmony export ReadVarExpr */
/* unused harmony export ReturnStatement */
/* unused harmony export ThrowStmt */
/* unused harmony export TryCatchStmt */
/* unused harmony export WriteKeyExpr */
/* unused harmony export WritePropExpr */
/* unused harmony export WriteVarExpr */
/* unused harmony export StmtModifier */
/* unused harmony export Statement */
/* unused harmony export collectExternalReferences */
/* unused harmony export EmitterVisitorContext */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "y", function() { return ViewCompiler; });
/* unused harmony export getParseErrors */
/* unused harmony export isSyntaxError */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A", function() { return syntaxError; });
/* unused harmony export Version */
/* unused harmony export VERSION */
/* unused harmony export TextAst */
/* unused harmony export BoundTextAst */
/* unused harmony export AttrAst */
/* unused harmony export BoundElementPropertyAst */
/* unused harmony export BoundEventAst */
/* unused harmony export ReferenceAst */
/* unused harmony export VariableAst */
/* unused harmony export ElementAst */
/* unused harmony export EmbeddedTemplateAst */
/* unused harmony export BoundDirectivePropertyAst */
/* unused harmony export DirectiveAst */
/* unused harmony export ProviderAst */
/* unused harmony export ProviderAstType */
/* unused harmony export NgContentAst */
/* unused harmony export PropertyBindingType */
/* unused harmony export NullTemplateVisitor */
/* unused harmony export RecursiveTemplateAstVisitor */
/* unused harmony export templateVisitAll */
/* unused harmony export identifierName */
/* unused harmony export identifierModuleUrl */
/* unused harmony export viewClassName */
/* unused harmony export rendererTypeName */
/* unused harmony export hostViewClassName */
/* unused harmony export componentFactoryName */
/* unused harmony export CompileSummaryKind */
/* unused harmony export tokenName */
/* unused harmony export tokenReference */
/* unused harmony export CompileStylesheetMetadata */
/* unused harmony export CompileTemplateMetadata */
/* unused harmony export CompileDirectiveMetadata */
/* unused harmony export CompilePipeMetadata */
/* unused harmony export CompileNgModuleMetadata */
/* unused harmony export TransitiveCompileNgModuleMetadata */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return ProviderMeta; });
/* unused harmony export flatten */
/* unused harmony export templateSourceUrl */
/* unused harmony export sharedStylesheetJitUrl */
/* unused harmony export ngModuleJitUrl */
/* unused harmony export templateJitUrl */
/* unused harmony export createAotUrlResolver */
/* unused harmony export createAotCompiler */
/* unused harmony export AotCompiler */
/* unused harmony export analyzeNgModules */
/* unused harmony export analyzeAndValidateNgModules */
/* unused harmony export analyzeFile */
/* unused harmony export mergeAnalyzedFiles */
/* unused harmony export GeneratedFile */
/* unused harmony export toTypeScript */
/* unused harmony export StaticReflector */
/* unused harmony export StaticSymbol */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return StaticSymbolCache; });
/* unused harmony export ResolvedStaticSymbol */
/* unused harmony export StaticSymbolResolver */
/* unused harmony export unescapeIdentifier */
/* unused harmony export AotSummaryResolver */
/* unused harmony export AstPath */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return SummaryResolver; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return JitSummaryResolver; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return CompileReflector; });
/* unused harmony export createUrlResolverWithoutPackagePrefix */
/* unused harmony export createOfflineCompileUrlResolver */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return UrlResolver; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "z", function() { return getUrlScheme; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return ResourceLoader; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return ElementSchemaRegistry; });
/* unused harmony export Extractor */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return I18NHtmlParser; });
/* unused harmony export MessageBundle */
/* unused harmony export Serializer */
/* unused harmony export Xliff */
/* unused harmony export Xliff2 */
/* unused harmony export Xmb */
/* unused harmony export Xtb */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return DirectiveNormalizer; });
/* unused harmony export ParserError */
/* unused harmony export ParseSpan */
/* unused harmony export AST */
/* unused harmony export Quote */
/* unused harmony export EmptyExpr */
/* unused harmony export ImplicitReceiver */
/* unused harmony export Chain */
/* unused harmony export Conditional */
/* unused harmony export PropertyRead */
/* unused harmony export PropertyWrite */
/* unused harmony export SafePropertyRead */
/* unused harmony export KeyedRead */
/* unused harmony export KeyedWrite */
/* unused harmony export BindingPipe */
/* unused harmony export LiteralPrimitive */
/* unused harmony export LiteralArray */
/* unused harmony export LiteralMap */
/* unused harmony export Interpolation */
/* unused harmony export Binary */
/* unused harmony export PrefixNot */
/* unused harmony export NonNullAssert */
/* unused harmony export MethodCall */
/* unused harmony export SafeMethodCall */
/* unused harmony export FunctionCall */
/* unused harmony export ASTWithSource */
/* unused harmony export TemplateBinding */
/* unused harmony export NullAstVisitor */
/* unused harmony export RecursiveAstVisitor */
/* unused harmony export AstTransformer */
/* unused harmony export visitAstChildren */
/* unused harmony export TokenType */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return Lexer; });
/* unused harmony export Token */
/* unused harmony export EOF */
/* unused harmony export isIdentifier */
/* unused harmony export isQuote */
/* unused harmony export SplitInterpolation */
/* unused harmony export TemplateBindingParseResult */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return Parser; });
/* unused harmony export _ParseAST */
/* unused harmony export ERROR_COMPONENT_TYPE */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CompileMetadataResolver; });
/* unused harmony export Text */
/* unused harmony export Expansion */
/* unused harmony export ExpansionCase */
/* unused harmony export Attribute */
/* unused harmony export Element */
/* unused harmony export Comment */
/* unused harmony export visitAll */
/* unused harmony export RecursiveVisitor */
/* unused harmony export findNode */
/* unused harmony export ParseTreeResult */
/* unused harmony export TreeError */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return HtmlParser; });
/* unused harmony export HtmlTagDefinition */
/* unused harmony export getHtmlTagDefinition */
/* unused harmony export TagContentType */
/* unused harmony export splitNsName */
/* unused harmony export isNgContainer */
/* unused harmony export isNgContent */
/* unused harmony export isNgTemplate */
/* unused harmony export getNsPrefix */
/* unused harmony export mergeNsAndName */
/* unused harmony export NAMED_ENTITIES */
/* unused harmony export NGSP_UNICODE */
/* unused harmony export debugOutputAstAsTypeScript */
/* unused harmony export TypeScriptEmitter */
/* unused harmony export ParseLocation */
/* unused harmony export ParseSourceFile */
/* unused harmony export ParseSourceSpan */
/* unused harmony export ParseErrorLevel */
/* unused harmony export ParseError */
/* unused harmony export typeSourceSpan */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return DomElementSchemaRegistry; });
/* unused harmony export CssSelector */
/* unused harmony export SelectorMatcher */
/* unused harmony export SelectorListContext */
/* unused harmony export SelectorContext */
/* unused harmony export StylesCompileDependency */
/* unused harmony export CompiledStylesheet */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return StyleCompiler; });
/* unused harmony export TemplateParseError */
/* unused harmony export TemplateParseResult */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return TemplateParser; });
/* unused harmony export splitClasses */
/* unused harmony export createElementCssSelector */
/* unused harmony export removeSummaryDuplicates */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_tslib__ = __webpack_require__(31);
/**
* @license Angular v5.0.3
* (c) 2010-2017 Google, Inc. https://angular.io/
* License: MIT
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @record
*/
function Inject() { }
var createInject = makeMetadataFactory('Inject', function (token) { return ({ token: token }); });
var createInjectionToken = makeMetadataFactory('InjectionToken', function (desc) { return ({ _desc: desc }); });
/**
* @record
*/
function Attribute() { }
var createAttribute = makeMetadataFactory('Attribute', function (attributeName) { return ({ attributeName: attributeName }); });
/**
* @record
*/
function Query() { }
var createContentChildren = makeMetadataFactory('ContentChildren', function (selector, data) {
if (data === void 0) { data = {}; }
return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ selector: selector, first: false, isViewQuery: false, descendants: false }, data));
});
var createContentChild = makeMetadataFactory('ContentChild', function (selector, data) {
if (data === void 0) { data = {}; }
return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ selector: selector, first: true, isViewQuery: false, descendants: true }, data));
});
var createViewChildren = makeMetadataFactory('ViewChildren', function (selector, data) {
if (data === void 0) { data = {}; }
return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ selector: selector, first: false, isViewQuery: true, descendants: true }, data));
});
var createViewChild = makeMetadataFactory('ViewChild', function (selector, data) {
return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ selector: selector, first: true, isViewQuery: true, descendants: true }, data));
});
/**
* @record
*/
function Directive() { }
var createDirective = makeMetadataFactory('Directive', function (dir) {
if (dir === void 0) { dir = {}; }
return dir;
});
/**
* @record
*/
function Component() { }
/** @enum {number} */
var ViewEncapsulation = {
Emulated: 0,
Native: 1,
None: 2,
};
ViewEncapsulation[ViewEncapsulation.Emulated] = "Emulated";
ViewEncapsulation[ViewEncapsulation.Native] = "Native";
ViewEncapsulation[ViewEncapsulation.None] = "None";
/** @enum {number} */
var ChangeDetectionStrategy = {
OnPush: 0,
Default: 1,
};
ChangeDetectionStrategy[ChangeDetectionStrategy.OnPush] = "OnPush";
ChangeDetectionStrategy[ChangeDetectionStrategy.Default] = "Default";
var createComponent = makeMetadataFactory('Component', function (c) {
if (c === void 0) { c = {}; }
return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ changeDetection: ChangeDetectionStrategy.Default }, c));
});
/**
* @record
*/
function Pipe() { }
var createPipe = makeMetadataFactory('Pipe', function (p) { return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ pure: true }, p)); });
/**
* @record
*/
function Input() { }
var createInput = makeMetadataFactory('Input', function (bindingPropertyName) { return ({ bindingPropertyName: bindingPropertyName }); });
/**
* @record
*/
function Output() { }
var createOutput = makeMetadataFactory('Output', function (bindingPropertyName) { return ({ bindingPropertyName: bindingPropertyName }); });
/**
* @record
*/
function HostBinding() { }
var createHostBinding = makeMetadataFactory('HostBinding', function (hostPropertyName) { return ({ hostPropertyName: hostPropertyName }); });
/**
* @record
*/
function HostListener() { }
var createHostListener = makeMetadataFactory('HostListener', function (eventName, args) { return ({ eventName: eventName, args: args }); });
/**
* @record
*/
function NgModule() { }
var createNgModule = makeMetadataFactory('NgModule', function (ngModule) { return ngModule; });
/**
* @record
*/
function ModuleWithProviders() { }
/**
* @record
*/
function SchemaMetadata() { }
var CUSTOM_ELEMENTS_SCHEMA = {
name: 'custom-elements'
};
var NO_ERRORS_SCHEMA = {
name: 'no-errors-schema'
};
var createOptional = makeMetadataFactory('Optional');
var createInjectable = makeMetadataFactory('Injectable');
var createSelf = makeMetadataFactory('Self');
var createSkipSelf = makeMetadataFactory('SkipSelf');
var createHost = makeMetadataFactory('Host');
var Type = Function;
/** @enum {number} */
var SecurityContext = {
NONE: 0,
HTML: 1,
STYLE: 2,
SCRIPT: 3,
URL: 4,
RESOURCE_URL: 5,
};
SecurityContext[SecurityContext.NONE] = "NONE";
SecurityContext[SecurityContext.HTML] = "HTML";
SecurityContext[SecurityContext.STYLE] = "STYLE";
SecurityContext[SecurityContext.SCRIPT] = "SCRIPT";
SecurityContext[SecurityContext.URL] = "URL";
SecurityContext[SecurityContext.RESOURCE_URL] = "RESOURCE_URL";
/** @enum {number} */
var NodeFlags = {
None: 0,
TypeElement: 1,
TypeText: 2,
ProjectedTemplate: 4,
CatRenderNode: 3,
TypeNgContent: 8,
TypePipe: 16,
TypePureArray: 32,
TypePureObject: 64,
TypePurePipe: 128,
CatPureExpression: 224,
TypeValueProvider: 256,
TypeClassProvider: 512,
TypeFactoryProvider: 1024,
TypeUseExistingProvider: 2048,
LazyProvider: 4096,
PrivateProvider: 8192,
TypeDirective: 16384,
Component: 32768,
CatProviderNoDirective: 3840,
CatProvider: 20224,
OnInit: 65536,
OnDestroy: 131072,
DoCheck: 262144,
OnChanges: 524288,
AfterContentInit: 1048576,
AfterContentChecked: 2097152,
AfterViewInit: 4194304,
AfterViewChecked: 8388608,
EmbeddedViews: 16777216,
ComponentView: 33554432,
TypeContentQuery: 67108864,
TypeViewQuery: 134217728,
StaticQuery: 268435456,
DynamicQuery: 536870912,
CatQuery: 201326592,
// mutually exclusive values...
Types: 201347067,
};
/** @enum {number} */
var DepFlags = {
None: 0,
SkipSelf: 1,
Optional: 2,
Value: 8,
};
/** @enum {number} */
var ArgumentType = { Inline: 0, Dynamic: 1, };
/** @enum {number} */
var BindingFlags = {
TypeElementAttribute: 1,
TypeElementClass: 2,
TypeElementStyle: 4,
TypeProperty: 8,
SyntheticProperty: 16,
SyntheticHostProperty: 32,
CatSyntheticProperty: 48,
// mutually exclusive values...
Types: 15,
};
/** @enum {number} */
var QueryBindingType = { First: 0, All: 1, };
/** @enum {number} */
var QueryValueType = {
ElementRef: 0,
RenderElement: 1,
TemplateRef: 2,
ViewContainerRef: 3,
Provider: 4,
};
/** @enum {number} */
var ViewFlags = {
None: 0,
OnPush: 2,
};
/** @enum {number} */
var MissingTranslationStrategy = {
Error: 0,
Warning: 1,
Ignore: 2,
};
MissingTranslationStrategy[MissingTranslationStrategy.Error] = "Error";
MissingTranslationStrategy[MissingTranslationStrategy.Warning] = "Warning";
MissingTranslationStrategy[MissingTranslationStrategy.Ignore] = "Ignore";
/**
* @record
*/
function MetadataFactory() { }
/**
* @template T
* @param {?} name
* @param {?=} props
* @return {?}
*/
function makeMetadataFactory(name, props) {
var /** @type {?} */ factory = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var /** @type {?} */ values = props ? props.apply(void 0, args) : {};
return Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({ ngMetadataName: name }, values);
};
factory.isTypeOf = function (obj) { return obj && obj.ngMetadataName === name; };
factory.ngMetadataName = name;
return factory;
}
/**
* @record
*/
function Route() { }
var core = Object.freeze({
Inject: Inject,
createInject: createInject,
createInjectionToken: createInjectionToken,
Attribute: Attribute,
createAttribute: createAttribute,
Query: Query,
createContentChildren: createContentChildren,
createContentChild: createContentChild,
createViewChildren: createViewChildren,
createViewChild: createViewChild,
Directive: Directive,
createDirective: createDirective,
Component: Component,
ViewEncapsulation: ViewEncapsulation,
ChangeDetectionStrategy: ChangeDetectionStrategy,
createComponent: createComponent,
Pipe: Pipe,
createPipe: createPipe,
Input: Input,
createInput: createInput,
Output: Output,
createOutput: createOutput,
HostBinding: HostBinding,
createHostBinding: createHostBinding,
HostListener: HostListener,
createHostListener: createHostListener,
NgModule: NgModule,
createNgModule: createNgModule,
ModuleWithProviders: ModuleWithProviders,
SchemaMetadata: SchemaMetadata,
CUSTOM_ELEMENTS_SCHEMA: CUSTOM_ELEMENTS_SCHEMA,
NO_ERRORS_SCHEMA: NO_ERRORS_SCHEMA,
createOptional: createOptional,
createInjectable: createInjectable,
createSelf: createSelf,
createSkipSelf: createSkipSelf,
createHost: createHost,
Type: Type,
SecurityContext: SecurityContext,
NodeFlags: NodeFlags,
DepFlags: DepFlags,
ArgumentType: ArgumentType,
BindingFlags: BindingFlags,
QueryBindingType: QueryBindingType,
QueryValueType: QueryValueType,
ViewFlags: ViewFlags,
MissingTranslationStrategy: MissingTranslationStrategy,
MetadataFactory: MetadataFactory,
Route: Route
});
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var DASH_CASE_REGEXP = /-+([a-z0-9])/g;
/**
* @param {?} input
* @return {?}
*/
function dashCaseToCamelCase(input) {
return input.replace(DASH_CASE_REGEXP, function () {
var m = [];
for (var _i = 0; _i < arguments.length; _i++) {
m[_i] = arguments[_i];
}
return m[1].toUpperCase();
});
}
/**
* @param {?} input
* @param {?} defaultValues
* @return {?}
*/
function splitAtColon(input, defaultValues) {
return _splitAt(input, ':', defaultValues);
}
/**
* @param {?} input
* @param {?} defaultValues
* @return {?}
*/
function splitAtPeriod(input, defaultValues) {
return _splitAt(input, '.', defaultValues);
}
/**
* @param {?} input
* @param {?} character
* @param {?} defaultValues
* @return {?}
*/
function _splitAt(input, character, defaultValues) {
var /** @type {?} */ characterIndex = input.indexOf(character);
if (characterIndex == -1)
return defaultValues;
return [input.slice(0, characterIndex).trim(), input.slice(characterIndex + 1).trim()];
}
/**
* @param {?} value
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function visitValue(value, visitor, context) {
if (Array.isArray(value)) {
return visitor.visitArray(/** @type {?} */ (value), context);
}
if (isStrictStringMap(value)) {
return visitor.visitStringMap(/** @type {?} */ (value), context);
}
if (value == null || typeof value == 'string' || typeof value == 'number' ||
typeof value == 'boolean') {
return visitor.visitPrimitive(value, context);
}
return visitor.visitOther(value, context);
}
/**
* @param {?} val
* @return {?}
*/
function isDefined(val) {
return val !== null && val !== undefined;
}
/**
* @template T
* @param {?} val
* @return {?}
*/
function noUndefined(val) {
return val === undefined ? /** @type {?} */ ((null)) : val;
}
/**
* @record
*/
var ValueTransformer = (function () {
function ValueTransformer() {
}
/**
* @param {?} arr
* @param {?} context
* @return {?}
*/
ValueTransformer.prototype.visitArray = /**
* @param {?} arr
* @param {?} context
* @return {?}
*/
function (arr, context) {
var _this = this;
return arr.map(function (value) { return visitValue(value, _this, context); });
};
/**
* @param {?} map
* @param {?} context
* @return {?}
*/
ValueTransformer.prototype.visitStringMap = /**
* @param {?} map
* @param {?} context
* @return {?}
*/
function (map, context) {
var _this = this;
var /** @type {?} */ result = {};
Object.keys(map).forEach(function (key) { result[key] = visitValue(map[key], _this, context); });
return result;
};
/**
* @param {?} value
* @param {?} context
* @return {?}
*/
ValueTransformer.prototype.visitPrimitive = /**
* @param {?} value
* @param {?} context
* @return {?}
*/
function (value, context) { return value; };
/**
* @param {?} value
* @param {?} context
* @return {?}
*/
ValueTransformer.prototype.visitOther = /**
* @param {?} value
* @param {?} context
* @return {?}
*/
function (value, context) { return value; };
return ValueTransformer;
}());
var SyncAsync = {
assertSync: function (value) {
if (isPromise(value)) {
throw new Error("Illegal state: value cannot be a promise");
}
return value;
},
then: function (value, cb) { return isPromise(value) ? value.then(cb) : cb(value); },
all: function (syncAsyncValues) {
return syncAsyncValues.some(isPromise) ? Promise.all(syncAsyncValues) : /** @type {?} */ (syncAsyncValues);
}
};
/**
* @param {?} msg
* @param {?=} parseErrors
* @return {?}
*/
function syntaxError(msg, parseErrors) {
var /** @type {?} */ error = Error(msg);
(/** @type {?} */ (error))[ERROR_SYNTAX_ERROR] = true;
if (parseErrors)
(/** @type {?} */ (error))[ERROR_PARSE_ERRORS] = parseErrors;
return error;
}
var ERROR_SYNTAX_ERROR = 'ngSyntaxError';
var ERROR_PARSE_ERRORS = 'ngParseErrors';
/**
* @param {?} error
* @return {?}
*/
function isSyntaxError(error) {
return (/** @type {?} */ (error))[ERROR_SYNTAX_ERROR];
}
/**
* @param {?} error
* @return {?}
*/
function getParseErrors(error) {
return (/** @type {?} */ (error))[ERROR_PARSE_ERRORS] || [];
}
/**
* @param {?} s
* @return {?}
*/
function escapeRegExp(s) {
return s.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
}
var STRING_MAP_PROTO = Object.getPrototypeOf({});
/**
* @param {?} obj
* @return {?}
*/
function isStrictStringMap(obj) {
return typeof obj === 'object' && obj !== null && Object.getPrototypeOf(obj) === STRING_MAP_PROTO;
}
/**
* @param {?} str
* @return {?}
*/
function utf8Encode(str) {
var /** @type {?} */ encoded = '';
for (var /** @type {?} */ index = 0; index < str.length; index++) {
var /** @type {?} */ codePoint = str.charCodeAt(index);
// decode surrogate
// see https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
if (codePoint >= 0xd800 && codePoint <= 0xdbff && str.length > (index + 1)) {
var /** @type {?} */ low = str.charCodeAt(index + 1);
if (low >= 0xdc00 && low <= 0xdfff) {
index++;
codePoint = ((codePoint - 0xd800) << 10) + low - 0xdc00 + 0x10000;
}
}
if (codePoint <= 0x7f) {
encoded += String.fromCharCode(codePoint);
}
else if (codePoint <= 0x7ff) {
encoded += String.fromCharCode(((codePoint >> 6) & 0x1F) | 0xc0, (codePoint & 0x3f) | 0x80);
}
else if (codePoint <= 0xffff) {
encoded += String.fromCharCode((codePoint >> 12) | 0xe0, ((codePoint >> 6) & 0x3f) | 0x80, (codePoint & 0x3f) | 0x80);
}
else if (codePoint <= 0x1fffff) {
encoded += String.fromCharCode(((codePoint >> 18) & 0x07) | 0xf0, ((codePoint >> 12) & 0x3f) | 0x80, ((codePoint >> 6) & 0x3f) | 0x80, (codePoint & 0x3f) | 0x80);
}
}
return encoded;
}
/**
* @record
*/
/**
* @param {?} token
* @return {?}
*/
function stringify(token) {
if (typeof token === 'string') {
return token;
}
if (token instanceof Array) {
return '[' + token.map(stringify).join(', ') + ']';
}
if (token == null) {
return '' + token;
}
if (token.overriddenName) {
return "" + token.overriddenName;
}
if (token.name) {
return "" + token.name;
}
var /** @type {?} */ res = token.toString();
if (res == null) {
return '' + res;
}
var /** @type {?} */ newLineIndex = res.indexOf('\n');
return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
}
/**
* Lazily retrieves the reference value from a forwardRef.
* @param {?} type
* @return {?}
*/
function resolveForwardRef(type) {
if (typeof type === 'function' && type.hasOwnProperty('__forward_ref__')) {
return type();
}
else {
return type;
}
}
/**
* Determine if the argument is shaped like a Promise
* @param {?} obj
* @return {?}
*/
function isPromise(obj) {
// allow any Promise/A+ compliant thenable.
// It's up to the caller to ensure that obj.then conforms to the spec
return !!obj && typeof obj.then === 'function';
}
var Version = (function () {
function Version(full) {
this.full = full;
var /** @type {?} */ splits = full.split('.');
this.major = splits[0];
this.minor = splits[1];
this.patch = splits.slice(2).join('.');
}
return Version;
}());
/**
* @record
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @module
* @description
* Entry point for all public APIs of the common package.
*/
/**
* \@stable
*/
var VERSION = new Version('5.0.3');
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* An Abstract Syntax Tree node representing part of a parsed Angular template.
* @record
*/
/**
* A segment of text within the template.
*/
var TextAst = (function () {
function TextAst(value, ngContentIndex, sourceSpan) {
this.value = value;
this.ngContentIndex = ngContentIndex;
this.sourceSpan = sourceSpan;
}
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
TextAst.prototype.visit = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) { return visitor.visitText(this, context); };
return TextAst;
}());
/**
* A bound expression within the text of a template.
*/
var BoundTextAst = (function () {
function BoundTextAst(value, ngContentIndex, sourceSpan) {
this.value = value;
this.ngContentIndex = ngContentIndex;
this.sourceSpan = sourceSpan;
}
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
BoundTextAst.prototype.visit = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitBoundText(this, context);
};
return BoundTextAst;
}());
/**
* A plain attribute on an element.
*/
var AttrAst = (function () {
function AttrAst(name, value, sourceSpan) {
this.name = name;
this.value = value;
this.sourceSpan = sourceSpan;
}
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
AttrAst.prototype.visit = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) { return visitor.visitAttr(this, context); };
return AttrAst;
}());
/**
* A binding for an element property (e.g. `[property]="expression"`) or an animation trigger (e.g.
* `[\@trigger]="stateExp"`)
*/
var BoundElementPropertyAst = (function () {
function BoundElementPropertyAst(name, type, securityContext, value, unit, sourceSpan) {
this.name = name;
this.type = type;
this.securityContext = securityContext;
this.value = value;
this.unit = unit;
this.sourceSpan = sourceSpan;
this.isAnimation = this.type === PropertyBindingType.Animation;
}
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
BoundElementPropertyAst.prototype.visit = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitElementProperty(this, context);
};
return BoundElementPropertyAst;
}());
/**
* A binding for an element event (e.g. `(event)="handler()"`) or an animation trigger event (e.g.
* `(\@trigger.phase)="callback($event)"`).
*/
var BoundEventAst = (function () {
function BoundEventAst(name, target, phase, handler, sourceSpan) {
this.name = name;
this.target = target;
this.phase = phase;
this.handler = handler;
this.sourceSpan = sourceSpan;
this.fullName = BoundEventAst.calcFullName(this.name, this.target, this.phase);
this.isAnimation = !!this.phase;
}
/**
* @param {?} name
* @param {?} target
* @param {?} phase
* @return {?}
*/
BoundEventAst.calcFullName = /**
* @param {?} name
* @param {?} target
* @param {?} phase
* @return {?}
*/
function (name, target, phase) {
if (target) {
return target + ":" + name;
}
else if (phase) {
return "@" + name + "." + phase;
}
else {
return name;
}
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
BoundEventAst.prototype.visit = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitEvent(this, context);
};
return BoundEventAst;
}());
/**
* A reference declaration on an element (e.g. `let someName="expression"`).
*/
var ReferenceAst = (function () {
function ReferenceAst(name, value, sourceSpan) {
this.name = name;
this.value = value;
this.sourceSpan = sourceSpan;
}
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
ReferenceAst.prototype.visit = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitReference(this, context);
};
return ReferenceAst;
}());
/**
* A variable declaration on a <ng-template> (e.g. `var-someName="someLocalName"`).
*/
var VariableAst = (function () {
function VariableAst(name, value, sourceSpan) {
this.name = name;
this.value = value;
this.sourceSpan = sourceSpan;
}
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
VariableAst.prototype.visit = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitVariable(this, context);
};
return VariableAst;
}());
/**
* An element declaration in a template.
*/
var ElementAst = (function () {
function ElementAst(name, attrs, inputs, outputs, references, directives, providers, hasViewContainer, queryMatches, children, ngContentIndex, sourceSpan, endSourceSpan) {
this.name = name;
this.attrs = attrs;
this.inputs = inputs;
this.outputs = outputs;
this.references = references;
this.directives = directives;
this.providers = providers;
this.hasViewContainer = hasViewContainer;
this.queryMatches = queryMatches;
this.children = children;
this.ngContentIndex = ngContentIndex;
this.sourceSpan = sourceSpan;
this.endSourceSpan = endSourceSpan;
}
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
ElementAst.prototype.visit = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitElement(this, context);
};
return ElementAst;
}());
/**
* A `<ng-template>` element included in an Angular template.
*/
var EmbeddedTemplateAst = (function () {
function EmbeddedTemplateAst(attrs, outputs, references, variables, directives, providers, hasViewContainer, queryMatches, children, ngContentIndex, sourceSpan) {
this.attrs = attrs;
this.outputs = outputs;
this.references = references;
this.variables = variables;
this.directives = directives;
this.providers = providers;
this.hasViewContainer = hasViewContainer;
this.queryMatches = queryMatches;
this.children = children;
this.ngContentIndex = ngContentIndex;
this.sourceSpan = sourceSpan;
}
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
EmbeddedTemplateAst.prototype.visit = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitEmbeddedTemplate(this, context);
};
return EmbeddedTemplateAst;
}());
/**
* A directive property with a bound value (e.g. `*ngIf="condition").
*/
var BoundDirectivePropertyAst = (function () {
function BoundDirectivePropertyAst(directiveName, templateName, value, sourceSpan) {
this.directiveName = directiveName;
this.templateName = templateName;
this.value = value;
this.sourceSpan = sourceSpan;
}
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
BoundDirectivePropertyAst.prototype.visit = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitDirectiveProperty(this, context);
};
return BoundDirectivePropertyAst;
}());
/**
* A directive declared on an element.
*/
var DirectiveAst = (function () {
function DirectiveAst(directive, inputs, hostProperties, hostEvents, contentQueryStartId, sourceSpan) {
this.directive = directive;
this.inputs = inputs;
this.hostProperties = hostProperties;
this.hostEvents = hostEvents;
this.contentQueryStartId = contentQueryStartId;
this.sourceSpan = sourceSpan;
}
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
DirectiveAst.prototype.visit = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitDirective(this, context);
};
return DirectiveAst;
}());
/**
* A provider declared on an element
*/
var ProviderAst = (function () {
function ProviderAst(token, multiProvider, eager, providers, providerType, lifecycleHooks, sourceSpan) {
this.token = token;
this.multiProvider = multiProvider;
this.eager = eager;
this.providers = providers;
this.providerType = providerType;
this.lifecycleHooks = lifecycleHooks;
this.sourceSpan = sourceSpan;
}
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
ProviderAst.prototype.visit = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
// No visit method in the visitor for now...
return null;
};
return ProviderAst;
}());
/** @enum {number} */
var ProviderAstType = {
PublicService: 0,
PrivateService: 1,
Component: 2,
Directive: 3,
Builtin: 4,
};
ProviderAstType[ProviderAstType.PublicService] = "PublicService";
ProviderAstType[ProviderAstType.PrivateService] = "PrivateService";
ProviderAstType[ProviderAstType.Component] = "Component";
ProviderAstType[ProviderAstType.Directive] = "Directive";
ProviderAstType[ProviderAstType.Builtin] = "Builtin";
/**
* Position where content is to be projected (instance of `<ng-content>` in a template).
*/
var NgContentAst = (function () {
function NgContentAst(index, ngContentIndex, sourceSpan) {
this.index = index;
this.ngContentIndex = ngContentIndex;
this.sourceSpan = sourceSpan;
}
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
NgContentAst.prototype.visit = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitNgContent(this, context);
};
return NgContentAst;
}());
/** @enum {number} */
var PropertyBindingType = {
/**
* A normal binding to a property (e.g. `[property]="expression"`).
*/
Property: 0,
/**
* A binding to an element attribute (e.g. `[attr.name]="expression"`).
*/
Attribute: 1,
/**
* A binding to a CSS class (e.g. `[class.name]="condition"`).
*/
Class: 2,
/**
* A binding to a style rule (e.g. `[style.rule]="expression"`).
*/
Style: 3,
/**
* A binding to an animation reference (e.g. `[animate.key]="expression"`).
*/
Animation: 4,
};
PropertyBindingType[PropertyBindingType.Property] = "Property";
PropertyBindingType[PropertyBindingType.Attribute] = "Attribute";
PropertyBindingType[PropertyBindingType.Class] = "Class";
PropertyBindingType[PropertyBindingType.Style] = "Style";
PropertyBindingType[PropertyBindingType.Animation] = "Animation";
/**
* @record
*/
/**
* A visitor for {\@link TemplateAst} trees that will process each node.
* @record
*/
/**
* A visitor that accepts each node but doesn't do anything. It is intended to be used
* as the base class for a visitor that is only interested in a subset of the node types.
*/
var NullTemplateVisitor = (function () {
function NullTemplateVisitor() {
}
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullTemplateVisitor.prototype.visitNgContent = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullTemplateVisitor.prototype.visitEmbeddedTemplate = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullTemplateVisitor.prototype.visitElement = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullTemplateVisitor.prototype.visitReference = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullTemplateVisitor.prototype.visitVariable = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullTemplateVisitor.prototype.visitEvent = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullTemplateVisitor.prototype.visitElementProperty = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullTemplateVisitor.prototype.visitAttr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullTemplateVisitor.prototype.visitBoundText = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullTemplateVisitor.prototype.visitText = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullTemplateVisitor.prototype.visitDirective = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullTemplateVisitor.prototype.visitDirectiveProperty = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
return NullTemplateVisitor;
}());
/**
* Base class that can be used to build a visitor that visits each node
* in an template ast recursively.
*/
var RecursiveTemplateAstVisitor = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(RecursiveTemplateAstVisitor, _super);
function RecursiveTemplateAstVisitor() {
return _super.call(this) || this;
}
// Nodes with children
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveTemplateAstVisitor.prototype.visitEmbeddedTemplate = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return this.visitChildren(context, function (visit) {
visit(ast.attrs);
visit(ast.references);
visit(ast.variables);
visit(ast.directives);
visit(ast.providers);
visit(ast.children);
});
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveTemplateAstVisitor.prototype.visitElement = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return this.visitChildren(context, function (visit) {
visit(ast.attrs);
visit(ast.inputs);
visit(ast.outputs);
visit(ast.references);
visit(ast.directives);
visit(ast.providers);
visit(ast.children);
});
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveTemplateAstVisitor.prototype.visitDirective = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return this.visitChildren(context, function (visit) {
visit(ast.inputs);
visit(ast.hostProperties);
visit(ast.hostEvents);
});
};
/**
* @template T
* @param {?} context
* @param {?} cb
* @return {?}
*/
RecursiveTemplateAstVisitor.prototype.visitChildren = /**
* @template T
* @param {?} context
* @param {?} cb
* @return {?}
*/
function (context, cb) {
var /** @type {?} */ results = [];
var /** @type {?} */ t = this;
/**
* @template T
* @param {?} children
* @return {?}
*/
function visit(children) {
if (children && children.length)
results.push(templateVisitAll(t, children, context));
}
cb(visit);
return [].concat.apply([], results);
};
return RecursiveTemplateAstVisitor;
}(NullTemplateVisitor));
/**
* Visit every node in a list of {\@link TemplateAst}s with the given {\@link TemplateAstVisitor}.
* @param {?} visitor
* @param {?} asts
* @param {?=} context
* @return {?}
*/
function templateVisitAll(visitor, asts, context) {
if (context === void 0) { context = null; }
var /** @type {?} */ result = [];
var /** @type {?} */ visit = visitor.visit ?
function (ast) { return /** @type {?} */ ((visitor.visit))(ast, context) || ast.visit(visitor, context); } :
function (ast) { return ast.visit(visitor, context); };
asts.forEach(function (ast) {
var /** @type {?} */ astResult = visit(ast);
if (astResult) {
result.push(astResult);
}
});
return result;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var CompilerConfig = (function () {
function CompilerConfig(_a) {
var _b = _a === void 0 ? {} : _a, _c = _b.defaultEncapsulation, defaultEncapsulation = _c === void 0 ? ViewEncapsulation.Emulated : _c, _d = _b.useJit, useJit = _d === void 0 ? true : _d, _e = _b.jitDevMode, jitDevMode = _e === void 0 ? false : _e, _f = _b.missingTranslation, missingTranslation = _f === void 0 ? null : _f, enableLegacyTemplate = _b.enableLegacyTemplate, preserveWhitespaces = _b.preserveWhitespaces, strictInjectionParameters = _b.strictInjectionParameters;
this.defaultEncapsulation = defaultEncapsulation;
this.useJit = !!useJit;
this.jitDevMode = !!jitDevMode;
this.missingTranslation = missingTranslation;
this.enableLegacyTemplate = enableLegacyTemplate === true;
this.preserveWhitespaces = preserveWhitespacesDefault(noUndefined(preserveWhitespaces));
this.strictInjectionParameters = strictInjectionParameters === true;
}
return CompilerConfig;
}());
/**
* @param {?} preserveWhitespacesOption
* @param {?=} defaultSetting
* @return {?}
*/
function preserveWhitespacesDefault(preserveWhitespacesOption, defaultSetting) {
if (defaultSetting === void 0) { defaultSetting = true; }
return preserveWhitespacesOption === null ? defaultSetting : preserveWhitespacesOption;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* A token representing the a reference to a static type.
*
* This token is unique for a filePath and name and can be used as a hash table key.
*/
var StaticSymbol = (function () {
function StaticSymbol(filePath, name, members) {
this.filePath = filePath;
this.name = name;
this.members = members;
}
/**
* @return {?}
*/
StaticSymbol.prototype.assertNoMembers = /**
* @return {?}
*/
function () {
if (this.members.length) {
throw new Error("Illegal state: symbol without members expected, but got " + JSON.stringify(this) + ".");
}
};
return StaticSymbol;
}());
/**
* A cache of static symbol used by the StaticReflector to return the same symbol for the
* same symbol values.
*/
var StaticSymbolCache = (function () {
function StaticSymbolCache() {
this.cache = new Map();
}
/**
* @param {?} declarationFile
* @param {?} name
* @param {?=} members
* @return {?}
*/
StaticSymbolCache.prototype.get = /**
* @param {?} declarationFile
* @param {?} name
* @param {?=} members
* @return {?}
*/
function (declarationFile, name, members) {
members = members || [];
var /** @type {?} */ memberSuffix = members.length ? "." + members.join('.') : '';
var /** @type {?} */ key = "\"" + declarationFile + "\"." + name + memberSuffix;
var /** @type {?} */ result = this.cache.get(key);
if (!result) {
result = new StaticSymbol(declarationFile, name, members);
this.cache.set(key, result);
}
return result;
};
return StaticSymbolCache;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// group 0: "[prop] or (event) or @trigger"
// group 1: "prop" from "[prop]"
// group 2: "event" from "(event)"
// group 3: "@trigger" from "@trigger"
var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))|(\@[-\w]+)$/;
/**
* @param {?} name
* @return {?}
*/
function _sanitizeIdentifier(name) {
return name.replace(/\W/g, '_');
}
var _anonymousTypeIndex = 0;
/**
* @param {?} compileIdentifier
* @return {?}
*/
function identifierName(compileIdentifier) {
if (!compileIdentifier || !compileIdentifier.reference) {
return null;
}
var /** @type {?} */ ref = compileIdentifier.reference;
if (ref instanceof StaticSymbol) {
return ref.name;
}
if (ref['__anonymousType']) {
return ref['__anonymousType'];
}
var /** @type {?} */ identifier = stringify(ref);
if (identifier.indexOf('(') >= 0) {
// case: anonymous functions!
identifier = "anonymous_" + _anonymousTypeIndex++;
ref['__anonymousType'] = identifier;
}
else {
identifier = _sanitizeIdentifier(identifier);
}
return identifier;
}
/**
* @param {?} compileIdentifier
* @return {?}
*/
function identifierModuleUrl(compileIdentifier) {
var /** @type {?} */ ref = compileIdentifier.reference;
if (ref instanceof StaticSymbol) {
return ref.filePath;
}
// Runtime type
return "./" + stringify(ref);
}
/**
* @param {?} compType
* @param {?} embeddedTemplateIndex
* @return {?}
*/
function viewClassName(compType, embeddedTemplateIndex) {
return "View_" + identifierName({ reference: compType }) + "_" + embeddedTemplateIndex;
}
/**
* @param {?} compType
* @return {?}
*/
function rendererTypeName(compType) {
return "RenderType_" + identifierName({ reference: compType });
}
/**
* @param {?} compType
* @return {?}
*/
function hostViewClassName(compType) {
return "HostView_" + identifierName({ reference: compType });
}
/**
* @param {?} compType
* @return {?}
*/
function componentFactoryName(compType) {
return identifierName({ reference: compType }) + "NgFactory";
}
/**
* @record
*/
/**
* @record
*/
/** @enum {number} */
var CompileSummaryKind = {
Pipe: 0,
Directive: 1,
NgModule: 2,
Injectable: 3,
};
CompileSummaryKind[CompileSummaryKind.Pipe] = "Pipe";
CompileSummaryKind[CompileSummaryKind.Directive] = "Directive";
CompileSummaryKind[CompileSummaryKind.NgModule] = "NgModule";
CompileSummaryKind[CompileSummaryKind.Injectable] = "Injectable";
/**
* A CompileSummary is the data needed to use a directive / pipe / module
* in other modules / components. However, this data is not enough to compile
* the directive / module itself.
* @record
*/
/**
* @record
*/
/**
* @record
*/
/**
* @record
*/
/**
* @param {?} token
* @return {?}
*/
function tokenName(token) {
return token.value != null ? _sanitizeIdentifier(token.value) : identifierName(token.identifier);
}
/**
* @param {?} token
* @return {?}
*/
function tokenReference(token) {
if (token.identifier != null) {
return token.identifier.reference;
}
else {
return token.value;
}
}
/**
* @record
*/
/**
* Metadata regarding compilation of a type.
* @record
*/
/**
* @record
*/
/**
* Metadata about a stylesheet
*/
var CompileStylesheetMetadata = (function () {
function CompileStylesheetMetadata(_a) {
var _b = _a === void 0 ? {} : _a, moduleUrl = _b.moduleUrl, styles = _b.styles, styleUrls = _b.styleUrls;
this.moduleUrl = moduleUrl || null;
this.styles = _normalizeArray(styles);
this.styleUrls = _normalizeArray(styleUrls);
}
return CompileStylesheetMetadata;
}());
/**
* Summary Metadata regarding compilation of a template.
* @record
*/
/**
* Metadata regarding compilation of a template.
*/
var CompileTemplateMetadata = (function () {
function CompileTemplateMetadata(_a) {
var encapsulation = _a.encapsulation, template = _a.template, templateUrl = _a.templateUrl, htmlAst = _a.htmlAst, styles = _a.styles, styleUrls = _a.styleUrls, externalStylesheets = _a.externalStylesheets, animations = _a.animations, ngContentSelectors = _a.ngContentSelectors, interpolation = _a.interpolation, isInline = _a.isInline, preserveWhitespaces = _a.preserveWhitespaces;
this.encapsulation = encapsulation;
this.template = template;
this.templateUrl = templateUrl;
this.htmlAst = htmlAst;
this.styles = _normalizeArray(styles);
this.styleUrls = _normalizeArray(styleUrls);
this.externalStylesheets = _normalizeArray(externalStylesheets);
this.animations = animations ? flatten(animations) : [];
this.ngContentSelectors = ngContentSelectors || [];
if (interpolation && interpolation.length != 2) {
throw new Error("'interpolation' should have a start and an end symbol.");
}
this.interpolation = interpolation;
this.isInline = isInline;
this.preserveWhitespaces = preserveWhitespaces;
}
/**
* @return {?}
*/
CompileTemplateMetadata.prototype.toSummary = /**
* @return {?}
*/
function () {
return {
ngContentSelectors: this.ngContentSelectors,
encapsulation: this.encapsulation,
};
};
return CompileTemplateMetadata;
}());
/**
* @record
*/
/**
* @record
*/
/**
* Metadata regarding compilation of a directive.
*/
var CompileDirectiveMetadata = (function () {
function CompileDirectiveMetadata(_a) {
var isHost = _a.isHost, type = _a.type, isComponent = _a.isComponent, selector = _a.selector, exportAs = _a.exportAs, changeDetection = _a.changeDetection, inputs = _a.inputs, outputs = _a.outputs, hostListeners = _a.hostListeners, hostProperties = _a.hostProperties, hostAttributes = _a.hostAttributes, providers = _a.providers, viewProviders = _a.viewProviders, queries = _a.queries, viewQueries = _a.viewQueries, entryComponents = _a.entryComponents, template = _a.template, componentViewType = _a.componentViewType, rendererType = _a.rendererType, componentFactory = _a.componentFactory;
this.isHost = !!isHost;
this.type = type;
this.isComponent = isComponent;
this.selector = selector;
this.exportAs = exportAs;
this.changeDetection = changeDetection;
this.inputs = inputs;
this.outputs = outputs;
this.hostListeners = hostListeners;
this.hostProperties = hostProperties;
this.hostAttributes = hostAttributes;
this.providers = _normalizeArray(providers);
this.viewProviders = _normalizeArray(viewProviders);
this.queries = _normalizeArray(queries);
this.viewQueries = _normalizeArray(viewQueries);
this.entryComponents = _normalizeArray(entryComponents);
this.template = template;
this.componentViewType = componentViewType;
this.rendererType = rendererType;
this.componentFactory = componentFactory;
}
/**
* @param {?} __0
* @return {?}
*/
CompileDirectiveMetadata.create = /**
* @param {?} __0
* @return {?}
*/
function (_a) {
var isHost = _a.isHost, type = _a.type, isComponent = _a.isComponent, selector = _a.selector, exportAs = _a.exportAs, changeDetection = _a.changeDetection, inputs = _a.inputs, outputs = _a.outputs, host = _a.host, providers = _a.providers, viewProviders = _a.viewProviders, queries = _a.queries, viewQueries = _a.viewQueries, entryComponents = _a.entryComponents, template = _a.template, componentViewType = _a.componentViewType, rendererType = _a.rendererType, componentFactory = _a.componentFactory;
var /** @type {?} */ hostListeners = {};
var /** @type {?} */ hostProperties = {};
var /** @type {?} */ hostAttributes = {};
if (host != null) {
Object.keys(host).forEach(function (key) {
var /** @type {?} */ value = host[key];
var /** @type {?} */ matches = key.match(HOST_REG_EXP);
if (matches === null) {
hostAttributes[key] = value;
}
else if (matches[1] != null) {
hostProperties[matches[1]] = value;
}
else if (matches[2] != null) {
hostListeners[matches[2]] = value;
}
});
}
var /** @type {?} */ inputsMap = {};
if (inputs != null) {
inputs.forEach(function (bindConfig) {
// canonical syntax: `dirProp: elProp`
// if there is no `:`, use dirProp = elProp
var /** @type {?} */ parts = splitAtColon(bindConfig, [bindConfig, bindConfig]);
inputsMap[parts[0]] = parts[1];
});
}
var /** @type {?} */ outputsMap = {};
if (outputs != null) {
outputs.forEach(function (bindConfig) {
// canonical syntax: `dirProp: elProp`
// if there is no `:`, use dirProp = elProp
var /** @type {?} */ parts = splitAtColon(bindConfig, [bindConfig, bindConfig]);
outputsMap[parts[0]] = parts[1];
});
}
return new CompileDirectiveMetadata({
isHost: isHost,
type: type,
isComponent: !!isComponent, selector: selector, exportAs: exportAs, changeDetection: changeDetection,
inputs: inputsMap,
outputs: outputsMap,
hostListeners: hostListeners,
hostProperties: hostProperties,
hostAttributes: hostAttributes,
providers: providers,
viewProviders: viewProviders,
queries: queries,
viewQueries: viewQueries,
entryComponents: entryComponents,
template: template,
componentViewType: componentViewType,
rendererType: rendererType,
componentFactory: componentFactory,
});
};
/**
* @return {?}
*/
CompileDirectiveMetadata.prototype.toSummary = /**
* @return {?}
*/
function () {
return {
summaryKind: CompileSummaryKind.Directive,
type: this.type,
isComponent: this.isComponent,
selector: this.selector,
exportAs: this.exportAs,
inputs: this.inputs,
outputs: this.outputs,
hostListeners: this.hostListeners,
hostProperties: this.hostProperties,
hostAttributes: this.hostAttributes,
providers: this.providers,
viewProviders: this.viewProviders,
queries: this.queries,
viewQueries: this.viewQueries,
entryComponents: this.entryComponents,
changeDetection: this.changeDetection,
template: this.template && this.template.toSummary(),
componentViewType: this.componentViewType,
rendererType: this.rendererType,
componentFactory: this.componentFactory
};
};
return CompileDirectiveMetadata;
}());
/**
* @record
*/
var CompilePipeMetadata = (function () {
function CompilePipeMetadata(_a) {
var type = _a.type, name = _a.name, pure = _a.pure;
this.type = type;
this.name = name;
this.pure = !!pure;
}
/**
* @return {?}
*/
CompilePipeMetadata.prototype.toSummary = /**
* @return {?}
*/
function () {
return {
summaryKind: CompileSummaryKind.Pipe,
type: this.type,
name: this.name,
pure: this.pure
};
};
return CompilePipeMetadata;
}());
/**
* @record
*/
/**
* Metadata regarding compilation of a module.
*/
var CompileNgModuleMetadata = (function () {
function CompileNgModuleMetadata(_a) {
var type = _a.type, providers = _a.providers, declaredDirectives = _a.declaredDirectives, exportedDirectives = _a.exportedDirectives, declaredPipes = _a.declaredPipes, exportedPipes = _a.exportedPipes, entryComponents = _a.entryComponents, bootstrapComponents = _a.bootstrapComponents, importedModules = _a.importedModules, exportedModules = _a.exportedModules, schemas = _a.schemas, transitiveModule = _a.transitiveModule, id = _a.id;
this.type = type || null;
this.declaredDirectives = _normalizeArray(declaredDirectives);
this.exportedDirectives = _normalizeArray(exportedDirectives);
this.declaredPipes = _normalizeArray(declaredPipes);
this.exportedPipes = _normalizeArray(exportedPipes);
this.providers = _normalizeArray(providers);
this.entryComponents = _normalizeArray(entryComponents);
this.bootstrapComponents = _normalizeArray(bootstrapComponents);
this.importedModules = _normalizeArray(importedModules);
this.exportedModules = _normalizeArray(exportedModules);
this.schemas = _normalizeArray(schemas);
this.id = id || null;
this.transitiveModule = transitiveModule || null;
}
/**
* @return {?}
*/
CompileNgModuleMetadata.prototype.toSummary = /**
* @return {?}
*/
function () {
var /** @type {?} */ module = /** @type {?} */ ((this.transitiveModule));
return {
summaryKind: CompileSummaryKind.NgModule,
type: this.type,
entryComponents: module.entryComponents,
providers: module.providers,
modules: module.modules,
exportedDirectives: module.exportedDirectives,
exportedPipes: module.exportedPipes
};
};
return CompileNgModuleMetadata;
}());
var TransitiveCompileNgModuleMetadata = (function () {
function TransitiveCompileNgModuleMetadata() {
this.directivesSet = new Set();
this.directives = [];
this.exportedDirectivesSet = new Set();
this.exportedDirectives = [];
this.pipesSet = new Set();
this.pipes = [];
this.exportedPipesSet = new Set();
this.exportedPipes = [];
this.modulesSet = new Set();
this.modules = [];
this.entryComponentsSet = new Set();
this.entryComponents = [];
this.providers = [];
}
/**
* @param {?} provider
* @param {?} module
* @return {?}
*/
TransitiveCompileNgModuleMetadata.prototype.addProvider = /**
* @param {?} provider
* @param {?} module
* @return {?}
*/
function (provider, module) {
this.providers.push({ provider: provider, module: module });
};
/**
* @param {?} id
* @return {?}
*/
TransitiveCompileNgModuleMetadata.prototype.addDirective = /**
* @param {?} id
* @return {?}
*/
function (id) {
if (!this.directivesSet.has(id.reference)) {
this.directivesSet.add(id.reference);
this.directives.push(id);
}
};
/**
* @param {?} id
* @return {?}
*/
TransitiveCompileNgModuleMetadata.prototype.addExportedDirective = /**
* @param {?} id
* @return {?}
*/
function (id) {
if (!this.exportedDirectivesSet.has(id.reference)) {
this.exportedDirectivesSet.add(id.reference);
this.exportedDirectives.push(id);
}
};
/**
* @param {?} id
* @return {?}
*/
TransitiveCompileNgModuleMetadata.prototype.addPipe = /**
* @param {?} id
* @return {?}
*/
function (id) {
if (!this.pipesSet.has(id.reference)) {
this.pipesSet.add(id.reference);
this.pipes.push(id);
}
};
/**
* @param {?} id
* @return {?}
*/
TransitiveCompileNgModuleMetadata.prototype.addExportedPipe = /**
* @param {?} id
* @return {?}
*/
function (id) {
if (!this.exportedPipesSet.has(id.reference)) {
this.exportedPipesSet.add(id.reference);
this.exportedPipes.push(id);
}
};
/**
* @param {?} id
* @return {?}
*/
TransitiveCompileNgModuleMetadata.prototype.addModule = /**
* @param {?} id
* @return {?}
*/
function (id) {
if (!this.modulesSet.has(id.reference)) {
this.modulesSet.add(id.reference);
this.modules.push(id);
}
};
/**
* @param {?} ec
* @return {?}
*/
TransitiveCompileNgModuleMetadata.prototype.addEntryComponent = /**
* @param {?} ec
* @return {?}
*/
function (ec) {
if (!this.entryComponentsSet.has(ec.componentType)) {
this.entryComponentsSet.add(ec.componentType);
this.entryComponents.push(ec);
}
};
return TransitiveCompileNgModuleMetadata;
}());
/**
* @param {?} obj
* @return {?}
*/
function _normalizeArray(obj) {
return obj || [];
}
var ProviderMeta = (function () {
function ProviderMeta(token, _a) {
var useClass = _a.useClass, useValue = _a.useValue, useExisting = _a.useExisting, useFactory = _a.useFactory, deps = _a.deps, multi = _a.multi;
this.token = token;
this.useClass = useClass || null;
this.useValue = useValue;
this.useExisting = useExisting;
this.useFactory = useFactory || null;
this.dependencies = deps || null;
this.multi = !!multi;
}
return ProviderMeta;
}());
/**
* @template T
* @param {?} list
* @return {?}
*/
function flatten(list) {
return list.reduce(function (flat, item) {
var /** @type {?} */ flatItem = Array.isArray(item) ? flatten(item) : item;
return (/** @type {?} */ (flat)).concat(flatItem);
}, []);
}
/**
* @param {?} url
* @return {?}
*/
function jitSourceUrl(url) {
// Note: We need 3 "/" so that ng shows up as a separate domain
// in the chrome dev tools.
return url.replace(/(\w+:\/\/[\w:-]+)?(\/+)?/, 'ng:///');
}
/**
* @param {?} ngModuleType
* @param {?} compMeta
* @param {?} templateMeta
* @return {?}
*/
function templateSourceUrl(ngModuleType, compMeta, templateMeta) {
var /** @type {?} */ url;
if (templateMeta.isInline) {
if (compMeta.type.reference instanceof StaticSymbol) {
// Note: a .ts file might contain multiple components with inline templates,
// so we need to give them unique urls, as these will be used for sourcemaps.
url = compMeta.type.reference.filePath + "." + compMeta.type.reference.name + ".html";
}
else {
url = identifierName(ngModuleType) + "/" + identifierName(compMeta.type) + ".html";
}
}
else {
url = /** @type {?} */ ((templateMeta.templateUrl));
}
return compMeta.type.reference instanceof StaticSymbol ? url : jitSourceUrl(url);
}
/**
* @param {?} meta
* @param {?} id
* @return {?}
*/
function sharedStylesheetJitUrl(meta, id) {
var /** @type {?} */ pathParts = /** @type {?} */ ((meta.moduleUrl)).split(/\/\\/g);
var /** @type {?} */ baseName = pathParts[pathParts.length - 1];
return jitSourceUrl("css/" + id + baseName + ".ngstyle.js");
}
/**
* @param {?} moduleMeta
* @return {?}
*/
function ngModuleJitUrl(moduleMeta) {
return jitSourceUrl(identifierName(moduleMeta.type) + "/module.ngfactory.js");
}
/**
* @param {?} ngModuleType
* @param {?} compMeta
* @return {?}
*/
function templateJitUrl(ngModuleType, compMeta) {
return jitSourceUrl(identifierName(ngModuleType) + "/" + identifierName(compMeta.type) + ".ngfactory.js");
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* A path is an ordered set of elements. Typically a path is to a
* particular offset in a source file. The head of the list is the top
* most node. The tail is the node that contains the offset directly.
*
* For example, the expresion `a + b + c` might have an ast that looks
* like:
* +
* / \
* a +
* / \
* b c
*
* The path to the node at offset 9 would be `['+' at 1-10, '+' at 7-10,
* 'c' at 9-10]` and the path the node at offset 1 would be
* `['+' at 1-10, 'a' at 1-2]`.
*/
var AstPath = (function () {
function AstPath(path, position) {
if (position === void 0) { position = -1; }
this.path = path;
this.position = position;
}
Object.defineProperty(AstPath.prototype, "empty", {
get: /**
* @return {?}
*/
function () { return !this.path || !this.path.length; },
enumerable: true,
configurable: true
});
Object.defineProperty(AstPath.prototype, "head", {
get: /**
* @return {?}
*/
function () { return this.path[0]; },
enumerable: true,
configurable: true
});
Object.defineProperty(AstPath.prototype, "tail", {
get: /**
* @return {?}
*/
function () { return this.path[this.path.length - 1]; },
enumerable: true,
configurable: true
});
/**
* @param {?} node
* @return {?}
*/
AstPath.prototype.parentOf = /**
* @param {?} node
* @return {?}
*/
function (node) {
return node && this.path[this.path.indexOf(node) - 1];
};
/**
* @param {?} node
* @return {?}
*/
AstPath.prototype.childOf = /**
* @param {?} node
* @return {?}
*/
function (node) { return this.path[this.path.indexOf(node) + 1]; };
/**
* @template N
* @param {?} ctor
* @return {?}
*/
AstPath.prototype.first = /**
* @template N
* @param {?} ctor
* @return {?}
*/
function (ctor) {
for (var /** @type {?} */ i = this.path.length - 1; i >= 0; i--) {
var /** @type {?} */ item = this.path[i];
if (item instanceof ctor)
return /** @type {?} */ (item);
}
};
/**
* @param {?} node
* @return {?}
*/
AstPath.prototype.push = /**
* @param {?} node
* @return {?}
*/
function (node) { this.path.push(node); };
/**
* @return {?}
*/
AstPath.prototype.pop = /**
* @return {?}
*/
function () { return /** @type {?} */ ((this.path.pop())); };
return AstPath;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @record
*/
var Text = (function () {
function Text(value, sourceSpan) {
this.value = value;
this.sourceSpan = sourceSpan;
}
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
Text.prototype.visit = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) { return visitor.visitText(this, context); };
return Text;
}());
var Expansion = (function () {
function Expansion(switchValue, type, cases, sourceSpan, switchValueSourceSpan) {
this.switchValue = switchValue;
this.type = type;
this.cases = cases;
this.sourceSpan = sourceSpan;
this.switchValueSourceSpan = switchValueSourceSpan;
}
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
Expansion.prototype.visit = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) { return visitor.visitExpansion(this, context); };
return Expansion;
}());
var ExpansionCase = (function () {
function ExpansionCase(value, expression, sourceSpan, valueSourceSpan, expSourceSpan) {
this.value = value;
this.expression = expression;
this.sourceSpan = sourceSpan;
this.valueSourceSpan = valueSourceSpan;
this.expSourceSpan = expSourceSpan;
}
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
ExpansionCase.prototype.visit = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) { return visitor.visitExpansionCase(this, context); };
return ExpansionCase;
}());
var Attribute$1 = (function () {
function Attribute(name, value, sourceSpan, valueSpan) {
this.name = name;
this.value = value;
this.sourceSpan = sourceSpan;
this.valueSpan = valueSpan;
}
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
Attribute.prototype.visit = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) { return visitor.visitAttribute(this, context); };
return Attribute;
}());
var Element = (function () {
function Element(name, attrs, children, sourceSpan, startSourceSpan, endSourceSpan) {
if (startSourceSpan === void 0) { startSourceSpan = null; }
if (endSourceSpan === void 0) { endSourceSpan = null; }
this.name = name;
this.attrs = attrs;
this.children = children;
this.sourceSpan = sourceSpan;
this.startSourceSpan = startSourceSpan;
this.endSourceSpan = endSourceSpan;
}
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
Element.prototype.visit = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) { return visitor.visitElement(this, context); };
return Element;
}());
var Comment = (function () {
function Comment(value, sourceSpan) {
this.value = value;
this.sourceSpan = sourceSpan;
}
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
Comment.prototype.visit = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) { return visitor.visitComment(this, context); };
return Comment;
}());
/**
* @record
*/
/**
* @param {?} visitor
* @param {?} nodes
* @param {?=} context
* @return {?}
*/
function visitAll(visitor, nodes, context) {
if (context === void 0) { context = null; }
var /** @type {?} */ result = [];
var /** @type {?} */ visit = visitor.visit ?
function (ast) { return /** @type {?} */ ((visitor.visit))(ast, context) || ast.visit(visitor, context); } :
function (ast) { return ast.visit(visitor, context); };
nodes.forEach(function (ast) {
var /** @type {?} */ astResult = visit(ast);
if (astResult) {
result.push(astResult);
}
});
return result;
}
var RecursiveVisitor = (function () {
function RecursiveVisitor() {
}
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveVisitor.prototype.visitElement = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
this.visitChildren(context, function (visit) {
visit(ast.attrs);
visit(ast.children);
});
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveVisitor.prototype.visitAttribute = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveVisitor.prototype.visitText = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveVisitor.prototype.visitComment = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveVisitor.prototype.visitExpansion = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return this.visitChildren(context, function (visit) { visit(ast.cases); });
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveVisitor.prototype.visitExpansionCase = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @template T
* @param {?} context
* @param {?} cb
* @return {?}
*/
RecursiveVisitor.prototype.visitChildren = /**
* @template T
* @param {?} context
* @param {?} cb
* @return {?}
*/
function (context, cb) {
var /** @type {?} */ results = [];
var /** @type {?} */ t = this;
/**
* @template T
* @param {?} children
* @return {?}
*/
function visit(children) {
if (children)
results.push(visitAll(t, children, context));
}
cb(visit);
return [].concat.apply([], results);
};
return RecursiveVisitor;
}());
/**
* @param {?} ast
* @return {?}
*/
function spanOf(ast) {
var /** @type {?} */ start = ast.sourceSpan.start.offset;
var /** @type {?} */ end = ast.sourceSpan.end.offset;
if (ast instanceof Element) {
if (ast.endSourceSpan) {
end = ast.endSourceSpan.end.offset;
}
else if (ast.children && ast.children.length) {
end = spanOf(ast.children[ast.children.length - 1]).end;
}
}
return { start: start, end: end };
}
/**
* @param {?} nodes
* @param {?} position
* @return {?}
*/
function findNode(nodes, position) {
var /** @type {?} */ path = [];
var /** @type {?} */ visitor = new (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(class_1, _super);
function class_1() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
class_1.prototype.visit = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
var /** @type {?} */ span = spanOf(ast);
if (span.start <= position && position < span.end) {
path.push(ast);
}
else {
// Returning a value here will result in the children being skipped.
return true;
}
};
return class_1;
}(RecursiveVisitor));
visitAll(visitor, nodes);
return new AstPath(path, position);
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @param {?} identifier
* @param {?} value
* @return {?}
*/
function assertArrayOfStrings(identifier, value) {
if (value == null) {
return;
}
if (!Array.isArray(value)) {
throw new Error("Expected '" + identifier + "' to be an array of strings.");
}
for (var /** @type {?} */ i = 0; i < value.length; i += 1) {
if (typeof value[i] !== 'string') {
throw new Error("Expected '" + identifier + "' to be an array of strings.");
}
}
}
var INTERPOLATION_BLACKLIST_REGEXPS = [
/^\s*$/,
/[<>]/,
/^[{}]$/,
/&(#|[a-z])/i,
/^\/\//,
];
/**
* @param {?} identifier
* @param {?} value
* @return {?}
*/
function assertInterpolationSymbols(identifier, value) {
if (value != null && !(Array.isArray(value) && value.length == 2)) {
throw new Error("Expected '" + identifier + "' to be an array, [start, end].");
}
else if (value != null) {
var /** @type {?} */ start_1 = /** @type {?} */ (value[0]);
var /** @type {?} */ end_1 = /** @type {?} */ (value[1]);
// black list checking
INTERPOLATION_BLACKLIST_REGEXPS.forEach(function (regexp) {
if (regexp.test(start_1) || regexp.test(end_1)) {
throw new Error("['" + start_1 + "', '" + end_1 + "'] contains unusable interpolation symbol.");
}
});
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var InterpolationConfig = (function () {
function InterpolationConfig(start, end) {
this.start = start;
this.end = end;
}
/**
* @param {?} markers
* @return {?}
*/
InterpolationConfig.fromArray = /**
* @param {?} markers
* @return {?}
*/
function (markers) {
if (!markers) {
return DEFAULT_INTERPOLATION_CONFIG;
}
assertInterpolationSymbols('interpolation', markers);
return new InterpolationConfig(markers[0], markers[1]);
};
return InterpolationConfig;
}());
var DEFAULT_INTERPOLATION_CONFIG = new InterpolationConfig('{{', '}}');
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var StyleWithImports = (function () {
function StyleWithImports(style, styleUrls) {
this.style = style;
this.styleUrls = styleUrls;
}
return StyleWithImports;
}());
/**
* @param {?} url
* @return {?}
*/
function isStyleUrlResolvable(url) {
if (url == null || url.length === 0 || url[0] == '/')
return false;
var /** @type {?} */ schemeMatch = url.match(URL_WITH_SCHEMA_REGEXP);
return schemeMatch === null || schemeMatch[1] == 'package' || schemeMatch[1] == 'asset';
}
/**
* Rewrites stylesheets by resolving and removing the \@import urls that
* are either relative or don't have a `package:` scheme
* @param {?} resolver
* @param {?} baseUrl
* @param {?} cssText
* @return {?}
*/
function extractStyleUrls(resolver, baseUrl, cssText) {
var /** @type {?} */ foundUrls = [];
var /** @type {?} */ modifiedCssText = cssText.replace(CSS_STRIPPABLE_COMMENT_REGEXP, '')
.replace(CSS_IMPORT_REGEXP, function () {
var m = [];
for (var _i = 0; _i < arguments.length; _i++) {
m[_i] = arguments[_i];
}
var /** @type {?} */ url = m[1] || m[2];
if (!isStyleUrlResolvable(url)) {
// Do not attempt to resolve non-package absolute URLs with URI
// scheme
return m[0];
}
foundUrls.push(resolver.resolve(baseUrl, url));
return '';
});
return new StyleWithImports(modifiedCssText, foundUrls);
}
var CSS_IMPORT_REGEXP = /@import\s+(?:url\()?\s*(?:(?:['"]([^'"]*))|([^;\)\s]*))[^;]*;?/g;
var CSS_STRIPPABLE_COMMENT_REGEXP = /\/\*(?!#\s*(?:sourceURL|sourceMappingURL)=)[\s\S]+?\*\//g;
var URL_WITH_SCHEMA_REGEXP = /^([^:/?#]+):/;
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/** @enum {number} */
var TagContentType = {
RAW_TEXT: 0,
ESCAPABLE_RAW_TEXT: 1,
PARSABLE_DATA: 2,
};
TagContentType[TagContentType.RAW_TEXT] = "RAW_TEXT";
TagContentType[TagContentType.ESCAPABLE_RAW_TEXT] = "ESCAPABLE_RAW_TEXT";
TagContentType[TagContentType.PARSABLE_DATA] = "PARSABLE_DATA";
/**
* @record
*/
/**
* @param {?} elementName
* @return {?}
*/
function splitNsName(elementName) {
if (elementName[0] != ':') {
return [null, elementName];
}
var /** @type {?} */ colonIndex = elementName.indexOf(':', 1);
if (colonIndex == -1) {
throw new Error("Unsupported format \"" + elementName + "\" expecting \":namespace:name\"");
}
return [elementName.slice(1, colonIndex), elementName.slice(colonIndex + 1)];
}
/**
* @param {?} tagName
* @return {?}
*/
function isNgContainer(tagName) {
return splitNsName(tagName)[1] === 'ng-container';
}
/**
* @param {?} tagName
* @return {?}
*/
function isNgContent(tagName) {
return splitNsName(tagName)[1] === 'ng-content';
}
/**
* @param {?} tagName
* @return {?}
*/
function isNgTemplate(tagName) {
return splitNsName(tagName)[1] === 'ng-template';
}
/**
* @param {?} fullName
* @return {?}
*/
function getNsPrefix(fullName) {
return fullName === null ? null : splitNsName(fullName)[0];
}
/**
* @param {?} prefix
* @param {?} localName
* @return {?}
*/
function mergeNsAndName(prefix, localName) {
return prefix ? ":" + prefix + ":" + localName : localName;
}
// see http://www.w3.org/TR/html51/syntax.html#named-character-references
// see https://html.spec.whatwg.org/multipage/entities.json
// This list is not exhaustive to keep the compiler footprint low.
// The `{` / `ƫ` syntax should be used when the named character reference does not
// exist.
var NAMED_ENTITIES = {
'Aacute': '\u00C1',
'aacute': '\u00E1',
'Acirc': '\u00C2',
'acirc': '\u00E2',
'acute': '\u00B4',
'AElig': '\u00C6',
'aelig': '\u00E6',
'Agrave': '\u00C0',
'agrave': '\u00E0',
'alefsym': '\u2135',
'Alpha': '\u0391',
'alpha': '\u03B1',
'amp': '&',
'and': '\u2227',
'ang': '\u2220',
'apos': '\u0027',
'Aring': '\u00C5',
'aring': '\u00E5',
'asymp': '\u2248',
'Atilde': '\u00C3',
'atilde': '\u00E3',
'Auml': '\u00C4',
'auml': '\u00E4',
'bdquo': '\u201E',
'Beta': '\u0392',
'beta': '\u03B2',
'brvbar': '\u00A6',
'bull': '\u2022',
'cap': '\u2229',
'Ccedil': '\u00C7',
'ccedil': '\u00E7',
'cedil': '\u00B8',
'cent': '\u00A2',
'Chi': '\u03A7',
'chi': '\u03C7',
'circ': '\u02C6',
'clubs': '\u2663',
'cong': '\u2245',
'copy': '\u00A9',
'crarr': '\u21B5',
'cup': '\u222A',
'curren': '\u00A4',
'dagger': '\u2020',
'Dagger': '\u2021',
'darr': '\u2193',
'dArr': '\u21D3',
'deg': '\u00B0',
'Delta': '\u0394',
'delta': '\u03B4',
'diams': '\u2666',
'divide': '\u00F7',
'Eacute': '\u00C9',
'eacute': '\u00E9',
'Ecirc': '\u00CA',
'ecirc': '\u00EA',
'Egrave': '\u00C8',
'egrave': '\u00E8',
'empty': '\u2205',
'emsp': '\u2003',
'ensp': '\u2002',
'Epsilon': '\u0395',
'epsilon': '\u03B5',
'equiv': '\u2261',
'Eta': '\u0397',
'eta': '\u03B7',
'ETH': '\u00D0',
'eth': '\u00F0',
'Euml': '\u00CB',
'euml': '\u00EB',
'euro': '\u20AC',
'exist': '\u2203',
'fnof': '\u0192',
'forall': '\u2200',
'frac12': '\u00BD',
'frac14': '\u00BC',
'frac34': '\u00BE',
'frasl': '\u2044',
'Gamma': '\u0393',
'gamma': '\u03B3',
'ge': '\u2265',
'gt': '>',
'harr': '\u2194',
'hArr': '\u21D4',
'hearts': '\u2665',
'hellip': '\u2026',
'Iacute': '\u00CD',
'iacute': '\u00ED',
'Icirc': '\u00CE',
'icirc': '\u00EE',
'iexcl': '\u00A1',
'Igrave': '\u00CC',
'igrave': '\u00EC',
'image': '\u2111',
'infin': '\u221E',
'int': '\u222B',
'Iota': '\u0399',
'iota': '\u03B9',
'iquest': '\u00BF',
'isin': '\u2208',
'Iuml': '\u00CF',
'iuml': '\u00EF',
'Kappa': '\u039A',
'kappa': '\u03BA',
'Lambda': '\u039B',
'lambda': '\u03BB',
'lang': '\u27E8',
'laquo': '\u00AB',
'larr': '\u2190',
'lArr': '\u21D0',
'lceil': '\u2308',
'ldquo': '\u201C',
'le': '\u2264',
'lfloor': '\u230A',
'lowast': '\u2217',
'loz': '\u25CA',
'lrm': '\u200E',
'lsaquo': '\u2039',
'lsquo': '\u2018',
'lt': '<',
'macr': '\u00AF',
'mdash': '\u2014',
'micro': '\u00B5',
'middot': '\u00B7',
'minus': '\u2212',
'Mu': '\u039C',
'mu': '\u03BC',
'nabla': '\u2207',
'nbsp': '\u00A0',
'ndash': '\u2013',
'ne': '\u2260',
'ni': '\u220B',
'not': '\u00AC',
'notin': '\u2209',
'nsub': '\u2284',
'Ntilde': '\u00D1',
'ntilde': '\u00F1',
'Nu': '\u039D',
'nu': '\u03BD',
'Oacute': '\u00D3',
'oacute': '\u00F3',
'Ocirc': '\u00D4',
'ocirc': '\u00F4',
'OElig': '\u0152',
'oelig': '\u0153',
'Ograve': '\u00D2',
'ograve': '\u00F2',
'oline': '\u203E',
'Omega': '\u03A9',
'omega': '\u03C9',
'Omicron': '\u039F',
'omicron': '\u03BF',
'oplus': '\u2295',
'or': '\u2228',
'ordf': '\u00AA',
'ordm': '\u00BA',
'Oslash': '\u00D8',
'oslash': '\u00F8',
'Otilde': '\u00D5',
'otilde': '\u00F5',
'otimes': '\u2297',
'Ouml': '\u00D6',
'ouml': '\u00F6',
'para': '\u00B6',
'permil': '\u2030',
'perp': '\u22A5',
'Phi': '\u03A6',
'phi': '\u03C6',
'Pi': '\u03A0',
'pi': '\u03C0',
'piv': '\u03D6',
'plusmn': '\u00B1',
'pound': '\u00A3',
'prime': '\u2032',
'Prime': '\u2033',
'prod': '\u220F',
'prop': '\u221D',
'Psi': '\u03A8',
'psi': '\u03C8',
'quot': '\u0022',
'radic': '\u221A',
'rang': '\u27E9',
'raquo': '\u00BB',
'rarr': '\u2192',
'rArr': '\u21D2',
'rceil': '\u2309',
'rdquo': '\u201D',
'real': '\u211C',
'reg': '\u00AE',
'rfloor': '\u230B',
'Rho': '\u03A1',
'rho': '\u03C1',
'rlm': '\u200F',
'rsaquo': '\u203A',
'rsquo': '\u2019',
'sbquo': '\u201A',
'Scaron': '\u0160',
'scaron': '\u0161',
'sdot': '\u22C5',
'sect': '\u00A7',
'shy': '\u00AD',
'Sigma': '\u03A3',
'sigma': '\u03C3',
'sigmaf': '\u03C2',
'sim': '\u223C',
'spades': '\u2660',
'sub': '\u2282',
'sube': '\u2286',
'sum': '\u2211',
'sup': '\u2283',
'sup1': '\u00B9',
'sup2': '\u00B2',
'sup3': '\u00B3',
'supe': '\u2287',
'szlig': '\u00DF',
'Tau': '\u03A4',
'tau': '\u03C4',
'there4': '\u2234',
'Theta': '\u0398',
'theta': '\u03B8',
'thetasym': '\u03D1',
'thinsp': '\u2009',
'THORN': '\u00DE',
'thorn': '\u00FE',
'tilde': '\u02DC',
'times': '\u00D7',
'trade': '\u2122',
'Uacute': '\u00DA',
'uacute': '\u00FA',
'uarr': '\u2191',
'uArr': '\u21D1',
'Ucirc': '\u00DB',
'ucirc': '\u00FB',
'Ugrave': '\u00D9',
'ugrave': '\u00F9',
'uml': '\u00A8',
'upsih': '\u03D2',
'Upsilon': '\u03A5',
'upsilon': '\u03C5',
'Uuml': '\u00DC',
'uuml': '\u00FC',
'weierp': '\u2118',
'Xi': '\u039E',
'xi': '\u03BE',
'Yacute': '\u00DD',
'yacute': '\u00FD',
'yen': '\u00A5',
'yuml': '\u00FF',
'Yuml': '\u0178',
'Zeta': '\u0396',
'zeta': '\u03B6',
'zwj': '\u200D',
'zwnj': '\u200C',
};
// The &ngsp; pseudo-entity is denoting a space. see:
// https://github.com/dart-lang/angular/blob/0bb611387d29d65b5af7f9d2515ab571fd3fbee4/_tests/test/compiler/preserve_whitespace_test.dart
var NGSP_UNICODE = '\uE500';
NAMED_ENTITIES['ngsp'] = NGSP_UNICODE;
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var NG_CONTENT_SELECT_ATTR = 'select';
var LINK_ELEMENT = 'link';
var LINK_STYLE_REL_ATTR = 'rel';
var LINK_STYLE_HREF_ATTR = 'href';
var LINK_STYLE_REL_VALUE = 'stylesheet';
var STYLE_ELEMENT = 'style';
var SCRIPT_ELEMENT = 'script';
var NG_NON_BINDABLE_ATTR = 'ngNonBindable';
var NG_PROJECT_AS = 'ngProjectAs';
/**
* @param {?} ast
* @return {?}
*/
function preparseElement(ast) {
var /** @type {?} */ selectAttr = /** @type {?} */ ((null));
var /** @type {?} */ hrefAttr = /** @type {?} */ ((null));
var /** @type {?} */ relAttr = /** @type {?} */ ((null));
var /** @type {?} */ nonBindable = false;
var /** @type {?} */ projectAs = /** @type {?} */ ((null));
ast.attrs.forEach(function (attr) {
var /** @type {?} */ lcAttrName = attr.name.toLowerCase();
if (lcAttrName == NG_CONTENT_SELECT_ATTR) {
selectAttr = attr.value;
}
else if (lcAttrName == LINK_STYLE_HREF_ATTR) {
hrefAttr = attr.value;
}
else if (lcAttrName == LINK_STYLE_REL_ATTR) {
relAttr = attr.value;
}
else if (attr.name == NG_NON_BINDABLE_ATTR) {
nonBindable = true;
}
else if (attr.name == NG_PROJECT_AS) {
if (attr.value.length > 0) {
projectAs = attr.value;
}
}
});
selectAttr = normalizeNgContentSelect(selectAttr);
var /** @type {?} */ nodeName = ast.name.toLowerCase();
var /** @type {?} */ type = PreparsedElementType.OTHER;
if (isNgContent(nodeName)) {
type = PreparsedElementType.NG_CONTENT;
}
else if (nodeName == STYLE_ELEMENT) {
type = PreparsedElementType.STYLE;
}
else if (nodeName == SCRIPT_ELEMENT) {
type = PreparsedElementType.SCRIPT;
}
else if (nodeName == LINK_ELEMENT && relAttr == LINK_STYLE_REL_VALUE) {
type = PreparsedElementType.STYLESHEET;
}
return new PreparsedElement(type, selectAttr, hrefAttr, nonBindable, projectAs);
}
/** @enum {number} */
var PreparsedElementType = {
NG_CONTENT: 0,
STYLE: 1,
STYLESHEET: 2,
SCRIPT: 3,
OTHER: 4,
};
PreparsedElementType[PreparsedElementType.NG_CONTENT] = "NG_CONTENT";
PreparsedElementType[PreparsedElementType.STYLE] = "STYLE";
PreparsedElementType[PreparsedElementType.STYLESHEET] = "STYLESHEET";
PreparsedElementType[PreparsedElementType.SCRIPT] = "SCRIPT";
PreparsedElementType[PreparsedElementType.OTHER] = "OTHER";
var PreparsedElement = (function () {
function PreparsedElement(type, selectAttr, hrefAttr, nonBindable, projectAs) {
this.type = type;
this.selectAttr = selectAttr;
this.hrefAttr = hrefAttr;
this.nonBindable = nonBindable;
this.projectAs = projectAs;
}
return PreparsedElement;
}());
/**
* @param {?} selectAttr
* @return {?}
*/
function normalizeNgContentSelect(selectAttr) {
if (selectAttr === null || selectAttr.length === 0) {
return '*';
}
return selectAttr;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @record
*/
var DirectiveNormalizer = (function () {
function DirectiveNormalizer(_resourceLoader, _urlResolver, _htmlParser, _config) {
this._resourceLoader = _resourceLoader;
this._urlResolver = _urlResolver;
this._htmlParser = _htmlParser;
this._config = _config;
this._resourceLoaderCache = new Map();
}
/**
* @return {?}
*/
DirectiveNormalizer.prototype.clearCache = /**
* @return {?}
*/
function () { this._resourceLoaderCache.clear(); };
/**
* @param {?} normalizedDirective
* @return {?}
*/
DirectiveNormalizer.prototype.clearCacheFor = /**
* @param {?} normalizedDirective
* @return {?}
*/
function (normalizedDirective) {
var _this = this;
if (!normalizedDirective.isComponent) {
return;
}
var /** @type {?} */ template = /** @type {?} */ ((normalizedDirective.template));
this._resourceLoaderCache.delete(/** @type {?} */ ((template.templateUrl)));
template.externalStylesheets.forEach(function (stylesheet) { _this._resourceLoaderCache.delete(/** @type {?} */ ((stylesheet.moduleUrl))); });
};
/**
* @param {?} url
* @return {?}
*/
DirectiveNormalizer.prototype._fetch = /**
* @param {?} url
* @return {?}
*/
function (url) {
var /** @type {?} */ result = this._resourceLoaderCache.get(url);
if (!result) {
result = this._resourceLoader.get(url);
this._resourceLoaderCache.set(url, result);
}
return result;
};
/**
* @param {?} prenormData
* @return {?}
*/
DirectiveNormalizer.prototype.normalizeTemplate = /**
* @param {?} prenormData
* @return {?}
*/
function (prenormData) {
var _this = this;
if (isDefined(prenormData.template)) {
if (isDefined(prenormData.templateUrl)) {
throw syntaxError("'" + stringify(prenormData.componentType) + "' component cannot define both template and templateUrl");
}
if (typeof prenormData.template !== 'string') {
throw syntaxError("The template specified for component " + stringify(prenormData.componentType) + " is not a string");
}
}
else if (isDefined(prenormData.templateUrl)) {
if (typeof prenormData.templateUrl !== 'string') {
throw syntaxError("The templateUrl specified for component " + stringify(prenormData.componentType) + " is not a string");
}
}
else {
throw syntaxError("No template specified for component " + stringify(prenormData.componentType));
}
if (isDefined(prenormData.preserveWhitespaces) &&
typeof prenormData.preserveWhitespaces !== 'boolean') {
throw syntaxError("The preserveWhitespaces option for component " + stringify(prenormData.componentType) + " must be a boolean");
}
return SyncAsync.then(this._preParseTemplate(prenormData), function (preparsedTemplate) { return _this._normalizeTemplateMetadata(prenormData, preparsedTemplate); });
};
/**
* @param {?} prenomData
* @return {?}
*/
DirectiveNormalizer.prototype._preParseTemplate = /**
* @param {?} prenomData
* @return {?}
*/
function (prenomData) {
var _this = this;
var /** @type {?} */ template;
var /** @type {?} */ templateUrl;
if (prenomData.template != null) {
template = prenomData.template;
templateUrl = prenomData.moduleUrl;
}
else {
templateUrl = this._urlResolver.resolve(prenomData.moduleUrl, /** @type {?} */ ((prenomData.templateUrl)));
template = this._fetch(templateUrl);
}
return SyncAsync.then(template, function (template) { return _this._preparseLoadedTemplate(prenomData, template, templateUrl); });
};
/**
* @param {?} prenormData
* @param {?} template
* @param {?} templateAbsUrl
* @return {?}
*/
DirectiveNormalizer.prototype._preparseLoadedTemplate = /**
* @param {?} prenormData
* @param {?} template
* @param {?} templateAbsUrl
* @return {?}
*/
function (prenormData, template, templateAbsUrl) {
var /** @type {?} */ isInline = !!prenormData.template;
var /** @type {?} */ interpolationConfig = InterpolationConfig.fromArray(/** @type {?} */ ((prenormData.interpolation)));
var /** @type {?} */ rootNodesAndErrors = this._htmlParser.parse(template, templateSourceUrl({ reference: prenormData.ngModuleType }, { type: { reference: prenormData.componentType } }, { isInline: isInline, templateUrl: templateAbsUrl }), true, interpolationConfig);
if (rootNodesAndErrors.errors.length > 0) {
var /** @type {?} */ errorString = rootNodesAndErrors.errors.join('\n');
throw syntaxError("Template parse errors:\n" + errorString);
}
var /** @type {?} */ templateMetadataStyles = this._normalizeStylesheet(new CompileStylesheetMetadata({ styles: prenormData.styles, moduleUrl: prenormData.moduleUrl }));
var /** @type {?} */ visitor = new TemplatePreparseVisitor();
visitAll(visitor, rootNodesAndErrors.rootNodes);
var /** @type {?} */ templateStyles = this._normalizeStylesheet(new CompileStylesheetMetadata({ styles: visitor.styles, styleUrls: visitor.styleUrls, moduleUrl: templateAbsUrl }));
var /** @type {?} */ styles = templateMetadataStyles.styles.concat(templateStyles.styles);
var /** @type {?} */ inlineStyleUrls = templateMetadataStyles.styleUrls.concat(templateStyles.styleUrls);
var /** @type {?} */ styleUrls = this
._normalizeStylesheet(new CompileStylesheetMetadata({ styleUrls: prenormData.styleUrls, moduleUrl: prenormData.moduleUrl }))
.styleUrls;
return {
template: template,
templateUrl: templateAbsUrl, isInline: isInline,
htmlAst: rootNodesAndErrors, styles: styles, inlineStyleUrls: inlineStyleUrls, styleUrls: styleUrls,
ngContentSelectors: visitor.ngContentSelectors,
};
};
/**
* @param {?} prenormData
* @param {?} preparsedTemplate
* @return {?}
*/
DirectiveNormalizer.prototype._normalizeTemplateMetadata = /**
* @param {?} prenormData
* @param {?} preparsedTemplate
* @return {?}
*/
function (prenormData, preparsedTemplate) {
var _this = this;
return SyncAsync.then(this._loadMissingExternalStylesheets(preparsedTemplate.styleUrls.concat(preparsedTemplate.inlineStyleUrls)), function (externalStylesheets) {
return _this._normalizeLoadedTemplateMetadata(prenormData, preparsedTemplate, externalStylesheets);
});
};
/**
* @param {?} prenormData
* @param {?} preparsedTemplate
* @param {?} stylesheets
* @return {?}
*/
DirectiveNormalizer.prototype._normalizeLoadedTemplateMetadata = /**
* @param {?} prenormData
* @param {?} preparsedTemplate
* @param {?} stylesheets
* @return {?}
*/
function (prenormData, preparsedTemplate, stylesheets) {
var _this = this;
// Algorithm:
// - produce exactly 1 entry per original styleUrl in
// CompileTemplateMetadata.externalStylesheets whith all styles inlined
// - inline all styles that are referenced by the template into CompileTemplateMetadata.styles.
// Reason: be able to determine how many stylesheets there are even without loading
// the template nor the stylesheets, so we can create a stub for TypeScript always synchronously
// (as resouce loading may be async)
var /** @type {?} */ styles = preparsedTemplate.styles.slice();
this._inlineStyles(preparsedTemplate.inlineStyleUrls, stylesheets, styles);
var /** @type {?} */ styleUrls = preparsedTemplate.styleUrls;
var /** @type {?} */ externalStylesheets = styleUrls.map(function (styleUrl) {
var /** @type {?} */ stylesheet = /** @type {?} */ ((stylesheets.get(styleUrl)));
var /** @type {?} */ styles = stylesheet.styles.slice();
_this._inlineStyles(stylesheet.styleUrls, stylesheets, styles);
return new CompileStylesheetMetadata({ moduleUrl: styleUrl, styles: styles });
});
var /** @type {?} */ encapsulation = prenormData.encapsulation;
if (encapsulation == null) {
encapsulation = this._config.defaultEncapsulation;
}
if (encapsulation === ViewEncapsulation.Emulated && styles.length === 0 &&
styleUrls.length === 0) {
encapsulation = ViewEncapsulation.None;
}
return new CompileTemplateMetadata({
encapsulation: encapsulation,
template: preparsedTemplate.template,
templateUrl: preparsedTemplate.templateUrl,
htmlAst: preparsedTemplate.htmlAst, styles: styles, styleUrls: styleUrls,
ngContentSelectors: preparsedTemplate.ngContentSelectors,
animations: prenormData.animations,
interpolation: prenormData.interpolation,
isInline: preparsedTemplate.isInline, externalStylesheets: externalStylesheets,
preserveWhitespaces: preserveWhitespacesDefault(prenormData.preserveWhitespaces, this._config.preserveWhitespaces),
});
};
/**
* @param {?} styleUrls
* @param {?} stylesheets
* @param {?} targetStyles
* @return {?}
*/
DirectiveNormalizer.prototype._inlineStyles = /**
* @param {?} styleUrls
* @param {?} stylesheets
* @param {?} targetStyles
* @return {?}
*/
function (styleUrls, stylesheets, targetStyles) {
var _this = this;
styleUrls.forEach(function (styleUrl) {
var /** @type {?} */ stylesheet = /** @type {?} */ ((stylesheets.get(styleUrl)));
stylesheet.styles.forEach(function (style) { return targetStyles.push(style); });
_this._inlineStyles(stylesheet.styleUrls, stylesheets, targetStyles);
});
};
/**
* @param {?} styleUrls
* @param {?=} loadedStylesheets
* @return {?}
*/
DirectiveNormalizer.prototype._loadMissingExternalStylesheets = /**
* @param {?} styleUrls
* @param {?=} loadedStylesheets
* @return {?}
*/
function (styleUrls, loadedStylesheets) {
var _this = this;
if (loadedStylesheets === void 0) { loadedStylesheets = new Map(); }
return SyncAsync.then(SyncAsync.all(styleUrls.filter(function (styleUrl) { return !loadedStylesheets.has(styleUrl); })
.map(function (styleUrl) {
return SyncAsync.then(_this._fetch(styleUrl), function (loadedStyle) {
var /** @type {?} */ stylesheet = _this._normalizeStylesheet(new CompileStylesheetMetadata({ styles: [loadedStyle], moduleUrl: styleUrl }));
loadedStylesheets.set(styleUrl, stylesheet);
return _this._loadMissingExternalStylesheets(stylesheet.styleUrls, loadedStylesheets);
});
})), function (_) { return loadedStylesheets; });
};
/**
* @param {?} stylesheet
* @return {?}
*/
DirectiveNormalizer.prototype._normalizeStylesheet = /**
* @param {?} stylesheet
* @return {?}
*/
function (stylesheet) {
var _this = this;
var /** @type {?} */ moduleUrl = /** @type {?} */ ((stylesheet.moduleUrl));
var /** @type {?} */ allStyleUrls = stylesheet.styleUrls.filter(isStyleUrlResolvable)
.map(function (url) { return _this._urlResolver.resolve(moduleUrl, url); });
var /** @type {?} */ allStyles = stylesheet.styles.map(function (style) {
var /** @type {?} */ styleWithImports = extractStyleUrls(_this._urlResolver, moduleUrl, style);
allStyleUrls.push.apply(allStyleUrls, styleWithImports.styleUrls);
return styleWithImports.style;
});
return new CompileStylesheetMetadata({ styles: allStyles, styleUrls: allStyleUrls, moduleUrl: moduleUrl });
};
return DirectiveNormalizer;
}());
var TemplatePreparseVisitor = (function () {
function TemplatePreparseVisitor() {
this.ngContentSelectors = [];
this.styles = [];
this.styleUrls = [];
this.ngNonBindableStackCount = 0;
}
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
TemplatePreparseVisitor.prototype.visitElement = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
var /** @type {?} */ preparsedElement = preparseElement(ast);
switch (preparsedElement.type) {
case PreparsedElementType.NG_CONTENT:
if (this.ngNonBindableStackCount === 0) {
this.ngContentSelectors.push(preparsedElement.selectAttr);
}
break;
case PreparsedElementType.STYLE:
var /** @type {?} */ textContent_1 = '';
ast.children.forEach(function (child) {
if (child instanceof Text) {
textContent_1 += child.value;
}
});
this.styles.push(textContent_1);
break;
case PreparsedElementType.STYLESHEET:
this.styleUrls.push(preparsedElement.hrefAttr);
break;
default:
break;
}
if (preparsedElement.nonBindable) {
this.ngNonBindableStackCount++;
}
visitAll(this, ast.children);
if (preparsedElement.nonBindable) {
this.ngNonBindableStackCount--;
}
return null;
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
TemplatePreparseVisitor.prototype.visitExpansion = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { visitAll(this, ast.cases); };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
TemplatePreparseVisitor.prototype.visitExpansionCase = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
visitAll(this, ast.expression);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
TemplatePreparseVisitor.prototype.visitComment = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { return null; };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
TemplatePreparseVisitor.prototype.visitAttribute = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { return null; };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
TemplatePreparseVisitor.prototype.visitText = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { return null; };
return TemplatePreparseVisitor;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var QUERY_METADATA_IDENTIFIERS = [
createViewChild,
createViewChildren,
createContentChild,
createContentChildren,
];
var DirectiveResolver = (function () {
function DirectiveResolver(_reflector) {
this._reflector = _reflector;
}
/**
* @param {?} type
* @return {?}
*/
DirectiveResolver.prototype.isDirective = /**
* @param {?} type
* @return {?}
*/
function (type) {
var /** @type {?} */ typeMetadata = this._reflector.annotations(resolveForwardRef(type));
return typeMetadata && typeMetadata.some(isDirectiveMetadata);
};
/**
* @param {?} type
* @param {?=} throwIfNotFound
* @return {?}
*/
DirectiveResolver.prototype.resolve = /**
* @param {?} type
* @param {?=} throwIfNotFound
* @return {?}
*/
function (type, throwIfNotFound) {
if (throwIfNotFound === void 0) { throwIfNotFound = true; }
var /** @type {?} */ typeMetadata = this._reflector.annotations(resolveForwardRef(type));
if (typeMetadata) {
var /** @type {?} */ metadata = findLast(typeMetadata, isDirectiveMetadata);
if (metadata) {
var /** @type {?} */ propertyMetadata = this._reflector.propMetadata(type);
return this._mergeWithPropertyMetadata(metadata, propertyMetadata, type);
}
}
if (throwIfNotFound) {
throw new Error("No Directive annotation found on " + stringify(type));
}
return null;
};
/**
* @param {?} dm
* @param {?} propertyMetadata
* @param {?} directiveType
* @return {?}
*/
DirectiveResolver.prototype._mergeWithPropertyMetadata = /**
* @param {?} dm
* @param {?} propertyMetadata
* @param {?} directiveType
* @return {?}
*/
function (dm, propertyMetadata, directiveType) {
var /** @type {?} */ inputs = [];
var /** @type {?} */ outputs = [];
var /** @type {?} */ host = {};
var /** @type {?} */ queries = {};
Object.keys(propertyMetadata).forEach(function (propName) {
var /** @type {?} */ input = findLast(propertyMetadata[propName], function (a) { return createInput.isTypeOf(a); });
if (input) {
if (input.bindingPropertyName) {
inputs.push(propName + ": " + input.bindingPropertyName);
}
else {
inputs.push(propName);
}
}
var /** @type {?} */ output = findLast(propertyMetadata[propName], function (a) { return createOutput.isTypeOf(a); });
if (output) {
if (output.bindingPropertyName) {
outputs.push(propName + ": " + output.bindingPropertyName);
}
else {
outputs.push(propName);
}
}
var /** @type {?} */ hostBindings = propertyMetadata[propName].filter(function (a) { return createHostBinding.isTypeOf(a); });
hostBindings.forEach(function (hostBinding) {
if (hostBinding.hostPropertyName) {
var /** @type {?} */ startWith = hostBinding.hostPropertyName[0];
if (startWith === '(') {
throw new Error("@HostBinding can not bind to events. Use @HostListener instead.");
}
else if (startWith === '[') {
throw new Error("@HostBinding parameter should be a property name, 'class.<name>', or 'attr.<name>'.");
}
host["[" + hostBinding.hostPropertyName + "]"] = propName;
}
else {
host["[" + propName + "]"] = propName;
}
});
var /** @type {?} */ hostListeners = propertyMetadata[propName].filter(function (a) { return createHostListener.isTypeOf(a); });
hostListeners.forEach(function (hostListener) {
var /** @type {?} */ args = hostListener.args || [];
host["(" + hostListener.eventName + ")"] = propName + "(" + args.join(',') + ")";
});
var /** @type {?} */ query = findLast(propertyMetadata[propName], function (a) { return QUERY_METADATA_IDENTIFIERS.some(function (i) { return i.isTypeOf(a); }); });
if (query) {
queries[propName] = query;
}
});
return this._merge(dm, inputs, outputs, host, queries, directiveType);
};
/**
* @param {?} def
* @return {?}
*/
DirectiveResolver.prototype._extractPublicName = /**
* @param {?} def
* @return {?}
*/
function (def) { return splitAtColon(def, [/** @type {?} */ ((null)), def])[1].trim(); };
/**
* @param {?} bindings
* @return {?}
*/
DirectiveResolver.prototype._dedupeBindings = /**
* @param {?} bindings
* @return {?}
*/
function (bindings) {
var /** @type {?} */ names = new Set();
var /** @type {?} */ reversedResult = [];
// go last to first to allow later entries to overwrite previous entries
for (var /** @type {?} */ i = bindings.length - 1; i >= 0; i--) {
var /** @type {?} */ binding = bindings[i];
var /** @type {?} */ name_1 = this._extractPublicName(binding);
if (!names.has(name_1)) {
names.add(name_1);
reversedResult.push(binding);
}
}
return reversedResult.reverse();
};
/**
* @param {?} directive
* @param {?} inputs
* @param {?} outputs
* @param {?} host
* @param {?} queries
* @param {?} directiveType
* @return {?}
*/
DirectiveResolver.prototype._merge = /**
* @param {?} directive
* @param {?} inputs
* @param {?} outputs
* @param {?} host
* @param {?} queries
* @param {?} directiveType
* @return {?}
*/
function (directive, inputs, outputs, host, queries, directiveType) {
var /** @type {?} */ mergedInputs = this._dedupeBindings(directive.inputs ? directive.inputs.concat(inputs) : inputs);
var /** @type {?} */ mergedOutputs = this._dedupeBindings(directive.outputs ? directive.outputs.concat(outputs) : outputs);
var /** @type {?} */ mergedHost = directive.host ? Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({}, directive.host, host) : host;
var /** @type {?} */ mergedQueries = directive.queries ? Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({}, directive.queries, queries) : queries;
if (createComponent.isTypeOf(directive)) {
var /** @type {?} */ comp = /** @type {?} */ (directive);
return createComponent({
selector: comp.selector,
inputs: mergedInputs,
outputs: mergedOutputs,
host: mergedHost,
exportAs: comp.exportAs,
moduleId: comp.moduleId,
queries: mergedQueries,
changeDetection: comp.changeDetection,
providers: comp.providers,
viewProviders: comp.viewProviders,
entryComponents: comp.entryComponents,
template: comp.template,
templateUrl: comp.templateUrl,
styles: comp.styles,
styleUrls: comp.styleUrls,
encapsulation: comp.encapsulation,
animations: comp.animations,
interpolation: comp.interpolation,
preserveWhitespaces: directive.preserveWhitespaces,
});
}
else {
return createDirective({
selector: directive.selector,
inputs: mergedInputs,
outputs: mergedOutputs,
host: mergedHost,
exportAs: directive.exportAs,
queries: mergedQueries,
providers: directive.providers
});
}
};
return DirectiveResolver;
}());
/**
* @param {?} type
* @return {?}
*/
function isDirectiveMetadata(type) {
return createDirective.isTypeOf(type) || createComponent.isTypeOf(type);
}
/**
* @template T
* @param {?} arr
* @param {?} condition
* @return {?}
*/
function findLast(arr, condition) {
for (var /** @type {?} */ i = arr.length - 1; i >= 0; i--) {
if (condition(arr[i])) {
return arr[i];
}
}
return null;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var $EOF = 0;
var $TAB = 9;
var $LF = 10;
var $VTAB = 11;
var $FF = 12;
var $CR = 13;
var $SPACE = 32;
var $BANG = 33;
var $DQ = 34;
var $HASH = 35;
var $$ = 36;
var $PERCENT = 37;
var $AMPERSAND = 38;
var $SQ = 39;
var $LPAREN = 40;
var $RPAREN = 41;
var $STAR = 42;
var $PLUS = 43;
var $COMMA = 44;
var $MINUS = 45;
var $PERIOD = 46;
var $SLASH = 47;
var $COLON = 58;
var $SEMICOLON = 59;
var $LT = 60;
var $EQ = 61;
var $GT = 62;
var $QUESTION = 63;
var $0 = 48;
var $9 = 57;
var $A = 65;
var $E = 69;
var $F = 70;
var $X = 88;
var $Z = 90;
var $LBRACKET = 91;
var $BACKSLASH = 92;
var $RBRACKET = 93;
var $CARET = 94;
var $_ = 95;
var $a = 97;
var $e = 101;
var $f = 102;
var $n = 110;
var $r = 114;
var $t = 116;
var $u = 117;
var $v = 118;
var $x = 120;
var $z = 122;
var $LBRACE = 123;
var $BAR = 124;
var $RBRACE = 125;
var $NBSP = 160;
var $BT = 96;
/**
* @param {?} code
* @return {?}
*/
function isWhitespace(code) {
return (code >= $TAB && code <= $SPACE) || (code == $NBSP);
}
/**
* @param {?} code
* @return {?}
*/
function isDigit(code) {
return $0 <= code && code <= $9;
}
/**
* @param {?} code
* @return {?}
*/
function isAsciiLetter(code) {
return code >= $a && code <= $z || code >= $A && code <= $Z;
}
/**
* @param {?} code
* @return {?}
*/
function isAsciiHexDigit(code) {
return code >= $a && code <= $f || code >= $A && code <= $F || isDigit(code);
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/** @enum {number} */
var TokenType = {
Character: 0,
Identifier: 1,
Keyword: 2,
String: 3,
Operator: 4,
Number: 5,
Error: 6,
};
TokenType[TokenType.Character] = "Character";
TokenType[TokenType.Identifier] = "Identifier";
TokenType[TokenType.Keyword] = "Keyword";
TokenType[TokenType.String] = "String";
TokenType[TokenType.Operator] = "Operator";
TokenType[TokenType.Number] = "Number";
TokenType[TokenType.Error] = "Error";
var KEYWORDS = ['var', 'let', 'as', 'null', 'undefined', 'true', 'false', 'if', 'else', 'this'];
var Lexer = (function () {
function Lexer() {
}
/**
* @param {?} text
* @return {?}
*/
Lexer.prototype.tokenize = /**
* @param {?} text
* @return {?}
*/
function (text) {
var /** @type {?} */ scanner = new _Scanner(text);
var /** @type {?} */ tokens = [];
var /** @type {?} */ token = scanner.scanToken();
while (token != null) {
tokens.push(token);
token = scanner.scanToken();
}
return tokens;
};
return Lexer;
}());
var Token = (function () {
function Token(index, type, numValue, strValue) {
this.index = index;
this.type = type;
this.numValue = numValue;
this.strValue = strValue;
}
/**
* @param {?} code
* @return {?}
*/
Token.prototype.isCharacter = /**
* @param {?} code
* @return {?}
*/
function (code) {
return this.type == TokenType.Character && this.numValue == code;
};
/**
* @return {?}
*/
Token.prototype.isNumber = /**
* @return {?}
*/
function () { return this.type == TokenType.Number; };
/**
* @return {?}
*/
Token.prototype.isString = /**
* @return {?}
*/
function () { return this.type == TokenType.String; };
/**
* @param {?} operater
* @return {?}
*/
Token.prototype.isOperator = /**
* @param {?} operater
* @return {?}
*/
function (operater) {
return this.type == TokenType.Operator && this.strValue == operater;
};
/**
* @return {?}
*/
Token.prototype.isIdentifier = /**
* @return {?}
*/
function () { return this.type == TokenType.Identifier; };
/**
* @return {?}
*/
Token.prototype.isKeyword = /**
* @return {?}
*/
function () { return this.type == TokenType.Keyword; };
/**
* @return {?}
*/
Token.prototype.isKeywordLet = /**
* @return {?}
*/
function () { return this.type == TokenType.Keyword && this.strValue == 'let'; };
/**
* @return {?}
*/
Token.prototype.isKeywordAs = /**
* @return {?}
*/
function () { return this.type == TokenType.Keyword && this.strValue == 'as'; };
/**
* @return {?}
*/
Token.prototype.isKeywordNull = /**
* @return {?}
*/
function () { return this.type == TokenType.Keyword && this.strValue == 'null'; };
/**
* @return {?}
*/
Token.prototype.isKeywordUndefined = /**
* @return {?}
*/
function () {
return this.type == TokenType.Keyword && this.strValue == 'undefined';
};
/**
* @return {?}
*/
Token.prototype.isKeywordTrue = /**
* @return {?}
*/
function () { return this.type == TokenType.Keyword && this.strValue == 'true'; };
/**
* @return {?}
*/
Token.prototype.isKeywordFalse = /**
* @return {?}
*/
function () { return this.type == TokenType.Keyword && this.strValue == 'false'; };
/**
* @return {?}
*/
Token.prototype.isKeywordThis = /**
* @return {?}
*/
function () { return this.type == TokenType.Keyword && this.strValue == 'this'; };
/**
* @return {?}
*/
Token.prototype.isError = /**
* @return {?}
*/
function () { return this.type == TokenType.Error; };
/**
* @return {?}
*/
Token.prototype.toNumber = /**
* @return {?}
*/
function () { return this.type == TokenType.Number ? this.numValue : -1; };
/**
* @return {?}
*/
Token.prototype.toString = /**
* @return {?}
*/
function () {
switch (this.type) {
case TokenType.Character:
case TokenType.Identifier:
case TokenType.Keyword:
case TokenType.Operator:
case TokenType.String:
case TokenType.Error:
return this.strValue;
case TokenType.Number:
return this.numValue.toString();
default:
return null;
}
};
return Token;
}());
/**
* @param {?} index
* @param {?} code
* @return {?}
*/
function newCharacterToken(index, code) {
return new Token(index, TokenType.Character, code, String.fromCharCode(code));
}
/**
* @param {?} index
* @param {?} text
* @return {?}
*/
function newIdentifierToken(index, text) {
return new Token(index, TokenType.Identifier, 0, text);
}
/**
* @param {?} index
* @param {?} text
* @return {?}
*/
function newKeywordToken(index, text) {
return new Token(index, TokenType.Keyword, 0, text);
}
/**
* @param {?} index
* @param {?} text
* @return {?}
*/
function newOperatorToken(index, text) {
return new Token(index, TokenType.Operator, 0, text);
}
/**
* @param {?} index
* @param {?} text
* @return {?}
*/
function newStringToken(index, text) {
return new Token(index, TokenType.String, 0, text);
}
/**
* @param {?} index
* @param {?} n
* @return {?}
*/
function newNumberToken(index, n) {
return new Token(index, TokenType.Number, n, '');
}
/**
* @param {?} index
* @param {?} message
* @return {?}
*/
function newErrorToken(index, message) {
return new Token(index, TokenType.Error, 0, message);
}
var EOF = new Token(-1, TokenType.Character, 0, '');
var _Scanner = (function () {
function _Scanner(input) {
this.input = input;
this.peek = 0;
this.index = -1;
this.length = input.length;
this.advance();
}
/**
* @return {?}
*/
_Scanner.prototype.advance = /**
* @return {?}
*/
function () {
this.peek = ++this.index >= this.length ? $EOF : this.input.charCodeAt(this.index);
};
/**
* @return {?}
*/
_Scanner.prototype.scanToken = /**
* @return {?}
*/
function () {
var /** @type {?} */ input = this.input, /** @type {?} */ length = this.length;
var /** @type {?} */ peek = this.peek, /** @type {?} */ index = this.index;
// Skip whitespace.
while (peek <= $SPACE) {
if (++index >= length) {
peek = $EOF;
break;
}
else {
peek = input.charCodeAt(index);
}
}
this.peek = peek;
this.index = index;
if (index >= length) {
return null;
}
// Handle identifiers and numbers.
if (isIdentifierStart(peek))
return this.scanIdentifier();
if (isDigit(peek))
return this.scanNumber(index);
var /** @type {?} */ start = index;
switch (peek) {
case $PERIOD:
this.advance();
return isDigit(this.peek) ? this.scanNumber(start) :
newCharacterToken(start, $PERIOD);
case $LPAREN:
case $RPAREN:
case $LBRACE:
case $RBRACE:
case $LBRACKET:
case $RBRACKET:
case $COMMA:
case $COLON:
case $SEMICOLON:
return this.scanCharacter(start, peek);
case $SQ:
case $DQ:
return this.scanString();
case $HASH:
case $PLUS:
case $MINUS:
case $STAR:
case $SLASH:
case $PERCENT:
case $CARET:
return this.scanOperator(start, String.fromCharCode(peek));
case $QUESTION:
return this.scanComplexOperator(start, '?', $PERIOD, '.');
case $LT:
case $GT:
return this.scanComplexOperator(start, String.fromCharCode(peek), $EQ, '=');
case $BANG:
case $EQ:
return this.scanComplexOperator(start, String.fromCharCode(peek), $EQ, '=', $EQ, '=');
case $AMPERSAND:
return this.scanComplexOperator(start, '&', $AMPERSAND, '&');
case $BAR:
return this.scanComplexOperator(start, '|', $BAR, '|');
case $NBSP:
while (isWhitespace(this.peek))
this.advance();
return this.scanToken();
}
this.advance();
return this.error("Unexpected character [" + String.fromCharCode(peek) + "]", 0);
};
/**
* @param {?} start
* @param {?} code
* @return {?}
*/
_Scanner.prototype.scanCharacter = /**
* @param {?} start
* @param {?} code
* @return {?}
*/
function (start, code) {
this.advance();
return newCharacterToken(start, code);
};
/**
* @param {?} start
* @param {?} str
* @return {?}
*/
_Scanner.prototype.scanOperator = /**
* @param {?} start
* @param {?} str
* @return {?}
*/
function (start, str) {
this.advance();
return newOperatorToken(start, str);
};
/**
* Tokenize a 2/3 char long operator
*
* @param start start index in the expression
* @param one first symbol (always part of the operator)
* @param twoCode code point for the second symbol
* @param two second symbol (part of the operator when the second code point matches)
* @param threeCode code point for the third symbol
* @param three third symbol (part of the operator when provided and matches source expression)
*/
/**
* Tokenize a 2/3 char long operator
*
* @param {?} start start index in the expression
* @param {?} one first symbol (always part of the operator)
* @param {?} twoCode code point for the second symbol
* @param {?} two second symbol (part of the operator when the second code point matches)
* @param {?=} threeCode code point for the third symbol
* @param {?=} three third symbol (part of the operator when provided and matches source expression)
* @return {?}
*/
_Scanner.prototype.scanComplexOperator = /**
* Tokenize a 2/3 char long operator
*
* @param {?} start start index in the expression
* @param {?} one first symbol (always part of the operator)
* @param {?} twoCode code point for the second symbol
* @param {?} two second symbol (part of the operator when the second code point matches)
* @param {?=} threeCode code point for the third symbol
* @param {?=} three third symbol (part of the operator when provided and matches source expression)
* @return {?}
*/
function (start, one, twoCode, two, threeCode, three) {
this.advance();
var /** @type {?} */ str = one;
if (this.peek == twoCode) {
this.advance();
str += two;
}
if (threeCode != null && this.peek == threeCode) {
this.advance();
str += three;
}
return newOperatorToken(start, str);
};
/**
* @return {?}
*/
_Scanner.prototype.scanIdentifier = /**
* @return {?}
*/
function () {
var /** @type {?} */ start = this.index;
this.advance();
while (isIdentifierPart(this.peek))
this.advance();
var /** @type {?} */ str = this.input.substring(start, this.index);
return KEYWORDS.indexOf(str) > -1 ? newKeywordToken(start, str) :
newIdentifierToken(start, str);
};
/**
* @param {?} start
* @return {?}
*/
_Scanner.prototype.scanNumber = /**
* @param {?} start
* @return {?}
*/
function (start) {
var /** @type {?} */ simple = (this.index === start);
this.advance(); // Skip initial digit.
while (true) {
if (isDigit(this.peek)) {
// Do nothing.
}
else if (this.peek == $PERIOD) {
simple = false;
}
else if (isExponentStart(this.peek)) {
this.advance();
if (isExponentSign(this.peek))
this.advance();
if (!isDigit(this.peek))
return this.error('Invalid exponent', -1);
simple = false;
}
else {
break;
}
this.advance();
}
var /** @type {?} */ str = this.input.substring(start, this.index);
var /** @type {?} */ value = simple ? parseIntAutoRadix(str) : parseFloat(str);
return newNumberToken(start, value);
};
/**
* @return {?}
*/
_Scanner.prototype.scanString = /**
* @return {?}
*/
function () {
var /** @type {?} */ start = this.index;
var /** @type {?} */ quote = this.peek;
this.advance(); // Skip initial quote.
var /** @type {?} */ buffer = '';
var /** @type {?} */ marker = this.index;
var /** @type {?} */ input = this.input;
while (this.peek != quote) {
if (this.peek == $BACKSLASH) {
buffer += input.substring(marker, this.index);
this.advance();
var /** @type {?} */ unescapedCode = void 0;
// Workaround for TS2.1-introduced type strictness
this.peek = this.peek;
if (this.peek == $u) {
// 4 character hex code for unicode character.
var /** @type {?} */ hex = input.substring(this.index + 1, this.index + 5);
if (/^[0-9a-f]+$/i.test(hex)) {
unescapedCode = parseInt(hex, 16);
}
else {
return this.error("Invalid unicode escape [\\u" + hex + "]", 0);
}
for (var /** @type {?} */ i = 0; i < 5; i++) {
this.advance();
}
}
else {
unescapedCode = unescape(this.peek);
this.advance();
}
buffer += String.fromCharCode(unescapedCode);
marker = this.index;
}
else if (this.peek == $EOF) {
return this.error('Unterminated quote', 0);
}
else {
this.advance();
}
}
var /** @type {?} */ last = input.substring(marker, this.index);
this.advance(); // Skip terminating quote.
return newStringToken(start, buffer + last);
};
/**
* @param {?} message
* @param {?} offset
* @return {?}
*/
_Scanner.prototype.error = /**
* @param {?} message
* @param {?} offset
* @return {?}
*/
function (message, offset) {
var /** @type {?} */ position = this.index + offset;
return newErrorToken(position, "Lexer Error: " + message + " at column " + position + " in expression [" + this.input + "]");
};
return _Scanner;
}());
/**
* @param {?} code
* @return {?}
*/
function isIdentifierStart(code) {
return ($a <= code && code <= $z) || ($A <= code && code <= $Z) ||
(code == $_) || (code == $$);
}
/**
* @param {?} input
* @return {?}
*/
function isIdentifier(input) {
if (input.length == 0)
return false;
var /** @type {?} */ scanner = new _Scanner(input);
if (!isIdentifierStart(scanner.peek))
return false;
scanner.advance();
while (scanner.peek !== $EOF) {
if (!isIdentifierPart(scanner.peek))
return false;
scanner.advance();
}
return true;
}
/**
* @param {?} code
* @return {?}
*/
function isIdentifierPart(code) {
return isAsciiLetter(code) || isDigit(code) || (code == $_) ||
(code == $$);
}
/**
* @param {?} code
* @return {?}
*/
function isExponentStart(code) {
return code == $e || code == $E;
}
/**
* @param {?} code
* @return {?}
*/
function isExponentSign(code) {
return code == $MINUS || code == $PLUS;
}
/**
* @param {?} code
* @return {?}
*/
function isQuote(code) {
return code === $SQ || code === $DQ || code === $BT;
}
/**
* @param {?} code
* @return {?}
*/
function unescape(code) {
switch (code) {
case $n:
return $LF;
case $f:
return $FF;
case $r:
return $CR;
case $t:
return $TAB;
case $v:
return $VTAB;
default:
return code;
}
}
/**
* @param {?} text
* @return {?}
*/
function parseIntAutoRadix(text) {
var /** @type {?} */ result = parseInt(text);
if (isNaN(result)) {
throw new Error('Invalid integer literal when parsing ' + text);
}
return result;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var ParserError = (function () {
function ParserError(message, input, errLocation, ctxLocation) {
this.input = input;
this.errLocation = errLocation;
this.ctxLocation = ctxLocation;
this.message = "Parser Error: " + message + " " + errLocation + " [" + input + "] in " + ctxLocation;
}
return ParserError;
}());
var ParseSpan = (function () {
function ParseSpan(start, end) {
this.start = start;
this.end = end;
}
return ParseSpan;
}());
var AST = (function () {
function AST(span) {
this.span = span;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
AST.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) {
if (context === void 0) { context = null; }
return null;
};
/**
* @return {?}
*/
AST.prototype.toString = /**
* @return {?}
*/
function () { return 'AST'; };
return AST;
}());
/**
* Represents a quoted expression of the form:
*
* quote = prefix `:` uninterpretedExpression
* prefix = identifier
* uninterpretedExpression = arbitrary string
*
* A quoted expression is meant to be pre-processed by an AST transformer that
* converts it into another AST that no longer contains quoted expressions.
* It is meant to allow third-party developers to extend Angular template
* expression language. The `uninterpretedExpression` part of the quote is
* therefore not interpreted by the Angular's own expression parser.
*/
var Quote = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Quote, _super);
function Quote(span, prefix, uninterpretedExpression, location) {
var _this = _super.call(this, span) || this;
_this.prefix = prefix;
_this.uninterpretedExpression = uninterpretedExpression;
_this.location = location;
return _this;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
Quote.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) {
if (context === void 0) { context = null; }
return visitor.visitQuote(this, context);
};
/**
* @return {?}
*/
Quote.prototype.toString = /**
* @return {?}
*/
function () { return 'Quote'; };
return Quote;
}(AST));
var EmptyExpr = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(EmptyExpr, _super);
function EmptyExpr() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
EmptyExpr.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) {
if (context === void 0) { context = null; }
// do nothing
};
return EmptyExpr;
}(AST));
var ImplicitReceiver = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ImplicitReceiver, _super);
function ImplicitReceiver() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
ImplicitReceiver.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) {
if (context === void 0) { context = null; }
return visitor.visitImplicitReceiver(this, context);
};
return ImplicitReceiver;
}(AST));
/**
* Multiple expressions separated by a semicolon.
*/
var Chain = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Chain, _super);
function Chain(span, expressions) {
var _this = _super.call(this, span) || this;
_this.expressions = expressions;
return _this;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
Chain.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) {
if (context === void 0) { context = null; }
return visitor.visitChain(this, context);
};
return Chain;
}(AST));
var Conditional = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Conditional, _super);
function Conditional(span, condition, trueExp, falseExp) {
var _this = _super.call(this, span) || this;
_this.condition = condition;
_this.trueExp = trueExp;
_this.falseExp = falseExp;
return _this;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
Conditional.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) {
if (context === void 0) { context = null; }
return visitor.visitConditional(this, context);
};
return Conditional;
}(AST));
var PropertyRead = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(PropertyRead, _super);
function PropertyRead(span, receiver, name) {
var _this = _super.call(this, span) || this;
_this.receiver = receiver;
_this.name = name;
return _this;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
PropertyRead.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) {
if (context === void 0) { context = null; }
return visitor.visitPropertyRead(this, context);
};
return PropertyRead;
}(AST));
var PropertyWrite = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(PropertyWrite, _super);
function PropertyWrite(span, receiver, name, value) {
var _this = _super.call(this, span) || this;
_this.receiver = receiver;
_this.name = name;
_this.value = value;
return _this;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
PropertyWrite.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) {
if (context === void 0) { context = null; }
return visitor.visitPropertyWrite(this, context);
};
return PropertyWrite;
}(AST));
var SafePropertyRead = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(SafePropertyRead, _super);
function SafePropertyRead(span, receiver, name) {
var _this = _super.call(this, span) || this;
_this.receiver = receiver;
_this.name = name;
return _this;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
SafePropertyRead.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) {
if (context === void 0) { context = null; }
return visitor.visitSafePropertyRead(this, context);
};
return SafePropertyRead;
}(AST));
var KeyedRead = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(KeyedRead, _super);
function KeyedRead(span, obj, key) {
var _this = _super.call(this, span) || this;
_this.obj = obj;
_this.key = key;
return _this;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
KeyedRead.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) {
if (context === void 0) { context = null; }
return visitor.visitKeyedRead(this, context);
};
return KeyedRead;
}(AST));
var KeyedWrite = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(KeyedWrite, _super);
function KeyedWrite(span, obj, key, value) {
var _this = _super.call(this, span) || this;
_this.obj = obj;
_this.key = key;
_this.value = value;
return _this;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
KeyedWrite.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) {
if (context === void 0) { context = null; }
return visitor.visitKeyedWrite(this, context);
};
return KeyedWrite;
}(AST));
var BindingPipe = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(BindingPipe, _super);
function BindingPipe(span, exp, name, args) {
var _this = _super.call(this, span) || this;
_this.exp = exp;
_this.name = name;
_this.args = args;
return _this;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
BindingPipe.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) {
if (context === void 0) { context = null; }
return visitor.visitPipe(this, context);
};
return BindingPipe;
}(AST));
var LiteralPrimitive = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(LiteralPrimitive, _super);
function LiteralPrimitive(span, value) {
var _this = _super.call(this, span) || this;
_this.value = value;
return _this;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
LiteralPrimitive.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) {
if (context === void 0) { context = null; }
return visitor.visitLiteralPrimitive(this, context);
};
return LiteralPrimitive;
}(AST));
var LiteralArray = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(LiteralArray, _super);
function LiteralArray(span, expressions) {
var _this = _super.call(this, span) || this;
_this.expressions = expressions;
return _this;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
LiteralArray.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) {
if (context === void 0) { context = null; }
return visitor.visitLiteralArray(this, context);
};
return LiteralArray;
}(AST));
var LiteralMap = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(LiteralMap, _super);
function LiteralMap(span, keys, values) {
var _this = _super.call(this, span) || this;
_this.keys = keys;
_this.values = values;
return _this;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
LiteralMap.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) {
if (context === void 0) { context = null; }
return visitor.visitLiteralMap(this, context);
};
return LiteralMap;
}(AST));
var Interpolation = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Interpolation, _super);
function Interpolation(span, strings, expressions) {
var _this = _super.call(this, span) || this;
_this.strings = strings;
_this.expressions = expressions;
return _this;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
Interpolation.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) {
if (context === void 0) { context = null; }
return visitor.visitInterpolation(this, context);
};
return Interpolation;
}(AST));
var Binary = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Binary, _super);
function Binary(span, operation, left, right) {
var _this = _super.call(this, span) || this;
_this.operation = operation;
_this.left = left;
_this.right = right;
return _this;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
Binary.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) {
if (context === void 0) { context = null; }
return visitor.visitBinary(this, context);
};
return Binary;
}(AST));
var PrefixNot = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(PrefixNot, _super);
function PrefixNot(span, expression) {
var _this = _super.call(this, span) || this;
_this.expression = expression;
return _this;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
PrefixNot.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) {
if (context === void 0) { context = null; }
return visitor.visitPrefixNot(this, context);
};
return PrefixNot;
}(AST));
var NonNullAssert = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(NonNullAssert, _super);
function NonNullAssert(span, expression) {
var _this = _super.call(this, span) || this;
_this.expression = expression;
return _this;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
NonNullAssert.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) {
if (context === void 0) { context = null; }
return visitor.visitNonNullAssert(this, context);
};
return NonNullAssert;
}(AST));
var MethodCall = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(MethodCall, _super);
function MethodCall(span, receiver, name, args) {
var _this = _super.call(this, span) || this;
_this.receiver = receiver;
_this.name = name;
_this.args = args;
return _this;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
MethodCall.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) {
if (context === void 0) { context = null; }
return visitor.visitMethodCall(this, context);
};
return MethodCall;
}(AST));
var SafeMethodCall = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(SafeMethodCall, _super);
function SafeMethodCall(span, receiver, name, args) {
var _this = _super.call(this, span) || this;
_this.receiver = receiver;
_this.name = name;
_this.args = args;
return _this;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
SafeMethodCall.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) {
if (context === void 0) { context = null; }
return visitor.visitSafeMethodCall(this, context);
};
return SafeMethodCall;
}(AST));
var FunctionCall = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(FunctionCall, _super);
function FunctionCall(span, target, args) {
var _this = _super.call(this, span) || this;
_this.target = target;
_this.args = args;
return _this;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
FunctionCall.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) {
if (context === void 0) { context = null; }
return visitor.visitFunctionCall(this, context);
};
return FunctionCall;
}(AST));
var ASTWithSource = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ASTWithSource, _super);
function ASTWithSource(ast, source, location, errors) {
var _this = _super.call(this, new ParseSpan(0, source == null ? 0 : source.length)) || this;
_this.ast = ast;
_this.source = source;
_this.location = location;
_this.errors = errors;
return _this;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
ASTWithSource.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) {
if (context === void 0) { context = null; }
return this.ast.visit(visitor, context);
};
/**
* @return {?}
*/
ASTWithSource.prototype.toString = /**
* @return {?}
*/
function () { return this.source + " in " + this.location; };
return ASTWithSource;
}(AST));
var TemplateBinding = (function () {
function TemplateBinding(span, key, keyIsVar, name, expression) {
this.span = span;
this.key = key;
this.keyIsVar = keyIsVar;
this.name = name;
this.expression = expression;
}
return TemplateBinding;
}());
/**
* @record
*/
var NullAstVisitor = (function () {
function NullAstVisitor() {
}
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullAstVisitor.prototype.visitBinary = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullAstVisitor.prototype.visitChain = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullAstVisitor.prototype.visitConditional = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullAstVisitor.prototype.visitFunctionCall = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullAstVisitor.prototype.visitImplicitReceiver = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullAstVisitor.prototype.visitInterpolation = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullAstVisitor.prototype.visitKeyedRead = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullAstVisitor.prototype.visitKeyedWrite = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullAstVisitor.prototype.visitLiteralArray = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullAstVisitor.prototype.visitLiteralMap = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullAstVisitor.prototype.visitLiteralPrimitive = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullAstVisitor.prototype.visitMethodCall = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullAstVisitor.prototype.visitPipe = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullAstVisitor.prototype.visitPrefixNot = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullAstVisitor.prototype.visitNonNullAssert = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullAstVisitor.prototype.visitPropertyRead = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullAstVisitor.prototype.visitPropertyWrite = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullAstVisitor.prototype.visitQuote = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullAstVisitor.prototype.visitSafeMethodCall = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
NullAstVisitor.prototype.visitSafePropertyRead = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
return NullAstVisitor;
}());
var RecursiveAstVisitor = (function () {
function RecursiveAstVisitor() {
}
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitBinary = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
ast.left.visit(this);
ast.right.visit(this);
return null;
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitChain = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { return this.visitAll(ast.expressions, context); };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitConditional = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
ast.condition.visit(this);
ast.trueExp.visit(this);
ast.falseExp.visit(this);
return null;
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitPipe = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
ast.exp.visit(this);
this.visitAll(ast.args, context);
return null;
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitFunctionCall = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
/** @type {?} */ ((ast.target)).visit(this);
this.visitAll(ast.args, context);
return null;
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitImplicitReceiver = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { return null; };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitInterpolation = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return this.visitAll(ast.expressions, context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitKeyedRead = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
ast.obj.visit(this);
ast.key.visit(this);
return null;
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitKeyedWrite = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
ast.obj.visit(this);
ast.key.visit(this);
ast.value.visit(this);
return null;
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitLiteralArray = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return this.visitAll(ast.expressions, context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitLiteralMap = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { return this.visitAll(ast.values, context); };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitLiteralPrimitive = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { return null; };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitMethodCall = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
ast.receiver.visit(this);
return this.visitAll(ast.args, context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitPrefixNot = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
ast.expression.visit(this);
return null;
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitNonNullAssert = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
ast.expression.visit(this);
return null;
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitPropertyRead = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
ast.receiver.visit(this);
return null;
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitPropertyWrite = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
ast.receiver.visit(this);
ast.value.visit(this);
return null;
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitSafePropertyRead = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
ast.receiver.visit(this);
return null;
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitSafeMethodCall = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
ast.receiver.visit(this);
return this.visitAll(ast.args, context);
};
/**
* @param {?} asts
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitAll = /**
* @param {?} asts
* @param {?} context
* @return {?}
*/
function (asts, context) {
var _this = this;
asts.forEach(function (ast) { return ast.visit(_this, context); });
return null;
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitQuote = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { return null; };
return RecursiveAstVisitor;
}());
var AstTransformer = (function () {
function AstTransformer() {
}
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitImplicitReceiver = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { return ast; };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitInterpolation = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return new Interpolation(ast.span, ast.strings, this.visitAll(ast.expressions));
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitLiteralPrimitive = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return new LiteralPrimitive(ast.span, ast.value);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitPropertyRead = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return new PropertyRead(ast.span, ast.receiver.visit(this), ast.name);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitPropertyWrite = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return new PropertyWrite(ast.span, ast.receiver.visit(this), ast.name, ast.value.visit(this));
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitSafePropertyRead = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return new SafePropertyRead(ast.span, ast.receiver.visit(this), ast.name);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitMethodCall = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return new MethodCall(ast.span, ast.receiver.visit(this), ast.name, this.visitAll(ast.args));
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitSafeMethodCall = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return new SafeMethodCall(ast.span, ast.receiver.visit(this), ast.name, this.visitAll(ast.args));
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitFunctionCall = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return new FunctionCall(ast.span, /** @type {?} */ ((ast.target)).visit(this), this.visitAll(ast.args));
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitLiteralArray = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return new LiteralArray(ast.span, this.visitAll(ast.expressions));
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitLiteralMap = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return new LiteralMap(ast.span, ast.keys, this.visitAll(ast.values));
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitBinary = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return new Binary(ast.span, ast.operation, ast.left.visit(this), ast.right.visit(this));
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitPrefixNot = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return new PrefixNot(ast.span, ast.expression.visit(this));
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitNonNullAssert = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return new NonNullAssert(ast.span, ast.expression.visit(this));
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitConditional = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return new Conditional(ast.span, ast.condition.visit(this), ast.trueExp.visit(this), ast.falseExp.visit(this));
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitPipe = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return new BindingPipe(ast.span, ast.exp.visit(this), ast.name, this.visitAll(ast.args));
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitKeyedRead = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return new KeyedRead(ast.span, ast.obj.visit(this), ast.key.visit(this));
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitKeyedWrite = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return new KeyedWrite(ast.span, ast.obj.visit(this), ast.key.visit(this), ast.value.visit(this));
};
/**
* @param {?} asts
* @return {?}
*/
AstTransformer.prototype.visitAll = /**
* @param {?} asts
* @return {?}
*/
function (asts) {
var /** @type {?} */ res = new Array(asts.length);
for (var /** @type {?} */ i = 0; i < asts.length; ++i) {
res[i] = asts[i].visit(this);
}
return res;
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitChain = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return new Chain(ast.span, this.visitAll(ast.expressions));
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitQuote = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return new Quote(ast.span, ast.prefix, ast.uninterpretedExpression, ast.location);
};
return AstTransformer;
}());
/**
* @param {?} ast
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function visitAstChildren(ast, visitor, context) {
/**
* @param {?} ast
* @return {?}
*/
function visit(ast) {
visitor.visit && visitor.visit(ast, context) || ast.visit(visitor, context);
}
/**
* @template T
* @param {?} asts
* @return {?}
*/
function visitAll(asts) { asts.forEach(visit); }
ast.visit({
visitBinary: /**
* @param {?} ast
* @return {?}
*/
function (ast) {
visit(ast.left);
visit(ast.right);
},
visitChain: /**
* @param {?} ast
* @return {?}
*/
function (ast) { visitAll(ast.expressions); },
visitConditional: /**
* @param {?} ast
* @return {?}
*/
function (ast) {
visit(ast.condition);
visit(ast.trueExp);
visit(ast.falseExp);
},
visitFunctionCall: /**
* @param {?} ast
* @return {?}
*/
function (ast) {
if (ast.target) {
visit(ast.target);
}
visitAll(ast.args);
},
visitImplicitReceiver: /**
* @param {?} ast
* @return {?}
*/
function (ast) { },
visitInterpolation: /**
* @param {?} ast
* @return {?}
*/
function (ast) { visitAll(ast.expressions); },
visitKeyedRead: /**
* @param {?} ast
* @return {?}
*/
function (ast) {
visit(ast.obj);
visit(ast.key);
},
visitKeyedWrite: /**
* @param {?} ast
* @return {?}
*/
function (ast) {
visit(ast.obj);
visit(ast.key);
visit(ast.obj);
},
visitLiteralArray: /**
* @param {?} ast
* @return {?}
*/
function (ast) { visitAll(ast.expressions); },
visitLiteralMap: /**
* @param {?} ast
* @return {?}
*/
function (ast) { },
visitLiteralPrimitive: /**
* @param {?} ast
* @return {?}
*/
function (ast) { },
visitMethodCall: /**
* @param {?} ast
* @return {?}
*/
function (ast) {
visit(ast.receiver);
visitAll(ast.args);
},
visitPipe: /**
* @param {?} ast
* @return {?}
*/
function (ast) {
visit(ast.exp);
visitAll(ast.args);
},
visitPrefixNot: /**
* @param {?} ast
* @return {?}
*/
function (ast) { visit(ast.expression); },
visitNonNullAssert: /**
* @param {?} ast
* @return {?}
*/
function (ast) { visit(ast.expression); },
visitPropertyRead: /**
* @param {?} ast
* @return {?}
*/
function (ast) { visit(ast.receiver); },
visitPropertyWrite: /**
* @param {?} ast
* @return {?}
*/
function (ast) {
visit(ast.receiver);
visit(ast.value);
},
visitQuote: /**
* @param {?} ast
* @return {?}
*/
function (ast) { },
visitSafeMethodCall: /**
* @param {?} ast
* @return {?}
*/
function (ast) {
visit(ast.receiver);
visitAll(ast.args);
},
visitSafePropertyRead: /**
* @param {?} ast
* @return {?}
*/
function (ast) { visit(ast.receiver); },
});
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var SplitInterpolation = (function () {
function SplitInterpolation(strings, expressions, offsets) {
this.strings = strings;
this.expressions = expressions;
this.offsets = offsets;
}
return SplitInterpolation;
}());
var TemplateBindingParseResult = (function () {
function TemplateBindingParseResult(templateBindings, warnings, errors) {
this.templateBindings = templateBindings;
this.warnings = warnings;
this.errors = errors;
}
return TemplateBindingParseResult;
}());
/**
* @param {?} config
* @return {?}
*/
function _createInterpolateRegExp(config) {
var /** @type {?} */ pattern = escapeRegExp(config.start) + '([\\s\\S]*?)' + escapeRegExp(config.end);
return new RegExp(pattern, 'g');
}
var Parser = (function () {
function Parser(_lexer) {
this._lexer = _lexer;
this.errors = [];
}
/**
* @param {?} input
* @param {?} location
* @param {?=} interpolationConfig
* @return {?}
*/
Parser.prototype.parseAction = /**
* @param {?} input
* @param {?} location
* @param {?=} interpolationConfig
* @return {?}
*/
function (input, location, interpolationConfig) {
if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
this._checkNoInterpolation(input, location, interpolationConfig);
var /** @type {?} */ sourceToLex = this._stripComments(input);
var /** @type {?} */ tokens = this._lexer.tokenize(this._stripComments(input));
var /** @type {?} */ ast = new _ParseAST(input, location, tokens, sourceToLex.length, true, this.errors, input.length - sourceToLex.length)
.parseChain();
return new ASTWithSource(ast, input, location, this.errors);
};
/**
* @param {?} input
* @param {?} location
* @param {?=} interpolationConfig
* @return {?}
*/
Parser.prototype.parseBinding = /**
* @param {?} input
* @param {?} location
* @param {?=} interpolationConfig
* @return {?}
*/
function (input, location, interpolationConfig) {
if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
var /** @type {?} */ ast = this._parseBindingAst(input, location, interpolationConfig);
return new ASTWithSource(ast, input, location, this.errors);
};
/**
* @param {?} input
* @param {?} location
* @param {?=} interpolationConfig
* @return {?}
*/
Parser.prototype.parseSimpleBinding = /**
* @param {?} input
* @param {?} location
* @param {?=} interpolationConfig
* @return {?}
*/
function (input, location, interpolationConfig) {
if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
var /** @type {?} */ ast = this._parseBindingAst(input, location, interpolationConfig);
var /** @type {?} */ errors = SimpleExpressionChecker.check(ast);
if (errors.length > 0) {
this._reportError("Host binding expression cannot contain " + errors.join(' '), input, location);
}
return new ASTWithSource(ast, input, location, this.errors);
};
/**
* @param {?} message
* @param {?} input
* @param {?} errLocation
* @param {?=} ctxLocation
* @return {?}
*/
Parser.prototype._reportError = /**
* @param {?} message
* @param {?} input
* @param {?} errLocation
* @param {?=} ctxLocation
* @return {?}
*/
function (message, input, errLocation, ctxLocation) {
this.errors.push(new ParserError(message, input, errLocation, ctxLocation));
};
/**
* @param {?} input
* @param {?} location
* @param {?} interpolationConfig
* @return {?}
*/
Parser.prototype._parseBindingAst = /**
* @param {?} input
* @param {?} location
* @param {?} interpolationConfig
* @return {?}
*/
function (input, location, interpolationConfig) {
// Quotes expressions use 3rd-party expression language. We don't want to use
// our lexer or parser for that, so we check for that ahead of time.
var /** @type {?} */ quote = this._parseQuote(input, location);
if (quote != null) {
return quote;
}
this._checkNoInterpolation(input, location, interpolationConfig);
var /** @type {?} */ sourceToLex = this._stripComments(input);
var /** @type {?} */ tokens = this._lexer.tokenize(sourceToLex);
return new _ParseAST(input, location, tokens, sourceToLex.length, false, this.errors, input.length - sourceToLex.length)
.parseChain();
};
/**
* @param {?} input
* @param {?} location
* @return {?}
*/
Parser.prototype._parseQuote = /**
* @param {?} input
* @param {?} location
* @return {?}
*/
function (input, location) {
if (input == null)
return null;
var /** @type {?} */ prefixSeparatorIndex = input.indexOf(':');
if (prefixSeparatorIndex == -1)
return null;
var /** @type {?} */ prefix = input.substring(0, prefixSeparatorIndex).trim();
if (!isIdentifier(prefix))
return null;
var /** @type {?} */ uninterpretedExpression = input.substring(prefixSeparatorIndex + 1);
return new Quote(new ParseSpan(0, input.length), prefix, uninterpretedExpression, location);
};
/**
* @param {?} prefixToken
* @param {?} input
* @param {?} location
* @return {?}
*/
Parser.prototype.parseTemplateBindings = /**
* @param {?} prefixToken
* @param {?} input
* @param {?} location
* @return {?}
*/
function (prefixToken, input, location) {
var /** @type {?} */ tokens = this._lexer.tokenize(input);
if (prefixToken) {
// Prefix the tokens with the tokens from prefixToken but have them take no space (0 index).
var /** @type {?} */ prefixTokens = this._lexer.tokenize(prefixToken).map(function (t) {
t.index = 0;
return t;
});
tokens.unshift.apply(tokens, prefixTokens);
}
return new _ParseAST(input, location, tokens, input.length, false, this.errors, 0)
.parseTemplateBindings();
};
/**
* @param {?} input
* @param {?} location
* @param {?=} interpolationConfig
* @return {?}
*/
Parser.prototype.parseInterpolation = /**
* @param {?} input
* @param {?} location
* @param {?=} interpolationConfig
* @return {?}
*/
function (input, location, interpolationConfig) {
if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
var /** @type {?} */ split = this.splitInterpolation(input, location, interpolationConfig);
if (split == null)
return null;
var /** @type {?} */ expressions = [];
for (var /** @type {?} */ i = 0; i < split.expressions.length; ++i) {
var /** @type {?} */ expressionText = split.expressions[i];
var /** @type {?} */ sourceToLex = this._stripComments(expressionText);
var /** @type {?} */ tokens = this._lexer.tokenize(sourceToLex);
var /** @type {?} */ ast = new _ParseAST(input, location, tokens, sourceToLex.length, false, this.errors, split.offsets[i] + (expressionText.length - sourceToLex.length))
.parseChain();
expressions.push(ast);
}
return new ASTWithSource(new Interpolation(new ParseSpan(0, input == null ? 0 : input.length), split.strings, expressions), input, location, this.errors);
};
/**
* @param {?} input
* @param {?} location
* @param {?=} interpolationConfig
* @return {?}
*/
Parser.prototype.splitInterpolation = /**
* @param {?} input
* @param {?} location
* @param {?=} interpolationConfig
* @return {?}
*/
function (input, location, interpolationConfig) {
if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
var /** @type {?} */ regexp = _createInterpolateRegExp(interpolationConfig);
var /** @type {?} */ parts = input.split(regexp);
if (parts.length <= 1) {
return null;
}
var /** @type {?} */ strings = [];
var /** @type {?} */ expressions = [];
var /** @type {?} */ offsets = [];
var /** @type {?} */ offset = 0;
for (var /** @type {?} */ i = 0; i < parts.length; i++) {
var /** @type {?} */ part = parts[i];
if (i % 2 === 0) {
// fixed string
strings.push(part);
offset += part.length;
}
else if (part.trim().length > 0) {
offset += interpolationConfig.start.length;
expressions.push(part);
offsets.push(offset);
offset += part.length + interpolationConfig.end.length;
}
else {
this._reportError('Blank expressions are not allowed in interpolated strings', input, "at column " + this._findInterpolationErrorColumn(parts, i, interpolationConfig) + " in", location);
expressions.push('$implict');
offsets.push(offset);
}
}
return new SplitInterpolation(strings, expressions, offsets);
};
/**
* @param {?} input
* @param {?} location
* @return {?}
*/
Parser.prototype.wrapLiteralPrimitive = /**
* @param {?} input
* @param {?} location
* @return {?}
*/
function (input, location) {
return new ASTWithSource(new LiteralPrimitive(new ParseSpan(0, input == null ? 0 : input.length), input), input, location, this.errors);
};
/**
* @param {?} input
* @return {?}
*/
Parser.prototype._stripComments = /**
* @param {?} input
* @return {?}
*/
function (input) {
var /** @type {?} */ i = this._commentStart(input);
return i != null ? input.substring(0, i).trim() : input;
};
/**
* @param {?} input
* @return {?}
*/
Parser.prototype._commentStart = /**
* @param {?} input
* @return {?}
*/
function (input) {
var /** @type {?} */ outerQuote = null;
for (var /** @type {?} */ i = 0; i < input.length - 1; i++) {
var /** @type {?} */ char = input.charCodeAt(i);
var /** @type {?} */ nextChar = input.charCodeAt(i + 1);
if (char === $SLASH && nextChar == $SLASH && outerQuote == null)
return i;
if (outerQuote === char) {
outerQuote = null;
}
else if (outerQuote == null && isQuote(char)) {
outerQuote = char;
}
}
return null;
};
/**
* @param {?} input
* @param {?} location
* @param {?} interpolationConfig
* @return {?}
*/
Parser.prototype._checkNoInterpolation = /**
* @param {?} input
* @param {?} location
* @param {?} interpolationConfig
* @return {?}
*/
function (input, location, interpolationConfig) {
var /** @type {?} */ regexp = _createInterpolateRegExp(interpolationConfig);
var /** @type {?} */ parts = input.split(regexp);
if (parts.length > 1) {
this._reportError("Got interpolation (" + interpolationConfig.start + interpolationConfig.end + ") where expression was expected", input, "at column " + this._findInterpolationErrorColumn(parts, 1, interpolationConfig) + " in", location);
}
};
/**
* @param {?} parts
* @param {?} partInErrIdx
* @param {?} interpolationConfig
* @return {?}
*/
Parser.prototype._findInterpolationErrorColumn = /**
* @param {?} parts
* @param {?} partInErrIdx
* @param {?} interpolationConfig
* @return {?}
*/
function (parts, partInErrIdx, interpolationConfig) {
var /** @type {?} */ errLocation = '';
for (var /** @type {?} */ j = 0; j < partInErrIdx; j++) {
errLocation += j % 2 === 0 ?
parts[j] :
"" + interpolationConfig.start + parts[j] + interpolationConfig.end;
}
return errLocation.length;
};
return Parser;
}());
var _ParseAST = (function () {
function _ParseAST(input, location, tokens, inputLength, parseAction, errors, offset) {
this.input = input;
this.location = location;
this.tokens = tokens;
this.inputLength = inputLength;
this.parseAction = parseAction;
this.errors = errors;
this.offset = offset;
this.rparensExpected = 0;
this.rbracketsExpected = 0;
this.rbracesExpected = 0;
this.index = 0;
}
/**
* @param {?} offset
* @return {?}
*/
_ParseAST.prototype.peek = /**
* @param {?} offset
* @return {?}
*/
function (offset) {
var /** @type {?} */ i = this.index + offset;
return i < this.tokens.length ? this.tokens[i] : EOF;
};
Object.defineProperty(_ParseAST.prototype, "next", {
get: /**
* @return {?}
*/
function () { return this.peek(0); },
enumerable: true,
configurable: true
});
Object.defineProperty(_ParseAST.prototype, "inputIndex", {
get: /**
* @return {?}
*/
function () {
return (this.index < this.tokens.length) ? this.next.index + this.offset :
this.inputLength + this.offset;
},
enumerable: true,
configurable: true
});
/**
* @param {?} start
* @return {?}
*/
_ParseAST.prototype.span = /**
* @param {?} start
* @return {?}
*/
function (start) { return new ParseSpan(start, this.inputIndex); };
/**
* @return {?}
*/
_ParseAST.prototype.advance = /**
* @return {?}
*/
function () { this.index++; };
/**
* @param {?} code
* @return {?}
*/
_ParseAST.prototype.optionalCharacter = /**
* @param {?} code
* @return {?}
*/
function (code) {
if (this.next.isCharacter(code)) {
this.advance();
return true;
}
else {
return false;
}
};
/**
* @return {?}
*/
_ParseAST.prototype.peekKeywordLet = /**
* @return {?}
*/
function () { return this.next.isKeywordLet(); };
/**
* @return {?}
*/
_ParseAST.prototype.peekKeywordAs = /**
* @return {?}
*/
function () { return this.next.isKeywordAs(); };
/**
* @param {?} code
* @return {?}
*/
_ParseAST.prototype.expectCharacter = /**
* @param {?} code
* @return {?}
*/
function (code) {
if (this.optionalCharacter(code))
return;
this.error("Missing expected " + String.fromCharCode(code));
};
/**
* @param {?} op
* @return {?}
*/
_ParseAST.prototype.optionalOperator = /**
* @param {?} op
* @return {?}
*/
function (op) {
if (this.next.isOperator(op)) {
this.advance();
return true;
}
else {
return false;
}
};
/**
* @param {?} operator
* @return {?}
*/
_ParseAST.prototype.expectOperator = /**
* @param {?} operator
* @return {?}
*/
function (operator) {
if (this.optionalOperator(operator))
return;
this.error("Missing expected operator " + operator);
};
/**
* @return {?}
*/
_ParseAST.prototype.expectIdentifierOrKeyword = /**
* @return {?}
*/
function () {
var /** @type {?} */ n = this.next;
if (!n.isIdentifier() && !n.isKeyword()) {
this.error("Unexpected token " + n + ", expected identifier or keyword");
return '';
}
this.advance();
return /** @type {?} */ (n.toString());
};
/**
* @return {?}
*/
_ParseAST.prototype.expectIdentifierOrKeywordOrString = /**
* @return {?}
*/
function () {
var /** @type {?} */ n = this.next;
if (!n.isIdentifier() && !n.isKeyword() && !n.isString()) {
this.error("Unexpected token " + n + ", expected identifier, keyword, or string");
return '';
}
this.advance();
return /** @type {?} */ (n.toString());
};
/**
* @return {?}
*/
_ParseAST.prototype.parseChain = /**
* @return {?}
*/
function () {
var /** @type {?} */ exprs = [];
var /** @type {?} */ start = this.inputIndex;
while (this.index < this.tokens.length) {
var /** @type {?} */ expr = this.parsePipe();
exprs.push(expr);
if (this.optionalCharacter($SEMICOLON)) {
if (!this.parseAction) {
this.error('Binding expression cannot contain chained expression');
}
while (this.optionalCharacter($SEMICOLON)) {
} // read all semicolons
}
else if (this.index < this.tokens.length) {
this.error("Unexpected token '" + this.next + "'");
}
}
if (exprs.length == 0)
return new EmptyExpr(this.span(start));
if (exprs.length == 1)
return exprs[0];
return new Chain(this.span(start), exprs);
};
/**
* @return {?}
*/
_ParseAST.prototype.parsePipe = /**
* @return {?}
*/
function () {
var /** @type {?} */ result = this.parseExpression();
if (this.optionalOperator('|')) {
if (this.parseAction) {
this.error('Cannot have a pipe in an action expression');
}
do {
var /** @type {?} */ name_1 = this.expectIdentifierOrKeyword();
var /** @type {?} */ args = [];
while (this.optionalCharacter($COLON)) {
args.push(this.parseExpression());
}
result = new BindingPipe(this.span(result.span.start), result, name_1, args);
} while (this.optionalOperator('|'));
}
return result;
};
/**
* @return {?}
*/
_ParseAST.prototype.parseExpression = /**
* @return {?}
*/
function () { return this.parseConditional(); };
/**
* @return {?}
*/
_ParseAST.prototype.parseConditional = /**
* @return {?}
*/
function () {
var /** @type {?} */ start = this.inputIndex;
var /** @type {?} */ result = this.parseLogicalOr();
if (this.optionalOperator('?')) {
var /** @type {?} */ yes = this.parsePipe();
var /** @type {?} */ no = void 0;
if (!this.optionalCharacter($COLON)) {
var /** @type {?} */ end = this.inputIndex;
var /** @type {?} */ expression = this.input.substring(start, end);
this.error("Conditional expression " + expression + " requires all 3 expressions");
no = new EmptyExpr(this.span(start));
}
else {
no = this.parsePipe();
}
return new Conditional(this.span(start), result, yes, no);
}
else {
return result;
}
};
/**
* @return {?}
*/
_ParseAST.prototype.parseLogicalOr = /**
* @return {?}
*/
function () {
// '||'
var /** @type {?} */ result = this.parseLogicalAnd();
while (this.optionalOperator('||')) {
var /** @type {?} */ right = this.parseLogicalAnd();
result = new Binary(this.span(result.span.start), '||', result, right);
}
return result;
};
/**
* @return {?}
*/
_ParseAST.prototype.parseLogicalAnd = /**
* @return {?}
*/
function () {
// '&&'
var /** @type {?} */ result = this.parseEquality();
while (this.optionalOperator('&&')) {
var /** @type {?} */ right = this.parseEquality();
result = new Binary(this.span(result.span.start), '&&', result, right);
}
return result;
};
/**
* @return {?}
*/
_ParseAST.prototype.parseEquality = /**
* @return {?}
*/
function () {
// '==','!=','===','!=='
var /** @type {?} */ result = this.parseRelational();
while (this.next.type == TokenType.Operator) {
var /** @type {?} */ operator = this.next.strValue;
switch (operator) {
case '==':
case '===':
case '!=':
case '!==':
this.advance();
var /** @type {?} */ right = this.parseRelational();
result = new Binary(this.span(result.span.start), operator, result, right);
continue;
}
break;
}
return result;
};
/**
* @return {?}
*/
_ParseAST.prototype.parseRelational = /**
* @return {?}
*/
function () {
// '<', '>', '<=', '>='
var /** @type {?} */ result = this.parseAdditive();
while (this.next.type == TokenType.Operator) {
var /** @type {?} */ operator = this.next.strValue;
switch (operator) {
case '<':
case '>':
case '<=':
case '>=':
this.advance();
var /** @type {?} */ right = this.parseAdditive();
result = new Binary(this.span(result.span.start), operator, result, right);
continue;
}
break;
}
return result;
};
/**
* @return {?}
*/
_ParseAST.prototype.parseAdditive = /**
* @return {?}
*/
function () {
// '+', '-'
var /** @type {?} */ result = this.parseMultiplicative();
while (this.next.type == TokenType.Operator) {
var /** @type {?} */ operator = this.next.strValue;
switch (operator) {
case '+':
case '-':
this.advance();
var /** @type {?} */ right = this.parseMultiplicative();
result = new Binary(this.span(result.span.start), operator, result, right);
continue;
}
break;
}
return result;
};
/**
* @return {?}
*/
_ParseAST.prototype.parseMultiplicative = /**
* @return {?}
*/
function () {
// '*', '%', '/'
var /** @type {?} */ result = this.parsePrefix();
while (this.next.type == TokenType.Operator) {
var /** @type {?} */ operator = this.next.strValue;
switch (operator) {
case '*':
case '%':
case '/':
this.advance();
var /** @type {?} */ right = this.parsePrefix();
result = new Binary(this.span(result.span.start), operator, result, right);
continue;
}
break;
}
return result;
};
/**
* @return {?}
*/
_ParseAST.prototype.parsePrefix = /**
* @return {?}
*/
function () {
if (this.next.type == TokenType.Operator) {
var /** @type {?} */ start = this.inputIndex;
var /** @type {?} */ operator = this.next.strValue;
var /** @type {?} */ result = void 0;
switch (operator) {
case '+':
this.advance();
return this.parsePrefix();
case '-':
this.advance();
result = this.parsePrefix();
return new Binary(this.span(start), operator, new LiteralPrimitive(new ParseSpan(start, start), 0), result);
case '!':
this.advance();
result = this.parsePrefix();
return new PrefixNot(this.span(start), result);
}
}
return this.parseCallChain();
};
/**
* @return {?}
*/
_ParseAST.prototype.parseCallChain = /**
* @return {?}
*/
function () {
var /** @type {?} */ result = this.parsePrimary();
while (true) {
if (this.optionalCharacter($PERIOD)) {
result = this.parseAccessMemberOrMethodCall(result, false);
}
else if (this.optionalOperator('?.')) {
result = this.parseAccessMemberOrMethodCall(result, true);
}
else if (this.optionalCharacter($LBRACKET)) {
this.rbracketsExpected++;
var /** @type {?} */ key = this.parsePipe();
this.rbracketsExpected--;
this.expectCharacter($RBRACKET);
if (this.optionalOperator('=')) {
var /** @type {?} */ value = this.parseConditional();
result = new KeyedWrite(this.span(result.span.start), result, key, value);
}
else {
result = new KeyedRead(this.span(result.span.start), result, key);
}
}
else if (this.optionalCharacter($LPAREN)) {
this.rparensExpected++;
var /** @type {?} */ args = this.parseCallArguments();
this.rparensExpected--;
this.expectCharacter($RPAREN);
result = new FunctionCall(this.span(result.span.start), result, args);
}
else if (this.optionalOperator('!')) {
result = new NonNullAssert(this.span(result.span.start), result);
}
else {
return result;
}
}
};
/**
* @return {?}
*/
_ParseAST.prototype.parsePrimary = /**
* @return {?}
*/
function () {
var /** @type {?} */ start = this.inputIndex;
if (this.optionalCharacter($LPAREN)) {
this.rparensExpected++;
var /** @type {?} */ result = this.parsePipe();
this.rparensExpected--;
this.expectCharacter($RPAREN);
return result;
}
else if (this.next.isKeywordNull()) {
this.advance();
return new LiteralPrimitive(this.span(start), null);
}
else if (this.next.isKeywordUndefined()) {
this.advance();
return new LiteralPrimitive(this.span(start), void 0);
}
else if (this.next.isKeywordTrue()) {
this.advance();
return new LiteralPrimitive(this.span(start), true);
}
else if (this.next.isKeywordFalse()) {
this.advance();
return new LiteralPrimitive(this.span(start), false);
}
else if (this.next.isKeywordThis()) {
this.advance();
return new ImplicitReceiver(this.span(start));
}
else if (this.optionalCharacter($LBRACKET)) {
this.rbracketsExpected++;
var /** @type {?} */ elements = this.parseExpressionList($RBRACKET);
this.rbracketsExpected--;
this.expectCharacter($RBRACKET);
return new LiteralArray(this.span(start), elements);
}
else if (this.next.isCharacter($LBRACE)) {
return this.parseLiteralMap();
}
else if (this.next.isIdentifier()) {
return this.parseAccessMemberOrMethodCall(new ImplicitReceiver(this.span(start)), false);
}
else if (this.next.isNumber()) {
var /** @type {?} */ value = this.next.toNumber();
this.advance();
return new LiteralPrimitive(this.span(start), value);
}
else if (this.next.isString()) {
var /** @type {?} */ literalValue = this.next.toString();
this.advance();
return new LiteralPrimitive(this.span(start), literalValue);
}
else if (this.index >= this.tokens.length) {
this.error("Unexpected end of expression: " + this.input);
return new EmptyExpr(this.span(start));
}
else {
this.error("Unexpected token " + this.next);
return new EmptyExpr(this.span(start));
}
};
/**
* @param {?} terminator
* @return {?}
*/
_ParseAST.prototype.parseExpressionList = /**
* @param {?} terminator
* @return {?}
*/
function (terminator) {
var /** @type {?} */ result = [];
if (!this.next.isCharacter(terminator)) {
do {
result.push(this.parsePipe());
} while (this.optionalCharacter($COMMA));
}
return result;
};
/**
* @return {?}
*/
_ParseAST.prototype.parseLiteralMap = /**
* @return {?}
*/
function () {
var /** @type {?} */ keys = [];
var /** @type {?} */ values = [];
var /** @type {?} */ start = this.inputIndex;
this.expectCharacter($LBRACE);
if (!this.optionalCharacter($RBRACE)) {
this.rbracesExpected++;
do {
var /** @type {?} */ quoted = this.next.isString();
var /** @type {?} */ key = this.expectIdentifierOrKeywordOrString();
keys.push({ key: key, quoted: quoted });
this.expectCharacter($COLON);
values.push(this.parsePipe());
} while (this.optionalCharacter($COMMA));
this.rbracesExpected--;
this.expectCharacter($RBRACE);
}
return new LiteralMap(this.span(start), keys, values);
};
/**
* @param {?} receiver
* @param {?=} isSafe
* @return {?}
*/
_ParseAST.prototype.parseAccessMemberOrMethodCall = /**
* @param {?} receiver
* @param {?=} isSafe
* @return {?}
*/
function (receiver, isSafe) {
if (isSafe === void 0) { isSafe = false; }
var /** @type {?} */ start = receiver.span.start;
var /** @type {?} */ id = this.expectIdentifierOrKeyword();
if (this.optionalCharacter($LPAREN)) {
this.rparensExpected++;
var /** @type {?} */ args = this.parseCallArguments();
this.expectCharacter($RPAREN);
this.rparensExpected--;
var /** @type {?} */ span = this.span(start);
return isSafe ? new SafeMethodCall(span, receiver, id, args) :
new MethodCall(span, receiver, id, args);
}
else {
if (isSafe) {
if (this.optionalOperator('=')) {
this.error('The \'?.\' operator cannot be used in the assignment');
return new EmptyExpr(this.span(start));
}
else {
return new SafePropertyRead(this.span(start), receiver, id);
}
}
else {
if (this.optionalOperator('=')) {
if (!this.parseAction) {
this.error('Bindings cannot contain assignments');
return new EmptyExpr(this.span(start));
}
var /** @type {?} */ value = this.parseConditional();
return new PropertyWrite(this.span(start), receiver, id, value);
}
else {
return new PropertyRead(this.span(start), receiver, id);
}
}
}
};
/**
* @return {?}
*/
_ParseAST.prototype.parseCallArguments = /**
* @return {?}
*/
function () {
if (this.next.isCharacter($RPAREN))
return [];
var /** @type {?} */ positionals = [];
do {
positionals.push(this.parsePipe());
} while (this.optionalCharacter($COMMA));
return /** @type {?} */ (positionals);
};
/**
* An identifier, a keyword, a string with an optional `-` inbetween.
*/
/**
* An identifier, a keyword, a string with an optional `-` inbetween.
* @return {?}
*/
_ParseAST.prototype.expectTemplateBindingKey = /**
* An identifier, a keyword, a string with an optional `-` inbetween.
* @return {?}
*/
function () {
var /** @type {?} */ result = '';
var /** @type {?} */ operatorFound = false;
do {
result += this.expectIdentifierOrKeywordOrString();
operatorFound = this.optionalOperator('-');
if (operatorFound) {
result += '-';
}
} while (operatorFound);
return result.toString();
};
/**
* @return {?}
*/
_ParseAST.prototype.parseTemplateBindings = /**
* @return {?}
*/
function () {
var /** @type {?} */ bindings = [];
var /** @type {?} */ prefix = /** @type {?} */ ((null));
var /** @type {?} */ warnings = [];
while (this.index < this.tokens.length) {
var /** @type {?} */ start = this.inputIndex;
var /** @type {?} */ keyIsVar = this.peekKeywordLet();
if (keyIsVar) {
this.advance();
}
var /** @type {?} */ rawKey = this.expectTemplateBindingKey();
var /** @type {?} */ key = rawKey;
if (!keyIsVar) {
if (prefix == null) {
prefix = key;
}
else {
key = prefix + key[0].toUpperCase() + key.substring(1);
}
}
this.optionalCharacter($COLON);
var /** @type {?} */ name_2 = /** @type {?} */ ((null));
var /** @type {?} */ expression = /** @type {?} */ ((null));
if (keyIsVar) {
if (this.optionalOperator('=')) {
name_2 = this.expectTemplateBindingKey();
}
else {
name_2 = '\$implicit';
}
}
else if (this.peekKeywordAs()) {
var /** @type {?} */ letStart = this.inputIndex;
this.advance(); // consume `as`
name_2 = rawKey;
key = this.expectTemplateBindingKey(); // read local var name
keyIsVar = true;
}
else if (this.next !== EOF && !this.peekKeywordLet()) {
var /** @type {?} */ start_1 = this.inputIndex;
var /** @type {?} */ ast = this.parsePipe();
var /** @type {?} */ source = this.input.substring(start_1 - this.offset, this.inputIndex - this.offset);
expression = new ASTWithSource(ast, source, this.location, this.errors);
}
bindings.push(new TemplateBinding(this.span(start), key, keyIsVar, name_2, expression));
if (this.peekKeywordAs() && !keyIsVar) {
var /** @type {?} */ letStart = this.inputIndex;
this.advance(); // consume `as`
var /** @type {?} */ letName = this.expectTemplateBindingKey(); // read local var name
bindings.push(new TemplateBinding(this.span(letStart), letName, true, key, /** @type {?} */ ((null))));
}
if (!this.optionalCharacter($SEMICOLON)) {
this.optionalCharacter($COMMA);
}
}
return new TemplateBindingParseResult(bindings, warnings, this.errors);
};
/**
* @param {?} message
* @param {?=} index
* @return {?}
*/
_ParseAST.prototype.error = /**
* @param {?} message
* @param {?=} index
* @return {?}
*/
function (message, index) {
if (index === void 0) { index = null; }
this.errors.push(new ParserError(message, this.input, this.locationText(index), this.location));
this.skip();
};
/**
* @param {?=} index
* @return {?}
*/
_ParseAST.prototype.locationText = /**
* @param {?=} index
* @return {?}
*/
function (index) {
if (index === void 0) { index = null; }
if (index == null)
index = this.index;
return (index < this.tokens.length) ? "at column " + (this.tokens[index].index + 1) + " in" :
"at the end of the expression";
};
/**
* @return {?}
*/
_ParseAST.prototype.skip = /**
* @return {?}
*/
function () {
var /** @type {?} */ n = this.next;
while (this.index < this.tokens.length && !n.isCharacter($SEMICOLON) &&
(this.rparensExpected <= 0 || !n.isCharacter($RPAREN)) &&
(this.rbracesExpected <= 0 || !n.isCharacter($RBRACE)) &&
(this.rbracketsExpected <= 0 || !n.isCharacter($RBRACKET))) {
if (this.next.isError()) {
this.errors.push(new ParserError(/** @type {?} */ ((this.next.toString())), this.input, this.locationText(), this.location));
}
this.advance();
n = this.next;
}
};
return _ParseAST;
}());
var SimpleExpressionChecker = (function () {
function SimpleExpressionChecker() {
this.errors = [];
}
/**
* @param {?} ast
* @return {?}
*/
SimpleExpressionChecker.check = /**
* @param {?} ast
* @return {?}
*/
function (ast) {
var /** @type {?} */ s = new SimpleExpressionChecker();
ast.visit(s);
return s.errors;
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
SimpleExpressionChecker.prototype.visitImplicitReceiver = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
SimpleExpressionChecker.prototype.visitInterpolation = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
SimpleExpressionChecker.prototype.visitLiteralPrimitive = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
SimpleExpressionChecker.prototype.visitPropertyRead = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
SimpleExpressionChecker.prototype.visitPropertyWrite = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
SimpleExpressionChecker.prototype.visitSafePropertyRead = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
SimpleExpressionChecker.prototype.visitMethodCall = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
SimpleExpressionChecker.prototype.visitSafeMethodCall = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
SimpleExpressionChecker.prototype.visitFunctionCall = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
SimpleExpressionChecker.prototype.visitLiteralArray = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { this.visitAll(ast.expressions); };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
SimpleExpressionChecker.prototype.visitLiteralMap = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { this.visitAll(ast.values); };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
SimpleExpressionChecker.prototype.visitBinary = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
SimpleExpressionChecker.prototype.visitPrefixNot = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
SimpleExpressionChecker.prototype.visitNonNullAssert = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
SimpleExpressionChecker.prototype.visitConditional = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
SimpleExpressionChecker.prototype.visitPipe = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { this.errors.push('pipes'); };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
SimpleExpressionChecker.prototype.visitKeyedRead = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
SimpleExpressionChecker.prototype.visitKeyedWrite = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} asts
* @return {?}
*/
SimpleExpressionChecker.prototype.visitAll = /**
* @param {?} asts
* @return {?}
*/
function (asts) {
var _this = this;
return asts.map(function (node) { return node.visit(_this); });
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
SimpleExpressionChecker.prototype.visitChain = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
SimpleExpressionChecker.prototype.visitQuote = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
return SimpleExpressionChecker;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var ParseLocation = (function () {
function ParseLocation(file, offset, line, col) {
this.file = file;
this.offset = offset;
this.line = line;
this.col = col;
}
/**
* @return {?}
*/
ParseLocation.prototype.toString = /**
* @return {?}
*/
function () {
return this.offset != null ? this.file.url + "@" + this.line + ":" + this.col : this.file.url;
};
/**
* @param {?} delta
* @return {?}
*/
ParseLocation.prototype.moveBy = /**
* @param {?} delta
* @return {?}
*/
function (delta) {
var /** @type {?} */ source = this.file.content;
var /** @type {?} */ len = source.length;
var /** @type {?} */ offset = this.offset;
var /** @type {?} */ line = this.line;
var /** @type {?} */ col = this.col;
while (offset > 0 && delta < 0) {
offset--;
delta++;
var /** @type {?} */ ch = source.charCodeAt(offset);
if (ch == $LF) {
line--;
var /** @type {?} */ priorLine = source.substr(0, offset - 1).lastIndexOf(String.fromCharCode($LF));
col = priorLine > 0 ? offset - priorLine : offset;
}
else {
col--;
}
}
while (offset < len && delta > 0) {
var /** @type {?} */ ch = source.charCodeAt(offset);
offset++;
delta--;
if (ch == $LF) {
line++;
col = 0;
}
else {
col++;
}
}
return new ParseLocation(this.file, offset, line, col);
};
// Return the source around the location
// Up to `maxChars` or `maxLines` on each side of the location
/**
* @param {?} maxChars
* @param {?} maxLines
* @return {?}
*/
ParseLocation.prototype.getContext = /**
* @param {?} maxChars
* @param {?} maxLines
* @return {?}
*/
function (maxChars, maxLines) {
var /** @type {?} */ content = this.file.content;
var /** @type {?} */ startOffset = this.offset;
if (startOffset != null) {
if (startOffset > content.length - 1) {
startOffset = content.length - 1;
}
var /** @type {?} */ endOffset = startOffset;
var /** @type {?} */ ctxChars = 0;
var /** @type {?} */ ctxLines = 0;
while (ctxChars < maxChars && startOffset > 0) {
startOffset--;
ctxChars++;
if (content[startOffset] == '\n') {
if (++ctxLines == maxLines) {
break;
}
}
}
ctxChars = 0;
ctxLines = 0;
while (ctxChars < maxChars && endOffset < content.length - 1) {
endOffset++;
ctxChars++;
if (content[endOffset] == '\n') {
if (++ctxLines == maxLines) {
break;
}
}
}
return {
before: content.substring(startOffset, this.offset),
after: content.substring(this.offset, endOffset + 1),
};
}
return null;
};
return ParseLocation;
}());
var ParseSourceFile = (function () {
function ParseSourceFile(content, url) {
this.content = content;
this.url = url;
}
return ParseSourceFile;
}());
var ParseSourceSpan = (function () {
function ParseSourceSpan(start, end, details) {
if (details === void 0) { details = null; }
this.start = start;
this.end = end;
this.details = details;
}
/**
* @return {?}
*/
ParseSourceSpan.prototype.toString = /**
* @return {?}
*/
function () {
return this.start.file.content.substring(this.start.offset, this.end.offset);
};
return ParseSourceSpan;
}());
/** @enum {number} */
var ParseErrorLevel = {
WARNING: 0,
ERROR: 1,
};
ParseErrorLevel[ParseErrorLevel.WARNING] = "WARNING";
ParseErrorLevel[ParseErrorLevel.ERROR] = "ERROR";
var ParseError = (function () {
function ParseError(span, msg, level) {
if (level === void 0) { level = ParseErrorLevel.ERROR; }
this.span = span;
this.msg = msg;
this.level = level;
}
/**
* @return {?}
*/
ParseError.prototype.contextualMessage = /**
* @return {?}
*/
function () {
var /** @type {?} */ ctx = this.span.start.getContext(100, 3);
return ctx ? this.msg + " (\"" + ctx.before + "[" + ParseErrorLevel[this.level] + " ->]" + ctx.after + "\")" :
this.msg;
};
/**
* @return {?}
*/
ParseError.prototype.toString = /**
* @return {?}
*/
function () {
var /** @type {?} */ details = this.span.details ? ", " + this.span.details : '';
return this.contextualMessage() + ": " + this.span.start + details;
};
return ParseError;
}());
/**
* @param {?} kind
* @param {?} type
* @return {?}
*/
function typeSourceSpan(kind, type) {
var /** @type {?} */ moduleUrl = identifierModuleUrl(type);
var /** @type {?} */ sourceFileName = moduleUrl != null ? "in " + kind + " " + identifierName(type) + " in " + moduleUrl :
"in " + kind + " " + identifierName(type);
var /** @type {?} */ sourceFile = new ParseSourceFile('', sourceFileName);
return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/** @enum {number} */
var TokenType$1 = {
TAG_OPEN_START: 0,
TAG_OPEN_END: 1,
TAG_OPEN_END_VOID: 2,
TAG_CLOSE: 3,
TEXT: 4,
ESCAPABLE_RAW_TEXT: 5,
RAW_TEXT: 6,
COMMENT_START: 7,
COMMENT_END: 8,
CDATA_START: 9,
CDATA_END: 10,
ATTR_NAME: 11,
ATTR_VALUE: 12,
DOC_TYPE: 13,
EXPANSION_FORM_START: 14,
EXPANSION_CASE_VALUE: 15,
EXPANSION_CASE_EXP_START: 16,
EXPANSION_CASE_EXP_END: 17,
EXPANSION_FORM_END: 18,
EOF: 19,
};
TokenType$1[TokenType$1.TAG_OPEN_START] = "TAG_OPEN_START";
TokenType$1[TokenType$1.TAG_OPEN_END] = "TAG_OPEN_END";
TokenType$1[TokenType$1.TAG_OPEN_END_VOID] = "TAG_OPEN_END_VOID";
TokenType$1[TokenType$1.TAG_CLOSE] = "TAG_CLOSE";
TokenType$1[TokenType$1.TEXT] = "TEXT";
TokenType$1[TokenType$1.ESCAPABLE_RAW_TEXT] = "ESCAPABLE_RAW_TEXT";
TokenType$1[TokenType$1.RAW_TEXT] = "RAW_TEXT";
TokenType$1[TokenType$1.COMMENT_START] = "COMMENT_START";
TokenType$1[TokenType$1.COMMENT_END] = "COMMENT_END";
TokenType$1[TokenType$1.CDATA_START] = "CDATA_START";
TokenType$1[TokenType$1.CDATA_END] = "CDATA_END";
TokenType$1[TokenType$1.ATTR_NAME] = "ATTR_NAME";
TokenType$1[TokenType$1.ATTR_VALUE] = "ATTR_VALUE";
TokenType$1[TokenType$1.DOC_TYPE] = "DOC_TYPE";
TokenType$1[TokenType$1.EXPANSION_FORM_START] = "EXPANSION_FORM_START";
TokenType$1[TokenType$1.EXPANSION_CASE_VALUE] = "EXPANSION_CASE_VALUE";
TokenType$1[TokenType$1.EXPANSION_CASE_EXP_START] = "EXPANSION_CASE_EXP_START";
TokenType$1[TokenType$1.EXPANSION_CASE_EXP_END] = "EXPANSION_CASE_EXP_END";
TokenType$1[TokenType$1.EXPANSION_FORM_END] = "EXPANSION_FORM_END";
TokenType$1[TokenType$1.EOF] = "EOF";
var Token$1 = (function () {
function Token(type, parts, sourceSpan) {
this.type = type;
this.parts = parts;
this.sourceSpan = sourceSpan;
}
return Token;
}());
var TokenError = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(TokenError, _super);
function TokenError(errorMsg, tokenType, span) {
var _this = _super.call(this, span, errorMsg) || this;
_this.tokenType = tokenType;
return _this;
}
return TokenError;
}(ParseError));
var TokenizeResult = (function () {
function TokenizeResult(tokens, errors) {
this.tokens = tokens;
this.errors = errors;
}
return TokenizeResult;
}());
/**
* @param {?} source
* @param {?} url
* @param {?} getTagDefinition
* @param {?=} tokenizeExpansionForms
* @param {?=} interpolationConfig
* @return {?}
*/
function tokenize(source, url, getTagDefinition, tokenizeExpansionForms, interpolationConfig) {
if (tokenizeExpansionForms === void 0) { tokenizeExpansionForms = false; }
if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
return new _Tokenizer(new ParseSourceFile(source, url), getTagDefinition, tokenizeExpansionForms, interpolationConfig)
.tokenize();
}
var _CR_OR_CRLF_REGEXP = /\r\n?/g;
/**
* @param {?} charCode
* @return {?}
*/
function _unexpectedCharacterErrorMsg(charCode) {
var /** @type {?} */ char = charCode === $EOF ? 'EOF' : String.fromCharCode(charCode);
return "Unexpected character \"" + char + "\"";
}
/**
* @param {?} entitySrc
* @return {?}
*/
function _unknownEntityErrorMsg(entitySrc) {
return "Unknown entity \"" + entitySrc + "\" - use the \"&#<decimal>;\" or \"&#x<hex>;\" syntax";
}
var _ControlFlowError = (function () {
function _ControlFlowError(error) {
this.error = error;
}
return _ControlFlowError;
}());
var _Tokenizer = (function () {
/**
* @param _file The html source
* @param _getTagDefinition
* @param _tokenizeIcu Whether to tokenize ICU messages (considered as text nodes when false)
* @param _interpolationConfig
*/
function _Tokenizer(_file, _getTagDefinition, _tokenizeIcu, _interpolationConfig) {
if (_interpolationConfig === void 0) { _interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
this._file = _file;
this._getTagDefinition = _getTagDefinition;
this._tokenizeIcu = _tokenizeIcu;
this._interpolationConfig = _interpolationConfig;
this._peek = -1;
this._nextPeek = -1;
this._index = -1;
this._line = 0;
this._column = -1;
this._expansionCaseStack = [];
this._inInterpolation = false;
this.tokens = [];
this.errors = [];
this._input = _file.content;
this._length = _file.content.length;
this._advance();
}
/**
* @param {?} content
* @return {?}
*/
_Tokenizer.prototype._processCarriageReturns = /**
* @param {?} content
* @return {?}
*/
function (content) {
// http://www.w3.org/TR/html5/syntax.html#preprocessing-the-input-stream
// In order to keep the original position in the source, we can not
// pre-process it.
// Instead CRs are processed right before instantiating the tokens.
return content.replace(_CR_OR_CRLF_REGEXP, '\n');
};
/**
* @return {?}
*/
_Tokenizer.prototype.tokenize = /**
* @return {?}
*/
function () {
while (this._peek !== $EOF) {
var /** @type {?} */ start = this._getLocation();
try {
if (this._attemptCharCode($LT)) {
if (this._attemptCharCode($BANG)) {
if (this._attemptCharCode($LBRACKET)) {
this._consumeCdata(start);
}
else if (this._attemptCharCode($MINUS)) {
this._consumeComment(start);
}
else {
this._consumeDocType(start);
}
}
else if (this._attemptCharCode($SLASH)) {
this._consumeTagClose(start);
}
else {
this._consumeTagOpen(start);
}
}
else if (!(this._tokenizeIcu && this._tokenizeExpansionForm())) {
this._consumeText();
}
}
catch (/** @type {?} */ e) {
if (e instanceof _ControlFlowError) {
this.errors.push(e.error);
}
else {
throw e;
}
}
}
this._beginToken(TokenType$1.EOF);
this._endToken([]);
return new TokenizeResult(mergeTextTokens(this.tokens), this.errors);
};
/**
* \@internal
* @return {?} whether an ICU token has been created
*/
_Tokenizer.prototype._tokenizeExpansionForm = /**
* \@internal
* @return {?} whether an ICU token has been created
*/
function () {
if (isExpansionFormStart(this._input, this._index, this._interpolationConfig)) {
this._consumeExpansionFormStart();
return true;
}
if (isExpansionCaseStart(this._peek) && this._isInExpansionForm()) {
this._consumeExpansionCaseStart();
return true;
}
if (this._peek === $RBRACE) {
if (this._isInExpansionCase()) {
this._consumeExpansionCaseEnd();
return true;
}
if (this._isInExpansionForm()) {
this._consumeExpansionFormEnd();
return true;
}
}
return false;
};
/**
* @return {?}
*/
_Tokenizer.prototype._getLocation = /**
* @return {?}
*/
function () {
return new ParseLocation(this._file, this._index, this._line, this._column);
};
/**
* @param {?=} start
* @param {?=} end
* @return {?}
*/
_Tokenizer.prototype._getSpan = /**
* @param {?=} start
* @param {?=} end
* @return {?}
*/
function (start, end) {
if (start === void 0) { start = this._getLocation(); }
if (end === void 0) { end = this._getLocation(); }
return new ParseSourceSpan(start, end);
};
/**
* @param {?} type
* @param {?=} start
* @return {?}
*/
_Tokenizer.prototype._beginToken = /**
* @param {?} type
* @param {?=} start
* @return {?}
*/
function (type, start) {
if (start === void 0) { start = this._getLocation(); }
this._currentTokenStart = start;
this._currentTokenType = type;
};
/**
* @param {?} parts
* @param {?=} end
* @return {?}
*/
_Tokenizer.prototype._endToken = /**
* @param {?} parts
* @param {?=} end
* @return {?}
*/
function (parts, end) {
if (end === void 0) { end = this._getLocation(); }
var /** @type {?} */ token = new Token$1(this._currentTokenType, parts, new ParseSourceSpan(this._currentTokenStart, end));
this.tokens.push(token);
this._currentTokenStart = /** @type {?} */ ((null));
this._currentTokenType = /** @type {?} */ ((null));
return token;
};
/**
* @param {?} msg
* @param {?} span
* @return {?}
*/
_Tokenizer.prototype._createError = /**
* @param {?} msg
* @param {?} span
* @return {?}
*/
function (msg, span) {
if (this._isInExpansionForm()) {
msg += " (Do you have an unescaped \"{\" in your template? Use \"{{ '{' }}\") to escape it.)";
}
var /** @type {?} */ error = new TokenError(msg, this._currentTokenType, span);
this._currentTokenStart = /** @type {?} */ ((null));
this._currentTokenType = /** @type {?} */ ((null));
return new _ControlFlowError(error);
};
/**
* @return {?}
*/
_Tokenizer.prototype._advance = /**
* @return {?}
*/
function () {
if (this._index >= this._length) {
throw this._createError(_unexpectedCharacterErrorMsg($EOF), this._getSpan());
}
if (this._peek === $LF) {
this._line++;
this._column = 0;
}
else if (this._peek !== $LF && this._peek !== $CR) {
this._column++;
}
this._index++;
this._peek = this._index >= this._length ? $EOF : this._input.charCodeAt(this._index);
this._nextPeek =
this._index + 1 >= this._length ? $EOF : this._input.charCodeAt(this._index + 1);
};
/**
* @param {?} charCode
* @return {?}
*/
_Tokenizer.prototype._attemptCharCode = /**
* @param {?} charCode
* @return {?}
*/
function (charCode) {
if (this._peek === charCode) {
this._advance();
return true;
}
return false;
};
/**
* @param {?} charCode
* @return {?}
*/
_Tokenizer.prototype._attemptCharCodeCaseInsensitive = /**
* @param {?} charCode
* @return {?}
*/
function (charCode) {
if (compareCharCodeCaseInsensitive(this._peek, charCode)) {
this._advance();
return true;
}
return false;
};
/**
* @param {?} charCode
* @return {?}
*/
_Tokenizer.prototype._requireCharCode = /**
* @param {?} charCode
* @return {?}
*/
function (charCode) {
var /** @type {?} */ location = this._getLocation();
if (!this._attemptCharCode(charCode)) {
throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan(location, location));
}
};
/**
* @param {?} chars
* @return {?}
*/
_Tokenizer.prototype._attemptStr = /**
* @param {?} chars
* @return {?}
*/
function (chars) {
var /** @type {?} */ len = chars.length;
if (this._index + len > this._length) {
return false;
}
var /** @type {?} */ initialPosition = this._savePosition();
for (var /** @type {?} */ i = 0; i < len; i++) {
if (!this._attemptCharCode(chars.charCodeAt(i))) {
// If attempting to parse the string fails, we want to reset the parser
// to where it was before the attempt
this._restorePosition(initialPosition);
return false;
}
}
return true;
};
/**
* @param {?} chars
* @return {?}
*/
_Tokenizer.prototype._attemptStrCaseInsensitive = /**
* @param {?} chars
* @return {?}
*/
function (chars) {
for (var /** @type {?} */ i = 0; i < chars.length; i++) {
if (!this._attemptCharCodeCaseInsensitive(chars.charCodeAt(i))) {
return false;
}
}
return true;
};
/**
* @param {?} chars
* @return {?}
*/
_Tokenizer.prototype._requireStr = /**
* @param {?} chars
* @return {?}
*/
function (chars) {
var /** @type {?} */ location = this._getLocation();
if (!this._attemptStr(chars)) {
throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan(location));
}
};
/**
* @param {?} predicate
* @return {?}
*/
_Tokenizer.prototype._attemptCharCodeUntilFn = /**
* @param {?} predicate
* @return {?}
*/
function (predicate) {
while (!predicate(this._peek)) {
this._advance();
}
};
/**
* @param {?} predicate
* @param {?} len
* @return {?}
*/
_Tokenizer.prototype._requireCharCodeUntilFn = /**
* @param {?} predicate
* @param {?} len
* @return {?}
*/
function (predicate, len) {
var /** @type {?} */ start = this._getLocation();
this._attemptCharCodeUntilFn(predicate);
if (this._index - start.offset < len) {
throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan(start, start));
}
};
/**
* @param {?} char
* @return {?}
*/
_Tokenizer.prototype._attemptUntilChar = /**
* @param {?} char
* @return {?}
*/
function (char) {
while (this._peek !== char) {
this._advance();
}
};
/**
* @param {?} decodeEntities
* @return {?}
*/
_Tokenizer.prototype._readChar = /**
* @param {?} decodeEntities
* @return {?}
*/
function (decodeEntities) {
if (decodeEntities && this._peek === $AMPERSAND) {
return this._decodeEntity();
}
else {
var /** @type {?} */ index = this._index;
this._advance();
return this._input[index];
}
};
/**
* @return {?}
*/
_Tokenizer.prototype._decodeEntity = /**
* @return {?}
*/
function () {
var /** @type {?} */ start = this._getLocation();
this._advance();
if (this._attemptCharCode($HASH)) {
var /** @type {?} */ isHex = this._attemptCharCode($x) || this._attemptCharCode($X);
var /** @type {?} */ numberStart = this._getLocation().offset;
this._attemptCharCodeUntilFn(isDigitEntityEnd);
if (this._peek != $SEMICOLON) {
throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan());
}
this._advance();
var /** @type {?} */ strNum = this._input.substring(numberStart, this._index - 1);
try {
var /** @type {?} */ charCode = parseInt(strNum, isHex ? 16 : 10);
return String.fromCharCode(charCode);
}
catch (/** @type {?} */ e) {
var /** @type {?} */ entity = this._input.substring(start.offset + 1, this._index - 1);
throw this._createError(_unknownEntityErrorMsg(entity), this._getSpan(start));
}
}
else {
var /** @type {?} */ startPosition = this._savePosition();
this._attemptCharCodeUntilFn(isNamedEntityEnd);
if (this._peek != $SEMICOLON) {
this._restorePosition(startPosition);
return '&';
}
this._advance();
var /** @type {?} */ name_1 = this._input.substring(start.offset + 1, this._index - 1);
var /** @type {?} */ char = NAMED_ENTITIES[name_1];
if (!char) {
throw this._createError(_unknownEntityErrorMsg(name_1), this._getSpan(start));
}
return char;
}
};
/**
* @param {?} decodeEntities
* @param {?} firstCharOfEnd
* @param {?} attemptEndRest
* @return {?}
*/
_Tokenizer.prototype._consumeRawText = /**
* @param {?} decodeEntities
* @param {?} firstCharOfEnd
* @param {?} attemptEndRest
* @return {?}
*/
function (decodeEntities, firstCharOfEnd, attemptEndRest) {
var /** @type {?} */ tagCloseStart;
var /** @type {?} */ textStart = this._getLocation();
this._beginToken(decodeEntities ? TokenType$1.ESCAPABLE_RAW_TEXT : TokenType$1.RAW_TEXT, textStart);
var /** @type {?} */ parts = [];
while (true) {
tagCloseStart = this._getLocation();
if (this._attemptCharCode(firstCharOfEnd) && attemptEndRest()) {
break;
}
if (this._index > tagCloseStart.offset) {
// add the characters consumed by the previous if statement to the output
parts.push(this._input.substring(tagCloseStart.offset, this._index));
}
while (this._peek !== firstCharOfEnd) {
parts.push(this._readChar(decodeEntities));
}
}
return this._endToken([this._processCarriageReturns(parts.join(''))], tagCloseStart);
};
/**
* @param {?} start
* @return {?}
*/
_Tokenizer.prototype._consumeComment = /**
* @param {?} start
* @return {?}
*/
function (start) {
var _this = this;
this._beginToken(TokenType$1.COMMENT_START, start);
this._requireCharCode($MINUS);
this._endToken([]);
var /** @type {?} */ textToken = this._consumeRawText(false, $MINUS, function () { return _this._attemptStr('->'); });
this._beginToken(TokenType$1.COMMENT_END, textToken.sourceSpan.end);
this._endToken([]);
};
/**
* @param {?} start
* @return {?}
*/
_Tokenizer.prototype._consumeCdata = /**
* @param {?} start
* @return {?}
*/
function (start) {
var _this = this;
this._beginToken(TokenType$1.CDATA_START, start);
this._requireStr('CDATA[');
this._endToken([]);
var /** @type {?} */ textToken = this._consumeRawText(false, $RBRACKET, function () { return _this._attemptStr(']>'); });
this._beginToken(TokenType$1.CDATA_END, textToken.sourceSpan.end);
this._endToken([]);
};
/**
* @param {?} start
* @return {?}
*/
_Tokenizer.prototype._consumeDocType = /**
* @param {?} start
* @return {?}
*/
function (start) {
this._beginToken(TokenType$1.DOC_TYPE, start);
this._attemptUntilChar($GT);
this._advance();
this._endToken([this._input.substring(start.offset + 2, this._index - 1)]);
};
/**
* @return {?}
*/
_Tokenizer.prototype._consumePrefixAndName = /**
* @return {?}
*/
function () {
var /** @type {?} */ nameOrPrefixStart = this._index;
var /** @type {?} */ prefix = /** @type {?} */ ((null));
while (this._peek !== $COLON && !isPrefixEnd(this._peek)) {
this._advance();
}
var /** @type {?} */ nameStart;
if (this._peek === $COLON) {
this._advance();
prefix = this._input.substring(nameOrPrefixStart, this._index - 1);
nameStart = this._index;
}
else {
nameStart = nameOrPrefixStart;
}
this._requireCharCodeUntilFn(isNameEnd, this._index === nameStart ? 1 : 0);
var /** @type {?} */ name = this._input.substring(nameStart, this._index);
return [prefix, name];
};
/**
* @param {?} start
* @return {?}
*/
_Tokenizer.prototype._consumeTagOpen = /**
* @param {?} start
* @return {?}
*/
function (start) {
var /** @type {?} */ savedPos = this._savePosition();
var /** @type {?} */ tagName;
var /** @type {?} */ lowercaseTagName;
try {
if (!isAsciiLetter(this._peek)) {
throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan());
}
var /** @type {?} */ nameStart = this._index;
this._consumeTagOpenStart(start);
tagName = this._input.substring(nameStart, this._index);
lowercaseTagName = tagName.toLowerCase();
this._attemptCharCodeUntilFn(isNotWhitespace);
while (this._peek !== $SLASH && this._peek !== $GT) {
this._consumeAttributeName();
this._attemptCharCodeUntilFn(isNotWhitespace);
if (this._attemptCharCode($EQ)) {
this._attemptCharCodeUntilFn(isNotWhitespace);
this._consumeAttributeValue();
}
this._attemptCharCodeUntilFn(isNotWhitespace);
}
this._consumeTagOpenEnd();
}
catch (/** @type {?} */ e) {
if (e instanceof _ControlFlowError) {
// When the start tag is invalid, assume we want a "<"
this._restorePosition(savedPos);
// Back to back text tokens are merged at the end
this._beginToken(TokenType$1.TEXT, start);
this._endToken(['<']);
return;
}
throw e;
}
var /** @type {?} */ contentTokenType = this._getTagDefinition(tagName).contentType;
if (contentTokenType === TagContentType.RAW_TEXT) {
this._consumeRawTextWithTagClose(lowercaseTagName, false);
}
else if (contentTokenType === TagContentType.ESCAPABLE_RAW_TEXT) {
this._consumeRawTextWithTagClose(lowercaseTagName, true);
}
};
/**
* @param {?} lowercaseTagName
* @param {?} decodeEntities
* @return {?}
*/
_Tokenizer.prototype._consumeRawTextWithTagClose = /**
* @param {?} lowercaseTagName
* @param {?} decodeEntities
* @return {?}
*/
function (lowercaseTagName, decodeEntities) {
var _this = this;
var /** @type {?} */ textToken = this._consumeRawText(decodeEntities, $LT, function () {
if (!_this._attemptCharCode($SLASH))
return false;
_this._attemptCharCodeUntilFn(isNotWhitespace);
if (!_this._attemptStrCaseInsensitive(lowercaseTagName))
return false;
_this._attemptCharCodeUntilFn(isNotWhitespace);
return _this._attemptCharCode($GT);
});
this._beginToken(TokenType$1.TAG_CLOSE, textToken.sourceSpan.end);
this._endToken([/** @type {?} */ ((null)), lowercaseTagName]);
};
/**
* @param {?} start
* @return {?}
*/
_Tokenizer.prototype._consumeTagOpenStart = /**
* @param {?} start
* @return {?}
*/
function (start) {
this._beginToken(TokenType$1.TAG_OPEN_START, start);
var /** @type {?} */ parts = this._consumePrefixAndName();
this._endToken(parts);
};
/**
* @return {?}
*/
_Tokenizer.prototype._consumeAttributeName = /**
* @return {?}
*/
function () {
this._beginToken(TokenType$1.ATTR_NAME);
var /** @type {?} */ prefixAndName = this._consumePrefixAndName();
this._endToken(prefixAndName);
};
/**
* @return {?}
*/
_Tokenizer.prototype._consumeAttributeValue = /**
* @return {?}
*/
function () {
this._beginToken(TokenType$1.ATTR_VALUE);
var /** @type {?} */ value;
if (this._peek === $SQ || this._peek === $DQ) {
var /** @type {?} */ quoteChar = this._peek;
this._advance();
var /** @type {?} */ parts = [];
while (this._peek !== quoteChar) {
parts.push(this._readChar(true));
}
value = parts.join('');
this._advance();
}
else {
var /** @type {?} */ valueStart = this._index;
this._requireCharCodeUntilFn(isNameEnd, 1);
value = this._input.substring(valueStart, this._index);
}
this._endToken([this._processCarriageReturns(value)]);
};
/**
* @return {?}
*/
_Tokenizer.prototype._consumeTagOpenEnd = /**
* @return {?}
*/
function () {
var /** @type {?} */ tokenType = this._attemptCharCode($SLASH) ? TokenType$1.TAG_OPEN_END_VOID : TokenType$1.TAG_OPEN_END;
this._beginToken(tokenType);
this._requireCharCode($GT);
this._endToken([]);
};
/**
* @param {?} start
* @return {?}
*/
_Tokenizer.prototype._consumeTagClose = /**
* @param {?} start
* @return {?}
*/
function (start) {
this._beginToken(TokenType$1.TAG_CLOSE, start);
this._attemptCharCodeUntilFn(isNotWhitespace);
var /** @type {?} */ prefixAndName = this._consumePrefixAndName();
this._attemptCharCodeUntilFn(isNotWhitespace);
this._requireCharCode($GT);
this._endToken(prefixAndName);
};
/**
* @return {?}
*/
_Tokenizer.prototype._consumeExpansionFormStart = /**
* @return {?}
*/
function () {
this._beginToken(TokenType$1.EXPANSION_FORM_START, this._getLocation());
this._requireCharCode($LBRACE);
this._endToken([]);
this._expansionCaseStack.push(TokenType$1.EXPANSION_FORM_START);
this._beginToken(TokenType$1.RAW_TEXT, this._getLocation());
var /** @type {?} */ condition = this._readUntil($COMMA);
this._endToken([condition], this._getLocation());
this._requireCharCode($COMMA);
this._attemptCharCodeUntilFn(isNotWhitespace);
this._beginToken(TokenType$1.RAW_TEXT, this._getLocation());
var /** @type {?} */ type = this._readUntil($COMMA);
this._endToken([type], this._getLocation());
this._requireCharCode($COMMA);
this._attemptCharCodeUntilFn(isNotWhitespace);
};
/**
* @return {?}
*/
_Tokenizer.prototype._consumeExpansionCaseStart = /**
* @return {?}
*/
function () {
this._beginToken(TokenType$1.EXPANSION_CASE_VALUE, this._getLocation());
var /** @type {?} */ value = this._readUntil($LBRACE).trim();
this._endToken([value], this._getLocation());
this._attemptCharCodeUntilFn(isNotWhitespace);
this._beginToken(TokenType$1.EXPANSION_CASE_EXP_START, this._getLocation());
this._requireCharCode($LBRACE);
this._endToken([], this._getLocation());
this._attemptCharCodeUntilFn(isNotWhitespace);
this._expansionCaseStack.push(TokenType$1.EXPANSION_CASE_EXP_START);
};
/**
* @return {?}
*/
_Tokenizer.prototype._consumeExpansionCaseEnd = /**
* @return {?}
*/
function () {
this._beginToken(TokenType$1.EXPANSION_CASE_EXP_END, this._getLocation());
this._requireCharCode($RBRACE);
this._endToken([], this._getLocation());
this._attemptCharCodeUntilFn(isNotWhitespace);
this._expansionCaseStack.pop();
};
/**
* @return {?}
*/
_Tokenizer.prototype._consumeExpansionFormEnd = /**
* @return {?}
*/
function () {
this._beginToken(TokenType$1.EXPANSION_FORM_END, this._getLocation());
this._requireCharCode($RBRACE);
this._endToken([]);
this._expansionCaseStack.pop();
};
/**
* @return {?}
*/
_Tokenizer.prototype._consumeText = /**
* @return {?}
*/
function () {
var /** @type {?} */ start = this._getLocation();
this._beginToken(TokenType$1.TEXT, start);
var /** @type {?} */ parts = [];
do {
if (this._interpolationConfig && this._attemptStr(this._interpolationConfig.start)) {
parts.push(this._interpolationConfig.start);
this._inInterpolation = true;
}
else if (this._interpolationConfig && this._inInterpolation &&
this._attemptStr(this._interpolationConfig.end)) {
parts.push(this._interpolationConfig.end);
this._inInterpolation = false;
}
else {
parts.push(this._readChar(true));
}
} while (!this._isTextEnd());
this._endToken([this._processCarriageReturns(parts.join(''))]);
};
/**
* @return {?}
*/
_Tokenizer.prototype._isTextEnd = /**
* @return {?}
*/
function () {
if (this._peek === $LT || this._peek === $EOF) {
return true;
}
if (this._tokenizeIcu && !this._inInterpolation) {
if (isExpansionFormStart(this._input, this._index, this._interpolationConfig)) {
// start of an expansion form
return true;
}
if (this._peek === $RBRACE && this._isInExpansionCase()) {
// end of and expansion case
return true;
}
}
return false;
};
/**
* @return {?}
*/
_Tokenizer.prototype._savePosition = /**
* @return {?}
*/
function () {
return [this._peek, this._index, this._column, this._line, this.tokens.length];
};
/**
* @param {?} char
* @return {?}
*/
_Tokenizer.prototype._readUntil = /**
* @param {?} char
* @return {?}
*/
function (char) {
var /** @type {?} */ start = this._index;
this._attemptUntilChar(char);
return this._input.substring(start, this._index);
};
/**
* @param {?} position
* @return {?}
*/
_Tokenizer.prototype._restorePosition = /**
* @param {?} position
* @return {?}
*/
function (position) {
this._peek = position[0];
this._index = position[1];
this._column = position[2];
this._line = position[3];
var /** @type {?} */ nbTokens = position[4];
if (nbTokens < this.tokens.length) {
// remove any extra tokens
this.tokens = this.tokens.slice(0, nbTokens);
}
};
/**
* @return {?}
*/
_Tokenizer.prototype._isInExpansionCase = /**
* @return {?}
*/
function () {
return this._expansionCaseStack.length > 0 &&
this._expansionCaseStack[this._expansionCaseStack.length - 1] ===
TokenType$1.EXPANSION_CASE_EXP_START;
};
/**
* @return {?}
*/
_Tokenizer.prototype._isInExpansionForm = /**
* @return {?}
*/
function () {
return this._expansionCaseStack.length > 0 &&
this._expansionCaseStack[this._expansionCaseStack.length - 1] ===
TokenType$1.EXPANSION_FORM_START;
};
return _Tokenizer;
}());
/**
* @param {?} code
* @return {?}
*/
function isNotWhitespace(code) {
return !isWhitespace(code) || code === $EOF;
}
/**
* @param {?} code
* @return {?}
*/
function isNameEnd(code) {
return isWhitespace(code) || code === $GT || code === $SLASH ||
code === $SQ || code === $DQ || code === $EQ;
}
/**
* @param {?} code
* @return {?}
*/
function isPrefixEnd(code) {
return (code < $a || $z < code) && (code < $A || $Z < code) &&
(code < $0 || code > $9);
}
/**
* @param {?} code
* @return {?}
*/
function isDigitEntityEnd(code) {
return code == $SEMICOLON || code == $EOF || !isAsciiHexDigit(code);
}
/**
* @param {?} code
* @return {?}
*/
function isNamedEntityEnd(code) {
return code == $SEMICOLON || code == $EOF || !isAsciiLetter(code);
}
/**
* @param {?} input
* @param {?} offset
* @param {?} interpolationConfig
* @return {?}
*/
function isExpansionFormStart(input, offset, interpolationConfig) {
var /** @type {?} */ isInterpolationStart = interpolationConfig ? input.indexOf(interpolationConfig.start, offset) == offset : false;
return input.charCodeAt(offset) == $LBRACE && !isInterpolationStart;
}
/**
* @param {?} peek
* @return {?}
*/
function isExpansionCaseStart(peek) {
return peek === $EQ || isAsciiLetter(peek) || isDigit(peek);
}
/**
* @param {?} code1
* @param {?} code2
* @return {?}
*/
function compareCharCodeCaseInsensitive(code1, code2) {
return toUpperCaseCharCode(code1) == toUpperCaseCharCode(code2);
}
/**
* @param {?} code
* @return {?}
*/
function toUpperCaseCharCode(code) {
return code >= $a && code <= $z ? code - $a + $A : code;
}
/**
* @param {?} srcTokens
* @return {?}
*/
function mergeTextTokens(srcTokens) {
var /** @type {?} */ dstTokens = [];
var /** @type {?} */ lastDstToken = undefined;
for (var /** @type {?} */ i = 0; i < srcTokens.length; i++) {
var /** @type {?} */ token = srcTokens[i];
if (lastDstToken && lastDstToken.type == TokenType$1.TEXT && token.type == TokenType$1.TEXT) {
lastDstToken.parts[0] += token.parts[0];
lastDstToken.sourceSpan.end = token.sourceSpan.end;
}
else {
lastDstToken = token;
dstTokens.push(lastDstToken);
}
}
return dstTokens;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var TreeError = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(TreeError, _super);
function TreeError(elementName, span, msg) {
var _this = _super.call(this, span, msg) || this;
_this.elementName = elementName;
return _this;
}
/**
* @param {?} elementName
* @param {?} span
* @param {?} msg
* @return {?}
*/
TreeError.create = /**
* @param {?} elementName
* @param {?} span
* @param {?} msg
* @return {?}
*/
function (elementName, span, msg) {
return new TreeError(elementName, span, msg);
};
return TreeError;
}(ParseError));
var ParseTreeResult = (function () {
function ParseTreeResult(rootNodes, errors) {
this.rootNodes = rootNodes;
this.errors = errors;
}
return ParseTreeResult;
}());
var Parser$1 = (function () {
function Parser(getTagDefinition) {
this.getTagDefinition = getTagDefinition;
}
/**
* @param {?} source
* @param {?} url
* @param {?=} parseExpansionForms
* @param {?=} interpolationConfig
* @return {?}
*/
Parser.prototype.parse = /**
* @param {?} source
* @param {?} url
* @param {?=} parseExpansionForms
* @param {?=} interpolationConfig
* @return {?}
*/
function (source, url, parseExpansionForms, interpolationConfig) {
if (parseExpansionForms === void 0) { parseExpansionForms = false; }
if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
var /** @type {?} */ tokensAndErrors = tokenize(source, url, this.getTagDefinition, parseExpansionForms, interpolationConfig);
var /** @type {?} */ treeAndErrors = new _TreeBuilder(tokensAndErrors.tokens, this.getTagDefinition).build();
return new ParseTreeResult(treeAndErrors.rootNodes, (/** @type {?} */ (tokensAndErrors.errors)).concat(treeAndErrors.errors));
};
return Parser;
}());
var _TreeBuilder = (function () {
function _TreeBuilder(tokens, getTagDefinition) {
this.tokens = tokens;
this.getTagDefinition = getTagDefinition;
this._index = -1;
this._rootNodes = [];
this._errors = [];
this._elementStack = [];
this._advance();
}
/**
* @return {?}
*/
_TreeBuilder.prototype.build = /**
* @return {?}
*/
function () {
while (this._peek.type !== TokenType$1.EOF) {
if (this._peek.type === TokenType$1.TAG_OPEN_START) {
this._consumeStartTag(this._advance());
}
else if (this._peek.type === TokenType$1.TAG_CLOSE) {
this._consumeEndTag(this._advance());
}
else if (this._peek.type === TokenType$1.CDATA_START) {
this._closeVoidElement();
this._consumeCdata(this._advance());
}
else if (this._peek.type === TokenType$1.COMMENT_START) {
this._closeVoidElement();
this._consumeComment(this._advance());
}
else if (this._peek.type === TokenType$1.TEXT || this._peek.type === TokenType$1.RAW_TEXT ||
this._peek.type === TokenType$1.ESCAPABLE_RAW_TEXT) {
this._closeVoidElement();
this._consumeText(this._advance());
}
else if (this._peek.type === TokenType$1.EXPANSION_FORM_START) {
this._consumeExpansion(this._advance());
}
else {
// Skip all other tokens...
this._advance();
}
}
return new ParseTreeResult(this._rootNodes, this._errors);
};
/**
* @return {?}
*/
_TreeBuilder.prototype._advance = /**
* @return {?}
*/
function () {
var /** @type {?} */ prev = this._peek;
if (this._index < this.tokens.length - 1) {
// Note: there is always an EOF token at the end
this._index++;
}
this._peek = this.tokens[this._index];
return prev;
};
/**
* @param {?} type
* @return {?}
*/
_TreeBuilder.prototype._advanceIf = /**
* @param {?} type
* @return {?}
*/
function (type) {
if (this._peek.type === type) {
return this._advance();
}
return null;
};
/**
* @param {?} startToken
* @return {?}
*/
_TreeBuilder.prototype._consumeCdata = /**
* @param {?} startToken
* @return {?}
*/
function (startToken) {
this._consumeText(this._advance());
this._advanceIf(TokenType$1.CDATA_END);
};
/**
* @param {?} token
* @return {?}
*/
_TreeBuilder.prototype._consumeComment = /**
* @param {?} token
* @return {?}
*/
function (token) {
var /** @type {?} */ text = this._advanceIf(TokenType$1.RAW_TEXT);
this._advanceIf(TokenType$1.COMMENT_END);
var /** @type {?} */ value = text != null ? text.parts[0].trim() : null;
this._addToParent(new Comment(value, token.sourceSpan));
};
/**
* @param {?} token
* @return {?}
*/
_TreeBuilder.prototype._consumeExpansion = /**
* @param {?} token
* @return {?}
*/
function (token) {
var /** @type {?} */ switchValue = this._advance();
var /** @type {?} */ type = this._advance();
var /** @type {?} */ cases = [];
// read =
while (this._peek.type === TokenType$1.EXPANSION_CASE_VALUE) {
var /** @type {?} */ expCase = this._parseExpansionCase();
if (!expCase)
return; // error
cases.push(expCase);
}
// read the final }
if (this._peek.type !== TokenType$1.EXPANSION_FORM_END) {
this._errors.push(TreeError.create(null, this._peek.sourceSpan, "Invalid ICU message. Missing '}'."));
return;
}
var /** @type {?} */ sourceSpan = new ParseSourceSpan(token.sourceSpan.start, this._peek.sourceSpan.end);
this._addToParent(new Expansion(switchValue.parts[0], type.parts[0], cases, sourceSpan, switchValue.sourceSpan));
this._advance();
};
/**
* @return {?}
*/
_TreeBuilder.prototype._parseExpansionCase = /**
* @return {?}
*/
function () {
var /** @type {?} */ value = this._advance();
// read {
if (this._peek.type !== TokenType$1.EXPANSION_CASE_EXP_START) {
this._errors.push(TreeError.create(null, this._peek.sourceSpan, "Invalid ICU message. Missing '{'."));
return null;
}
// read until }
var /** @type {?} */ start = this._advance();
var /** @type {?} */ exp = this._collectExpansionExpTokens(start);
if (!exp)
return null;
var /** @type {?} */ end = this._advance();
exp.push(new Token$1(TokenType$1.EOF, [], end.sourceSpan));
// parse everything in between { and }
var /** @type {?} */ parsedExp = new _TreeBuilder(exp, this.getTagDefinition).build();
if (parsedExp.errors.length > 0) {
this._errors = this._errors.concat(/** @type {?} */ (parsedExp.errors));
return null;
}
var /** @type {?} */ sourceSpan = new ParseSourceSpan(value.sourceSpan.start, end.sourceSpan.end);
var /** @type {?} */ expSourceSpan = new ParseSourceSpan(start.sourceSpan.start, end.sourceSpan.end);
return new ExpansionCase(value.parts[0], parsedExp.rootNodes, sourceSpan, value.sourceSpan, expSourceSpan);
};
/**
* @param {?} start
* @return {?}
*/
_TreeBuilder.prototype._collectExpansionExpTokens = /**
* @param {?} start
* @return {?}
*/
function (start) {
var /** @type {?} */ exp = [];
var /** @type {?} */ expansionFormStack = [TokenType$1.EXPANSION_CASE_EXP_START];
while (true) {
if (this._peek.type === TokenType$1.EXPANSION_FORM_START ||
this._peek.type === TokenType$1.EXPANSION_CASE_EXP_START) {
expansionFormStack.push(this._peek.type);
}
if (this._peek.type === TokenType$1.EXPANSION_CASE_EXP_END) {
if (lastOnStack(expansionFormStack, TokenType$1.EXPANSION_CASE_EXP_START)) {
expansionFormStack.pop();
if (expansionFormStack.length == 0)
return exp;
}
else {
this._errors.push(TreeError.create(null, start.sourceSpan, "Invalid ICU message. Missing '}'."));
return null;
}
}
if (this._peek.type === TokenType$1.EXPANSION_FORM_END) {
if (lastOnStack(expansionFormStack, TokenType$1.EXPANSION_FORM_START)) {
expansionFormStack.pop();
}
else {
this._errors.push(TreeError.create(null, start.sourceSpan, "Invalid ICU message. Missing '}'."));
return null;
}
}
if (this._peek.type === TokenType$1.EOF) {
this._errors.push(TreeError.create(null, start.sourceSpan, "Invalid ICU message. Missing '}'."));
return null;
}
exp.push(this._advance());
}
};
/**
* @param {?} token
* @return {?}
*/
_TreeBuilder.prototype._consumeText = /**
* @param {?} token
* @return {?}
*/
function (token) {
var /** @type {?} */ text = token.parts[0];
if (text.length > 0 && text[0] == '\n') {
var /** @type {?} */ parent_1 = this._getParentElement();
if (parent_1 != null && parent_1.children.length == 0 &&
this.getTagDefinition(parent_1.name).ignoreFirstLf) {
text = text.substring(1);
}
}
if (text.length > 0) {
this._addToParent(new Text(text, token.sourceSpan));
}
};
/**
* @return {?}
*/
_TreeBuilder.prototype._closeVoidElement = /**
* @return {?}
*/
function () {
var /** @type {?} */ el = this._getParentElement();
if (el && this.getTagDefinition(el.name).isVoid) {
this._elementStack.pop();
}
};
/**
* @param {?} startTagToken
* @return {?}
*/
_TreeBuilder.prototype._consumeStartTag = /**
* @param {?} startTagToken
* @return {?}
*/
function (startTagToken) {
var /** @type {?} */ prefix = startTagToken.parts[0];
var /** @type {?} */ name = startTagToken.parts[1];
var /** @type {?} */ attrs = [];
while (this._peek.type === TokenType$1.ATTR_NAME) {
attrs.push(this._consumeAttr(this._advance()));
}
var /** @type {?} */ fullName = this._getElementFullName(prefix, name, this._getParentElement());
var /** @type {?} */ selfClosing = false;
// Note: There could have been a tokenizer error
// so that we don't get a token for the end tag...
if (this._peek.type === TokenType$1.TAG_OPEN_END_VOID) {
this._advance();
selfClosing = true;
var /** @type {?} */ tagDef = this.getTagDefinition(fullName);
if (!(tagDef.canSelfClose || getNsPrefix(fullName) !== null || tagDef.isVoid)) {
this._errors.push(TreeError.create(fullName, startTagToken.sourceSpan, "Only void and foreign elements can be self closed \"" + startTagToken.parts[1] + "\""));
}
}
else if (this._peek.type === TokenType$1.TAG_OPEN_END) {
this._advance();
selfClosing = false;
}
var /** @type {?} */ end = this._peek.sourceSpan.start;
var /** @type {?} */ span = new ParseSourceSpan(startTagToken.sourceSpan.start, end);
var /** @type {?} */ el = new Element(fullName, attrs, [], span, span, undefined);
this._pushElement(el);
if (selfClosing) {
this._popElement(fullName);
el.endSourceSpan = span;
}
};
/**
* @param {?} el
* @return {?}
*/
_TreeBuilder.prototype._pushElement = /**
* @param {?} el
* @return {?}
*/
function (el) {
var /** @type {?} */ parentEl = this._getParentElement();
if (parentEl && this.getTagDefinition(parentEl.name).isClosedByChild(el.name)) {
this._elementStack.pop();
}
var /** @type {?} */ tagDef = this.getTagDefinition(el.name);
var _a = this._getParentElementSkippingContainers(), parent = _a.parent, container = _a.container;
if (parent && tagDef.requireExtraParent(parent.name)) {
var /** @type {?} */ newParent = new Element(tagDef.parentToAdd, [], [], el.sourceSpan, el.startSourceSpan, el.endSourceSpan);
this._insertBeforeContainer(parent, container, newParent);
}
this._addToParent(el);
this._elementStack.push(el);
};
/**
* @param {?} endTagToken
* @return {?}
*/
_TreeBuilder.prototype._consumeEndTag = /**
* @param {?} endTagToken
* @return {?}
*/
function (endTagToken) {
var /** @type {?} */ fullName = this._getElementFullName(endTagToken.parts[0], endTagToken.parts[1], this._getParentElement());
if (this._getParentElement()) {
/** @type {?} */ ((this._getParentElement())).endSourceSpan = endTagToken.sourceSpan;
}
if (this.getTagDefinition(fullName).isVoid) {
this._errors.push(TreeError.create(fullName, endTagToken.sourceSpan, "Void elements do not have end tags \"" + endTagToken.parts[1] + "\""));
}
else if (!this._popElement(fullName)) {
var /** @type {?} */ errMsg = "Unexpected closing tag \"" + fullName + "\". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags";
this._errors.push(TreeError.create(fullName, endTagToken.sourceSpan, errMsg));
}
};
/**
* @param {?} fullName
* @return {?}
*/
_TreeBuilder.prototype._popElement = /**
* @param {?} fullName
* @return {?}
*/
function (fullName) {
for (var /** @type {?} */ stackIndex = this._elementStack.length - 1; stackIndex >= 0; stackIndex--) {
var /** @type {?} */ el = this._elementStack[stackIndex];
if (el.name == fullName) {
this._elementStack.splice(stackIndex, this._elementStack.length - stackIndex);
return true;
}
if (!this.getTagDefinition(el.name).closedByParent) {
return false;
}
}
return false;
};
/**
* @param {?} attrName
* @return {?}
*/
_TreeBuilder.prototype._consumeAttr = /**
* @param {?} attrName
* @return {?}
*/
function (attrName) {
var /** @type {?} */ fullName = mergeNsAndName(attrName.parts[0], attrName.parts[1]);
var /** @type {?} */ end = attrName.sourceSpan.end;
var /** @type {?} */ value = '';
var /** @type {?} */ valueSpan = /** @type {?} */ ((undefined));
if (this._peek.type === TokenType$1.ATTR_VALUE) {
var /** @type {?} */ valueToken = this._advance();
value = valueToken.parts[0];
end = valueToken.sourceSpan.end;
valueSpan = valueToken.sourceSpan;
}
return new Attribute$1(fullName, value, new ParseSourceSpan(attrName.sourceSpan.start, end), valueSpan);
};
/**
* @return {?}
*/
_TreeBuilder.prototype._getParentElement = /**
* @return {?}
*/
function () {
return this._elementStack.length > 0 ? this._elementStack[this._elementStack.length - 1] : null;
};
/**
* Returns the parent in the DOM and the container.
*
* `<ng-container>` elements are skipped as they are not rendered as DOM element.
* @return {?}
*/
_TreeBuilder.prototype._getParentElementSkippingContainers = /**
* Returns the parent in the DOM and the container.
*
* `<ng-container>` elements are skipped as they are not rendered as DOM element.
* @return {?}
*/
function () {
var /** @type {?} */ container = null;
for (var /** @type {?} */ i = this._elementStack.length - 1; i >= 0; i--) {
if (!isNgContainer(this._elementStack[i].name)) {
return { parent: this._elementStack[i], container: container };
}
container = this._elementStack[i];
}
return { parent: null, container: container };
};
/**
* @param {?} node
* @return {?}
*/
_TreeBuilder.prototype._addToParent = /**
* @param {?} node
* @return {?}
*/
function (node) {
var /** @type {?} */ parent = this._getParentElement();
if (parent != null) {
parent.children.push(node);
}
else {
this._rootNodes.push(node);
}
};
/**
* Insert a node between the parent and the container.
* When no container is given, the node is appended as a child of the parent.
* Also updates the element stack accordingly.
*
* \@internal
* @param {?} parent
* @param {?} container
* @param {?} node
* @return {?}
*/
_TreeBuilder.prototype._insertBeforeContainer = /**
* Insert a node between the parent and the container.
* When no container is given, the node is appended as a child of the parent.
* Also updates the element stack accordingly.
*
* \@internal
* @param {?} parent
* @param {?} container
* @param {?} node
* @return {?}
*/
function (parent, container, node) {
if (!container) {
this._addToParent(node);
this._elementStack.push(node);
}
else {
if (parent) {
// replace the container with the new node in the children
var /** @type {?} */ index = parent.children.indexOf(container);
parent.children[index] = node;
}
else {
this._rootNodes.push(node);
}
node.children.push(container);
this._elementStack.splice(this._elementStack.indexOf(container), 0, node);
}
};
/**
* @param {?} prefix
* @param {?} localName
* @param {?} parentElement
* @return {?}
*/
_TreeBuilder.prototype._getElementFullName = /**
* @param {?} prefix
* @param {?} localName
* @param {?} parentElement
* @return {?}
*/
function (prefix, localName, parentElement) {
if (prefix == null) {
prefix = /** @type {?} */ ((this.getTagDefinition(localName).implicitNamespacePrefix));
if (prefix == null && parentElement != null) {
prefix = getNsPrefix(parentElement.name);
}
}
return mergeNsAndName(prefix, localName);
};
return _TreeBuilder;
}());
/**
* @param {?} stack
* @param {?} element
* @return {?}
*/
function lastOnStack(stack, element) {
return stack.length > 0 && stack[stack.length - 1] === element;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @param {?} message
* @return {?}
*/
function digest(message) {
return message.id || sha1(serializeNodes(message.nodes).join('') + ("[" + message.meaning + "]"));
}
/**
* @param {?} message
* @return {?}
*/
function decimalDigest(message) {
if (message.id) {
return message.id;
}
var /** @type {?} */ visitor = new _SerializerIgnoreIcuExpVisitor();
var /** @type {?} */ parts = message.nodes.map(function (a) { return a.visit(visitor, null); });
return computeMsgId(parts.join(''), message.meaning);
}
/**
* Serialize the i18n ast to something xml-like in order to generate an UID.
*
* The visitor is also used in the i18n parser tests
*
* \@internal
*/
var _SerializerVisitor = (function () {
function _SerializerVisitor() {
}
/**
* @param {?} text
* @param {?} context
* @return {?}
*/
_SerializerVisitor.prototype.visitText = /**
* @param {?} text
* @param {?} context
* @return {?}
*/
function (text, context) { return text.value; };
/**
* @param {?} container
* @param {?} context
* @return {?}
*/
_SerializerVisitor.prototype.visitContainer = /**
* @param {?} container
* @param {?} context
* @return {?}
*/
function (container, context) {
var _this = this;
return "[" + container.children.map(function (child) { return child.visit(_this); }).join(', ') + "]";
};
/**
* @param {?} icu
* @param {?} context
* @return {?}
*/
_SerializerVisitor.prototype.visitIcu = /**
* @param {?} icu
* @param {?} context
* @return {?}
*/
function (icu, context) {
var _this = this;
var /** @type {?} */ strCases = Object.keys(icu.cases).map(function (k) { return k + " {" + icu.cases[k].visit(_this) + "}"; });
return "{" + icu.expression + ", " + icu.type + ", " + strCases.join(', ') + "}";
};
/**
* @param {?} ph
* @param {?} context
* @return {?}
*/
_SerializerVisitor.prototype.visitTagPlaceholder = /**
* @param {?} ph
* @param {?} context
* @return {?}
*/
function (ph, context) {
var _this = this;
return ph.isVoid ?
"<ph tag name=\"" + ph.startName + "\"/>" :
"<ph tag name=\"" + ph.startName + "\">" + ph.children.map(function (child) { return child.visit(_this); }).join(', ') + "</ph name=\"" + ph.closeName + "\">";
};
/**
* @param {?} ph
* @param {?} context
* @return {?}
*/
_SerializerVisitor.prototype.visitPlaceholder = /**
* @param {?} ph
* @param {?} context
* @return {?}
*/
function (ph, context) {
return ph.value ? "<ph name=\"" + ph.name + "\">" + ph.value + "</ph>" : "<ph name=\"" + ph.name + "\"/>";
};
/**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
_SerializerVisitor.prototype.visitIcuPlaceholder = /**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
function (ph, context) {
return "<ph icu name=\"" + ph.name + "\">" + ph.value.visit(this) + "</ph>";
};
return _SerializerVisitor;
}());
var serializerVisitor = new _SerializerVisitor();
/**
* @param {?} nodes
* @return {?}
*/
function serializeNodes(nodes) {
return nodes.map(function (a) { return a.visit(serializerVisitor, null); });
}
/**
* Serialize the i18n ast to something xml-like in order to generate an UID.
*
* Ignore the ICU expressions so that message IDs stays identical if only the expression changes.
*
* \@internal
*/
var _SerializerIgnoreIcuExpVisitor = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(_SerializerIgnoreIcuExpVisitor, _super);
function _SerializerIgnoreIcuExpVisitor() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @param {?} icu
* @param {?} context
* @return {?}
*/
_SerializerIgnoreIcuExpVisitor.prototype.visitIcu = /**
* @param {?} icu
* @param {?} context
* @return {?}
*/
function (icu, context) {
var _this = this;
var /** @type {?} */ strCases = Object.keys(icu.cases).map(function (k) { return k + " {" + icu.cases[k].visit(_this) + "}"; });
// Do not take the expression into account
return "{" + icu.type + ", " + strCases.join(', ') + "}";
};
return _SerializerIgnoreIcuExpVisitor;
}(_SerializerVisitor));
/**
* Compute the SHA1 of the given string
*
* see http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf
*
* WARNING: this function has not been designed not tested with security in mind.
* DO NOT USE IT IN A SECURITY SENSITIVE CONTEXT.
* @param {?} str
* @return {?}
*/
function sha1(str) {
var /** @type {?} */ utf8 = utf8Encode(str);
var /** @type {?} */ words32 = stringToWords32(utf8, Endian.Big);
var /** @type {?} */ len = utf8.length * 8;
var /** @type {?} */ w = new Array(80);
var _a = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0], a = _a[0], b = _a[1], c = _a[2], d = _a[3], e = _a[4];
words32[len >> 5] |= 0x80 << (24 - len % 32);
words32[((len + 64 >> 9) << 4) + 15] = len;
for (var /** @type {?} */ i = 0; i < words32.length; i += 16) {
var _b = [a, b, c, d, e], h0 = _b[0], h1 = _b[1], h2 = _b[2], h3 = _b[3], h4 = _b[4];
for (var /** @type {?} */ j = 0; j < 80; j++) {
if (j < 16) {
w[j] = words32[i + j];
}
else {
w[j] = rol32(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1);
}
var _c = fk(j, b, c, d), f = _c[0], k = _c[1];
var /** @type {?} */ temp = [rol32(a, 5), f, e, k, w[j]].reduce(add32);
_d = [d, c, rol32(b, 30), a, temp], e = _d[0], d = _d[1], c = _d[2], b = _d[3], a = _d[4];
}
_e = [add32(a, h0), add32(b, h1), add32(c, h2), add32(d, h3), add32(e, h4)], a = _e[0], b = _e[1], c = _e[2], d = _e[3], e = _e[4];
}
return byteStringToHexString(words32ToByteString([a, b, c, d, e]));
var _d, _e;
}
/**
* @param {?} index
* @param {?} b
* @param {?} c
* @param {?} d
* @return {?}
*/
function fk(index, b, c, d) {
if (index < 20) {
return [(b & c) | (~b & d), 0x5a827999];
}
if (index < 40) {
return [b ^ c ^ d, 0x6ed9eba1];
}
if (index < 60) {
return [(b & c) | (b & d) | (c & d), 0x8f1bbcdc];
}
return [b ^ c ^ d, 0xca62c1d6];
}
/**
* Compute the fingerprint of the given string
*
* The output is 64 bit number encoded as a decimal string
*
* based on:
* https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/GoogleJsMessageIdGenerator.java
* @param {?} str
* @return {?}
*/
function fingerprint(str) {
var /** @type {?} */ utf8 = utf8Encode(str);
var _a = [hash32(utf8, 0), hash32(utf8, 102072)], hi = _a[0], lo = _a[1];
if (hi == 0 && (lo == 0 || lo == 1)) {
hi = hi ^ 0x130f9bef;
lo = lo ^ -0x6b5f56d8;
}
return [hi, lo];
}
/**
* @param {?} msg
* @param {?} meaning
* @return {?}
*/
function computeMsgId(msg, meaning) {
var _a = fingerprint(msg), hi = _a[0], lo = _a[1];
if (meaning) {
var _b = fingerprint(meaning), him = _b[0], lom = _b[1];
_c = add64(rol64([hi, lo], 1), [him, lom]), hi = _c[0], lo = _c[1];
}
return byteStringToDecString(words32ToByteString([hi & 0x7fffffff, lo]));
var _c;
}
/**
* @param {?} str
* @param {?} c
* @return {?}
*/
function hash32(str, c) {
var _a = [0x9e3779b9, 0x9e3779b9], a = _a[0], b = _a[1];
var /** @type {?} */ i;
var /** @type {?} */ len = str.length;
for (i = 0; i + 12 <= len; i += 12) {
a = add32(a, wordAt(str, i, Endian.Little));
b = add32(b, wordAt(str, i + 4, Endian.Little));
c = add32(c, wordAt(str, i + 8, Endian.Little));
_b = mix([a, b, c]), a = _b[0], b = _b[1], c = _b[2];
}
a = add32(a, wordAt(str, i, Endian.Little));
b = add32(b, wordAt(str, i + 4, Endian.Little));
// the first byte of c is reserved for the length
c = add32(c, len);
c = add32(c, wordAt(str, i + 8, Endian.Little) << 8);
return mix([a, b, c])[2];
var _b;
}
/**
* @param {?} __0
* @return {?}
*/
function mix(_a) {
var a = _a[0], b = _a[1], c = _a[2];
a = sub32(a, b);
a = sub32(a, c);
a ^= c >>> 13;
b = sub32(b, c);
b = sub32(b, a);
b ^= a << 8;
c = sub32(c, a);
c = sub32(c, b);
c ^= b >>> 13;
a = sub32(a, b);
a = sub32(a, c);
a ^= c >>> 12;
b = sub32(b, c);
b = sub32(b, a);
b ^= a << 16;
c = sub32(c, a);
c = sub32(c, b);
c ^= b >>> 5;
a = sub32(a, b);
a = sub32(a, c);
a ^= c >>> 3;
b = sub32(b, c);
b = sub32(b, a);
b ^= a << 10;
c = sub32(c, a);
c = sub32(c, b);
c ^= b >>> 15;
return [a, b, c];
}
/** @enum {number} */
var Endian = {
Little: 0,
Big: 1,
};
Endian[Endian.Little] = "Little";
Endian[Endian.Big] = "Big";
/**
* @param {?} a
* @param {?} b
* @return {?}
*/
function add32(a, b) {
return add32to64(a, b)[1];
}
/**
* @param {?} a
* @param {?} b
* @return {?}
*/
function add32to64(a, b) {
var /** @type {?} */ low = (a & 0xffff) + (b & 0xffff);
var /** @type {?} */ high = (a >>> 16) + (b >>> 16) + (low >>> 16);
return [high >>> 16, (high << 16) | (low & 0xffff)];
}
/**
* @param {?} __0
* @param {?} __1
* @return {?}
*/
function add64(_a, _b) {
var ah = _a[0], al = _a[1];
var bh = _b[0], bl = _b[1];
var _c = add32to64(al, bl), carry = _c[0], l = _c[1];
var /** @type {?} */ h = add32(add32(ah, bh), carry);
return [h, l];
}
/**
* @param {?} a
* @param {?} b
* @return {?}
*/
function sub32(a, b) {
var /** @type {?} */ low = (a & 0xffff) - (b & 0xffff);
var /** @type {?} */ high = (a >> 16) - (b >> 16) + (low >> 16);
return (high << 16) | (low & 0xffff);
}
/**
* @param {?} a
* @param {?} count
* @return {?}
*/
function rol32(a, count) {
return (a << count) | (a >>> (32 - count));
}
/**
* @param {?} __0
* @param {?} count
* @return {?}
*/
function rol64(_a, count) {
var hi = _a[0], lo = _a[1];
var /** @type {?} */ h = (hi << count) | (lo >>> (32 - count));
var /** @type {?} */ l = (lo << count) | (hi >>> (32 - count));
return [h, l];
}
/**
* @param {?} str
* @param {?} endian
* @return {?}
*/
function stringToWords32(str, endian) {
var /** @type {?} */ words32 = Array((str.length + 3) >>> 2);
for (var /** @type {?} */ i = 0; i < words32.length; i++) {
words32[i] = wordAt(str, i * 4, endian);
}
return words32;
}
/**
* @param {?} str
* @param {?} index
* @return {?}
*/
function byteAt(str, index) {
return index >= str.length ? 0 : str.charCodeAt(index) & 0xff;
}
/**
* @param {?} str
* @param {?} index
* @param {?} endian
* @return {?}
*/
function wordAt(str, index, endian) {
var /** @type {?} */ word = 0;
if (endian === Endian.Big) {
for (var /** @type {?} */ i = 0; i < 4; i++) {
word += byteAt(str, index + i) << (24 - 8 * i);
}
}
else {
for (var /** @type {?} */ i = 0; i < 4; i++) {
word += byteAt(str, index + i) << 8 * i;
}
}
return word;
}
/**
* @param {?} words32
* @return {?}
*/
function words32ToByteString(words32) {
return words32.reduce(function (str, word) { return str + word32ToByteString(word); }, '');
}
/**
* @param {?} word
* @return {?}
*/
function word32ToByteString(word) {
var /** @type {?} */ str = '';
for (var /** @type {?} */ i = 0; i < 4; i++) {
str += String.fromCharCode((word >>> 8 * (3 - i)) & 0xff);
}
return str;
}
/**
* @param {?} str
* @return {?}
*/
function byteStringToHexString(str) {
var /** @type {?} */ hex = '';
for (var /** @type {?} */ i = 0; i < str.length; i++) {
var /** @type {?} */ b = byteAt(str, i);
hex += (b >>> 4).toString(16) + (b & 0x0f).toString(16);
}
return hex.toLowerCase();
}
/**
* @param {?} str
* @return {?}
*/
function byteStringToDecString(str) {
var /** @type {?} */ decimal = '';
var /** @type {?} */ toThePower = '1';
for (var /** @type {?} */ i = str.length - 1; i >= 0; i--) {
decimal = addBigInt(decimal, numberTimesBigInt(byteAt(str, i), toThePower));
toThePower = numberTimesBigInt(256, toThePower);
}
return decimal.split('').reverse().join('');
}
/**
* @param {?} x
* @param {?} y
* @return {?}
*/
function addBigInt(x, y) {
var /** @type {?} */ sum = '';
var /** @type {?} */ len = Math.max(x.length, y.length);
for (var /** @type {?} */ i = 0, /** @type {?} */ carry = 0; i < len || carry; i++) {
var /** @type {?} */ tmpSum = carry + +(x[i] || 0) + +(y[i] || 0);
if (tmpSum >= 10) {
carry = 1;
sum += tmpSum - 10;
}
else {
carry = 0;
sum += tmpSum;
}
}
return sum;
}
/**
* @param {?} num
* @param {?} b
* @return {?}
*/
function numberTimesBigInt(num, b) {
var /** @type {?} */ product = '';
var /** @type {?} */ bToThePower = b;
for (; num !== 0; num = num >>> 1) {
if (num & 1)
product = addBigInt(product, bToThePower);
bToThePower = addBigInt(bToThePower, bToThePower);
}
return product;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var Message = (function () {
/**
* @param nodes message AST
* @param placeholders maps placeholder names to static content
* @param placeholderToMessage maps placeholder names to messages (used for nested ICU messages)
* @param meaning
* @param description
* @param id
*/
function Message(nodes, placeholders, placeholderToMessage, meaning, description, id) {
this.nodes = nodes;
this.placeholders = placeholders;
this.placeholderToMessage = placeholderToMessage;
this.meaning = meaning;
this.description = description;
this.id = id;
if (nodes.length) {
this.sources = [{
filePath: nodes[0].sourceSpan.start.file.url,
startLine: nodes[0].sourceSpan.start.line + 1,
startCol: nodes[0].sourceSpan.start.col + 1,
endLine: nodes[nodes.length - 1].sourceSpan.end.line + 1,
endCol: nodes[0].sourceSpan.start.col + 1
}];
}
else {
this.sources = [];
}
}
return Message;
}());
/**
* @record
*/
/**
* @record
*/
var Text$1 = (function () {
function Text(value, sourceSpan) {
this.value = value;
this.sourceSpan = sourceSpan;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
Text.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) { return visitor.visitText(this, context); };
return Text;
}());
var Container = (function () {
function Container(children, sourceSpan) {
this.children = children;
this.sourceSpan = sourceSpan;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
Container.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) { return visitor.visitContainer(this, context); };
return Container;
}());
var Icu = (function () {
function Icu(expression, type, cases, sourceSpan) {
this.expression = expression;
this.type = type;
this.cases = cases;
this.sourceSpan = sourceSpan;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
Icu.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) { return visitor.visitIcu(this, context); };
return Icu;
}());
var TagPlaceholder = (function () {
function TagPlaceholder(tag, attrs, startName, closeName, children, isVoid, sourceSpan) {
this.tag = tag;
this.attrs = attrs;
this.startName = startName;
this.closeName = closeName;
this.children = children;
this.isVoid = isVoid;
this.sourceSpan = sourceSpan;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
TagPlaceholder.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) { return visitor.visitTagPlaceholder(this, context); };
return TagPlaceholder;
}());
var Placeholder = (function () {
function Placeholder(value, name, sourceSpan) {
this.value = value;
this.name = name;
this.sourceSpan = sourceSpan;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
Placeholder.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) { return visitor.visitPlaceholder(this, context); };
return Placeholder;
}());
var IcuPlaceholder = (function () {
function IcuPlaceholder(value, name, sourceSpan) {
this.value = value;
this.name = name;
this.sourceSpan = sourceSpan;
}
/**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
IcuPlaceholder.prototype.visit = /**
* @param {?} visitor
* @param {?=} context
* @return {?}
*/
function (visitor, context) { return visitor.visitIcuPlaceholder(this, context); };
return IcuPlaceholder;
}());
/**
* @record
*/
var CloneVisitor = (function () {
function CloneVisitor() {
}
/**
* @param {?} text
* @param {?=} context
* @return {?}
*/
CloneVisitor.prototype.visitText = /**
* @param {?} text
* @param {?=} context
* @return {?}
*/
function (text, context) { return new Text$1(text.value, text.sourceSpan); };
/**
* @param {?} container
* @param {?=} context
* @return {?}
*/
CloneVisitor.prototype.visitContainer = /**
* @param {?} container
* @param {?=} context
* @return {?}
*/
function (container, context) {
var _this = this;
var /** @type {?} */ children = container.children.map(function (n) { return n.visit(_this, context); });
return new Container(children, container.sourceSpan);
};
/**
* @param {?} icu
* @param {?=} context
* @return {?}
*/
CloneVisitor.prototype.visitIcu = /**
* @param {?} icu
* @param {?=} context
* @return {?}
*/
function (icu, context) {
var _this = this;
var /** @type {?} */ cases = {};
Object.keys(icu.cases).forEach(function (key) { return cases[key] = icu.cases[key].visit(_this, context); });
var /** @type {?} */ msg = new Icu(icu.expression, icu.type, cases, icu.sourceSpan);
msg.expressionPlaceholder = icu.expressionPlaceholder;
return msg;
};
/**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
CloneVisitor.prototype.visitTagPlaceholder = /**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
function (ph, context) {
var _this = this;
var /** @type {?} */ children = ph.children.map(function (n) { return n.visit(_this, context); });
return new TagPlaceholder(ph.tag, ph.attrs, ph.startName, ph.closeName, children, ph.isVoid, ph.sourceSpan);
};
/**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
CloneVisitor.prototype.visitPlaceholder = /**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
function (ph, context) {
return new Placeholder(ph.value, ph.name, ph.sourceSpan);
};
/**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
CloneVisitor.prototype.visitIcuPlaceholder = /**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
function (ph, context) {
return new IcuPlaceholder(ph.value, ph.name, ph.sourceSpan);
};
return CloneVisitor;
}());
var RecurseVisitor = (function () {
function RecurseVisitor() {
}
/**
* @param {?} text
* @param {?=} context
* @return {?}
*/
RecurseVisitor.prototype.visitText = /**
* @param {?} text
* @param {?=} context
* @return {?}
*/
function (text, context) { };
/**
* @param {?} container
* @param {?=} context
* @return {?}
*/
RecurseVisitor.prototype.visitContainer = /**
* @param {?} container
* @param {?=} context
* @return {?}
*/
function (container, context) {
var _this = this;
container.children.forEach(function (child) { return child.visit(_this); });
};
/**
* @param {?} icu
* @param {?=} context
* @return {?}
*/
RecurseVisitor.prototype.visitIcu = /**
* @param {?} icu
* @param {?=} context
* @return {?}
*/
function (icu, context) {
var _this = this;
Object.keys(icu.cases).forEach(function (k) { icu.cases[k].visit(_this); });
};
/**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
RecurseVisitor.prototype.visitTagPlaceholder = /**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
function (ph, context) {
var _this = this;
ph.children.forEach(function (child) { return child.visit(_this); });
};
/**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
RecurseVisitor.prototype.visitPlaceholder = /**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
function (ph, context) { };
/**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
RecurseVisitor.prototype.visitIcuPlaceholder = /**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
function (ph, context) { };
return RecurseVisitor;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var HtmlTagDefinition = (function () {
function HtmlTagDefinition(_a) {
var _b = _a === void 0 ? {} : _a, closedByChildren = _b.closedByChildren, requiredParents = _b.requiredParents, implicitNamespacePrefix = _b.implicitNamespacePrefix, _c = _b.contentType, contentType = _c === void 0 ? TagContentType.PARSABLE_DATA : _c, _d = _b.closedByParent, closedByParent = _d === void 0 ? false : _d, _e = _b.isVoid, isVoid = _e === void 0 ? false : _e, _f = _b.ignoreFirstLf, ignoreFirstLf = _f === void 0 ? false : _f;
var _this = this;
this.closedByChildren = {};
this.closedByParent = false;
this.canSelfClose = false;
if (closedByChildren && closedByChildren.length > 0) {
closedByChildren.forEach(function (tagName) { return _this.closedByChildren[tagName] = true; });
}
this.isVoid = isVoid;
this.closedByParent = closedByParent || isVoid;
if (requiredParents && requiredParents.length > 0) {
this.requiredParents = {};
// The first parent is the list is automatically when none of the listed parents are present
this.parentToAdd = requiredParents[0];
requiredParents.forEach(function (tagName) { return _this.requiredParents[tagName] = true; });
}
this.implicitNamespacePrefix = implicitNamespacePrefix || null;
this.contentType = contentType;
this.ignoreFirstLf = ignoreFirstLf;
}
/**
* @param {?} currentParent
* @return {?}
*/
HtmlTagDefinition.prototype.requireExtraParent = /**
* @param {?} currentParent
* @return {?}
*/
function (currentParent) {
if (!this.requiredParents) {
return false;
}
if (!currentParent) {
return true;
}
var /** @type {?} */ lcParent = currentParent.toLowerCase();
var /** @type {?} */ isParentTemplate = lcParent === 'template' || currentParent === 'ng-template';
return !isParentTemplate && this.requiredParents[lcParent] != true;
};
/**
* @param {?} name
* @return {?}
*/
HtmlTagDefinition.prototype.isClosedByChild = /**
* @param {?} name
* @return {?}
*/
function (name) {
return this.isVoid || name.toLowerCase() in this.closedByChildren;
};
return HtmlTagDefinition;
}());
// see http://www.w3.org/TR/html51/syntax.html#optional-tags
// This implementation does not fully conform to the HTML5 spec.
var TAG_DEFINITIONS = {
'base': new HtmlTagDefinition({ isVoid: true }),
'meta': new HtmlTagDefinition({ isVoid: true }),
'area': new HtmlTagDefinition({ isVoid: true }),
'embed': new HtmlTagDefinition({ isVoid: true }),
'link': new HtmlTagDefinition({ isVoid: true }),
'img': new HtmlTagDefinition({ isVoid: true }),
'input': new HtmlTagDefinition({ isVoid: true }),
'param': new HtmlTagDefinition({ isVoid: true }),
'hr': new HtmlTagDefinition({ isVoid: true }),
'br': new HtmlTagDefinition({ isVoid: true }),
'source': new HtmlTagDefinition({ isVoid: true }),
'track': new HtmlTagDefinition({ isVoid: true }),
'wbr': new HtmlTagDefinition({ isVoid: true }),
'p': new HtmlTagDefinition({
closedByChildren: [
'address', 'article', 'aside', 'blockquote', 'div', 'dl', 'fieldset', 'footer', 'form',
'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr',
'main', 'nav', 'ol', 'p', 'pre', 'section', 'table', 'ul'
],
closedByParent: true
}),
'thead': new HtmlTagDefinition({ closedByChildren: ['tbody', 'tfoot'] }),
'tbody': new HtmlTagDefinition({ closedByChildren: ['tbody', 'tfoot'], closedByParent: true }),
'tfoot': new HtmlTagDefinition({ closedByChildren: ['tbody'], closedByParent: true }),
'tr': new HtmlTagDefinition({
closedByChildren: ['tr'],
requiredParents: ['tbody', 'tfoot', 'thead'],
closedByParent: true
}),
'td': new HtmlTagDefinition({ closedByChildren: ['td', 'th'], closedByParent: true }),
'th': new HtmlTagDefinition({ closedByChildren: ['td', 'th'], closedByParent: true }),
'col': new HtmlTagDefinition({ requiredParents: ['colgroup'], isVoid: true }),
'svg': new HtmlTagDefinition({ implicitNamespacePrefix: 'svg' }),
'math': new HtmlTagDefinition({ implicitNamespacePrefix: 'math' }),
'li': new HtmlTagDefinition({ closedByChildren: ['li'], closedByParent: true }),
'dt': new HtmlTagDefinition({ closedByChildren: ['dt', 'dd'] }),
'dd': new HtmlTagDefinition({ closedByChildren: ['dt', 'dd'], closedByParent: true }),
'rb': new HtmlTagDefinition({ closedByChildren: ['rb', 'rt', 'rtc', 'rp'], closedByParent: true }),
'rt': new HtmlTagDefinition({ closedByChildren: ['rb', 'rt', 'rtc', 'rp'], closedByParent: true }),
'rtc': new HtmlTagDefinition({ closedByChildren: ['rb', 'rtc', 'rp'], closedByParent: true }),
'rp': new HtmlTagDefinition({ closedByChildren: ['rb', 'rt', 'rtc', 'rp'], closedByParent: true }),
'optgroup': new HtmlTagDefinition({ closedByChildren: ['optgroup'], closedByParent: true }),
'option': new HtmlTagDefinition({ closedByChildren: ['option', 'optgroup'], closedByParent: true }),
'pre': new HtmlTagDefinition({ ignoreFirstLf: true }),
'listing': new HtmlTagDefinition({ ignoreFirstLf: true }),
'style': new HtmlTagDefinition({ contentType: TagContentType.RAW_TEXT }),
'script': new HtmlTagDefinition({ contentType: TagContentType.RAW_TEXT }),
'title': new HtmlTagDefinition({ contentType: TagContentType.ESCAPABLE_RAW_TEXT }),
'textarea': new HtmlTagDefinition({ contentType: TagContentType.ESCAPABLE_RAW_TEXT, ignoreFirstLf: true }),
};
var _DEFAULT_TAG_DEFINITION = new HtmlTagDefinition();
/**
* @param {?} tagName
* @return {?}
*/
function getHtmlTagDefinition(tagName) {
return TAG_DEFINITIONS[tagName.toLowerCase()] || _DEFAULT_TAG_DEFINITION;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var TAG_TO_PLACEHOLDER_NAMES = {
'A': 'LINK',
'B': 'BOLD_TEXT',
'BR': 'LINE_BREAK',
'EM': 'EMPHASISED_TEXT',
'H1': 'HEADING_LEVEL1',
'H2': 'HEADING_LEVEL2',
'H3': 'HEADING_LEVEL3',
'H4': 'HEADING_LEVEL4',
'H5': 'HEADING_LEVEL5',
'H6': 'HEADING_LEVEL6',
'HR': 'HORIZONTAL_RULE',
'I': 'ITALIC_TEXT',
'LI': 'LIST_ITEM',
'LINK': 'MEDIA_LINK',
'OL': 'ORDERED_LIST',
'P': 'PARAGRAPH',
'Q': 'QUOTATION',
'S': 'STRIKETHROUGH_TEXT',
'SMALL': 'SMALL_TEXT',
'SUB': 'SUBSTRIPT',
'SUP': 'SUPERSCRIPT',
'TBODY': 'TABLE_BODY',
'TD': 'TABLE_CELL',
'TFOOT': 'TABLE_FOOTER',
'TH': 'TABLE_HEADER_CELL',
'THEAD': 'TABLE_HEADER',
'TR': 'TABLE_ROW',
'TT': 'MONOSPACED_TEXT',
'U': 'UNDERLINED_TEXT',
'UL': 'UNORDERED_LIST',
};
/**
* Creates unique names for placeholder with different content.
*
* Returns the same placeholder name when the content is identical.
*
* \@internal
*/
var PlaceholderRegistry = (function () {
function PlaceholderRegistry() {
this._placeHolderNameCounts = {};
this._signatureToName = {};
}
/**
* @param {?} tag
* @param {?} attrs
* @param {?} isVoid
* @return {?}
*/
PlaceholderRegistry.prototype.getStartTagPlaceholderName = /**
* @param {?} tag
* @param {?} attrs
* @param {?} isVoid
* @return {?}
*/
function (tag, attrs, isVoid) {
var /** @type {?} */ signature = this._hashTag(tag, attrs, isVoid);
if (this._signatureToName[signature]) {
return this._signatureToName[signature];
}
var /** @type {?} */ upperTag = tag.toUpperCase();
var /** @type {?} */ baseName = TAG_TO_PLACEHOLDER_NAMES[upperTag] || "TAG_" + upperTag;
var /** @type {?} */ name = this._generateUniqueName(isVoid ? baseName : "START_" + baseName);
this._signatureToName[signature] = name;
return name;
};
/**
* @param {?} tag
* @return {?}
*/
PlaceholderRegistry.prototype.getCloseTagPlaceholderName = /**
* @param {?} tag
* @return {?}
*/
function (tag) {
var /** @type {?} */ signature = this._hashClosingTag(tag);
if (this._signatureToName[signature]) {
return this._signatureToName[signature];
}
var /** @type {?} */ upperTag = tag.toUpperCase();
var /** @type {?} */ baseName = TAG_TO_PLACEHOLDER_NAMES[upperTag] || "TAG_" + upperTag;
var /** @type {?} */ name = this._generateUniqueName("CLOSE_" + baseName);
this._signatureToName[signature] = name;
return name;
};
/**
* @param {?} name
* @param {?} content
* @return {?}
*/
PlaceholderRegistry.prototype.getPlaceholderName = /**
* @param {?} name
* @param {?} content
* @return {?}
*/
function (name, content) {
var /** @type {?} */ upperName = name.toUpperCase();
var /** @type {?} */ signature = "PH: " + upperName + "=" + content;
if (this._signatureToName[signature]) {
return this._signatureToName[signature];
}
var /** @type {?} */ uniqueName = this._generateUniqueName(upperName);
this._signatureToName[signature] = uniqueName;
return uniqueName;
};
/**
* @param {?} name
* @return {?}
*/
PlaceholderRegistry.prototype.getUniquePlaceholder = /**
* @param {?} name
* @return {?}
*/
function (name) {
return this._generateUniqueName(name.toUpperCase());
};
/**
* @param {?} tag
* @param {?} attrs
* @param {?} isVoid
* @return {?}
*/
PlaceholderRegistry.prototype._hashTag = /**
* @param {?} tag
* @param {?} attrs
* @param {?} isVoid
* @return {?}
*/
function (tag, attrs, isVoid) {
var /** @type {?} */ start = "<" + tag;
var /** @type {?} */ strAttrs = Object.keys(attrs).sort().map(function (name) { return " " + name + "=" + attrs[name]; }).join('');
var /** @type {?} */ end = isVoid ? '/>' : "></" + tag + ">";
return start + strAttrs + end;
};
/**
* @param {?} tag
* @return {?}
*/
PlaceholderRegistry.prototype._hashClosingTag = /**
* @param {?} tag
* @return {?}
*/
function (tag) { return this._hashTag("/" + tag, {}, false); };
/**
* @param {?} base
* @return {?}
*/
PlaceholderRegistry.prototype._generateUniqueName = /**
* @param {?} base
* @return {?}
*/
function (base) {
var /** @type {?} */ seen = this._placeHolderNameCounts.hasOwnProperty(base);
if (!seen) {
this._placeHolderNameCounts[base] = 1;
return base;
}
var /** @type {?} */ id = this._placeHolderNameCounts[base];
this._placeHolderNameCounts[base] = id + 1;
return base + "_" + id;
};
return PlaceholderRegistry;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var _expParser = new Parser(new Lexer());
/**
* Returns a function converting html nodes to an i18n Message given an interpolationConfig
* @param {?} interpolationConfig
* @return {?}
*/
function createI18nMessageFactory(interpolationConfig) {
var /** @type {?} */ visitor = new _I18nVisitor(_expParser, interpolationConfig);
return function (nodes, meaning, description, id) {
return visitor.toI18nMessage(nodes, meaning, description, id);
};
}
var _I18nVisitor = (function () {
function _I18nVisitor(_expressionParser, _interpolationConfig) {
this._expressionParser = _expressionParser;
this._interpolationConfig = _interpolationConfig;
}
/**
* @param {?} nodes
* @param {?} meaning
* @param {?} description
* @param {?} id
* @return {?}
*/
_I18nVisitor.prototype.toI18nMessage = /**
* @param {?} nodes
* @param {?} meaning
* @param {?} description
* @param {?} id
* @return {?}
*/
function (nodes, meaning, description, id) {
this._isIcu = nodes.length == 1 && nodes[0] instanceof Expansion;
this._icuDepth = 0;
this._placeholderRegistry = new PlaceholderRegistry();
this._placeholderToContent = {};
this._placeholderToMessage = {};
var /** @type {?} */ i18nodes = visitAll(this, nodes, {});
return new Message(i18nodes, this._placeholderToContent, this._placeholderToMessage, meaning, description, id);
};
/**
* @param {?} el
* @param {?} context
* @return {?}
*/
_I18nVisitor.prototype.visitElement = /**
* @param {?} el
* @param {?} context
* @return {?}
*/
function (el, context) {
var /** @type {?} */ children = visitAll(this, el.children);
var /** @type {?} */ attrs = {};
el.attrs.forEach(function (attr) {
// Do not visit the attributes, translatable ones are top-level ASTs
attrs[attr.name] = attr.value;
});
var /** @type {?} */ isVoid = getHtmlTagDefinition(el.name).isVoid;
var /** @type {?} */ startPhName = this._placeholderRegistry.getStartTagPlaceholderName(el.name, attrs, isVoid);
this._placeholderToContent[startPhName] = /** @type {?} */ ((el.sourceSpan)).toString();
var /** @type {?} */ closePhName = '';
if (!isVoid) {
closePhName = this._placeholderRegistry.getCloseTagPlaceholderName(el.name);
this._placeholderToContent[closePhName] = "</" + el.name + ">";
}
return new TagPlaceholder(el.name, attrs, startPhName, closePhName, children, isVoid, /** @type {?} */ ((el.sourceSpan)));
};
/**
* @param {?} attribute
* @param {?} context
* @return {?}
*/
_I18nVisitor.prototype.visitAttribute = /**
* @param {?} attribute
* @param {?} context
* @return {?}
*/
function (attribute, context) {
return this._visitTextWithInterpolation(attribute.value, attribute.sourceSpan);
};
/**
* @param {?} text
* @param {?} context
* @return {?}
*/
_I18nVisitor.prototype.visitText = /**
* @param {?} text
* @param {?} context
* @return {?}
*/
function (text, context) {
return this._visitTextWithInterpolation(text.value, /** @type {?} */ ((text.sourceSpan)));
};
/**
* @param {?} comment
* @param {?} context
* @return {?}
*/
_I18nVisitor.prototype.visitComment = /**
* @param {?} comment
* @param {?} context
* @return {?}
*/
function (comment, context) { return null; };
/**
* @param {?} icu
* @param {?} context
* @return {?}
*/
_I18nVisitor.prototype.visitExpansion = /**
* @param {?} icu
* @param {?} context
* @return {?}
*/
function (icu, context) {
var _this = this;
this._icuDepth++;
var /** @type {?} */ i18nIcuCases = {};
var /** @type {?} */ i18nIcu = new Icu(icu.switchValue, icu.type, i18nIcuCases, icu.sourceSpan);
icu.cases.forEach(function (caze) {
i18nIcuCases[caze.value] = new Container(caze.expression.map(function (node) { return node.visit(_this, {}); }), caze.expSourceSpan);
});
this._icuDepth--;
if (this._isIcu || this._icuDepth > 0) {
// Returns an ICU node when:
// - the message (vs a part of the message) is an ICU message, or
// - the ICU message is nested.
var /** @type {?} */ expPh = this._placeholderRegistry.getUniquePlaceholder("VAR_" + icu.type);
i18nIcu.expressionPlaceholder = expPh;
this._placeholderToContent[expPh] = icu.switchValue;
return i18nIcu;
}
// Else returns a placeholder
// ICU placeholders should not be replaced with their original content but with the their
// translations. We need to create a new visitor (they are not re-entrant) to compute the
// message id.
// TODO(vicb): add a html.Node -> i18n.Message cache to avoid having to re-create the msg
var /** @type {?} */ phName = this._placeholderRegistry.getPlaceholderName('ICU', icu.sourceSpan.toString());
var /** @type {?} */ visitor = new _I18nVisitor(this._expressionParser, this._interpolationConfig);
this._placeholderToMessage[phName] = visitor.toI18nMessage([icu], '', '', '');
return new IcuPlaceholder(i18nIcu, phName, icu.sourceSpan);
};
/**
* @param {?} icuCase
* @param {?} context
* @return {?}
*/
_I18nVisitor.prototype.visitExpansionCase = /**
* @param {?} icuCase
* @param {?} context
* @return {?}
*/
function (icuCase, context) {
throw new Error('Unreachable code');
};
/**
* @param {?} text
* @param {?} sourceSpan
* @return {?}
*/
_I18nVisitor.prototype._visitTextWithInterpolation = /**
* @param {?} text
* @param {?} sourceSpan
* @return {?}
*/
function (text, sourceSpan) {
var /** @type {?} */ splitInterpolation = this._expressionParser.splitInterpolation(text, sourceSpan.start.toString(), this._interpolationConfig);
if (!splitInterpolation) {
// No expression, return a single text
return new Text$1(text, sourceSpan);
}
// Return a group of text + expressions
var /** @type {?} */ nodes = [];
var /** @type {?} */ container = new Container(nodes, sourceSpan);
var _a = this._interpolationConfig, sDelimiter = _a.start, eDelimiter = _a.end;
for (var /** @type {?} */ i = 0; i < splitInterpolation.strings.length - 1; i++) {
var /** @type {?} */ expression = splitInterpolation.expressions[i];
var /** @type {?} */ baseName = _extractPlaceholderName(expression) || 'INTERPOLATION';
var /** @type {?} */ phName = this._placeholderRegistry.getPlaceholderName(baseName, expression);
if (splitInterpolation.strings[i].length) {
// No need to add empty strings
nodes.push(new Text$1(splitInterpolation.strings[i], sourceSpan));
}
nodes.push(new Placeholder(expression, phName, sourceSpan));
this._placeholderToContent[phName] = sDelimiter + expression + eDelimiter;
}
// The last index contains no expression
var /** @type {?} */ lastStringIdx = splitInterpolation.strings.length - 1;
if (splitInterpolation.strings[lastStringIdx].length) {
nodes.push(new Text$1(splitInterpolation.strings[lastStringIdx], sourceSpan));
}
return container;
};
return _I18nVisitor;
}());
var _CUSTOM_PH_EXP = /\/\/[\s\S]*i18n[\s\S]*\([\s\S]*ph[\s\S]*=[\s\S]*("|')([\s\S]*?)\1[\s\S]*\)/g;
/**
* @param {?} input
* @return {?}
*/
function _extractPlaceholderName(input) {
return input.split(_CUSTOM_PH_EXP)[2];
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* An i18n error.
*/
var I18nError = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(I18nError, _super);
function I18nError(span, msg) {
return _super.call(this, span, msg) || this;
}
return I18nError;
}(ParseError));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var _I18N_ATTR = 'i18n';
var _I18N_ATTR_PREFIX = 'i18n-';
var _I18N_COMMENT_PREFIX_REGEXP = /^i18n:?/;
var MEANING_SEPARATOR = '|';
var ID_SEPARATOR = '@@';
var i18nCommentsWarned = false;
/**
* Extract translatable messages from an html AST
* @param {?} nodes
* @param {?} interpolationConfig
* @param {?} implicitTags
* @param {?} implicitAttrs
* @return {?}
*/
function extractMessages(nodes, interpolationConfig, implicitTags, implicitAttrs) {
var /** @type {?} */ visitor = new _Visitor(implicitTags, implicitAttrs);
return visitor.extract(nodes, interpolationConfig);
}
/**
* @param {?} nodes
* @param {?} translations
* @param {?} interpolationConfig
* @param {?} implicitTags
* @param {?} implicitAttrs
* @return {?}
*/
function mergeTranslations(nodes, translations, interpolationConfig, implicitTags, implicitAttrs) {
var /** @type {?} */ visitor = new _Visitor(implicitTags, implicitAttrs);
return visitor.merge(nodes, translations, interpolationConfig);
}
var ExtractionResult = (function () {
function ExtractionResult(messages, errors) {
this.messages = messages;
this.errors = errors;
}
return ExtractionResult;
}());
/** @enum {number} */
var _VisitorMode = {
Extract: 0,
Merge: 1,
};
_VisitorMode[_VisitorMode.Extract] = "Extract";
_VisitorMode[_VisitorMode.Merge] = "Merge";
/**
* This Visitor is used:
* 1. to extract all the translatable strings from an html AST (see `extract()`),
* 2. to replace the translatable strings with the actual translations (see `merge()`)
*
* \@internal
*/
var _Visitor = (function () {
function _Visitor(_implicitTags, _implicitAttrs) {
this._implicitTags = _implicitTags;
this._implicitAttrs = _implicitAttrs;
}
/**
* Extracts the messages from the tree
*/
/**
* Extracts the messages from the tree
* @param {?} nodes
* @param {?} interpolationConfig
* @return {?}
*/
_Visitor.prototype.extract = /**
* Extracts the messages from the tree
* @param {?} nodes
* @param {?} interpolationConfig
* @return {?}
*/
function (nodes, interpolationConfig) {
var _this = this;
this._init(_VisitorMode.Extract, interpolationConfig);
nodes.forEach(function (node) { return node.visit(_this, null); });
if (this._inI18nBlock) {
this._reportError(nodes[nodes.length - 1], 'Unclosed block');
}
return new ExtractionResult(this._messages, this._errors);
};
/**
* Returns a tree where all translatable nodes are translated
*/
/**
* Returns a tree where all translatable nodes are translated
* @param {?} nodes
* @param {?} translations
* @param {?} interpolationConfig
* @return {?}
*/
_Visitor.prototype.merge = /**
* Returns a tree where all translatable nodes are translated
* @param {?} nodes
* @param {?} translations
* @param {?} interpolationConfig
* @return {?}
*/
function (nodes, translations, interpolationConfig) {
this._init(_VisitorMode.Merge, interpolationConfig);
this._translations = translations;
// Construct a single fake root element
var /** @type {?} */ wrapper = new Element('wrapper', [], nodes, /** @type {?} */ ((undefined)), undefined, undefined);
var /** @type {?} */ translatedNode = wrapper.visit(this, null);
if (this._inI18nBlock) {
this._reportError(nodes[nodes.length - 1], 'Unclosed block');
}
return new ParseTreeResult(translatedNode.children, this._errors);
};
/**
* @param {?} icuCase
* @param {?} context
* @return {?}
*/
_Visitor.prototype.visitExpansionCase = /**
* @param {?} icuCase
* @param {?} context
* @return {?}
*/
function (icuCase, context) {
// Parse cases for translatable html attributes
var /** @type {?} */ expression = visitAll(this, icuCase.expression, context);
if (this._mode === _VisitorMode.Merge) {
return new ExpansionCase(icuCase.value, expression, icuCase.sourceSpan, icuCase.valueSourceSpan, icuCase.expSourceSpan);
}
};
/**
* @param {?} icu
* @param {?} context
* @return {?}
*/
_Visitor.prototype.visitExpansion = /**
* @param {?} icu
* @param {?} context
* @return {?}
*/
function (icu, context) {
this._mayBeAddBlockChildren(icu);
var /** @type {?} */ wasInIcu = this._inIcu;
if (!this._inIcu) {
// nested ICU messages should not be extracted but top-level translated as a whole
if (this._isInTranslatableSection) {
this._addMessage([icu]);
}
this._inIcu = true;
}
var /** @type {?} */ cases = visitAll(this, icu.cases, context);
if (this._mode === _VisitorMode.Merge) {
icu = new Expansion(icu.switchValue, icu.type, cases, icu.sourceSpan, icu.switchValueSourceSpan);
}
this._inIcu = wasInIcu;
return icu;
};
/**
* @param {?} comment
* @param {?} context
* @return {?}
*/
_Visitor.prototype.visitComment = /**
* @param {?} comment
* @param {?} context
* @return {?}
*/
function (comment, context) {
var /** @type {?} */ isOpening = _isOpeningComment(comment);
if (isOpening && this._isInTranslatableSection) {
this._reportError(comment, 'Could not start a block inside a translatable section');
return;
}
var /** @type {?} */ isClosing = _isClosingComment(comment);
if (isClosing && !this._inI18nBlock) {
this._reportError(comment, 'Trying to close an unopened block');
return;
}
if (!this._inI18nNode && !this._inIcu) {
if (!this._inI18nBlock) {
if (isOpening) {
// deprecated from v5 you should use <ng-container i18n> instead of i18n comments
if (!i18nCommentsWarned && /** @type {?} */ (console) && /** @type {?} */ (console.warn)) {
i18nCommentsWarned = true;
var /** @type {?} */ details = comment.sourceSpan.details ? ", " + comment.sourceSpan.details : '';
// TODO(ocombe): use a log service once there is a public one available
console.warn("I18n comments are deprecated, use an <ng-container> element instead (" + comment.sourceSpan.start + details + ")");
}
this._inI18nBlock = true;
this._blockStartDepth = this._depth;
this._blockChildren = [];
this._blockMeaningAndDesc = /** @type {?} */ ((comment.value)).replace(_I18N_COMMENT_PREFIX_REGEXP, '').trim();
this._openTranslatableSection(comment);
}
}
else {
if (isClosing) {
if (this._depth == this._blockStartDepth) {
this._closeTranslatableSection(comment, this._blockChildren);
this._inI18nBlock = false;
var /** @type {?} */ message = /** @type {?} */ ((this._addMessage(this._blockChildren, this._blockMeaningAndDesc)));
// merge attributes in sections
var /** @type {?} */ nodes = this._translateMessage(comment, message);
return visitAll(this, nodes);
}
else {
this._reportError(comment, 'I18N blocks should not cross element boundaries');
return;
}
}
}
}
};
/**
* @param {?} text
* @param {?} context
* @return {?}
*/
_Visitor.prototype.visitText = /**
* @param {?} text
* @param {?} context
* @return {?}
*/
function (text, context) {
if (this._isInTranslatableSection) {
this._mayBeAddBlockChildren(text);
}
return text;
};
/**
* @param {?} el
* @param {?} context
* @return {?}
*/
_Visitor.prototype.visitElement = /**
* @param {?} el
* @param {?} context
* @return {?}
*/
function (el, context) {
var _this = this;
this._mayBeAddBlockChildren(el);
this._depth++;
var /** @type {?} */ wasInI18nNode = this._inI18nNode;
var /** @type {?} */ wasInImplicitNode = this._inImplicitNode;
var /** @type {?} */ childNodes = [];
var /** @type {?} */ translatedChildNodes = /** @type {?} */ ((undefined));
// Extract:
// - top level nodes with the (implicit) "i18n" attribute if not already in a section
// - ICU messages
var /** @type {?} */ i18nAttr = _getI18nAttr(el);
var /** @type {?} */ i18nMeta = i18nAttr ? i18nAttr.value : '';
var /** @type {?} */ isImplicit = this._implicitTags.some(function (tag) { return el.name === tag; }) && !this._inIcu &&
!this._isInTranslatableSection;
var /** @type {?} */ isTopLevelImplicit = !wasInImplicitNode && isImplicit;
this._inImplicitNode = wasInImplicitNode || isImplicit;
if (!this._isInTranslatableSection && !this._inIcu) {
if (i18nAttr || isTopLevelImplicit) {
this._inI18nNode = true;
var /** @type {?} */ message = /** @type {?} */ ((this._addMessage(el.children, i18nMeta)));
translatedChildNodes = this._translateMessage(el, message);
}
if (this._mode == _VisitorMode.Extract) {
var /** @type {?} */ isTranslatable = i18nAttr || isTopLevelImplicit;
if (isTranslatable)
this._openTranslatableSection(el);
visitAll(this, el.children);
if (isTranslatable)
this._closeTranslatableSection(el, el.children);
}
}
else {
if (i18nAttr || isTopLevelImplicit) {
this._reportError(el, 'Could not mark an element as translatable inside a translatable section');
}
if (this._mode == _VisitorMode.Extract) {
// Descend into child nodes for extraction
visitAll(this, el.children);
}
}
if (this._mode === _VisitorMode.Merge) {
var /** @type {?} */ visitNodes = translatedChildNodes || el.children;
visitNodes.forEach(function (child) {
var /** @type {?} */ visited = child.visit(_this, context);
if (visited && !_this._isInTranslatableSection) {
// Do not add the children from translatable sections (= i18n blocks here)
// They will be added later in this loop when the block closes (i.e. on `<!-- /i18n -->`)
childNodes = childNodes.concat(visited);
}
});
}
this._visitAttributesOf(el);
this._depth--;
this._inI18nNode = wasInI18nNode;
this._inImplicitNode = wasInImplicitNode;
if (this._mode === _VisitorMode.Merge) {
var /** @type {?} */ translatedAttrs = this._translateAttributes(el);
return new Element(el.name, translatedAttrs, childNodes, el.sourceSpan, el.startSourceSpan, el.endSourceSpan);
}
return null;
};
/**
* @param {?} attribute
* @param {?} context
* @return {?}
*/
_Visitor.prototype.visitAttribute = /**
* @param {?} attribute
* @param {?} context
* @return {?}
*/
function (attribute, context) {
throw new Error('unreachable code');
};
/**
* @param {?} mode
* @param {?} interpolationConfig
* @return {?}
*/
_Visitor.prototype._init = /**
* @param {?} mode
* @param {?} interpolationConfig
* @return {?}
*/
function (mode, interpolationConfig) {
this._mode = mode;
this._inI18nBlock = false;
this._inI18nNode = false;
this._depth = 0;
this._inIcu = false;
this._msgCountAtSectionStart = undefined;
this._errors = [];
this._messages = [];
this._inImplicitNode = false;
this._createI18nMessage = createI18nMessageFactory(interpolationConfig);
};
/**
* @param {?} el
* @return {?}
*/
_Visitor.prototype._visitAttributesOf = /**
* @param {?} el
* @return {?}
*/
function (el) {
var _this = this;
var /** @type {?} */ explicitAttrNameToValue = {};
var /** @type {?} */ implicitAttrNames = this._implicitAttrs[el.name] || [];
el.attrs.filter(function (attr) { return attr.name.startsWith(_I18N_ATTR_PREFIX); })
.forEach(function (attr) {
return explicitAttrNameToValue[attr.name.slice(_I18N_ATTR_PREFIX.length)] =
attr.value;
});
el.attrs.forEach(function (attr) {
if (attr.name in explicitAttrNameToValue) {
_this._addMessage([attr], explicitAttrNameToValue[attr.name]);
}
else if (implicitAttrNames.some(function (name) { return attr.name === name; })) {
_this._addMessage([attr]);
}
});
};
/**
* @param {?} ast
* @param {?=} msgMeta
* @return {?}
*/
_Visitor.prototype._addMessage = /**
* @param {?} ast
* @param {?=} msgMeta
* @return {?}
*/
function (ast, msgMeta) {
if (ast.length == 0 ||
ast.length == 1 && ast[0] instanceof Attribute$1 && !(/** @type {?} */ (ast[0])).value) {
// Do not create empty messages
return null;
}
var _a = _parseMessageMeta(msgMeta), meaning = _a.meaning, description = _a.description, id = _a.id;
var /** @type {?} */ message = this._createI18nMessage(ast, meaning, description, id);
this._messages.push(message);
return message;
};
/**
* @param {?} el
* @param {?} message
* @return {?}
*/
_Visitor.prototype._translateMessage = /**
* @param {?} el
* @param {?} message
* @return {?}
*/
function (el, message) {
if (message && this._mode === _VisitorMode.Merge) {
var /** @type {?} */ nodes = this._translations.get(message);
if (nodes) {
return nodes;
}
this._reportError(el, "Translation unavailable for message id=\"" + this._translations.digest(message) + "\"");
}
return [];
};
/**
* @param {?} el
* @return {?}
*/
_Visitor.prototype._translateAttributes = /**
* @param {?} el
* @return {?}
*/
function (el) {
var _this = this;
var /** @type {?} */ attributes = el.attrs;
var /** @type {?} */ i18nParsedMessageMeta = {};
attributes.forEach(function (attr) {
if (attr.name.startsWith(_I18N_ATTR_PREFIX)) {
i18nParsedMessageMeta[attr.name.slice(_I18N_ATTR_PREFIX.length)] =
_parseMessageMeta(attr.value);
}
});
var /** @type {?} */ translatedAttributes = [];
attributes.forEach(function (attr) {
if (attr.name === _I18N_ATTR || attr.name.startsWith(_I18N_ATTR_PREFIX)) {
// strip i18n specific attributes
return;
}
if (attr.value && attr.value != '' && i18nParsedMessageMeta.hasOwnProperty(attr.name)) {
var _a = i18nParsedMessageMeta[attr.name], meaning = _a.meaning, description = _a.description, id = _a.id;
var /** @type {?} */ message = _this._createI18nMessage([attr], meaning, description, id);
var /** @type {?} */ nodes = _this._translations.get(message);
if (nodes) {
if (nodes.length == 0) {
translatedAttributes.push(new Attribute$1(attr.name, '', attr.sourceSpan));
}
else if (nodes[0] instanceof Text) {
var /** @type {?} */ value = (/** @type {?} */ (nodes[0])).value;
translatedAttributes.push(new Attribute$1(attr.name, value, attr.sourceSpan));
}
else {
_this._reportError(el, "Unexpected translation for attribute \"" + attr.name + "\" (id=\"" + (id || _this._translations.digest(message)) + "\")");
}
}
else {
_this._reportError(el, "Translation unavailable for attribute \"" + attr.name + "\" (id=\"" + (id || _this._translations.digest(message)) + "\")");
}
}
else {
translatedAttributes.push(attr);
}
});
return translatedAttributes;
};
/**
* Add the node as a child of the block when:
* - we are in a block,
* - we are not inside a ICU message (those are handled separately),
* - the node is a "direct child" of the block
* @param {?} node
* @return {?}
*/
_Visitor.prototype._mayBeAddBlockChildren = /**
* Add the node as a child of the block when:
* - we are in a block,
* - we are not inside a ICU message (those are handled separately),
* - the node is a "direct child" of the block
* @param {?} node
* @return {?}
*/
function (node) {
if (this._inI18nBlock && !this._inIcu && this._depth == this._blockStartDepth) {
this._blockChildren.push(node);
}
};
/**
* Marks the start of a section, see `_closeTranslatableSection`
* @param {?} node
* @return {?}
*/
_Visitor.prototype._openTranslatableSection = /**
* Marks the start of a section, see `_closeTranslatableSection`
* @param {?} node
* @return {?}
*/
function (node) {
if (this._isInTranslatableSection) {
this._reportError(node, 'Unexpected section start');
}
else {
this._msgCountAtSectionStart = this._messages.length;
}
};
Object.defineProperty(_Visitor.prototype, "_isInTranslatableSection", {
get: /**
* A translatable section could be:
* - the content of translatable element,
* - nodes between `<!-- i18n -->` and `<!-- /i18n -->` comments
* @return {?}
*/
function () {
return this._msgCountAtSectionStart !== void 0;
},
enumerable: true,
configurable: true
});
/**
* Terminates a section.
*
* If a section has only one significant children (comments not significant) then we should not
* keep the message from this children:
*
* `<p i18n="meaning|description">{ICU message}</p>` would produce two messages:
* - one for the <p> content with meaning and description,
* - another one for the ICU message.
*
* In this case the last message is discarded as it contains less information (the AST is
* otherwise identical).
*
* Note that we should still keep messages extracted from attributes inside the section (ie in the
* ICU message here)
* @param {?} node
* @param {?} directChildren
* @return {?}
*/
_Visitor.prototype._closeTranslatableSection = /**
* Terminates a section.
*
* If a section has only one significant children (comments not significant) then we should not
* keep the message from this children:
*
* `<p i18n="meaning|description">{ICU message}</p>` would produce two messages:
* - one for the <p> content with meaning and description,
* - another one for the ICU message.
*
* In this case the last message is discarded as it contains less information (the AST is
* otherwise identical).
*
* Note that we should still keep messages extracted from attributes inside the section (ie in the
* ICU message here)
* @param {?} node
* @param {?} directChildren
* @return {?}
*/
function (node, directChildren) {
if (!this._isInTranslatableSection) {
this._reportError(node, 'Unexpected section end');
return;
}
var /** @type {?} */ startIndex = this._msgCountAtSectionStart;
var /** @type {?} */ significantChildren = directChildren.reduce(function (count, node) { return count + (node instanceof Comment ? 0 : 1); }, 0);
if (significantChildren == 1) {
for (var /** @type {?} */ i = this._messages.length - 1; i >= /** @type {?} */ ((startIndex)); i--) {
var /** @type {?} */ ast = this._messages[i].nodes;
if (!(ast.length == 1 && ast[0] instanceof Text$1)) {
this._messages.splice(i, 1);
break;
}
}
}
this._msgCountAtSectionStart = undefined;
};
/**
* @param {?} node
* @param {?} msg
* @return {?}
*/
_Visitor.prototype._reportError = /**
* @param {?} node
* @param {?} msg
* @return {?}
*/
function (node, msg) {
this._errors.push(new I18nError(/** @type {?} */ ((node.sourceSpan)), msg));
};
return _Visitor;
}());
/**
* @param {?} n
* @return {?}
*/
function _isOpeningComment(n) {
return !!(n instanceof Comment && n.value && n.value.startsWith('i18n'));
}
/**
* @param {?} n
* @return {?}
*/
function _isClosingComment(n) {
return !!(n instanceof Comment && n.value && n.value === '/i18n');
}
/**
* @param {?} p
* @return {?}
*/
function _getI18nAttr(p) {
return p.attrs.find(function (attr) { return attr.name === _I18N_ATTR; }) || null;
}
/**
* @param {?=} i18n
* @return {?}
*/
function _parseMessageMeta(i18n) {
if (!i18n)
return { meaning: '', description: '', id: '' };
var /** @type {?} */ idIndex = i18n.indexOf(ID_SEPARATOR);
var /** @type {?} */ descIndex = i18n.indexOf(MEANING_SEPARATOR);
var _a = (idIndex > -1) ? [i18n.slice(0, idIndex), i18n.slice(idIndex + 2)] : [i18n, ''], meaningAndDesc = _a[0], id = _a[1];
var _b = (descIndex > -1) ?
[meaningAndDesc.slice(0, descIndex), meaningAndDesc.slice(descIndex + 1)] :
['', meaningAndDesc], meaning = _b[0], description = _b[1];
return { meaning: meaning, description: description, id: id };
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var XmlTagDefinition = (function () {
function XmlTagDefinition() {
this.closedByParent = false;
this.contentType = TagContentType.PARSABLE_DATA;
this.isVoid = false;
this.ignoreFirstLf = false;
this.canSelfClose = true;
}
/**
* @param {?} currentParent
* @return {?}
*/
XmlTagDefinition.prototype.requireExtraParent = /**
* @param {?} currentParent
* @return {?}
*/
function (currentParent) { return false; };
/**
* @param {?} name
* @return {?}
*/
XmlTagDefinition.prototype.isClosedByChild = /**
* @param {?} name
* @return {?}
*/
function (name) { return false; };
return XmlTagDefinition;
}());
var _TAG_DEFINITION = new XmlTagDefinition();
/**
* @param {?} tagName
* @return {?}
*/
function getXmlTagDefinition(tagName) {
return _TAG_DEFINITION;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var XmlParser = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(XmlParser, _super);
function XmlParser() {
return _super.call(this, getXmlTagDefinition) || this;
}
/**
* @param {?} source
* @param {?} url
* @param {?=} parseExpansionForms
* @return {?}
*/
XmlParser.prototype.parse = /**
* @param {?} source
* @param {?} url
* @param {?=} parseExpansionForms
* @return {?}
*/
function (source, url, parseExpansionForms) {
if (parseExpansionForms === void 0) { parseExpansionForms = false; }
return _super.prototype.parse.call(this, source, url, parseExpansionForms);
};
return XmlParser;
}(Parser$1));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @abstract
*/
var Serializer = (function () {
function Serializer() {
}
// Creates a name mapper, see `PlaceholderMapper`
// Returning `null` means that no name mapping is used.
/**
* @param {?} message
* @return {?}
*/
Serializer.prototype.createNameMapper = /**
* @param {?} message
* @return {?}
*/
function (message) { return null; };
return Serializer;
}());
/**
* A `PlaceholderMapper` converts placeholder names from internal to serialized representation and
* back.
*
* It should be used for serialization format that put constraints on the placeholder names.
* @record
*/
/**
* A simple mapper that take a function to transform an internal name to a public name
*/
var SimplePlaceholderMapper = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(SimplePlaceholderMapper, _super);
// create a mapping from the message
function SimplePlaceholderMapper(message, mapName) {
var _this = _super.call(this) || this;
_this.mapName = mapName;
_this.internalToPublic = {};
_this.publicToNextId = {};
_this.publicToInternal = {};
message.nodes.forEach(function (node) { return node.visit(_this); });
return _this;
}
/**
* @param {?} internalName
* @return {?}
*/
SimplePlaceholderMapper.prototype.toPublicName = /**
* @param {?} internalName
* @return {?}
*/
function (internalName) {
return this.internalToPublic.hasOwnProperty(internalName) ?
this.internalToPublic[internalName] :
null;
};
/**
* @param {?} publicName
* @return {?}
*/
SimplePlaceholderMapper.prototype.toInternalName = /**
* @param {?} publicName
* @return {?}
*/
function (publicName) {
return this.publicToInternal.hasOwnProperty(publicName) ? this.publicToInternal[publicName] :
null;
};
/**
* @param {?} text
* @param {?=} context
* @return {?}
*/
SimplePlaceholderMapper.prototype.visitText = /**
* @param {?} text
* @param {?=} context
* @return {?}
*/
function (text, context) { return null; };
/**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
SimplePlaceholderMapper.prototype.visitTagPlaceholder = /**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
function (ph, context) {
this.visitPlaceholderName(ph.startName);
_super.prototype.visitTagPlaceholder.call(this, ph, context);
this.visitPlaceholderName(ph.closeName);
};
/**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
SimplePlaceholderMapper.prototype.visitPlaceholder = /**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
function (ph, context) { this.visitPlaceholderName(ph.name); };
/**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
SimplePlaceholderMapper.prototype.visitIcuPlaceholder = /**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
function (ph, context) {
this.visitPlaceholderName(ph.name);
};
/**
* @param {?} internalName
* @return {?}
*/
SimplePlaceholderMapper.prototype.visitPlaceholderName = /**
* @param {?} internalName
* @return {?}
*/
function (internalName) {
if (!internalName || this.internalToPublic.hasOwnProperty(internalName)) {
return;
}
var /** @type {?} */ publicName = this.mapName(internalName);
if (this.publicToInternal.hasOwnProperty(publicName)) {
// Create a new XMB when it has already been used
var /** @type {?} */ nextId = this.publicToNextId[publicName];
this.publicToNextId[publicName] = nextId + 1;
publicName = publicName + "_" + nextId;
}
else {
this.publicToNextId[publicName] = 1;
}
this.internalToPublic[internalName] = publicName;
this.publicToInternal[publicName] = internalName;
};
return SimplePlaceholderMapper;
}(RecurseVisitor));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @record
*/
var _Visitor$1 = (function () {
function _Visitor() {
}
/**
* @param {?} tag
* @return {?}
*/
_Visitor.prototype.visitTag = /**
* @param {?} tag
* @return {?}
*/
function (tag) {
var _this = this;
var /** @type {?} */ strAttrs = this._serializeAttributes(tag.attrs);
if (tag.children.length == 0) {
return "<" + tag.name + strAttrs + "/>";
}
var /** @type {?} */ strChildren = tag.children.map(function (node) { return node.visit(_this); });
return "<" + tag.name + strAttrs + ">" + strChildren.join('') + "</" + tag.name + ">";
};
/**
* @param {?} text
* @return {?}
*/
_Visitor.prototype.visitText = /**
* @param {?} text
* @return {?}
*/
function (text) { return text.value; };
/**
* @param {?} decl
* @return {?}
*/
_Visitor.prototype.visitDeclaration = /**
* @param {?} decl
* @return {?}
*/
function (decl) {
return "<?xml" + this._serializeAttributes(decl.attrs) + " ?>";
};
/**
* @param {?} attrs
* @return {?}
*/
_Visitor.prototype._serializeAttributes = /**
* @param {?} attrs
* @return {?}
*/
function (attrs) {
var /** @type {?} */ strAttrs = Object.keys(attrs).map(function (name) { return name + "=\"" + attrs[name] + "\""; }).join(' ');
return strAttrs.length > 0 ? ' ' + strAttrs : '';
};
/**
* @param {?} doctype
* @return {?}
*/
_Visitor.prototype.visitDoctype = /**
* @param {?} doctype
* @return {?}
*/
function (doctype) {
return "<!DOCTYPE " + doctype.rootTag + " [\n" + doctype.dtd + "\n]>";
};
return _Visitor;
}());
var _visitor = new _Visitor$1();
/**
* @param {?} nodes
* @return {?}
*/
function serialize(nodes) {
return nodes.map(function (node) { return node.visit(_visitor); }).join('');
}
/**
* @record
*/
var Declaration = (function () {
function Declaration(unescapedAttrs) {
var _this = this;
this.attrs = {};
Object.keys(unescapedAttrs).forEach(function (k) {
_this.attrs[k] = _escapeXml(unescapedAttrs[k]);
});
}
/**
* @param {?} visitor
* @return {?}
*/
Declaration.prototype.visit = /**
* @param {?} visitor
* @return {?}
*/
function (visitor) { return visitor.visitDeclaration(this); };
return Declaration;
}());
var Doctype = (function () {
function Doctype(rootTag, dtd) {
this.rootTag = rootTag;
this.dtd = dtd;
}
/**
* @param {?} visitor
* @return {?}
*/
Doctype.prototype.visit = /**
* @param {?} visitor
* @return {?}
*/
function (visitor) { return visitor.visitDoctype(this); };
return Doctype;
}());
var Tag = (function () {
function Tag(name, unescapedAttrs, children) {
if (unescapedAttrs === void 0) { unescapedAttrs = {}; }
if (children === void 0) { children = []; }
var _this = this;
this.name = name;
this.children = children;
this.attrs = {};
Object.keys(unescapedAttrs).forEach(function (k) {
_this.attrs[k] = _escapeXml(unescapedAttrs[k]);
});
}
/**
* @param {?} visitor
* @return {?}
*/
Tag.prototype.visit = /**
* @param {?} visitor
* @return {?}
*/
function (visitor) { return visitor.visitTag(this); };
return Tag;
}());
var Text$2 = (function () {
function Text(unescapedValue) {
this.value = _escapeXml(unescapedValue);
}
/**
* @param {?} visitor
* @return {?}
*/
Text.prototype.visit = /**
* @param {?} visitor
* @return {?}
*/
function (visitor) { return visitor.visitText(this); };
return Text;
}());
var CR = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(CR, _super);
function CR(ws) {
if (ws === void 0) { ws = 0; }
return _super.call(this, "\n" + new Array(ws + 1).join(' ')) || this;
}
return CR;
}(Text$2));
var _ESCAPED_CHARS = [
[/&/g, '&'],
[/"/g, '"'],
[/'/g, '''],
[/</g, '<'],
[/>/g, '>'],
];
/**
* @param {?} text
* @return {?}
*/
function _escapeXml(text) {
return _ESCAPED_CHARS.reduce(function (text, entry) { return text.replace(entry[0], entry[1]); }, text);
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var _VERSION = '1.2';
var _XMLNS = 'urn:oasis:names:tc:xliff:document:1.2';
// TODO(vicb): make this a param (s/_/-/)
var _DEFAULT_SOURCE_LANG = 'en';
var _PLACEHOLDER_TAG = 'x';
var _FILE_TAG = 'file';
var _SOURCE_TAG = 'source';
var _TARGET_TAG = 'target';
var _UNIT_TAG = 'trans-unit';
var _CONTEXT_GROUP_TAG = 'context-group';
var _CONTEXT_TAG = 'context';
var Xliff = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Xliff, _super);
function Xliff() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @param {?} messages
* @param {?} locale
* @return {?}
*/
Xliff.prototype.write = /**
* @param {?} messages
* @param {?} locale
* @return {?}
*/
function (messages, locale) {
var /** @type {?} */ visitor = new _WriteVisitor();
var /** @type {?} */ transUnits = [];
messages.forEach(function (message) {
var /** @type {?} */ contextTags = [];
message.sources.forEach(function (source) {
var /** @type {?} */ contextGroupTag = new Tag(_CONTEXT_GROUP_TAG, { purpose: 'location' });
contextGroupTag.children.push(new CR(10), new Tag(_CONTEXT_TAG, { 'context-type': 'sourcefile' }, [new Text$2(source.filePath)]), new CR(10), new Tag(_CONTEXT_TAG, { 'context-type': 'linenumber' }, [new Text$2("" + source.startLine)]), new CR(8));
contextTags.push(new CR(8), contextGroupTag);
});
var /** @type {?} */ transUnit = new Tag(_UNIT_TAG, { id: message.id, datatype: 'html' });
(_a = transUnit.children).push.apply(_a, [new CR(8), new Tag(_SOURCE_TAG, {}, visitor.serialize(message.nodes))].concat(contextTags));
if (message.description) {
transUnit.children.push(new CR(8), new Tag('note', { priority: '1', from: 'description' }, [new Text$2(message.description)]));
}
if (message.meaning) {
transUnit.children.push(new CR(8), new Tag('note', { priority: '1', from: 'meaning' }, [new Text$2(message.meaning)]));
}
transUnit.children.push(new CR(6));
transUnits.push(new CR(6), transUnit);
var _a;
});
var /** @type {?} */ body = new Tag('body', {}, transUnits.concat([new CR(4)]));
var /** @type {?} */ file = new Tag('file', {
'source-language': locale || _DEFAULT_SOURCE_LANG,
datatype: 'plaintext',
original: 'ng2.template',
}, [new CR(4), body, new CR(2)]);
var /** @type {?} */ xliff = new Tag('xliff', { version: _VERSION, xmlns: _XMLNS }, [new CR(2), file, new CR()]);
return serialize([
new Declaration({ version: '1.0', encoding: 'UTF-8' }), new CR(), xliff, new CR()
]);
};
/**
* @param {?} content
* @param {?} url
* @return {?}
*/
Xliff.prototype.load = /**
* @param {?} content
* @param {?} url
* @return {?}
*/
function (content, url) {
// xliff to xml nodes
var /** @type {?} */ xliffParser = new XliffParser();
var _a = xliffParser.parse(content, url), locale = _a.locale, msgIdToHtml = _a.msgIdToHtml, errors = _a.errors;
// xml nodes to i18n nodes
var /** @type {?} */ i18nNodesByMsgId = {};
var /** @type {?} */ converter = new XmlToI18n();
Object.keys(msgIdToHtml).forEach(function (msgId) {
var _a = converter.convert(msgIdToHtml[msgId], url), i18nNodes = _a.i18nNodes, e = _a.errors;
errors.push.apply(errors, e);
i18nNodesByMsgId[msgId] = i18nNodes;
});
if (errors.length) {
throw new Error("xliff parse errors:\n" + errors.join('\n'));
}
return { locale: /** @type {?} */ ((locale)), i18nNodesByMsgId: i18nNodesByMsgId };
};
/**
* @param {?} message
* @return {?}
*/
Xliff.prototype.digest = /**
* @param {?} message
* @return {?}
*/
function (message) { return digest(message); };
return Xliff;
}(Serializer));
var _WriteVisitor = (function () {
function _WriteVisitor() {
}
/**
* @param {?} text
* @param {?=} context
* @return {?}
*/
_WriteVisitor.prototype.visitText = /**
* @param {?} text
* @param {?=} context
* @return {?}
*/
function (text, context) { return [new Text$2(text.value)]; };
/**
* @param {?} container
* @param {?=} context
* @return {?}
*/
_WriteVisitor.prototype.visitContainer = /**
* @param {?} container
* @param {?=} context
* @return {?}
*/
function (container, context) {
var _this = this;
var /** @type {?} */ nodes = [];
container.children.forEach(function (node) { return nodes.push.apply(nodes, node.visit(_this)); });
return nodes;
};
/**
* @param {?} icu
* @param {?=} context
* @return {?}
*/
_WriteVisitor.prototype.visitIcu = /**
* @param {?} icu
* @param {?=} context
* @return {?}
*/
function (icu, context) {
var _this = this;
var /** @type {?} */ nodes = [new Text$2("{" + icu.expressionPlaceholder + ", " + icu.type + ", ")];
Object.keys(icu.cases).forEach(function (c) {
nodes.push.apply(nodes, [new Text$2(c + " {")].concat(icu.cases[c].visit(_this), [new Text$2("} ")]));
});
nodes.push(new Text$2("}"));
return nodes;
};
/**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
_WriteVisitor.prototype.visitTagPlaceholder = /**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
function (ph, context) {
var /** @type {?} */ ctype = getCtypeForTag(ph.tag);
if (ph.isVoid) {
// void tags have no children nor closing tags
return [new Tag(_PLACEHOLDER_TAG, { id: ph.startName, ctype: ctype, 'equiv-text': "<" + ph.tag + "/>" })];
}
var /** @type {?} */ startTagPh = new Tag(_PLACEHOLDER_TAG, { id: ph.startName, ctype: ctype, 'equiv-text': "<" + ph.tag + ">" });
var /** @type {?} */ closeTagPh = new Tag(_PLACEHOLDER_TAG, { id: ph.closeName, ctype: ctype, 'equiv-text': "</" + ph.tag + ">" });
return [startTagPh].concat(this.serialize(ph.children), [closeTagPh]);
};
/**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
_WriteVisitor.prototype.visitPlaceholder = /**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
function (ph, context) {
return [new Tag(_PLACEHOLDER_TAG, { id: ph.name, 'equiv-text': "{{" + ph.value + "}}" })];
};
/**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
_WriteVisitor.prototype.visitIcuPlaceholder = /**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
function (ph, context) {
var /** @type {?} */ equivText = "{" + ph.value.expression + ", " + ph.value.type + ", " + Object.keys(ph.value.cases).map(function (value) { return value + ' {...}'; }).join(' ') + "}";
return [new Tag(_PLACEHOLDER_TAG, { id: ph.name, 'equiv-text': equivText })];
};
/**
* @param {?} nodes
* @return {?}
*/
_WriteVisitor.prototype.serialize = /**
* @param {?} nodes
* @return {?}
*/
function (nodes) {
var _this = this;
return [].concat.apply([], nodes.map(function (node) { return node.visit(_this); }));
};
return _WriteVisitor;
}());
var XliffParser = (function () {
function XliffParser() {
this._locale = null;
}
/**
* @param {?} xliff
* @param {?} url
* @return {?}
*/
XliffParser.prototype.parse = /**
* @param {?} xliff
* @param {?} url
* @return {?}
*/
function (xliff, url) {
this._unitMlString = null;
this._msgIdToHtml = {};
var /** @type {?} */ xml = new XmlParser().parse(xliff, url, false);
this._errors = xml.errors;
visitAll(this, xml.rootNodes, null);
return {
msgIdToHtml: this._msgIdToHtml,
errors: this._errors,
locale: this._locale,
};
};
/**
* @param {?} element
* @param {?} context
* @return {?}
*/
XliffParser.prototype.visitElement = /**
* @param {?} element
* @param {?} context
* @return {?}
*/
function (element, context) {
switch (element.name) {
case _UNIT_TAG:
this._unitMlString = /** @type {?} */ ((null));
var /** @type {?} */ idAttr = element.attrs.find(function (attr) { return attr.name === 'id'; });
if (!idAttr) {
this._addError(element, "<" + _UNIT_TAG + "> misses the \"id\" attribute");
}
else {
var /** @type {?} */ id = idAttr.value;
if (this._msgIdToHtml.hasOwnProperty(id)) {
this._addError(element, "Duplicated translations for msg " + id);
}
else {
visitAll(this, element.children, null);
if (typeof this._unitMlString === 'string') {
this._msgIdToHtml[id] = this._unitMlString;
}
else {
this._addError(element, "Message " + id + " misses a translation");
}
}
}
break;
case _SOURCE_TAG:
// ignore source message
break;
case _TARGET_TAG:
var /** @type {?} */ innerTextStart = /** @type {?} */ ((element.startSourceSpan)).end.offset;
var /** @type {?} */ innerTextEnd = /** @type {?} */ ((element.endSourceSpan)).start.offset;
var /** @type {?} */ content = /** @type {?} */ ((element.startSourceSpan)).start.file.content;
var /** @type {?} */ innerText = content.slice(innerTextStart, innerTextEnd);
this._unitMlString = innerText;
break;
case _FILE_TAG:
var /** @type {?} */ localeAttr = element.attrs.find(function (attr) { return attr.name === 'target-language'; });
if (localeAttr) {
this._locale = localeAttr.value;
}
visitAll(this, element.children, null);
break;
default:
// TODO(vicb): assert file structure, xliff version
// For now only recurse on unhandled nodes
visitAll(this, element.children, null);
}
};
/**
* @param {?} attribute
* @param {?} context
* @return {?}
*/
XliffParser.prototype.visitAttribute = /**
* @param {?} attribute
* @param {?} context
* @return {?}
*/
function (attribute, context) { };
/**
* @param {?} text
* @param {?} context
* @return {?}
*/
XliffParser.prototype.visitText = /**
* @param {?} text
* @param {?} context
* @return {?}
*/
function (text, context) { };
/**
* @param {?} comment
* @param {?} context
* @return {?}
*/
XliffParser.prototype.visitComment = /**
* @param {?} comment
* @param {?} context
* @return {?}
*/
function (comment, context) { };
/**
* @param {?} expansion
* @param {?} context
* @return {?}
*/
XliffParser.prototype.visitExpansion = /**
* @param {?} expansion
* @param {?} context
* @return {?}
*/
function (expansion, context) { };
/**
* @param {?} expansionCase
* @param {?} context
* @return {?}
*/
XliffParser.prototype.visitExpansionCase = /**
* @param {?} expansionCase
* @param {?} context
* @return {?}
*/
function (expansionCase, context) { };
/**
* @param {?} node
* @param {?} message
* @return {?}
*/
XliffParser.prototype._addError = /**
* @param {?} node
* @param {?} message
* @return {?}
*/
function (node, message) {
this._errors.push(new I18nError(/** @type {?} */ ((node.sourceSpan)), message));
};
return XliffParser;
}());
var XmlToI18n = (function () {
function XmlToI18n() {
}
/**
* @param {?} message
* @param {?} url
* @return {?}
*/
XmlToI18n.prototype.convert = /**
* @param {?} message
* @param {?} url
* @return {?}
*/
function (message, url) {
var /** @type {?} */ xmlIcu = new XmlParser().parse(message, url, true);
this._errors = xmlIcu.errors;
var /** @type {?} */ i18nNodes = this._errors.length > 0 || xmlIcu.rootNodes.length == 0 ?
[] :
visitAll(this, xmlIcu.rootNodes);
return {
i18nNodes: i18nNodes,
errors: this._errors,
};
};
/**
* @param {?} text
* @param {?} context
* @return {?}
*/
XmlToI18n.prototype.visitText = /**
* @param {?} text
* @param {?} context
* @return {?}
*/
function (text, context) { return new Text$1(text.value, /** @type {?} */ ((text.sourceSpan))); };
/**
* @param {?} el
* @param {?} context
* @return {?}
*/
XmlToI18n.prototype.visitElement = /**
* @param {?} el
* @param {?} context
* @return {?}
*/
function (el, context) {
if (el.name === _PLACEHOLDER_TAG) {
var /** @type {?} */ nameAttr = el.attrs.find(function (attr) { return attr.name === 'id'; });
if (nameAttr) {
return new Placeholder('', nameAttr.value, /** @type {?} */ ((el.sourceSpan)));
}
this._addError(el, "<" + _PLACEHOLDER_TAG + "> misses the \"id\" attribute");
}
else {
this._addError(el, "Unexpected tag");
}
return null;
};
/**
* @param {?} icu
* @param {?} context
* @return {?}
*/
XmlToI18n.prototype.visitExpansion = /**
* @param {?} icu
* @param {?} context
* @return {?}
*/
function (icu, context) {
var /** @type {?} */ caseMap = {};
visitAll(this, icu.cases).forEach(function (c) {
caseMap[c.value] = new Container(c.nodes, icu.sourceSpan);
});
return new Icu(icu.switchValue, icu.type, caseMap, icu.sourceSpan);
};
/**
* @param {?} icuCase
* @param {?} context
* @return {?}
*/
XmlToI18n.prototype.visitExpansionCase = /**
* @param {?} icuCase
* @param {?} context
* @return {?}
*/
function (icuCase, context) {
return {
value: icuCase.value,
nodes: visitAll(this, icuCase.expression),
};
};
/**
* @param {?} comment
* @param {?} context
* @return {?}
*/
XmlToI18n.prototype.visitComment = /**
* @param {?} comment
* @param {?} context
* @return {?}
*/
function (comment, context) { };
/**
* @param {?} attribute
* @param {?} context
* @return {?}
*/
XmlToI18n.prototype.visitAttribute = /**
* @param {?} attribute
* @param {?} context
* @return {?}
*/
function (attribute, context) { };
/**
* @param {?} node
* @param {?} message
* @return {?}
*/
XmlToI18n.prototype._addError = /**
* @param {?} node
* @param {?} message
* @return {?}
*/
function (node, message) {
this._errors.push(new I18nError(/** @type {?} */ ((node.sourceSpan)), message));
};
return XmlToI18n;
}());
/**
* @param {?} tag
* @return {?}
*/
function getCtypeForTag(tag) {
switch (tag.toLowerCase()) {
case 'br':
return 'lb';
case 'img':
return 'image';
default:
return "x-" + tag;
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var _VERSION$1 = '2.0';
var _XMLNS$1 = 'urn:oasis:names:tc:xliff:document:2.0';
// TODO(vicb): make this a param (s/_/-/)
var _DEFAULT_SOURCE_LANG$1 = 'en';
var _PLACEHOLDER_TAG$1 = 'ph';
var _PLACEHOLDER_SPANNING_TAG = 'pc';
var _XLIFF_TAG = 'xliff';
var _SOURCE_TAG$1 = 'source';
var _TARGET_TAG$1 = 'target';
var _UNIT_TAG$1 = 'unit';
var Xliff2 = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Xliff2, _super);
function Xliff2() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @param {?} messages
* @param {?} locale
* @return {?}
*/
Xliff2.prototype.write = /**
* @param {?} messages
* @param {?} locale
* @return {?}
*/
function (messages, locale) {
var /** @type {?} */ visitor = new _WriteVisitor$1();
var /** @type {?} */ units = [];
messages.forEach(function (message) {
var /** @type {?} */ unit = new Tag(_UNIT_TAG$1, { id: message.id });
var /** @type {?} */ notes = new Tag('notes');
if (message.description || message.meaning) {
if (message.description) {
notes.children.push(new CR(8), new Tag('note', { category: 'description' }, [new Text$2(message.description)]));
}
if (message.meaning) {
notes.children.push(new CR(8), new Tag('note', { category: 'meaning' }, [new Text$2(message.meaning)]));
}
}
message.sources.forEach(function (source) {
notes.children.push(new CR(8), new Tag('note', { category: 'location' }, [
new Text$2(source.filePath + ":" + source.startLine + (source.endLine !== source.startLine ? ',' + source.endLine : ''))
]));
});
notes.children.push(new CR(6));
unit.children.push(new CR(6), notes);
var /** @type {?} */ segment = new Tag('segment');
segment.children.push(new CR(8), new Tag(_SOURCE_TAG$1, {}, visitor.serialize(message.nodes)), new CR(6));
unit.children.push(new CR(6), segment, new CR(4));
units.push(new CR(4), unit);
});
var /** @type {?} */ file = new Tag('file', { 'original': 'ng.template', id: 'ngi18n' }, units.concat([new CR(2)]));
var /** @type {?} */ xliff = new Tag(_XLIFF_TAG, { version: _VERSION$1, xmlns: _XMLNS$1, srcLang: locale || _DEFAULT_SOURCE_LANG$1 }, [new CR(2), file, new CR()]);
return serialize([
new Declaration({ version: '1.0', encoding: 'UTF-8' }), new CR(), xliff, new CR()
]);
};
/**
* @param {?} content
* @param {?} url
* @return {?}
*/
Xliff2.prototype.load = /**
* @param {?} content
* @param {?} url
* @return {?}
*/
function (content, url) {
// xliff to xml nodes
var /** @type {?} */ xliff2Parser = new Xliff2Parser();
var _a = xliff2Parser.parse(content, url), locale = _a.locale, msgIdToHtml = _a.msgIdToHtml, errors = _a.errors;
// xml nodes to i18n nodes
var /** @type {?} */ i18nNodesByMsgId = {};
var /** @type {?} */ converter = new XmlToI18n$1();
Object.keys(msgIdToHtml).forEach(function (msgId) {
var _a = converter.convert(msgIdToHtml[msgId], url), i18nNodes = _a.i18nNodes, e = _a.errors;
errors.push.apply(errors, e);
i18nNodesByMsgId[msgId] = i18nNodes;
});
if (errors.length) {
throw new Error("xliff2 parse errors:\n" + errors.join('\n'));
}
return { locale: /** @type {?} */ ((locale)), i18nNodesByMsgId: i18nNodesByMsgId };
};
/**
* @param {?} message
* @return {?}
*/
Xliff2.prototype.digest = /**
* @param {?} message
* @return {?}
*/
function (message) { return decimalDigest(message); };
return Xliff2;
}(Serializer));
var _WriteVisitor$1 = (function () {
function _WriteVisitor() {
}
/**
* @param {?} text
* @param {?=} context
* @return {?}
*/
_WriteVisitor.prototype.visitText = /**
* @param {?} text
* @param {?=} context
* @return {?}
*/
function (text, context) { return [new Text$2(text.value)]; };
/**
* @param {?} container
* @param {?=} context
* @return {?}
*/
_WriteVisitor.prototype.visitContainer = /**
* @param {?} container
* @param {?=} context
* @return {?}
*/
function (container, context) {
var _this = this;
var /** @type {?} */ nodes = [];
container.children.forEach(function (node) { return nodes.push.apply(nodes, node.visit(_this)); });
return nodes;
};
/**
* @param {?} icu
* @param {?=} context
* @return {?}
*/
_WriteVisitor.prototype.visitIcu = /**
* @param {?} icu
* @param {?=} context
* @return {?}
*/
function (icu, context) {
var _this = this;
var /** @type {?} */ nodes = [new Text$2("{" + icu.expressionPlaceholder + ", " + icu.type + ", ")];
Object.keys(icu.cases).forEach(function (c) {
nodes.push.apply(nodes, [new Text$2(c + " {")].concat(icu.cases[c].visit(_this), [new Text$2("} ")]));
});
nodes.push(new Text$2("}"));
return nodes;
};
/**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
_WriteVisitor.prototype.visitTagPlaceholder = /**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
function (ph, context) {
var _this = this;
var /** @type {?} */ type = getTypeForTag(ph.tag);
if (ph.isVoid) {
var /** @type {?} */ tagPh = new Tag(_PLACEHOLDER_TAG$1, {
id: (this._nextPlaceholderId++).toString(),
equiv: ph.startName,
type: type,
disp: "<" + ph.tag + "/>",
});
return [tagPh];
}
var /** @type {?} */ tagPc = new Tag(_PLACEHOLDER_SPANNING_TAG, {
id: (this._nextPlaceholderId++).toString(),
equivStart: ph.startName,
equivEnd: ph.closeName,
type: type,
dispStart: "<" + ph.tag + ">",
dispEnd: "</" + ph.tag + ">",
});
var /** @type {?} */ nodes = [].concat.apply([], ph.children.map(function (node) { return node.visit(_this); }));
if (nodes.length) {
nodes.forEach(function (node) { return tagPc.children.push(node); });
}
else {
tagPc.children.push(new Text$2(''));
}
return [tagPc];
};
/**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
_WriteVisitor.prototype.visitPlaceholder = /**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
function (ph, context) {
var /** @type {?} */ idStr = (this._nextPlaceholderId++).toString();
return [new Tag(_PLACEHOLDER_TAG$1, {
id: idStr,
equiv: ph.name,
disp: "{{" + ph.value + "}}",
})];
};
/**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
_WriteVisitor.prototype.visitIcuPlaceholder = /**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
function (ph, context) {
var /** @type {?} */ cases = Object.keys(ph.value.cases).map(function (value) { return value + ' {...}'; }).join(' ');
var /** @type {?} */ idStr = (this._nextPlaceholderId++).toString();
return [new Tag(_PLACEHOLDER_TAG$1, { id: idStr, equiv: ph.name, disp: "{" + ph.value.expression + ", " + ph.value.type + ", " + cases + "}" })];
};
/**
* @param {?} nodes
* @return {?}
*/
_WriteVisitor.prototype.serialize = /**
* @param {?} nodes
* @return {?}
*/
function (nodes) {
var _this = this;
this._nextPlaceholderId = 0;
return [].concat.apply([], nodes.map(function (node) { return node.visit(_this); }));
};
return _WriteVisitor;
}());
var Xliff2Parser = (function () {
function Xliff2Parser() {
this._locale = null;
}
/**
* @param {?} xliff
* @param {?} url
* @return {?}
*/
Xliff2Parser.prototype.parse = /**
* @param {?} xliff
* @param {?} url
* @return {?}
*/
function (xliff, url) {
this._unitMlString = null;
this._msgIdToHtml = {};
var /** @type {?} */ xml = new XmlParser().parse(xliff, url, false);
this._errors = xml.errors;
visitAll(this, xml.rootNodes, null);
return {
msgIdToHtml: this._msgIdToHtml,
errors: this._errors,
locale: this._locale,
};
};
/**
* @param {?} element
* @param {?} context
* @return {?}
*/
Xliff2Parser.prototype.visitElement = /**
* @param {?} element
* @param {?} context
* @return {?}
*/
function (element, context) {
switch (element.name) {
case _UNIT_TAG$1:
this._unitMlString = null;
var /** @type {?} */ idAttr = element.attrs.find(function (attr) { return attr.name === 'id'; });
if (!idAttr) {
this._addError(element, "<" + _UNIT_TAG$1 + "> misses the \"id\" attribute");
}
else {
var /** @type {?} */ id = idAttr.value;
if (this._msgIdToHtml.hasOwnProperty(id)) {
this._addError(element, "Duplicated translations for msg " + id);
}
else {
visitAll(this, element.children, null);
if (typeof this._unitMlString === 'string') {
this._msgIdToHtml[id] = this._unitMlString;
}
else {
this._addError(element, "Message " + id + " misses a translation");
}
}
}
break;
case _SOURCE_TAG$1:
// ignore source message
break;
case _TARGET_TAG$1:
var /** @type {?} */ innerTextStart = /** @type {?} */ ((element.startSourceSpan)).end.offset;
var /** @type {?} */ innerTextEnd = /** @type {?} */ ((element.endSourceSpan)).start.offset;
var /** @type {?} */ content = /** @type {?} */ ((element.startSourceSpan)).start.file.content;
var /** @type {?} */ innerText = content.slice(innerTextStart, innerTextEnd);
this._unitMlString = innerText;
break;
case _XLIFF_TAG:
var /** @type {?} */ localeAttr = element.attrs.find(function (attr) { return attr.name === 'trgLang'; });
if (localeAttr) {
this._locale = localeAttr.value;
}
var /** @type {?} */ versionAttr = element.attrs.find(function (attr) { return attr.name === 'version'; });
if (versionAttr) {
var /** @type {?} */ version = versionAttr.value;
if (version !== '2.0') {
this._addError(element, "The XLIFF file version " + version + " is not compatible with XLIFF 2.0 serializer");
}
else {
visitAll(this, element.children, null);
}
}
break;
default:
visitAll(this, element.children, null);
}
};
/**
* @param {?} attribute
* @param {?} context
* @return {?}
*/
Xliff2Parser.prototype.visitAttribute = /**
* @param {?} attribute
* @param {?} context
* @return {?}
*/
function (attribute, context) { };
/**
* @param {?} text
* @param {?} context
* @return {?}
*/
Xliff2Parser.prototype.visitText = /**
* @param {?} text
* @param {?} context
* @return {?}
*/
function (text, context) { };
/**
* @param {?} comment
* @param {?} context
* @return {?}
*/
Xliff2Parser.prototype.visitComment = /**
* @param {?} comment
* @param {?} context
* @return {?}
*/
function (comment, context) { };
/**
* @param {?} expansion
* @param {?} context
* @return {?}
*/
Xliff2Parser.prototype.visitExpansion = /**
* @param {?} expansion
* @param {?} context
* @return {?}
*/
function (expansion, context) { };
/**
* @param {?} expansionCase
* @param {?} context
* @return {?}
*/
Xliff2Parser.prototype.visitExpansionCase = /**
* @param {?} expansionCase
* @param {?} context
* @return {?}
*/
function (expansionCase, context) { };
/**
* @param {?} node
* @param {?} message
* @return {?}
*/
Xliff2Parser.prototype._addError = /**
* @param {?} node
* @param {?} message
* @return {?}
*/
function (node, message) {
this._errors.push(new I18nError(node.sourceSpan, message));
};
return Xliff2Parser;
}());
var XmlToI18n$1 = (function () {
function XmlToI18n() {
}
/**
* @param {?} message
* @param {?} url
* @return {?}
*/
XmlToI18n.prototype.convert = /**
* @param {?} message
* @param {?} url
* @return {?}
*/
function (message, url) {
var /** @type {?} */ xmlIcu = new XmlParser().parse(message, url, true);
this._errors = xmlIcu.errors;
var /** @type {?} */ i18nNodes = this._errors.length > 0 || xmlIcu.rootNodes.length == 0 ?
[] : [].concat.apply([], visitAll(this, xmlIcu.rootNodes));
return {
i18nNodes: i18nNodes,
errors: this._errors,
};
};
/**
* @param {?} text
* @param {?} context
* @return {?}
*/
XmlToI18n.prototype.visitText = /**
* @param {?} text
* @param {?} context
* @return {?}
*/
function (text, context) { return new Text$1(text.value, text.sourceSpan); };
/**
* @param {?} el
* @param {?} context
* @return {?}
*/
XmlToI18n.prototype.visitElement = /**
* @param {?} el
* @param {?} context
* @return {?}
*/
function (el, context) {
var _this = this;
switch (el.name) {
case _PLACEHOLDER_TAG$1:
var /** @type {?} */ nameAttr = el.attrs.find(function (attr) { return attr.name === 'equiv'; });
if (nameAttr) {
return [new Placeholder('', nameAttr.value, el.sourceSpan)];
}
this._addError(el, "<" + _PLACEHOLDER_TAG$1 + "> misses the \"equiv\" attribute");
break;
case _PLACEHOLDER_SPANNING_TAG:
var /** @type {?} */ startAttr = el.attrs.find(function (attr) { return attr.name === 'equivStart'; });
var /** @type {?} */ endAttr = el.attrs.find(function (attr) { return attr.name === 'equivEnd'; });
if (!startAttr) {
this._addError(el, "<" + _PLACEHOLDER_TAG$1 + "> misses the \"equivStart\" attribute");
}
else if (!endAttr) {
this._addError(el, "<" + _PLACEHOLDER_TAG$1 + "> misses the \"equivEnd\" attribute");
}
else {
var /** @type {?} */ startId = startAttr.value;
var /** @type {?} */ endId = endAttr.value;
var /** @type {?} */ nodes = [];
return nodes.concat.apply(nodes, [new Placeholder('', startId, el.sourceSpan)].concat(el.children.map(function (node) { return node.visit(_this, null); }), [new Placeholder('', endId, el.sourceSpan)]));
}
break;
default:
this._addError(el, "Unexpected tag");
}
return null;
};
/**
* @param {?} icu
* @param {?} context
* @return {?}
*/
XmlToI18n.prototype.visitExpansion = /**
* @param {?} icu
* @param {?} context
* @return {?}
*/
function (icu, context) {
var /** @type {?} */ caseMap = {};
visitAll(this, icu.cases).forEach(function (c) {
caseMap[c.value] = new Container(c.nodes, icu.sourceSpan);
});
return new Icu(icu.switchValue, icu.type, caseMap, icu.sourceSpan);
};
/**
* @param {?} icuCase
* @param {?} context
* @return {?}
*/
XmlToI18n.prototype.visitExpansionCase = /**
* @param {?} icuCase
* @param {?} context
* @return {?}
*/
function (icuCase, context) {
return {
value: icuCase.value,
nodes: [].concat.apply([], visitAll(this, icuCase.expression)),
};
};
/**
* @param {?} comment
* @param {?} context
* @return {?}
*/
XmlToI18n.prototype.visitComment = /**
* @param {?} comment
* @param {?} context
* @return {?}
*/
function (comment, context) { };
/**
* @param {?} attribute
* @param {?} context
* @return {?}
*/
XmlToI18n.prototype.visitAttribute = /**
* @param {?} attribute
* @param {?} context
* @return {?}
*/
function (attribute, context) { };
/**
* @param {?} node
* @param {?} message
* @return {?}
*/
XmlToI18n.prototype._addError = /**
* @param {?} node
* @param {?} message
* @return {?}
*/
function (node, message) {
this._errors.push(new I18nError(node.sourceSpan, message));
};
return XmlToI18n;
}());
/**
* @param {?} tag
* @return {?}
*/
function getTypeForTag(tag) {
switch (tag.toLowerCase()) {
case 'br':
case 'b':
case 'i':
case 'u':
return 'fmt';
case 'img':
return 'image';
case 'a':
return 'link';
default:
return 'other';
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var _MESSAGES_TAG = 'messagebundle';
var _MESSAGE_TAG = 'msg';
var _PLACEHOLDER_TAG$2 = 'ph';
var _EXEMPLE_TAG = 'ex';
var _SOURCE_TAG$2 = 'source';
var _DOCTYPE = "<!ELEMENT messagebundle (msg)*>\n<!ATTLIST messagebundle class CDATA #IMPLIED>\n\n<!ELEMENT msg (#PCDATA|ph|source)*>\n<!ATTLIST msg id CDATA #IMPLIED>\n<!ATTLIST msg seq CDATA #IMPLIED>\n<!ATTLIST msg name CDATA #IMPLIED>\n<!ATTLIST msg desc CDATA #IMPLIED>\n<!ATTLIST msg meaning CDATA #IMPLIED>\n<!ATTLIST msg obsolete (obsolete) #IMPLIED>\n<!ATTLIST msg xml:space (default|preserve) \"default\">\n<!ATTLIST msg is_hidden CDATA #IMPLIED>\n\n<!ELEMENT source (#PCDATA)>\n\n<!ELEMENT ph (#PCDATA|ex)*>\n<!ATTLIST ph name CDATA #REQUIRED>\n\n<!ELEMENT ex (#PCDATA)>";
var Xmb = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Xmb, _super);
function Xmb() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @param {?} messages
* @param {?} locale
* @return {?}
*/
Xmb.prototype.write = /**
* @param {?} messages
* @param {?} locale
* @return {?}
*/
function (messages, locale) {
var /** @type {?} */ exampleVisitor = new ExampleVisitor();
var /** @type {?} */ visitor = new _Visitor$2();
var /** @type {?} */ rootNode = new Tag(_MESSAGES_TAG);
messages.forEach(function (message) {
var /** @type {?} */ attrs = { id: message.id };
if (message.description) {
attrs['desc'] = message.description;
}
if (message.meaning) {
attrs['meaning'] = message.meaning;
}
var /** @type {?} */ sourceTags = [];
message.sources.forEach(function (source) {
sourceTags.push(new Tag(_SOURCE_TAG$2, {}, [
new Text$2(source.filePath + ":" + source.startLine + (source.endLine !== source.startLine ? ',' + source.endLine : ''))
]));
});
rootNode.children.push(new CR(2), new Tag(_MESSAGE_TAG, attrs, sourceTags.concat(visitor.serialize(message.nodes))));
});
rootNode.children.push(new CR());
return serialize([
new Declaration({ version: '1.0', encoding: 'UTF-8' }),
new CR(),
new Doctype(_MESSAGES_TAG, _DOCTYPE),
new CR(),
exampleVisitor.addDefaultExamples(rootNode),
new CR(),
]);
};
/**
* @param {?} content
* @param {?} url
* @return {?}
*/
Xmb.prototype.load = /**
* @param {?} content
* @param {?} url
* @return {?}
*/
function (content, url) {
throw new Error('Unsupported');
};
/**
* @param {?} message
* @return {?}
*/
Xmb.prototype.digest = /**
* @param {?} message
* @return {?}
*/
function (message) { return digest$1(message); };
/**
* @param {?} message
* @return {?}
*/
Xmb.prototype.createNameMapper = /**
* @param {?} message
* @return {?}
*/
function (message) {
return new SimplePlaceholderMapper(message, toPublicName);
};
return Xmb;
}(Serializer));
var _Visitor$2 = (function () {
function _Visitor() {
}
/**
* @param {?} text
* @param {?=} context
* @return {?}
*/
_Visitor.prototype.visitText = /**
* @param {?} text
* @param {?=} context
* @return {?}
*/
function (text, context) { return [new Text$2(text.value)]; };
/**
* @param {?} container
* @param {?} context
* @return {?}
*/
_Visitor.prototype.visitContainer = /**
* @param {?} container
* @param {?} context
* @return {?}
*/
function (container, context) {
var _this = this;
var /** @type {?} */ nodes = [];
container.children.forEach(function (node) { return nodes.push.apply(nodes, node.visit(_this)); });
return nodes;
};
/**
* @param {?} icu
* @param {?=} context
* @return {?}
*/
_Visitor.prototype.visitIcu = /**
* @param {?} icu
* @param {?=} context
* @return {?}
*/
function (icu, context) {
var _this = this;
var /** @type {?} */ nodes = [new Text$2("{" + icu.expressionPlaceholder + ", " + icu.type + ", ")];
Object.keys(icu.cases).forEach(function (c) {
nodes.push.apply(nodes, [new Text$2(c + " {")].concat(icu.cases[c].visit(_this), [new Text$2("} ")]));
});
nodes.push(new Text$2("}"));
return nodes;
};
/**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
_Visitor.prototype.visitTagPlaceholder = /**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
function (ph, context) {
var /** @type {?} */ startEx = new Tag(_EXEMPLE_TAG, {}, [new Text$2("<" + ph.tag + ">")]);
var /** @type {?} */ startTagPh = new Tag(_PLACEHOLDER_TAG$2, { name: ph.startName }, [startEx]);
if (ph.isVoid) {
// void tags have no children nor closing tags
return [startTagPh];
}
var /** @type {?} */ closeEx = new Tag(_EXEMPLE_TAG, {}, [new Text$2("</" + ph.tag + ">")]);
var /** @type {?} */ closeTagPh = new Tag(_PLACEHOLDER_TAG$2, { name: ph.closeName }, [closeEx]);
return [startTagPh].concat(this.serialize(ph.children), [closeTagPh]);
};
/**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
_Visitor.prototype.visitPlaceholder = /**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
function (ph, context) {
var /** @type {?} */ exTag = new Tag(_EXEMPLE_TAG, {}, [new Text$2("{{" + ph.value + "}}")]);
return [new Tag(_PLACEHOLDER_TAG$2, { name: ph.name }, [exTag])];
};
/**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
_Visitor.prototype.visitIcuPlaceholder = /**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
function (ph, context) {
var /** @type {?} */ exTag = new Tag(_EXEMPLE_TAG, {}, [
new Text$2("{" + ph.value.expression + ", " + ph.value.type + ", " + Object.keys(ph.value.cases).map(function (value) { return value + ' {...}'; }).join(' ') + "}")
]);
return [new Tag(_PLACEHOLDER_TAG$2, { name: ph.name }, [exTag])];
};
/**
* @param {?} nodes
* @return {?}
*/
_Visitor.prototype.serialize = /**
* @param {?} nodes
* @return {?}
*/
function (nodes) {
var _this = this;
return [].concat.apply([], nodes.map(function (node) { return node.visit(_this); }));
};
return _Visitor;
}());
/**
* @param {?} message
* @return {?}
*/
function digest$1(message) {
return decimalDigest(message);
}
var ExampleVisitor = (function () {
function ExampleVisitor() {
}
/**
* @param {?} node
* @return {?}
*/
ExampleVisitor.prototype.addDefaultExamples = /**
* @param {?} node
* @return {?}
*/
function (node) {
node.visit(this);
return node;
};
/**
* @param {?} tag
* @return {?}
*/
ExampleVisitor.prototype.visitTag = /**
* @param {?} tag
* @return {?}
*/
function (tag) {
var _this = this;
if (tag.name === _PLACEHOLDER_TAG$2) {
if (!tag.children || tag.children.length == 0) {
var /** @type {?} */ exText = new Text$2(tag.attrs['name'] || '...');
tag.children = [new Tag(_EXEMPLE_TAG, {}, [exText])];
}
}
else if (tag.children) {
tag.children.forEach(function (node) { return node.visit(_this); });
}
};
/**
* @param {?} text
* @return {?}
*/
ExampleVisitor.prototype.visitText = /**
* @param {?} text
* @return {?}
*/
function (text) { };
/**
* @param {?} decl
* @return {?}
*/
ExampleVisitor.prototype.visitDeclaration = /**
* @param {?} decl
* @return {?}
*/
function (decl) { };
/**
* @param {?} doctype
* @return {?}
*/
ExampleVisitor.prototype.visitDoctype = /**
* @param {?} doctype
* @return {?}
*/
function (doctype) { };
return ExampleVisitor;
}());
/**
* @param {?} internalName
* @return {?}
*/
function toPublicName(internalName) {
return internalName.toUpperCase().replace(/[^A-Z0-9_]/g, '_');
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var _TRANSLATIONS_TAG = 'translationbundle';
var _TRANSLATION_TAG = 'translation';
var _PLACEHOLDER_TAG$3 = 'ph';
var Xtb = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(Xtb, _super);
function Xtb() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @param {?} messages
* @param {?} locale
* @return {?}
*/
Xtb.prototype.write = /**
* @param {?} messages
* @param {?} locale
* @return {?}
*/
function (messages, locale) { throw new Error('Unsupported'); };
/**
* @param {?} content
* @param {?} url
* @return {?}
*/
Xtb.prototype.load = /**
* @param {?} content
* @param {?} url
* @return {?}
*/
function (content, url) {
// xtb to xml nodes
var /** @type {?} */ xtbParser = new XtbParser();
var _a = xtbParser.parse(content, url), locale = _a.locale, msgIdToHtml = _a.msgIdToHtml, errors = _a.errors;
// xml nodes to i18n nodes
var /** @type {?} */ i18nNodesByMsgId = {};
var /** @type {?} */ converter = new XmlToI18n$2();
// Because we should be able to load xtb files that rely on features not supported by angular,
// we need to delay the conversion of html to i18n nodes so that non angular messages are not
// converted
Object.keys(msgIdToHtml).forEach(function (msgId) {
var /** @type {?} */ valueFn = function () {
var _a = converter.convert(msgIdToHtml[msgId], url), i18nNodes = _a.i18nNodes, errors = _a.errors;
if (errors.length) {
throw new Error("xtb parse errors:\n" + errors.join('\n'));
}
return i18nNodes;
};
createLazyProperty(i18nNodesByMsgId, msgId, valueFn);
});
if (errors.length) {
throw new Error("xtb parse errors:\n" + errors.join('\n'));
}
return { locale: /** @type {?} */ ((locale)), i18nNodesByMsgId: i18nNodesByMsgId };
};
/**
* @param {?} message
* @return {?}
*/
Xtb.prototype.digest = /**
* @param {?} message
* @return {?}
*/
function (message) { return digest$1(message); };
/**
* @param {?} message
* @return {?}
*/
Xtb.prototype.createNameMapper = /**
* @param {?} message
* @return {?}
*/
function (message) {
return new SimplePlaceholderMapper(message, toPublicName);
};
return Xtb;
}(Serializer));
/**
* @param {?} messages
* @param {?} id
* @param {?} valueFn
* @return {?}
*/
function createLazyProperty(messages, id, valueFn) {
Object.defineProperty(messages, id, {
configurable: true,
enumerable: true,
get: function () {
var /** @type {?} */ value = valueFn();
Object.defineProperty(messages, id, { enumerable: true, value: value });
return value;
},
set: function (_) { throw new Error('Could not overwrite an XTB translation'); },
});
}
var XtbParser = (function () {
function XtbParser() {
this._locale = null;
}
/**
* @param {?} xtb
* @param {?} url
* @return {?}
*/
XtbParser.prototype.parse = /**
* @param {?} xtb
* @param {?} url
* @return {?}
*/
function (xtb, url) {
this._bundleDepth = 0;
this._msgIdToHtml = {};
// We can not parse the ICU messages at this point as some messages might not originate
// from Angular that could not be lex'd.
var /** @type {?} */ xml = new XmlParser().parse(xtb, url, false);
this._errors = xml.errors;
visitAll(this, xml.rootNodes);
return {
msgIdToHtml: this._msgIdToHtml,
errors: this._errors,
locale: this._locale,
};
};
/**
* @param {?} element
* @param {?} context
* @return {?}
*/
XtbParser.prototype.visitElement = /**
* @param {?} element
* @param {?} context
* @return {?}
*/
function (element, context) {
switch (element.name) {
case _TRANSLATIONS_TAG:
this._bundleDepth++;
if (this._bundleDepth > 1) {
this._addError(element, "<" + _TRANSLATIONS_TAG + "> elements can not be nested");
}
var /** @type {?} */ langAttr = element.attrs.find(function (attr) { return attr.name === 'lang'; });
if (langAttr) {
this._locale = langAttr.value;
}
visitAll(this, element.children, null);
this._bundleDepth--;
break;
case _TRANSLATION_TAG:
var /** @type {?} */ idAttr = element.attrs.find(function (attr) { return attr.name === 'id'; });
if (!idAttr) {
this._addError(element, "<" + _TRANSLATION_TAG + "> misses the \"id\" attribute");
}
else {
var /** @type {?} */ id = idAttr.value;
if (this._msgIdToHtml.hasOwnProperty(id)) {
this._addError(element, "Duplicated translations for msg " + id);
}
else {
var /** @type {?} */ innerTextStart = /** @type {?} */ ((element.startSourceSpan)).end.offset;
var /** @type {?} */ innerTextEnd = /** @type {?} */ ((element.endSourceSpan)).start.offset;
var /** @type {?} */ content = /** @type {?} */ ((element.startSourceSpan)).start.file.content;
var /** @type {?} */ innerText = content.slice(/** @type {?} */ ((innerTextStart)), /** @type {?} */ ((innerTextEnd)));
this._msgIdToHtml[id] = innerText;
}
}
break;
default:
this._addError(element, 'Unexpected tag');
}
};
/**
* @param {?} attribute
* @param {?} context
* @return {?}
*/
XtbParser.prototype.visitAttribute = /**
* @param {?} attribute
* @param {?} context
* @return {?}
*/
function (attribute, context) { };
/**
* @param {?} text
* @param {?} context
* @return {?}
*/
XtbParser.prototype.visitText = /**
* @param {?} text
* @param {?} context
* @return {?}
*/
function (text, context) { };
/**
* @param {?} comment
* @param {?} context
* @return {?}
*/
XtbParser.prototype.visitComment = /**
* @param {?} comment
* @param {?} context
* @return {?}
*/
function (comment, context) { };
/**
* @param {?} expansion
* @param {?} context
* @return {?}
*/
XtbParser.prototype.visitExpansion = /**
* @param {?} expansion
* @param {?} context
* @return {?}
*/
function (expansion, context) { };
/**
* @param {?} expansionCase
* @param {?} context
* @return {?}
*/
XtbParser.prototype.visitExpansionCase = /**
* @param {?} expansionCase
* @param {?} context
* @return {?}
*/
function (expansionCase, context) { };
/**
* @param {?} node
* @param {?} message
* @return {?}
*/
XtbParser.prototype._addError = /**
* @param {?} node
* @param {?} message
* @return {?}
*/
function (node, message) {
this._errors.push(new I18nError(/** @type {?} */ ((node.sourceSpan)), message));
};
return XtbParser;
}());
var XmlToI18n$2 = (function () {
function XmlToI18n() {
}
/**
* @param {?} message
* @param {?} url
* @return {?}
*/
XmlToI18n.prototype.convert = /**
* @param {?} message
* @param {?} url
* @return {?}
*/
function (message, url) {
var /** @type {?} */ xmlIcu = new XmlParser().parse(message, url, true);
this._errors = xmlIcu.errors;
var /** @type {?} */ i18nNodes = this._errors.length > 0 || xmlIcu.rootNodes.length == 0 ?
[] :
visitAll(this, xmlIcu.rootNodes);
return {
i18nNodes: i18nNodes,
errors: this._errors,
};
};
/**
* @param {?} text
* @param {?} context
* @return {?}
*/
XmlToI18n.prototype.visitText = /**
* @param {?} text
* @param {?} context
* @return {?}
*/
function (text, context) { return new Text$1(text.value, /** @type {?} */ ((text.sourceSpan))); };
/**
* @param {?} icu
* @param {?} context
* @return {?}
*/
XmlToI18n.prototype.visitExpansion = /**
* @param {?} icu
* @param {?} context
* @return {?}
*/
function (icu, context) {
var /** @type {?} */ caseMap = {};
visitAll(this, icu.cases).forEach(function (c) {
caseMap[c.value] = new Container(c.nodes, icu.sourceSpan);
});
return new Icu(icu.switchValue, icu.type, caseMap, icu.sourceSpan);
};
/**
* @param {?} icuCase
* @param {?} context
* @return {?}
*/
XmlToI18n.prototype.visitExpansionCase = /**
* @param {?} icuCase
* @param {?} context
* @return {?}
*/
function (icuCase, context) {
return {
value: icuCase.value,
nodes: visitAll(this, icuCase.expression),
};
};
/**
* @param {?} el
* @param {?} context
* @return {?}
*/
XmlToI18n.prototype.visitElement = /**
* @param {?} el
* @param {?} context
* @return {?}
*/
function (el, context) {
if (el.name === _PLACEHOLDER_TAG$3) {
var /** @type {?} */ nameAttr = el.attrs.find(function (attr) { return attr.name === 'name'; });
if (nameAttr) {
return new Placeholder('', nameAttr.value, /** @type {?} */ ((el.sourceSpan)));
}
this._addError(el, "<" + _PLACEHOLDER_TAG$3 + "> misses the \"name\" attribute");
}
else {
this._addError(el, "Unexpected tag");
}
return null;
};
/**
* @param {?} comment
* @param {?} context
* @return {?}
*/
XmlToI18n.prototype.visitComment = /**
* @param {?} comment
* @param {?} context
* @return {?}
*/
function (comment, context) { };
/**
* @param {?} attribute
* @param {?} context
* @return {?}
*/
XmlToI18n.prototype.visitAttribute = /**
* @param {?} attribute
* @param {?} context
* @return {?}
*/
function (attribute, context) { };
/**
* @param {?} node
* @param {?} message
* @return {?}
*/
XmlToI18n.prototype._addError = /**
* @param {?} node
* @param {?} message
* @return {?}
*/
function (node, message) {
this._errors.push(new I18nError(/** @type {?} */ ((node.sourceSpan)), message));
};
return XmlToI18n;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var HtmlParser = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(HtmlParser, _super);
function HtmlParser() {
return _super.call(this, getHtmlTagDefinition) || this;
}
/**
* @param {?} source
* @param {?} url
* @param {?=} parseExpansionForms
* @param {?=} interpolationConfig
* @return {?}
*/
HtmlParser.prototype.parse = /**
* @param {?} source
* @param {?} url
* @param {?=} parseExpansionForms
* @param {?=} interpolationConfig
* @return {?}
*/
function (source, url, parseExpansionForms, interpolationConfig) {
if (parseExpansionForms === void 0) { parseExpansionForms = false; }
if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
return _super.prototype.parse.call(this, source, url, parseExpansionForms, interpolationConfig);
};
return HtmlParser;
}(Parser$1));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* A container for translated messages
*/
var TranslationBundle = (function () {
function TranslationBundle(_i18nNodesByMsgId, locale, digest, mapperFactory, missingTranslationStrategy, console) {
if (_i18nNodesByMsgId === void 0) { _i18nNodesByMsgId = {}; }
if (missingTranslationStrategy === void 0) { missingTranslationStrategy = MissingTranslationStrategy.Warning; }
this._i18nNodesByMsgId = _i18nNodesByMsgId;
this.digest = digest;
this.mapperFactory = mapperFactory;
this._i18nToHtml = new I18nToHtmlVisitor(_i18nNodesByMsgId, locale, digest, /** @type {?} */ ((mapperFactory)), missingTranslationStrategy, console);
}
// Creates a `TranslationBundle` by parsing the given `content` with the `serializer`.
/**
* @param {?} content
* @param {?} url
* @param {?} serializer
* @param {?} missingTranslationStrategy
* @param {?=} console
* @return {?}
*/
TranslationBundle.load = /**
* @param {?} content
* @param {?} url
* @param {?} serializer
* @param {?} missingTranslationStrategy
* @param {?=} console
* @return {?}
*/
function (content, url, serializer, missingTranslationStrategy, console) {
var _a = serializer.load(content, url), locale = _a.locale, i18nNodesByMsgId = _a.i18nNodesByMsgId;
var /** @type {?} */ digestFn = function (m) { return serializer.digest(m); };
var /** @type {?} */ mapperFactory = function (m) { return /** @type {?} */ ((serializer.createNameMapper(m))); };
return new TranslationBundle(i18nNodesByMsgId, locale, digestFn, mapperFactory, missingTranslationStrategy, console);
};
// Returns the translation as HTML nodes from the given source message.
/**
* @param {?} srcMsg
* @return {?}
*/
TranslationBundle.prototype.get = /**
* @param {?} srcMsg
* @return {?}
*/
function (srcMsg) {
var /** @type {?} */ html = this._i18nToHtml.convert(srcMsg);
if (html.errors.length) {
throw new Error(html.errors.join('\n'));
}
return html.nodes;
};
/**
* @param {?} srcMsg
* @return {?}
*/
TranslationBundle.prototype.has = /**
* @param {?} srcMsg
* @return {?}
*/
function (srcMsg) { return this.digest(srcMsg) in this._i18nNodesByMsgId; };
return TranslationBundle;
}());
var I18nToHtmlVisitor = (function () {
function I18nToHtmlVisitor(_i18nNodesByMsgId, _locale, _digest, _mapperFactory, _missingTranslationStrategy, _console) {
if (_i18nNodesByMsgId === void 0) { _i18nNodesByMsgId = {}; }
this._i18nNodesByMsgId = _i18nNodesByMsgId;
this._locale = _locale;
this._digest = _digest;
this._mapperFactory = _mapperFactory;
this._missingTranslationStrategy = _missingTranslationStrategy;
this._console = _console;
this._contextStack = [];
this._errors = [];
}
/**
* @param {?} srcMsg
* @return {?}
*/
I18nToHtmlVisitor.prototype.convert = /**
* @param {?} srcMsg
* @return {?}
*/
function (srcMsg) {
this._contextStack.length = 0;
this._errors.length = 0;
// i18n to text
var /** @type {?} */ text = this._convertToText(srcMsg);
// text to html
var /** @type {?} */ url = srcMsg.nodes[0].sourceSpan.start.file.url;
var /** @type {?} */ html = new HtmlParser().parse(text, url, true);
return {
nodes: html.rootNodes,
errors: this._errors.concat(html.errors),
};
};
/**
* @param {?} text
* @param {?=} context
* @return {?}
*/
I18nToHtmlVisitor.prototype.visitText = /**
* @param {?} text
* @param {?=} context
* @return {?}
*/
function (text, context) { return text.value; };
/**
* @param {?} container
* @param {?=} context
* @return {?}
*/
I18nToHtmlVisitor.prototype.visitContainer = /**
* @param {?} container
* @param {?=} context
* @return {?}
*/
function (container, context) {
var _this = this;
return container.children.map(function (n) { return n.visit(_this); }).join('');
};
/**
* @param {?} icu
* @param {?=} context
* @return {?}
*/
I18nToHtmlVisitor.prototype.visitIcu = /**
* @param {?} icu
* @param {?=} context
* @return {?}
*/
function (icu, context) {
var _this = this;
var /** @type {?} */ cases = Object.keys(icu.cases).map(function (k) { return k + " {" + icu.cases[k].visit(_this) + "}"; });
// TODO(vicb): Once all format switch to using expression placeholders
// we should throw when the placeholder is not in the source message
var /** @type {?} */ exp = this._srcMsg.placeholders.hasOwnProperty(icu.expression) ?
this._srcMsg.placeholders[icu.expression] :
icu.expression;
return "{" + exp + ", " + icu.type + ", " + cases.join(' ') + "}";
};
/**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
I18nToHtmlVisitor.prototype.visitPlaceholder = /**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
function (ph, context) {
var /** @type {?} */ phName = this._mapper(ph.name);
if (this._srcMsg.placeholders.hasOwnProperty(phName)) {
return this._srcMsg.placeholders[phName];
}
if (this._srcMsg.placeholderToMessage.hasOwnProperty(phName)) {
return this._convertToText(this._srcMsg.placeholderToMessage[phName]);
}
this._addError(ph, "Unknown placeholder \"" + ph.name + "\"");
return '';
};
// Loaded message contains only placeholders (vs tag and icu placeholders).
// However when a translation can not be found, we need to serialize the source message
// which can contain tag placeholders
/**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
I18nToHtmlVisitor.prototype.visitTagPlaceholder = /**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
function (ph, context) {
var _this = this;
var /** @type {?} */ tag = "" + ph.tag;
var /** @type {?} */ attrs = Object.keys(ph.attrs).map(function (name) { return name + "=\"" + ph.attrs[name] + "\""; }).join(' ');
if (ph.isVoid) {
return "<" + tag + " " + attrs + "/>";
}
var /** @type {?} */ children = ph.children.map(function (c) { return c.visit(_this); }).join('');
return "<" + tag + " " + attrs + ">" + children + "</" + tag + ">";
};
// Loaded message contains only placeholders (vs tag and icu placeholders).
// However when a translation can not be found, we need to serialize the source message
// which can contain tag placeholders
/**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
I18nToHtmlVisitor.prototype.visitIcuPlaceholder = /**
* @param {?} ph
* @param {?=} context
* @return {?}
*/
function (ph, context) {
// An ICU placeholder references the source message to be serialized
return this._convertToText(this._srcMsg.placeholderToMessage[ph.name]);
};
/**
* Convert a source message to a translated text string:
* - text nodes are replaced with their translation,
* - placeholders are replaced with their content,
* - ICU nodes are converted to ICU expressions.
* @param {?} srcMsg
* @return {?}
*/
I18nToHtmlVisitor.prototype._convertToText = /**
* Convert a source message to a translated text string:
* - text nodes are replaced with their translation,
* - placeholders are replaced with their content,
* - ICU nodes are converted to ICU expressions.
* @param {?} srcMsg
* @return {?}
*/
function (srcMsg) {
var _this = this;
var /** @type {?} */ id = this._digest(srcMsg);
var /** @type {?} */ mapper = this._mapperFactory ? this._mapperFactory(srcMsg) : null;
var /** @type {?} */ nodes;
this._contextStack.push({ msg: this._srcMsg, mapper: this._mapper });
this._srcMsg = srcMsg;
if (this._i18nNodesByMsgId.hasOwnProperty(id)) {
// When there is a translation use its nodes as the source
// And create a mapper to convert serialized placeholder names to internal names
nodes = this._i18nNodesByMsgId[id];
this._mapper = function (name) { return mapper ? /** @type {?} */ ((mapper.toInternalName(name))) : name; };
}
else {
// When no translation has been found
// - report an error / a warning / nothing,
// - use the nodes from the original message
// - placeholders are already internal and need no mapper
if (this._missingTranslationStrategy === MissingTranslationStrategy.Error) {
var /** @type {?} */ ctx = this._locale ? " for locale \"" + this._locale + "\"" : '';
this._addError(srcMsg.nodes[0], "Missing translation for message \"" + id + "\"" + ctx);
}
else if (this._console &&
this._missingTranslationStrategy === MissingTranslationStrategy.Warning) {
var /** @type {?} */ ctx = this._locale ? " for locale \"" + this._locale + "\"" : '';
this._console.warn("Missing translation for message \"" + id + "\"" + ctx);
}
nodes = srcMsg.nodes;
this._mapper = function (name) { return name; };
}
var /** @type {?} */ text = nodes.map(function (node) { return node.visit(_this); }).join('');
var /** @type {?} */ context = /** @type {?} */ ((this._contextStack.pop()));
this._srcMsg = context.msg;
this._mapper = context.mapper;
return text;
};
/**
* @param {?} el
* @param {?} msg
* @return {?}
*/
I18nToHtmlVisitor.prototype._addError = /**
* @param {?} el
* @param {?} msg
* @return {?}
*/
function (el, msg) {
this._errors.push(new I18nError(el.sourceSpan, msg));
};
return I18nToHtmlVisitor;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var I18NHtmlParser = (function () {
function I18NHtmlParser(_htmlParser, translations, translationsFormat, missingTranslation, console) {
if (missingTranslation === void 0) { missingTranslation = MissingTranslationStrategy.Warning; }
this._htmlParser = _htmlParser;
if (translations) {
var /** @type {?} */ serializer = createSerializer(translationsFormat);
this._translationBundle =
TranslationBundle.load(translations, 'i18n', serializer, missingTranslation, console);
}
else {
this._translationBundle =
new TranslationBundle({}, null, digest, undefined, missingTranslation, console);
}
}
/**
* @param {?} source
* @param {?} url
* @param {?=} parseExpansionForms
* @param {?=} interpolationConfig
* @return {?}
*/
I18NHtmlParser.prototype.parse = /**
* @param {?} source
* @param {?} url
* @param {?=} parseExpansionForms
* @param {?=} interpolationConfig
* @return {?}
*/
function (source, url, parseExpansionForms, interpolationConfig) {
if (parseExpansionForms === void 0) { parseExpansionForms = false; }
if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
var /** @type {?} */ parseResult = this._htmlParser.parse(source, url, parseExpansionForms, interpolationConfig);
if (parseResult.errors.length) {
return new ParseTreeResult(parseResult.rootNodes, parseResult.errors);
}
return mergeTranslations(parseResult.rootNodes, this._translationBundle, interpolationConfig, [], {});
};
return I18NHtmlParser;
}());
/**
* @param {?=} format
* @return {?}
*/
function createSerializer(format) {
format = (format || 'xlf').toLowerCase();
switch (format) {
case 'xmb':
return new Xmb();
case 'xtb':
return new Xtb();
case 'xliff2':
case 'xlf2':
return new Xliff2();
case 'xliff':
case 'xlf':
default:
return new Xliff();
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var STRIP_SRC_FILE_SUFFIXES = /(\.ts|\.d\.ts|\.js|\.jsx|\.tsx)$/;
var GENERATED_FILE = /\.ngfactory\.|\.ngsummary\./;
var JIT_SUMMARY_FILE = /\.ngsummary\./;
var JIT_SUMMARY_NAME = /NgSummary$/;
/**
* @param {?} filePath
* @param {?=} forceSourceFile
* @return {?}
*/
function ngfactoryFilePath(filePath, forceSourceFile) {
if (forceSourceFile === void 0) { forceSourceFile = false; }
var /** @type {?} */ urlWithSuffix = splitTypescriptSuffix(filePath, forceSourceFile);
return urlWithSuffix[0] + ".ngfactory" + urlWithSuffix[1];
}
/**
* @param {?} filePath
* @return {?}
*/
function stripGeneratedFileSuffix(filePath) {
return filePath.replace(GENERATED_FILE, '.');
}
/**
* @param {?} filePath
* @return {?}
*/
function isGeneratedFile(filePath) {
return GENERATED_FILE.test(filePath);
}
/**
* @param {?} path
* @param {?=} forceSourceFile
* @return {?}
*/
function splitTypescriptSuffix(path, forceSourceFile) {
if (forceSourceFile === void 0) { forceSourceFile = false; }
if (path.endsWith('.d.ts')) {
return [path.slice(0, -5), forceSourceFile ? '.ts' : '.d.ts'];
}
var /** @type {?} */ lastDot = path.lastIndexOf('.');
if (lastDot !== -1) {
return [path.substring(0, lastDot), path.substring(lastDot)];
}
return [path, ''];
}
/**
* @param {?} fileName
* @return {?}
*/
function summaryFileName(fileName) {
var /** @type {?} */ fileNameWithoutSuffix = fileName.replace(STRIP_SRC_FILE_SUFFIXES, '');
return fileNameWithoutSuffix + ".ngsummary.json";
}
/**
* @param {?} fileName
* @param {?=} forceSourceFile
* @return {?}
*/
function summaryForJitFileName(fileName, forceSourceFile) {
if (forceSourceFile === void 0) { forceSourceFile = false; }
var /** @type {?} */ urlWithSuffix = splitTypescriptSuffix(stripGeneratedFileSuffix(fileName), forceSourceFile);
return urlWithSuffix[0] + ".ngsummary" + urlWithSuffix[1];
}
/**
* @param {?} filePath
* @return {?}
*/
function stripSummaryForJitFileSuffix(filePath) {
return filePath.replace(JIT_SUMMARY_FILE, '.');
}
/**
* @param {?} symbolName
* @return {?}
*/
function summaryForJitName(symbolName) {
return symbolName + "NgSummary";
}
/**
* @param {?} symbolName
* @return {?}
*/
function stripSummaryForJitNameSuffix(symbolName) {
return symbolName.replace(JIT_SUMMARY_NAME, '');
}
var LOWERED_SYMBOL = /\u0275\d+/;
/**
* @param {?} name
* @return {?}
*/
function isLoweredSymbol(name) {
return LOWERED_SYMBOL.test(name);
}
/**
* @param {?} id
* @return {?}
*/
function createLoweredSymbol(id) {
return "\u0275" + id;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var CORE = '@angular/core';
var Identifiers = (function () {
function Identifiers() {
}
Identifiers.ANALYZE_FOR_ENTRY_COMPONENTS = {
name: 'ANALYZE_FOR_ENTRY_COMPONENTS',
moduleName: CORE,
};
Identifiers.ElementRef = { name: 'ElementRef', moduleName: CORE };
Identifiers.NgModuleRef = { name: 'NgModuleRef', moduleName: CORE };
Identifiers.ViewContainerRef = { name: 'ViewContainerRef', moduleName: CORE };
Identifiers.ChangeDetectorRef = {
name: 'ChangeDetectorRef',
moduleName: CORE,
};
Identifiers.QueryList = { name: 'QueryList', moduleName: CORE };
Identifiers.TemplateRef = { name: 'TemplateRef', moduleName: CORE };
Identifiers.CodegenComponentFactoryResolver = {
name: 'ɵCodegenComponentFactoryResolver',
moduleName: CORE,
};
Identifiers.ComponentFactoryResolver = {
name: 'ComponentFactoryResolver',
moduleName: CORE,
};
Identifiers.ComponentFactory = { name: 'ComponentFactory', moduleName: CORE };
Identifiers.ComponentRef = { name: 'ComponentRef', moduleName: CORE };
Identifiers.NgModuleFactory = { name: 'NgModuleFactory', moduleName: CORE };
Identifiers.createModuleFactory = {
name: 'ɵcmf',
moduleName: CORE,
};
Identifiers.moduleDef = {
name: 'ɵmod',
moduleName: CORE,
};
Identifiers.moduleProviderDef = {
name: 'ɵmpd',
moduleName: CORE,
};
Identifiers.RegisterModuleFactoryFn = {
name: 'ɵregisterModuleFactory',
moduleName: CORE,
};
Identifiers.Injector = { name: 'Injector', moduleName: CORE };
Identifiers.ViewEncapsulation = {
name: 'ViewEncapsulation',
moduleName: CORE,
};
Identifiers.ChangeDetectionStrategy = {
name: 'ChangeDetectionStrategy',
moduleName: CORE,
};
Identifiers.SecurityContext = {
name: 'SecurityContext',
moduleName: CORE,
};
Identifiers.LOCALE_ID = { name: 'LOCALE_ID', moduleName: CORE };
Identifiers.TRANSLATIONS_FORMAT = {
name: 'TRANSLATIONS_FORMAT',
moduleName: CORE,
};
Identifiers.inlineInterpolate = {
name: 'ɵinlineInterpolate',
moduleName: CORE,
};
Identifiers.interpolate = { name: 'ɵinterpolate', moduleName: CORE };
Identifiers.EMPTY_ARRAY = { name: 'ɵEMPTY_ARRAY', moduleName: CORE };
Identifiers.EMPTY_MAP = { name: 'ɵEMPTY_MAP', moduleName: CORE };
Identifiers.Renderer = { name: 'Renderer', moduleName: CORE };
Identifiers.viewDef = { name: 'ɵvid', moduleName: CORE };
Identifiers.elementDef = { name: 'ɵeld', moduleName: CORE };
Identifiers.anchorDef = { name: 'ɵand', moduleName: CORE };
Identifiers.textDef = { name: 'ɵted', moduleName: CORE };
Identifiers.directiveDef = { name: 'ɵdid', moduleName: CORE };
Identifiers.providerDef = { name: 'ɵprd', moduleName: CORE };
Identifiers.queryDef = { name: 'ɵqud', moduleName: CORE };
Identifiers.pureArrayDef = { name: 'ɵpad', moduleName: CORE };
Identifiers.pureObjectDef = { name: 'ɵpod', moduleName: CORE };
Identifiers.purePipeDef = { name: 'ɵppd', moduleName: CORE };
Identifiers.pipeDef = { name: 'ɵpid', moduleName: CORE };
Identifiers.nodeValue = { name: 'ɵnov', moduleName: CORE };
Identifiers.ngContentDef = { name: 'ɵncd', moduleName: CORE };
Identifiers.unwrapValue = { name: 'ɵunv', moduleName: CORE };
Identifiers.createRendererType2 = { name: 'ɵcrt', moduleName: CORE };
// type only
Identifiers.RendererType2 = {
name: 'RendererType2',
moduleName: CORE,
};
// type only
Identifiers.ViewDefinition = {
name: 'ɵViewDefinition',
moduleName: CORE,
};
Identifiers.createComponentFactory = { name: 'ɵccf', moduleName: CORE };
return Identifiers;
}());
/**
* @param {?} reference
* @return {?}
*/
function createTokenForReference(reference) {
return { identifier: { reference: reference } };
}
/**
* @param {?} reflector
* @param {?} reference
* @return {?}
*/
function createTokenForExternalReference(reflector, reference) {
return createTokenForReference(reflector.resolveExternalReference(reference));
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/** @enum {number} */
var LifecycleHooks = {
OnInit: 0,
OnDestroy: 1,
DoCheck: 2,
OnChanges: 3,
AfterContentInit: 4,
AfterContentChecked: 5,
AfterViewInit: 6,
AfterViewChecked: 7,
};
LifecycleHooks[LifecycleHooks.OnInit] = "OnInit";
LifecycleHooks[LifecycleHooks.OnDestroy] = "OnDestroy";
LifecycleHooks[LifecycleHooks.DoCheck] = "DoCheck";
LifecycleHooks[LifecycleHooks.OnChanges] = "OnChanges";
LifecycleHooks[LifecycleHooks.AfterContentInit] = "AfterContentInit";
LifecycleHooks[LifecycleHooks.AfterContentChecked] = "AfterContentChecked";
LifecycleHooks[LifecycleHooks.AfterViewInit] = "AfterViewInit";
LifecycleHooks[LifecycleHooks.AfterViewChecked] = "AfterViewChecked";
var LIFECYCLE_HOOKS_VALUES = [
LifecycleHooks.OnInit, LifecycleHooks.OnDestroy, LifecycleHooks.DoCheck, LifecycleHooks.OnChanges,
LifecycleHooks.AfterContentInit, LifecycleHooks.AfterContentChecked, LifecycleHooks.AfterViewInit,
LifecycleHooks.AfterViewChecked
];
/**
* @param {?} reflector
* @param {?} hook
* @param {?} token
* @return {?}
*/
function hasLifecycleHook(reflector, hook, token) {
return reflector.hasLifecycleHook(token, getHookName(hook));
}
/**
* @param {?} reflector
* @param {?} token
* @return {?}
*/
function getAllLifecycleHooks(reflector, token) {
return LIFECYCLE_HOOKS_VALUES.filter(function (hook) { return hasLifecycleHook(reflector, hook, token); });
}
/**
* @param {?} hook
* @return {?}
*/
function getHookName(hook) {
switch (hook) {
case LifecycleHooks.OnInit:
return 'ngOnInit';
case LifecycleHooks.OnDestroy:
return 'ngOnDestroy';
case LifecycleHooks.DoCheck:
return 'ngDoCheck';
case LifecycleHooks.OnChanges:
return 'ngOnChanges';
case LifecycleHooks.AfterContentInit:
return 'ngAfterContentInit';
case LifecycleHooks.AfterContentChecked:
return 'ngAfterContentChecked';
case LifecycleHooks.AfterViewInit:
return 'ngAfterViewInit';
case LifecycleHooks.AfterViewChecked:
return 'ngAfterViewChecked';
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var _SELECTOR_REGEXP = new RegExp('(\\:not\\()|' +
'([-\\w]+)|' +
'(?:\\.([-\\w]+))|' +
'(?:\\[([-.\\w*]+)(?:=([\"\']?)([^\\]\"\']*)\\5)?\\])|' +
'(\\))|' +
'(\\s*,\\s*)', // ","
'g');
/**
* A css selector contains an element name,
* css classes and attribute/value pairs with the purpose
* of selecting subsets out of them.
*/
var CssSelector = (function () {
function CssSelector() {
this.element = null;
this.classNames = [];
this.attrs = [];
this.notSelectors = [];
}
/**
* @param {?} selector
* @return {?}
*/
CssSelector.parse = /**
* @param {?} selector
* @return {?}
*/
function (selector) {
var /** @type {?} */ results = [];
var /** @type {?} */ _addResult = function (res, cssSel) {
if (cssSel.notSelectors.length > 0 && !cssSel.element && cssSel.classNames.length == 0 &&
cssSel.attrs.length == 0) {
cssSel.element = '*';
}
res.push(cssSel);
};
var /** @type {?} */ cssSelector = new CssSelector();
var /** @type {?} */ match;
var /** @type {?} */ current = cssSelector;
var /** @type {?} */ inNot = false;
_SELECTOR_REGEXP.lastIndex = 0;
while (match = _SELECTOR_REGEXP.exec(selector)) {
if (match[1]) {
if (inNot) {
throw new Error('Nesting :not is not allowed in a selector');
}
inNot = true;
current = new CssSelector();
cssSelector.notSelectors.push(current);
}
if (match[2]) {
current.setElement(match[2]);
}
if (match[3]) {
current.addClassName(match[3]);
}
if (match[4]) {
current.addAttribute(match[4], match[6]);
}
if (match[7]) {
inNot = false;
current = cssSelector;
}
if (match[8]) {
if (inNot) {
throw new Error('Multiple selectors in :not are not supported');
}
_addResult(results, cssSelector);
cssSelector = current = new CssSelector();
}
}
_addResult(results, cssSelector);
return results;
};
/**
* @return {?}
*/
CssSelector.prototype.isElementSelector = /**
* @return {?}
*/
function () {
return this.hasElementSelector() && this.classNames.length == 0 && this.attrs.length == 0 &&
this.notSelectors.length === 0;
};
/**
* @return {?}
*/
CssSelector.prototype.hasElementSelector = /**
* @return {?}
*/
function () { return !!this.element; };
/**
* @param {?=} element
* @return {?}
*/
CssSelector.prototype.setElement = /**
* @param {?=} element
* @return {?}
*/
function (element) {
if (element === void 0) { element = null; }
this.element = element;
};
/** Gets a template string for an element that matches the selector. */
/**
* Gets a template string for an element that matches the selector.
* @return {?}
*/
CssSelector.prototype.getMatchingElementTemplate = /**
* Gets a template string for an element that matches the selector.
* @return {?}
*/
function () {
var /** @type {?} */ tagName = this.element || 'div';
var /** @type {?} */ classAttr = this.classNames.length > 0 ? " class=\"" + this.classNames.join(' ') + "\"" : '';
var /** @type {?} */ attrs = '';
for (var /** @type {?} */ i = 0; i < this.attrs.length; i += 2) {
var /** @type {?} */ attrName = this.attrs[i];
var /** @type {?} */ attrValue = this.attrs[i + 1] !== '' ? "=\"" + this.attrs[i + 1] + "\"" : '';
attrs += " " + attrName + attrValue;
}
return getHtmlTagDefinition(tagName).isVoid ? "<" + tagName + classAttr + attrs + "/>" :
"<" + tagName + classAttr + attrs + "></" + tagName + ">";
};
/**
* @param {?} name
* @param {?=} value
* @return {?}
*/
CssSelector.prototype.addAttribute = /**
* @param {?} name
* @param {?=} value
* @return {?}
*/
function (name, value) {
if (value === void 0) { value = ''; }
this.attrs.push(name, value && value.toLowerCase() || '');
};
/**
* @param {?} name
* @return {?}
*/
CssSelector.prototype.addClassName = /**
* @param {?} name
* @return {?}
*/
function (name) { this.classNames.push(name.toLowerCase()); };
/**
* @return {?}
*/
CssSelector.prototype.toString = /**
* @return {?}
*/
function () {
var /** @type {?} */ res = this.element || '';
if (this.classNames) {
this.classNames.forEach(function (klass) { return res += "." + klass; });
}
if (this.attrs) {
for (var /** @type {?} */ i = 0; i < this.attrs.length; i += 2) {
var /** @type {?} */ name_1 = this.attrs[i];
var /** @type {?} */ value = this.attrs[i + 1];
res += "[" + name_1 + (value ? '=' + value : '') + "]";
}
}
this.notSelectors.forEach(function (notSelector) { return res += ":not(" + notSelector + ")"; });
return res;
};
return CssSelector;
}());
/**
* Reads a list of CssSelectors and allows to calculate which ones
* are contained in a given CssSelector.
*/
var SelectorMatcher = (function () {
function SelectorMatcher() {
this._elementMap = new Map();
this._elementPartialMap = new Map();
this._classMap = new Map();
this._classPartialMap = new Map();
this._attrValueMap = new Map();
this._attrValuePartialMap = new Map();
this._listContexts = [];
}
/**
* @param {?} notSelectors
* @return {?}
*/
SelectorMatcher.createNotMatcher = /**
* @param {?} notSelectors
* @return {?}
*/
function (notSelectors) {
var /** @type {?} */ notMatcher = new SelectorMatcher();
notMatcher.addSelectables(notSelectors, null);
return notMatcher;
};
/**
* @param {?} cssSelectors
* @param {?=} callbackCtxt
* @return {?}
*/
SelectorMatcher.prototype.addSelectables = /**
* @param {?} cssSelectors
* @param {?=} callbackCtxt
* @return {?}
*/
function (cssSelectors, callbackCtxt) {
var /** @type {?} */ listContext = /** @type {?} */ ((null));
if (cssSelectors.length > 1) {
listContext = new SelectorListContext(cssSelectors);
this._listContexts.push(listContext);
}
for (var /** @type {?} */ i = 0; i < cssSelectors.length; i++) {
this._addSelectable(cssSelectors[i], callbackCtxt, listContext);
}
};
/**
* Add an object that can be found later on by calling `match`.
* @param {?} cssSelector A css selector
* @param {?} callbackCtxt An opaque object that will be given to the callback of the `match` function
* @param {?} listContext
* @return {?}
*/
SelectorMatcher.prototype._addSelectable = /**
* Add an object that can be found later on by calling `match`.
* @param {?} cssSelector A css selector
* @param {?} callbackCtxt An opaque object that will be given to the callback of the `match` function
* @param {?} listContext
* @return {?}
*/
function (cssSelector, callbackCtxt, listContext) {
var /** @type {?} */ matcher = this;
var /** @type {?} */ element = cssSelector.element;
var /** @type {?} */ classNames = cssSelector.classNames;
var /** @type {?} */ attrs = cssSelector.attrs;
var /** @type {?} */ selectable = new SelectorContext(cssSelector, callbackCtxt, listContext);
if (element) {
var /** @type {?} */ isTerminal = attrs.length === 0 && classNames.length === 0;
if (isTerminal) {
this._addTerminal(matcher._elementMap, element, selectable);
}
else {
matcher = this._addPartial(matcher._elementPartialMap, element);
}
}
if (classNames) {
for (var /** @type {?} */ i = 0; i < classNames.length; i++) {
var /** @type {?} */ isTerminal = attrs.length === 0 && i === classNames.length - 1;
var /** @type {?} */ className = classNames[i];
if (isTerminal) {
this._addTerminal(matcher._classMap, className, selectable);
}
else {
matcher = this._addPartial(matcher._classPartialMap, className);
}
}
}
if (attrs) {
for (var /** @type {?} */ i = 0; i < attrs.length; i += 2) {
var /** @type {?} */ isTerminal = i === attrs.length - 2;
var /** @type {?} */ name_2 = attrs[i];
var /** @type {?} */ value = attrs[i + 1];
if (isTerminal) {
var /** @type {?} */ terminalMap = matcher._attrValueMap;
var /** @type {?} */ terminalValuesMap = terminalMap.get(name_2);
if (!terminalValuesMap) {
terminalValuesMap = new Map();
terminalMap.set(name_2, terminalValuesMap);
}
this._addTerminal(terminalValuesMap, value, selectable);
}
else {
var /** @type {?} */ partialMap = matcher._attrValuePartialMap;
var /** @type {?} */ partialValuesMap = partialMap.get(name_2);
if (!partialValuesMap) {
partialValuesMap = new Map();
partialMap.set(name_2, partialValuesMap);
}
matcher = this._addPartial(partialValuesMap, value);
}
}
}
};
/**
* @param {?} map
* @param {?} name
* @param {?} selectable
* @return {?}
*/
SelectorMatcher.prototype._addTerminal = /**
* @param {?} map
* @param {?} name
* @param {?} selectable
* @return {?}
*/
function (map, name, selectable) {
var /** @type {?} */ terminalList = map.get(name);
if (!terminalList) {
terminalList = [];
map.set(name, terminalList);
}
terminalList.push(selectable);
};
/**
* @param {?} map
* @param {?} name
* @return {?}
*/
SelectorMatcher.prototype._addPartial = /**
* @param {?} map
* @param {?} name
* @return {?}
*/
function (map, name) {
var /** @type {?} */ matcher = map.get(name);
if (!matcher) {
matcher = new SelectorMatcher();
map.set(name, matcher);
}
return matcher;
};
/**
* Find the objects that have been added via `addSelectable`
* whose css selector is contained in the given css selector.
* @param cssSelector A css selector
* @param matchedCallback This callback will be called with the object handed into `addSelectable`
* @return boolean true if a match was found
*/
/**
* Find the objects that have been added via `addSelectable`
* whose css selector is contained in the given css selector.
* @param {?} cssSelector A css selector
* @param {?} matchedCallback This callback will be called with the object handed into `addSelectable`
* @return {?} boolean true if a match was found
*/
SelectorMatcher.prototype.match = /**
* Find the objects that have been added via `addSelectable`
* whose css selector is contained in the given css selector.
* @param {?} cssSelector A css selector
* @param {?} matchedCallback This callback will be called with the object handed into `addSelectable`
* @return {?} boolean true if a match was found
*/
function (cssSelector, matchedCallback) {
var /** @type {?} */ result = false;
var /** @type {?} */ element = /** @type {?} */ ((cssSelector.element));
var /** @type {?} */ classNames = cssSelector.classNames;
var /** @type {?} */ attrs = cssSelector.attrs;
for (var /** @type {?} */ i = 0; i < this._listContexts.length; i++) {
this._listContexts[i].alreadyMatched = false;
}
result = this._matchTerminal(this._elementMap, element, cssSelector, matchedCallback) || result;
result = this._matchPartial(this._elementPartialMap, element, cssSelector, matchedCallback) ||
result;
if (classNames) {
for (var /** @type {?} */ i = 0; i < classNames.length; i++) {
var /** @type {?} */ className = classNames[i];
result =
this._matchTerminal(this._classMap, className, cssSelector, matchedCallback) || result;
result =
this._matchPartial(this._classPartialMap, className, cssSelector, matchedCallback) ||
result;
}
}
if (attrs) {
for (var /** @type {?} */ i = 0; i < attrs.length; i += 2) {
var /** @type {?} */ name_3 = attrs[i];
var /** @type {?} */ value = attrs[i + 1];
var /** @type {?} */ terminalValuesMap = /** @type {?} */ ((this._attrValueMap.get(name_3)));
if (value) {
result =
this._matchTerminal(terminalValuesMap, '', cssSelector, matchedCallback) || result;
}
result =
this._matchTerminal(terminalValuesMap, value, cssSelector, matchedCallback) || result;
var /** @type {?} */ partialValuesMap = /** @type {?} */ ((this._attrValuePartialMap.get(name_3)));
if (value) {
result = this._matchPartial(partialValuesMap, '', cssSelector, matchedCallback) || result;
}
result =
this._matchPartial(partialValuesMap, value, cssSelector, matchedCallback) || result;
}
}
return result;
};
/** @internal */
/**
* \@internal
* @param {?} map
* @param {?} name
* @param {?} cssSelector
* @param {?} matchedCallback
* @return {?}
*/
SelectorMatcher.prototype._matchTerminal = /**
* \@internal
* @param {?} map
* @param {?} name
* @param {?} cssSelector
* @param {?} matchedCallback
* @return {?}
*/
function (map, name, cssSelector, matchedCallback) {
if (!map || typeof name !== 'string') {
return false;
}
var /** @type {?} */ selectables = map.get(name) || [];
var /** @type {?} */ starSelectables = /** @type {?} */ ((map.get('*')));
if (starSelectables) {
selectables = selectables.concat(starSelectables);
}
if (selectables.length === 0) {
return false;
}
var /** @type {?} */ selectable;
var /** @type {?} */ result = false;
for (var /** @type {?} */ i = 0; i < selectables.length; i++) {
selectable = selectables[i];
result = selectable.finalize(cssSelector, matchedCallback) || result;
}
return result;
};
/** @internal */
/**
* \@internal
* @param {?} map
* @param {?} name
* @param {?} cssSelector
* @param {?} matchedCallback
* @return {?}
*/
SelectorMatcher.prototype._matchPartial = /**
* \@internal
* @param {?} map
* @param {?} name
* @param {?} cssSelector
* @param {?} matchedCallback
* @return {?}
*/
function (map, name, cssSelector, matchedCallback) {
if (!map || typeof name !== 'string') {
return false;
}
var /** @type {?} */ nestedSelector = map.get(name);
if (!nestedSelector) {
return false;
}
// TODO(perf): get rid of recursion and measure again
// TODO(perf): don't pass the whole selector into the recursion,
// but only the not processed parts
return nestedSelector.match(cssSelector, matchedCallback);
};
return SelectorMatcher;
}());
var SelectorListContext = (function () {
function SelectorListContext(selectors) {
this.selectors = selectors;
this.alreadyMatched = false;
}
return SelectorListContext;
}());
var SelectorContext = (function () {
function SelectorContext(selector, cbContext, listContext) {
this.selector = selector;
this.cbContext = cbContext;
this.listContext = listContext;
this.notSelectors = selector.notSelectors;
}
/**
* @param {?} cssSelector
* @param {?} callback
* @return {?}
*/
SelectorContext.prototype.finalize = /**
* @param {?} cssSelector
* @param {?} callback
* @return {?}
*/
function (cssSelector, callback) {
var /** @type {?} */ result = true;
if (this.notSelectors.length > 0 && (!this.listContext || !this.listContext.alreadyMatched)) {
var /** @type {?} */ notMatcher = SelectorMatcher.createNotMatcher(this.notSelectors);
result = !notMatcher.match(cssSelector, null);
}
if (result && callback && (!this.listContext || !this.listContext.alreadyMatched)) {
if (this.listContext) {
this.listContext.alreadyMatched = true;
}
callback(this.selector, this.cbContext);
}
return result;
};
return SelectorContext;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var ERROR_COMPONENT_TYPE = 'ngComponentType';
var CompileMetadataResolver = (function () {
function CompileMetadataResolver(_config, _htmlParser, _ngModuleResolver, _directiveResolver, _pipeResolver, _summaryResolver, _schemaRegistry, _directiveNormalizer, _console, _staticSymbolCache, _reflector, _errorCollector) {
this._config = _config;
this._htmlParser = _htmlParser;
this._ngModuleResolver = _ngModuleResolver;
this._directiveResolver = _directiveResolver;
this._pipeResolver = _pipeResolver;
this._summaryResolver = _summaryResolver;
this._schemaRegistry = _schemaRegistry;
this._directiveNormalizer = _directiveNormalizer;
this._console = _console;
this._staticSymbolCache = _staticSymbolCache;
this._reflector = _reflector;
this._errorCollector = _errorCollector;
this._nonNormalizedDirectiveCache = new Map();
this._directiveCache = new Map();
this._summaryCache = new Map();
this._pipeCache = new Map();
this._ngModuleCache = new Map();
this._ngModuleOfTypes = new Map();
}
/**
* @return {?}
*/
CompileMetadataResolver.prototype.getReflector = /**
* @return {?}
*/
function () { return this._reflector; };
/**
* @param {?} type
* @return {?}
*/
CompileMetadataResolver.prototype.clearCacheFor = /**
* @param {?} type
* @return {?}
*/
function (type) {
var /** @type {?} */ dirMeta = this._directiveCache.get(type);
this._directiveCache.delete(type);
this._nonNormalizedDirectiveCache.delete(type);
this._summaryCache.delete(type);
this._pipeCache.delete(type);
this._ngModuleOfTypes.delete(type);
// Clear all of the NgModule as they contain transitive information!
this._ngModuleCache.clear();
if (dirMeta) {
this._directiveNormalizer.clearCacheFor(dirMeta);
}
};
/**
* @return {?}
*/
CompileMetadataResolver.prototype.clearCache = /**
* @return {?}
*/
function () {
this._directiveCache.clear();
this._nonNormalizedDirectiveCache.clear();
this._summaryCache.clear();
this._pipeCache.clear();
this._ngModuleCache.clear();
this._ngModuleOfTypes.clear();
this._directiveNormalizer.clearCache();
};
/**
* @param {?} baseType
* @param {?} name
* @return {?}
*/
CompileMetadataResolver.prototype._createProxyClass = /**
* @param {?} baseType
* @param {?} name
* @return {?}
*/
function (baseType, name) {
var /** @type {?} */ delegate = null;
var /** @type {?} */ proxyClass = /** @type {?} */ (function () {
if (!delegate) {
throw new Error("Illegal state: Class " + name + " for type " + stringify(baseType) + " is not compiled yet!");
}
return delegate.apply(this, arguments);
});
proxyClass.setDelegate = function (d) {
delegate = d;
(/** @type {?} */ (proxyClass)).prototype = d.prototype;
};
// Make stringify work correctly
(/** @type {?} */ (proxyClass)).overriddenName = name;
return proxyClass;
};
/**
* @param {?} dirType
* @param {?} name
* @return {?}
*/
CompileMetadataResolver.prototype.getGeneratedClass = /**
* @param {?} dirType
* @param {?} name
* @return {?}
*/
function (dirType, name) {
if (dirType instanceof StaticSymbol) {
return this._staticSymbolCache.get(ngfactoryFilePath(dirType.filePath), name);
}
else {
return this._createProxyClass(dirType, name);
}
};
/**
* @param {?} dirType
* @return {?}
*/
CompileMetadataResolver.prototype.getComponentViewClass = /**
* @param {?} dirType
* @return {?}
*/
function (dirType) {
return this.getGeneratedClass(dirType, viewClassName(dirType, 0));
};
/**
* @param {?} dirType
* @return {?}
*/
CompileMetadataResolver.prototype.getHostComponentViewClass = /**
* @param {?} dirType
* @return {?}
*/
function (dirType) {
return this.getGeneratedClass(dirType, hostViewClassName(dirType));
};
/**
* @param {?} dirType
* @return {?}
*/
CompileMetadataResolver.prototype.getHostComponentType = /**
* @param {?} dirType
* @return {?}
*/
function (dirType) {
var /** @type {?} */ name = identifierName({ reference: dirType }) + "_Host";
if (dirType instanceof StaticSymbol) {
return this._staticSymbolCache.get(dirType.filePath, name);
}
else {
var /** @type {?} */ HostClass = /** @type {?} */ (function HostClass() { });
HostClass.overriddenName = name;
return HostClass;
}
};
/**
* @param {?} dirType
* @return {?}
*/
CompileMetadataResolver.prototype.getRendererType = /**
* @param {?} dirType
* @return {?}
*/
function (dirType) {
if (dirType instanceof StaticSymbol) {
return this._staticSymbolCache.get(ngfactoryFilePath(dirType.filePath), rendererTypeName(dirType));
}
else {
// returning an object as proxy,
// that we fill later during runtime compilation.
return /** @type {?} */ ({});
}
};
/**
* @param {?} selector
* @param {?} dirType
* @param {?} inputs
* @param {?} outputs
* @return {?}
*/
CompileMetadataResolver.prototype.getComponentFactory = /**
* @param {?} selector
* @param {?} dirType
* @param {?} inputs
* @param {?} outputs
* @return {?}
*/
function (selector, dirType, inputs, outputs) {
if (dirType instanceof StaticSymbol) {
return this._staticSymbolCache.get(ngfactoryFilePath(dirType.filePath), componentFactoryName(dirType));
}
else {
var /** @type {?} */ hostView = this.getHostComponentViewClass(dirType);
// Note: ngContentSelectors will be filled later once the template is
// loaded.
var /** @type {?} */ createComponentFactory = this._reflector.resolveExternalReference(Identifiers.createComponentFactory);
return createComponentFactory(selector, dirType, /** @type {?} */ (hostView), inputs, outputs, []);
}
};
/**
* @param {?} factory
* @param {?} ngContentSelectors
* @return {?}
*/
CompileMetadataResolver.prototype.initComponentFactory = /**
* @param {?} factory
* @param {?} ngContentSelectors
* @return {?}
*/
function (factory, ngContentSelectors) {
if (!(factory instanceof StaticSymbol)) {
(_a = (/** @type {?} */ (factory)).ngContentSelectors).push.apply(_a, ngContentSelectors);
}
var _a;
};
/**
* @param {?} type
* @param {?} kind
* @return {?}
*/
CompileMetadataResolver.prototype._loadSummary = /**
* @param {?} type
* @param {?} kind
* @return {?}
*/
function (type, kind) {
var /** @type {?} */ typeSummary = this._summaryCache.get(type);
if (!typeSummary) {
var /** @type {?} */ summary = this._summaryResolver.resolveSummary(type);
typeSummary = summary ? summary.type : null;
this._summaryCache.set(type, typeSummary || null);
}
return typeSummary && typeSummary.summaryKind === kind ? typeSummary : null;
};
/**
* @param {?} compMeta
* @param {?=} hostViewType
* @return {?}
*/
CompileMetadataResolver.prototype.getHostComponentMetadata = /**
* @param {?} compMeta
* @param {?=} hostViewType
* @return {?}
*/
function (compMeta, hostViewType) {
var /** @type {?} */ hostType = this.getHostComponentType(compMeta.type.reference);
if (!hostViewType) {
hostViewType = this.getHostComponentViewClass(hostType);
}
// Note: ! is ok here as this method should only be called with normalized directive
// metadata, which always fills in the selector.
var /** @type {?} */ template = CssSelector.parse(/** @type {?} */ ((compMeta.selector)))[0].getMatchingElementTemplate();
var /** @type {?} */ templateUrl = '';
var /** @type {?} */ htmlAst = this._htmlParser.parse(template, templateUrl);
return CompileDirectiveMetadata.create({
isHost: true,
type: { reference: hostType, diDeps: [], lifecycleHooks: [] },
template: new CompileTemplateMetadata({
encapsulation: ViewEncapsulation.None,
template: template,
templateUrl: templateUrl,
htmlAst: htmlAst,
styles: [],
styleUrls: [],
ngContentSelectors: [],
animations: [],
isInline: true,
externalStylesheets: [],
interpolation: null,
preserveWhitespaces: false,
}),
exportAs: null,
changeDetection: ChangeDetectionStrategy.Default,
inputs: [],
outputs: [],
host: {},
isComponent: true,
selector: '*',
providers: [],
viewProviders: [],
queries: [],
viewQueries: [],
componentViewType: hostViewType,
rendererType: /** @type {?} */ ({ id: '__Host__', encapsulation: ViewEncapsulation.None, styles: [], data: {} }),
entryComponents: [],
componentFactory: null
});
};
/**
* @param {?} ngModuleType
* @param {?} directiveType
* @param {?} isSync
* @return {?}
*/
CompileMetadataResolver.prototype.loadDirectiveMetadata = /**
* @param {?} ngModuleType
* @param {?} directiveType
* @param {?} isSync
* @return {?}
*/
function (ngModuleType, directiveType, isSync) {
var _this = this;
if (this._directiveCache.has(directiveType)) {
return null;
}
directiveType = resolveForwardRef(directiveType);
var _a = /** @type {?} */ ((this.getNonNormalizedDirectiveMetadata(directiveType))), annotation = _a.annotation, metadata = _a.metadata;
var /** @type {?} */ createDirectiveMetadata = function (templateMetadata) {
var /** @type {?} */ normalizedDirMeta = new CompileDirectiveMetadata({
isHost: false,
type: metadata.type,
isComponent: metadata.isComponent,
selector: metadata.selector,
exportAs: metadata.exportAs,
changeDetection: metadata.changeDetection,
inputs: metadata.inputs,
outputs: metadata.outputs,
hostListeners: metadata.hostListeners,
hostProperties: metadata.hostProperties,
hostAttributes: metadata.hostAttributes,
providers: metadata.providers,
viewProviders: metadata.viewProviders,
queries: metadata.queries,
viewQueries: metadata.viewQueries,
entryComponents: metadata.entryComponents,
componentViewType: metadata.componentViewType,
rendererType: metadata.rendererType,
componentFactory: metadata.componentFactory,
template: templateMetadata
});
if (templateMetadata) {
_this.initComponentFactory(/** @type {?} */ ((metadata.componentFactory)), templateMetadata.ngContentSelectors);
}
_this._directiveCache.set(directiveType, normalizedDirMeta);
_this._summaryCache.set(directiveType, normalizedDirMeta.toSummary());
return null;
};
if (metadata.isComponent) {
var /** @type {?} */ template = /** @type {?} */ ((metadata.template));
var /** @type {?} */ templateMeta = this._directiveNormalizer.normalizeTemplate({
ngModuleType: ngModuleType,
componentType: directiveType,
moduleUrl: this._reflector.componentModuleUrl(directiveType, annotation),
encapsulation: template.encapsulation,
template: template.template,
templateUrl: template.templateUrl,
styles: template.styles,
styleUrls: template.styleUrls,
animations: template.animations,
interpolation: template.interpolation,
preserveWhitespaces: template.preserveWhitespaces
});
if (isPromise(templateMeta) && isSync) {
this._reportError(componentStillLoadingError(directiveType), directiveType);
return null;
}
return SyncAsync.then(templateMeta, createDirectiveMetadata);
}
else {
// directive
createDirectiveMetadata(null);
return null;
}
};
/**
* @param {?} directiveType
* @return {?}
*/
CompileMetadataResolver.prototype.getNonNormalizedDirectiveMetadata = /**
* @param {?} directiveType
* @return {?}
*/
function (directiveType) {
var _this = this;
directiveType = resolveForwardRef(directiveType);
if (!directiveType) {
return null;
}
var /** @type {?} */ cacheEntry = this._nonNormalizedDirectiveCache.get(directiveType);
if (cacheEntry) {
return cacheEntry;
}
var /** @type {?} */ dirMeta = this._directiveResolver.resolve(directiveType, false);
if (!dirMeta) {
return null;
}
var /** @type {?} */ nonNormalizedTemplateMetadata = /** @type {?} */ ((undefined));
if (createComponent.isTypeOf(dirMeta)) {
// component
var /** @type {?} */ compMeta = /** @type {?} */ (dirMeta);
assertArrayOfStrings('styles', compMeta.styles);
assertArrayOfStrings('styleUrls', compMeta.styleUrls);
assertInterpolationSymbols('interpolation', compMeta.interpolation);
var /** @type {?} */ animations = compMeta.animations;
nonNormalizedTemplateMetadata = new CompileTemplateMetadata({
encapsulation: noUndefined(compMeta.encapsulation),
template: noUndefined(compMeta.template),
templateUrl: noUndefined(compMeta.templateUrl),
htmlAst: null,
styles: compMeta.styles || [],
styleUrls: compMeta.styleUrls || [],
animations: animations || [],
interpolation: noUndefined(compMeta.interpolation),
isInline: !!compMeta.template,
externalStylesheets: [],
ngContentSelectors: [],
preserveWhitespaces: noUndefined(dirMeta.preserveWhitespaces),
});
}
var /** @type {?} */ changeDetectionStrategy = /** @type {?} */ ((null));
var /** @type {?} */ viewProviders = [];
var /** @type {?} */ entryComponentMetadata = [];
var /** @type {?} */ selector = dirMeta.selector;
if (createComponent.isTypeOf(dirMeta)) {
// Component
var /** @type {?} */ compMeta = /** @type {?} */ (dirMeta);
changeDetectionStrategy = /** @type {?} */ ((compMeta.changeDetection));
if (compMeta.viewProviders) {
viewProviders = this._getProvidersMetadata(compMeta.viewProviders, entryComponentMetadata, "viewProviders for \"" + stringifyType(directiveType) + "\"", [], directiveType);
}
if (compMeta.entryComponents) {
entryComponentMetadata = flattenAndDedupeArray(compMeta.entryComponents)
.map(function (type) { return /** @type {?} */ ((_this._getEntryComponentMetadata(type))); })
.concat(entryComponentMetadata);
}
if (!selector) {
selector = this._schemaRegistry.getDefaultComponentElementName();
}
}
else {
// Directive
if (!selector) {
this._reportError(syntaxError("Directive " + stringifyType(directiveType) + " has no selector, please add it!"), directiveType);
selector = 'error';
}
}
var /** @type {?} */ providers = [];
if (dirMeta.providers != null) {
providers = this._getProvidersMetadata(dirMeta.providers, entryComponentMetadata, "providers for \"" + stringifyType(directiveType) + "\"", [], directiveType);
}
var /** @type {?} */ queries = [];
var /** @type {?} */ viewQueries = [];
if (dirMeta.queries != null) {
queries = this._getQueriesMetadata(dirMeta.queries, false, directiveType);
viewQueries = this._getQueriesMetadata(dirMeta.queries, true, directiveType);
}
var /** @type {?} */ metadata = CompileDirectiveMetadata.create({
isHost: false,
selector: selector,
exportAs: noUndefined(dirMeta.exportAs),
isComponent: !!nonNormalizedTemplateMetadata,
type: this._getTypeMetadata(directiveType),
template: nonNormalizedTemplateMetadata,
changeDetection: changeDetectionStrategy,
inputs: dirMeta.inputs || [],
outputs: dirMeta.outputs || [],
host: dirMeta.host || {},
providers: providers || [],
viewProviders: viewProviders || [],
queries: queries || [],
viewQueries: viewQueries || [],
entryComponents: entryComponentMetadata,
componentViewType: nonNormalizedTemplateMetadata ? this.getComponentViewClass(directiveType) :
null,
rendererType: nonNormalizedTemplateMetadata ? this.getRendererType(directiveType) : null,
componentFactory: null
});
if (nonNormalizedTemplateMetadata) {
metadata.componentFactory =
this.getComponentFactory(selector, directiveType, metadata.inputs, metadata.outputs);
}
cacheEntry = { metadata: metadata, annotation: dirMeta };
this._nonNormalizedDirectiveCache.set(directiveType, cacheEntry);
return cacheEntry;
};
/**
* Gets the metadata for the given directive.
* This assumes `loadNgModuleDirectiveAndPipeMetadata` has been called first.
*/
/**
* Gets the metadata for the given directive.
* This assumes `loadNgModuleDirectiveAndPipeMetadata` has been called first.
* @param {?} directiveType
* @return {?}
*/
CompileMetadataResolver.prototype.getDirectiveMetadata = /**
* Gets the metadata for the given directive.
* This assumes `loadNgModuleDirectiveAndPipeMetadata` has been called first.
* @param {?} directiveType
* @return {?}
*/
function (directiveType) {
var /** @type {?} */ dirMeta = /** @type {?} */ ((this._directiveCache.get(directiveType)));
if (!dirMeta) {
this._reportError(syntaxError("Illegal state: getDirectiveMetadata can only be called after loadNgModuleDirectiveAndPipeMetadata for a module that declares it. Directive " + stringifyType(directiveType) + "."), directiveType);
}
return dirMeta;
};
/**
* @param {?} dirType
* @return {?}
*/
CompileMetadataResolver.prototype.getDirectiveSummary = /**
* @param {?} dirType
* @return {?}
*/
function (dirType) {
var /** @type {?} */ dirSummary = /** @type {?} */ (this._loadSummary(dirType, CompileSummaryKind.Directive));
if (!dirSummary) {
this._reportError(syntaxError("Illegal state: Could not load the summary for directive " + stringifyType(dirType) + "."), dirType);
}
return dirSummary;
};
/**
* @param {?} type
* @return {?}
*/
CompileMetadataResolver.prototype.isDirective = /**
* @param {?} type
* @return {?}
*/
function (type) {
return !!this._loadSummary(type, CompileSummaryKind.Directive) ||
this._directiveResolver.isDirective(type);
};
/**
* @param {?} type
* @return {?}
*/
CompileMetadataResolver.prototype.isPipe = /**
* @param {?} type
* @return {?}
*/
function (type) {
return !!this._loadSummary(type, CompileSummaryKind.Pipe) ||
this._pipeResolver.isPipe(type);
};
/**
* @param {?} type
* @return {?}
*/
CompileMetadataResolver.prototype.isNgModule = /**
* @param {?} type
* @return {?}
*/
function (type) {
return !!this._loadSummary(type, CompileSummaryKind.NgModule) ||
this._ngModuleResolver.isNgModule(type);
};
/**
* @param {?} moduleType
* @return {?}
*/
CompileMetadataResolver.prototype.getNgModuleSummary = /**
* @param {?} moduleType
* @return {?}
*/
function (moduleType) {
var /** @type {?} */ moduleSummary = /** @type {?} */ (this._loadSummary(moduleType, CompileSummaryKind.NgModule));
if (!moduleSummary) {
var /** @type {?} */ moduleMeta = this.getNgModuleMetadata(moduleType, false);
moduleSummary = moduleMeta ? moduleMeta.toSummary() : null;
if (moduleSummary) {
this._summaryCache.set(moduleType, moduleSummary);
}
}
return moduleSummary;
};
/**
* Loads the declared directives and pipes of an NgModule.
*/
/**
* Loads the declared directives and pipes of an NgModule.
* @param {?} moduleType
* @param {?} isSync
* @param {?=} throwIfNotFound
* @return {?}
*/
CompileMetadataResolver.prototype.loadNgModuleDirectiveAndPipeMetadata = /**
* Loads the declared directives and pipes of an NgModule.
* @param {?} moduleType
* @param {?} isSync
* @param {?=} throwIfNotFound
* @return {?}
*/
function (moduleType, isSync, throwIfNotFound) {
var _this = this;
if (throwIfNotFound === void 0) { throwIfNotFound = true; }
var /** @type {?} */ ngModule = this.getNgModuleMetadata(moduleType, throwIfNotFound);
var /** @type {?} */ loading = [];
if (ngModule) {
ngModule.declaredDirectives.forEach(function (id) {
var /** @type {?} */ promise = _this.loadDirectiveMetadata(moduleType, id.reference, isSync);
if (promise) {
loading.push(promise);
}
});
ngModule.declaredPipes.forEach(function (id) { return _this._loadPipeMetadata(id.reference); });
}
return Promise.all(loading);
};
/**
* @param {?} moduleType
* @param {?=} throwIfNotFound
* @return {?}
*/
CompileMetadataResolver.prototype.getNgModuleMetadata = /**
* @param {?} moduleType
* @param {?=} throwIfNotFound
* @return {?}
*/
function (moduleType, throwIfNotFound) {
var _this = this;
if (throwIfNotFound === void 0) { throwIfNotFound = true; }
moduleType = resolveForwardRef(moduleType);
var /** @type {?} */ compileMeta = this._ngModuleCache.get(moduleType);
if (compileMeta) {
return compileMeta;
}
var /** @type {?} */ meta = this._ngModuleResolver.resolve(moduleType, throwIfNotFound);
if (!meta) {
return null;
}
var /** @type {?} */ declaredDirectives = [];
var /** @type {?} */ exportedNonModuleIdentifiers = [];
var /** @type {?} */ declaredPipes = [];
var /** @type {?} */ importedModules = [];
var /** @type {?} */ exportedModules = [];
var /** @type {?} */ providers = [];
var /** @type {?} */ entryComponents = [];
var /** @type {?} */ bootstrapComponents = [];
var /** @type {?} */ schemas = [];
if (meta.imports) {
flattenAndDedupeArray(meta.imports).forEach(function (importedType) {
var /** @type {?} */ importedModuleType = /** @type {?} */ ((undefined));
if (isValidType(importedType)) {
importedModuleType = importedType;
}
else if (importedType && importedType.ngModule) {
var /** @type {?} */ moduleWithProviders = importedType;
importedModuleType = moduleWithProviders.ngModule;
if (moduleWithProviders.providers) {
providers.push.apply(providers, _this._getProvidersMetadata(moduleWithProviders.providers, entryComponents, "provider for the NgModule '" + stringifyType(importedModuleType) + "'", [], importedType));
}
}
if (importedModuleType) {
if (_this._checkSelfImport(moduleType, importedModuleType))
return;
var /** @type {?} */ importedModuleSummary = _this.getNgModuleSummary(importedModuleType);
if (!importedModuleSummary) {
_this._reportError(syntaxError("Unexpected " + _this._getTypeDescriptor(importedType) + " '" + stringifyType(importedType) + "' imported by the module '" + stringifyType(moduleType) + "'. Please add a @NgModule annotation."), moduleType);
return;
}
importedModules.push(importedModuleSummary);
}
else {
_this._reportError(syntaxError("Unexpected value '" + stringifyType(importedType) + "' imported by the module '" + stringifyType(moduleType) + "'"), moduleType);
return;
}
});
}
if (meta.exports) {
flattenAndDedupeArray(meta.exports).forEach(function (exportedType) {
if (!isValidType(exportedType)) {
_this._reportError(syntaxError("Unexpected value '" + stringifyType(exportedType) + "' exported by the module '" + stringifyType(moduleType) + "'"), moduleType);
return;
}
var /** @type {?} */ exportedModuleSummary = _this.getNgModuleSummary(exportedType);
if (exportedModuleSummary) {
exportedModules.push(exportedModuleSummary);
}
else {
exportedNonModuleIdentifiers.push(_this._getIdentifierMetadata(exportedType));
}
});
}
// Note: This will be modified later, so we rely on
// getting a new instance every time!
var /** @type {?} */ transitiveModule = this._getTransitiveNgModuleMetadata(importedModules, exportedModules);
if (meta.declarations) {
flattenAndDedupeArray(meta.declarations).forEach(function (declaredType) {
if (!isValidType(declaredType)) {
_this._reportError(syntaxError("Unexpected value '" + stringifyType(declaredType) + "' declared by the module '" + stringifyType(moduleType) + "'"), moduleType);
return;
}
var /** @type {?} */ declaredIdentifier = _this._getIdentifierMetadata(declaredType);
if (_this.isDirective(declaredType)) {
transitiveModule.addDirective(declaredIdentifier);
declaredDirectives.push(declaredIdentifier);
_this._addTypeToModule(declaredType, moduleType);
}
else if (_this.isPipe(declaredType)) {
transitiveModule.addPipe(declaredIdentifier);
transitiveModule.pipes.push(declaredIdentifier);
declaredPipes.push(declaredIdentifier);
_this._addTypeToModule(declaredType, moduleType);
}
else {
_this._reportError(syntaxError("Unexpected " + _this._getTypeDescriptor(declaredType) + " '" + stringifyType(declaredType) + "' declared by the module '" + stringifyType(moduleType) + "'. Please add a @Pipe/@Directive/@Component annotation."), moduleType);
return;
}
});
}
var /** @type {?} */ exportedDirectives = [];
var /** @type {?} */ exportedPipes = [];
exportedNonModuleIdentifiers.forEach(function (exportedId) {
if (transitiveModule.directivesSet.has(exportedId.reference)) {
exportedDirectives.push(exportedId);
transitiveModule.addExportedDirective(exportedId);
}
else if (transitiveModule.pipesSet.has(exportedId.reference)) {
exportedPipes.push(exportedId);
transitiveModule.addExportedPipe(exportedId);
}
else {
_this._reportError(syntaxError("Can't export " + _this._getTypeDescriptor(exportedId.reference) + " " + stringifyType(exportedId.reference) + " from " + stringifyType(moduleType) + " as it was neither declared nor imported!"), moduleType);
return;
}
});
// The providers of the module have to go last
// so that they overwrite any other provider we already added.
if (meta.providers) {
providers.push.apply(providers, this._getProvidersMetadata(meta.providers, entryComponents, "provider for the NgModule '" + stringifyType(moduleType) + "'", [], moduleType));
}
if (meta.entryComponents) {
entryComponents.push.apply(entryComponents, flattenAndDedupeArray(meta.entryComponents)
.map(function (type) { return /** @type {?} */ ((_this._getEntryComponentMetadata(type))); }));
}
if (meta.bootstrap) {
flattenAndDedupeArray(meta.bootstrap).forEach(function (type) {
if (!isValidType(type)) {
_this._reportError(syntaxError("Unexpected value '" + stringifyType(type) + "' used in the bootstrap property of module '" + stringifyType(moduleType) + "'"), moduleType);
return;
}
bootstrapComponents.push(_this._getIdentifierMetadata(type));
});
}
entryComponents.push.apply(entryComponents, bootstrapComponents.map(function (type) { return /** @type {?} */ ((_this._getEntryComponentMetadata(type.reference))); }));
if (meta.schemas) {
schemas.push.apply(schemas, flattenAndDedupeArray(meta.schemas));
}
compileMeta = new CompileNgModuleMetadata({
type: this._getTypeMetadata(moduleType),
providers: providers,
entryComponents: entryComponents,
bootstrapComponents: bootstrapComponents,
schemas: schemas,
declaredDirectives: declaredDirectives,
exportedDirectives: exportedDirectives,
declaredPipes: declaredPipes,
exportedPipes: exportedPipes,
importedModules: importedModules,
exportedModules: exportedModules,
transitiveModule: transitiveModule,
id: meta.id || null,
});
entryComponents.forEach(function (id) { return transitiveModule.addEntryComponent(id); });
providers.forEach(function (provider) { return transitiveModule.addProvider(provider, /** @type {?} */ ((compileMeta)).type); });
transitiveModule.addModule(compileMeta.type);
this._ngModuleCache.set(moduleType, compileMeta);
return compileMeta;
};
/**
* @param {?} moduleType
* @param {?} importedModuleType
* @return {?}
*/
CompileMetadataResolver.prototype._checkSelfImport = /**
* @param {?} moduleType
* @param {?} importedModuleType
* @return {?}
*/
function (moduleType, importedModuleType) {
if (moduleType === importedModuleType) {
this._reportError(syntaxError("'" + stringifyType(moduleType) + "' module can't import itself"), moduleType);
return true;
}
return false;
};
/**
* @param {?} type
* @return {?}
*/
CompileMetadataResolver.prototype._getTypeDescriptor = /**
* @param {?} type
* @return {?}
*/
function (type) {
if (isValidType(type)) {
if (this.isDirective(type)) {
return 'directive';
}
if (this.isPipe(type)) {
return 'pipe';
}
if (this.isNgModule(type)) {
return 'module';
}
}
if ((/** @type {?} */ (type)).provide) {
return 'provider';
}
return 'value';
};
/**
* @param {?} type
* @param {?} moduleType
* @return {?}
*/
CompileMetadataResolver.prototype._addTypeToModule = /**
* @param {?} type
* @param {?} moduleType
* @return {?}
*/
function (type, moduleType) {
var /** @type {?} */ oldModule = this._ngModuleOfTypes.get(type);
if (oldModule && oldModule !== moduleType) {
this._reportError(syntaxError("Type " + stringifyType(type) + " is part of the declarations of 2 modules: " + stringifyType(oldModule) + " and " + stringifyType(moduleType) + "! " +
("Please consider moving " + stringifyType(type) + " to a higher module that imports " + stringifyType(oldModule) + " and " + stringifyType(moduleType) + ". ") +
("You can also create a new NgModule that exports and includes " + stringifyType(type) + " then import that NgModule in " + stringifyType(oldModule) + " and " + stringifyType(moduleType) + ".")), moduleType);
return;
}
this._ngModuleOfTypes.set(type, moduleType);
};
/**
* @param {?} importedModules
* @param {?} exportedModules
* @return {?}
*/
CompileMetadataResolver.prototype._getTransitiveNgModuleMetadata = /**
* @param {?} importedModules
* @param {?} exportedModules
* @return {?}
*/
function (importedModules, exportedModules) {
// collect `providers` / `entryComponents` from all imported and all exported modules
var /** @type {?} */ result = new TransitiveCompileNgModuleMetadata();
var /** @type {?} */ modulesByToken = new Map();
importedModules.concat(exportedModules).forEach(function (modSummary) {
modSummary.modules.forEach(function (mod) { return result.addModule(mod); });
modSummary.entryComponents.forEach(function (comp) { return result.addEntryComponent(comp); });
var /** @type {?} */ addedTokens = new Set();
modSummary.providers.forEach(function (entry) {
var /** @type {?} */ tokenRef = tokenReference(entry.provider.token);
var /** @type {?} */ prevModules = modulesByToken.get(tokenRef);
if (!prevModules) {
prevModules = new Set();
modulesByToken.set(tokenRef, prevModules);
}
var /** @type {?} */ moduleRef = entry.module.reference;
// Note: the providers of one module may still contain multiple providers
// per token (e.g. for multi providers), and we need to preserve these.
if (addedTokens.has(tokenRef) || !prevModules.has(moduleRef)) {
prevModules.add(moduleRef);
addedTokens.add(tokenRef);
result.addProvider(entry.provider, entry.module);
}
});
});
exportedModules.forEach(function (modSummary) {
modSummary.exportedDirectives.forEach(function (id) { return result.addExportedDirective(id); });
modSummary.exportedPipes.forEach(function (id) { return result.addExportedPipe(id); });
});
importedModules.forEach(function (modSummary) {
modSummary.exportedDirectives.forEach(function (id) { return result.addDirective(id); });
modSummary.exportedPipes.forEach(function (id) { return result.addPipe(id); });
});
return result;
};
/**
* @param {?} type
* @return {?}
*/
CompileMetadataResolver.prototype._getIdentifierMetadata = /**
* @param {?} type
* @return {?}
*/
function (type) {
type = resolveForwardRef(type);
return { reference: type };
};
/**
* @param {?} type
* @return {?}
*/
CompileMetadataResolver.prototype.isInjectable = /**
* @param {?} type
* @return {?}
*/
function (type) {
var /** @type {?} */ annotations = this._reflector.annotations(type);
return annotations.some(function (ann) { return createInjectable.isTypeOf(ann); });
};
/**
* @param {?} type
* @return {?}
*/
CompileMetadataResolver.prototype.getInjectableSummary = /**
* @param {?} type
* @return {?}
*/
function (type) {
return {
summaryKind: CompileSummaryKind.Injectable,
type: this._getTypeMetadata(type, null, false)
};
};
/**
* @param {?} type
* @param {?=} dependencies
* @return {?}
*/
CompileMetadataResolver.prototype._getInjectableMetadata = /**
* @param {?} type
* @param {?=} dependencies
* @return {?}
*/
function (type, dependencies) {
if (dependencies === void 0) { dependencies = null; }
var /** @type {?} */ typeSummary = this._loadSummary(type, CompileSummaryKind.Injectable);
if (typeSummary) {
return typeSummary.type;
}
return this._getTypeMetadata(type, dependencies);
};
/**
* @param {?} type
* @param {?=} dependencies
* @param {?=} throwOnUnknownDeps
* @return {?}
*/
CompileMetadataResolver.prototype._getTypeMetadata = /**
* @param {?} type
* @param {?=} dependencies
* @param {?=} throwOnUnknownDeps
* @return {?}
*/
function (type, dependencies, throwOnUnknownDeps) {
if (dependencies === void 0) { dependencies = null; }
if (throwOnUnknownDeps === void 0) { throwOnUnknownDeps = true; }
var /** @type {?} */ identifier = this._getIdentifierMetadata(type);
return {
reference: identifier.reference,
diDeps: this._getDependenciesMetadata(identifier.reference, dependencies, throwOnUnknownDeps),
lifecycleHooks: getAllLifecycleHooks(this._reflector, identifier.reference),
};
};
/**
* @param {?} factory
* @param {?=} dependencies
* @return {?}
*/
CompileMetadataResolver.prototype._getFactoryMetadata = /**
* @param {?} factory
* @param {?=} dependencies
* @return {?}
*/
function (factory, dependencies) {
if (dependencies === void 0) { dependencies = null; }
factory = resolveForwardRef(factory);
return { reference: factory, diDeps: this._getDependenciesMetadata(factory, dependencies) };
};
/**
* Gets the metadata for the given pipe.
* This assumes `loadNgModuleDirectiveAndPipeMetadata` has been called first.
*/
/**
* Gets the metadata for the given pipe.
* This assumes `loadNgModuleDirectiveAndPipeMetadata` has been called first.
* @param {?} pipeType
* @return {?}
*/
CompileMetadataResolver.prototype.getPipeMetadata = /**
* Gets the metadata for the given pipe.
* This assumes `loadNgModuleDirectiveAndPipeMetadata` has been called first.
* @param {?} pipeType
* @return {?}
*/
function (pipeType) {
var /** @type {?} */ pipeMeta = this._pipeCache.get(pipeType);
if (!pipeMeta) {
this._reportError(syntaxError("Illegal state: getPipeMetadata can only be called after loadNgModuleDirectiveAndPipeMetadata for a module that declares it. Pipe " + stringifyType(pipeType) + "."), pipeType);
}
return pipeMeta || null;
};
/**
* @param {?} pipeType
* @return {?}
*/
CompileMetadataResolver.prototype.getPipeSummary = /**
* @param {?} pipeType
* @return {?}
*/
function (pipeType) {
var /** @type {?} */ pipeSummary = /** @type {?} */ (this._loadSummary(pipeType, CompileSummaryKind.Pipe));
if (!pipeSummary) {
this._reportError(syntaxError("Illegal state: Could not load the summary for pipe " + stringifyType(pipeType) + "."), pipeType);
}
return pipeSummary;
};
/**
* @param {?} pipeType
* @return {?}
*/
CompileMetadataResolver.prototype.getOrLoadPipeMetadata = /**
* @param {?} pipeType
* @return {?}
*/
function (pipeType) {
var /** @type {?} */ pipeMeta = this._pipeCache.get(pipeType);
if (!pipeMeta) {
pipeMeta = this._loadPipeMetadata(pipeType);
}
return pipeMeta;
};
/**
* @param {?} pipeType
* @return {?}
*/
CompileMetadataResolver.prototype._loadPipeMetadata = /**
* @param {?} pipeType
* @return {?}
*/
function (pipeType) {
pipeType = resolveForwardRef(pipeType);
var /** @type {?} */ pipeAnnotation = /** @type {?} */ ((this._pipeResolver.resolve(pipeType)));
var /** @type {?} */ pipeMeta = new CompilePipeMetadata({
type: this._getTypeMetadata(pipeType),
name: pipeAnnotation.name,
pure: !!pipeAnnotation.pure
});
this._pipeCache.set(pipeType, pipeMeta);
this._summaryCache.set(pipeType, pipeMeta.toSummary());
return pipeMeta;
};
/**
* @param {?} typeOrFunc
* @param {?} dependencies
* @param {?=} throwOnUnknownDeps
* @return {?}
*/
CompileMetadataResolver.prototype._getDependenciesMetadata = /**
* @param {?} typeOrFunc
* @param {?} dependencies
* @param {?=} throwOnUnknownDeps
* @return {?}
*/
function (typeOrFunc, dependencies, throwOnUnknownDeps) {
var _this = this;
if (throwOnUnknownDeps === void 0) { throwOnUnknownDeps = true; }
var /** @type {?} */ hasUnknownDeps = false;
var /** @type {?} */ params = dependencies || this._reflector.parameters(typeOrFunc) || [];
var /** @type {?} */ dependenciesMetadata = params.map(function (param) {
var /** @type {?} */ isAttribute = false;
var /** @type {?} */ isHost = false;
var /** @type {?} */ isSelf = false;
var /** @type {?} */ isSkipSelf = false;
var /** @type {?} */ isOptional = false;
var /** @type {?} */ token = null;
if (Array.isArray(param)) {
param.forEach(function (paramEntry) {
if (createHost.isTypeOf(paramEntry)) {
isHost = true;
}
else if (createSelf.isTypeOf(paramEntry)) {
isSelf = true;
}
else if (createSkipSelf.isTypeOf(paramEntry)) {
isSkipSelf = true;
}
else if (createOptional.isTypeOf(paramEntry)) {
isOptional = true;
}
else if (createAttribute.isTypeOf(paramEntry)) {
isAttribute = true;
token = paramEntry.attributeName;
}
else if (createInject.isTypeOf(paramEntry)) {
token = paramEntry.token;
}
else if (createInjectionToken.isTypeOf(paramEntry) || paramEntry instanceof StaticSymbol) {
token = paramEntry;
}
else if (isValidType(paramEntry) && token == null) {
token = paramEntry;
}
});
}
else {
token = param;
}
if (token == null) {
hasUnknownDeps = true;
return /** @type {?} */ ((null));
}
return {
isAttribute: isAttribute,
isHost: isHost,
isSelf: isSelf,
isSkipSelf: isSkipSelf,
isOptional: isOptional,
token: _this._getTokenMetadata(token)
};
});
if (hasUnknownDeps) {
var /** @type {?} */ depsTokens = dependenciesMetadata.map(function (dep) { return dep ? stringifyType(dep.token) : '?'; }).join(', ');
var /** @type {?} */ message = "Can't resolve all parameters for " + stringifyType(typeOrFunc) + ": (" + depsTokens + ").";
if (throwOnUnknownDeps || this._config.strictInjectionParameters) {
this._reportError(syntaxError(message), typeOrFunc);
}
else {
this._console.warn("Warning: " + message + " This will become an error in Angular v6.x");
}
}
return dependenciesMetadata;
};
/**
* @param {?} token
* @return {?}
*/
CompileMetadataResolver.prototype._getTokenMetadata = /**
* @param {?} token
* @return {?}
*/
function (token) {
token = resolveForwardRef(token);
var /** @type {?} */ compileToken;
if (typeof token === 'string') {
compileToken = { value: token };
}
else {
compileToken = { identifier: { reference: token } };
}
return compileToken;
};
/**
* @param {?} providers
* @param {?} targetEntryComponents
* @param {?=} debugInfo
* @param {?=} compileProviders
* @param {?=} type
* @return {?}
*/
CompileMetadataResolver.prototype._getProvidersMetadata = /**
* @param {?} providers
* @param {?} targetEntryComponents
* @param {?=} debugInfo
* @param {?=} compileProviders
* @param {?=} type
* @return {?}
*/
function (providers, targetEntryComponents, debugInfo, compileProviders, type) {
var _this = this;
if (compileProviders === void 0) { compileProviders = []; }
providers.forEach(function (provider, providerIdx) {
if (Array.isArray(provider)) {
_this._getProvidersMetadata(provider, targetEntryComponents, debugInfo, compileProviders);
}
else {
provider = resolveForwardRef(provider);
var /** @type {?} */ providerMeta = /** @type {?} */ ((undefined));
if (provider && typeof provider === 'object' && provider.hasOwnProperty('provide')) {
_this._validateProvider(provider);
providerMeta = new ProviderMeta(provider.provide, provider);
}
else if (isValidType(provider)) {
providerMeta = new ProviderMeta(provider, { useClass: provider });
}
else if (provider === void 0) {
_this._reportError(syntaxError("Encountered undefined provider! Usually this means you have a circular dependencies (might be caused by using 'barrel' index.ts files."));
return;
}
else {
var /** @type {?} */ providersInfo = (/** @type {?} */ (providers.reduce(function (soFar, seenProvider, seenProviderIdx) {
if (seenProviderIdx < providerIdx) {
soFar.push("" + stringifyType(seenProvider));
}
else if (seenProviderIdx == providerIdx) {
soFar.push("?" + stringifyType(seenProvider) + "?");
}
else if (seenProviderIdx == providerIdx + 1) {
soFar.push('...');
}
return soFar;
}, [])))
.join(', ');
_this._reportError(syntaxError("Invalid " + (debugInfo ? debugInfo : 'provider') + " - only instances of Provider and Type are allowed, got: [" + providersInfo + "]"), type);
return;
}
if (providerMeta.token ===
_this._reflector.resolveExternalReference(Identifiers.ANALYZE_FOR_ENTRY_COMPONENTS)) {
targetEntryComponents.push.apply(targetEntryComponents, _this._getEntryComponentsFromProvider(providerMeta, type));
}
else {
compileProviders.push(_this.getProviderMetadata(providerMeta));
}
}
});
return compileProviders;
};
/**
* @param {?} provider
* @return {?}
*/
CompileMetadataResolver.prototype._validateProvider = /**
* @param {?} provider
* @return {?}
*/
function (provider) {
if (provider.hasOwnProperty('useClass') && provider.useClass == null) {
this._reportError(syntaxError("Invalid provider for " + stringifyType(provider.provide) + ". useClass cannot be " + provider.useClass + ".\n Usually it happens when:\n 1. There's a circular dependency (might be caused by using index.ts (barrel) files).\n 2. Class was used before it was declared. Use forwardRef in this case."));
}
};
/**
* @param {?} provider
* @param {?=} type
* @return {?}
*/
CompileMetadataResolver.prototype._getEntryComponentsFromProvider = /**
* @param {?} provider
* @param {?=} type
* @return {?}
*/
function (provider, type) {
var _this = this;
var /** @type {?} */ components = [];
var /** @type {?} */ collectedIdentifiers = [];
if (provider.useFactory || provider.useExisting || provider.useClass) {
this._reportError(syntaxError("The ANALYZE_FOR_ENTRY_COMPONENTS token only supports useValue!"), type);
return [];
}
if (!provider.multi) {
this._reportError(syntaxError("The ANALYZE_FOR_ENTRY_COMPONENTS token only supports 'multi = true'!"), type);
return [];
}
extractIdentifiers(provider.useValue, collectedIdentifiers);
collectedIdentifiers.forEach(function (identifier) {
var /** @type {?} */ entry = _this._getEntryComponentMetadata(identifier.reference, false);
if (entry) {
components.push(entry);
}
});
return components;
};
/**
* @param {?} dirType
* @param {?=} throwIfNotFound
* @return {?}
*/
CompileMetadataResolver.prototype._getEntryComponentMetadata = /**
* @param {?} dirType
* @param {?=} throwIfNotFound
* @return {?}
*/
function (dirType, throwIfNotFound) {
if (throwIfNotFound === void 0) { throwIfNotFound = true; }
var /** @type {?} */ dirMeta = this.getNonNormalizedDirectiveMetadata(dirType);
if (dirMeta && dirMeta.metadata.isComponent) {
return { componentType: dirType, componentFactory: /** @type {?} */ ((dirMeta.metadata.componentFactory)) };
}
var /** @type {?} */ dirSummary = /** @type {?} */ (this._loadSummary(dirType, CompileSummaryKind.Directive));
if (dirSummary && dirSummary.isComponent) {
return { componentType: dirType, componentFactory: /** @type {?} */ ((dirSummary.componentFactory)) };
}
if (throwIfNotFound) {
throw syntaxError(dirType.name + " cannot be used as an entry component.");
}
return null;
};
/**
* @param {?} provider
* @return {?}
*/
CompileMetadataResolver.prototype.getProviderMetadata = /**
* @param {?} provider
* @return {?}
*/
function (provider) {
var /** @type {?} */ compileDeps = /** @type {?} */ ((undefined));
var /** @type {?} */ compileTypeMetadata = /** @type {?} */ ((null));
var /** @type {?} */ compileFactoryMetadata = /** @type {?} */ ((null));
var /** @type {?} */ token = this._getTokenMetadata(provider.token);
if (provider.useClass) {
compileTypeMetadata = this._getInjectableMetadata(provider.useClass, provider.dependencies);
compileDeps = compileTypeMetadata.diDeps;
if (provider.token === provider.useClass) {
// use the compileTypeMetadata as it contains information about lifecycleHooks...
token = { identifier: compileTypeMetadata };
}
}
else if (provider.useFactory) {
compileFactoryMetadata = this._getFactoryMetadata(provider.useFactory, provider.dependencies);
compileDeps = compileFactoryMetadata.diDeps;
}
return {
token: token,
useClass: compileTypeMetadata,
useValue: provider.useValue,
useFactory: compileFactoryMetadata,
useExisting: provider.useExisting ? this._getTokenMetadata(provider.useExisting) : undefined,
deps: compileDeps,
multi: provider.multi
};
};
/**
* @param {?} queries
* @param {?} isViewQuery
* @param {?} directiveType
* @return {?}
*/
CompileMetadataResolver.prototype._getQueriesMetadata = /**
* @param {?} queries
* @param {?} isViewQuery
* @param {?} directiveType
* @return {?}
*/
function (queries, isViewQuery, directiveType) {
var _this = this;
var /** @type {?} */ res = [];
Object.keys(queries).forEach(function (propertyName) {
var /** @type {?} */ query = queries[propertyName];
if (query.isViewQuery === isViewQuery) {
res.push(_this._getQueryMetadata(query, propertyName, directiveType));
}
});
return res;
};
/**
* @param {?} selector
* @return {?}
*/
CompileMetadataResolver.prototype._queryVarBindings = /**
* @param {?} selector
* @return {?}
*/
function (selector) { return selector.split(/\s*,\s*/); };
/**
* @param {?} q
* @param {?} propertyName
* @param {?} typeOrFunc
* @return {?}
*/
CompileMetadataResolver.prototype._getQueryMetadata = /**
* @param {?} q
* @param {?} propertyName
* @param {?} typeOrFunc
* @return {?}
*/
function (q, propertyName, typeOrFunc) {
var _this = this;
var /** @type {?} */ selectors;
if (typeof q.selector === 'string') {
selectors =
this._queryVarBindings(q.selector).map(function (varName) { return _this._getTokenMetadata(varName); });
}
else {
if (!q.selector) {
this._reportError(syntaxError("Can't construct a query for the property \"" + propertyName + "\" of \"" + stringifyType(typeOrFunc) + "\" since the query selector wasn't defined."), typeOrFunc);
selectors = [];
}
else {
selectors = [this._getTokenMetadata(q.selector)];
}
}
return {
selectors: selectors,
first: q.first,
descendants: q.descendants, propertyName: propertyName,
read: q.read ? this._getTokenMetadata(q.read) : /** @type {?} */ ((null))
};
};
/**
* @param {?} error
* @param {?=} type
* @param {?=} otherType
* @return {?}
*/
CompileMetadataResolver.prototype._reportError = /**
* @param {?} error
* @param {?=} type
* @param {?=} otherType
* @return {?}
*/
function (error, type, otherType) {
if (this._errorCollector) {
this._errorCollector(error, type);
if (otherType) {
this._errorCollector(error, otherType);
}
}
else {
throw error;
}
};
return CompileMetadataResolver;
}());
/**
* @param {?} tree
* @param {?=} out
* @return {?}
*/
function flattenArray(tree, out) {
if (out === void 0) { out = []; }
if (tree) {
for (var /** @type {?} */ i = 0; i < tree.length; i++) {
var /** @type {?} */ item = resolveForwardRef(tree[i]);
if (Array.isArray(item)) {
flattenArray(item, out);
}
else {
out.push(item);
}
}
}
return out;
}
/**
* @param {?} array
* @return {?}
*/
function dedupeArray(array) {
if (array) {
return Array.from(new Set(array));
}
return [];
}
/**
* @param {?} tree
* @return {?}
*/
function flattenAndDedupeArray(tree) {
return dedupeArray(flattenArray(tree));
}
/**
* @param {?} value
* @return {?}
*/
function isValidType(value) {
return (value instanceof StaticSymbol) || (value instanceof Type);
}
/**
* @param {?} value
* @param {?} targetIdentifiers
* @return {?}
*/
function extractIdentifiers(value, targetIdentifiers) {
visitValue(value, new _CompileValueConverter(), targetIdentifiers);
}
var _CompileValueConverter = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(_CompileValueConverter, _super);
function _CompileValueConverter() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @param {?} value
* @param {?} targetIdentifiers
* @return {?}
*/
_CompileValueConverter.prototype.visitOther = /**
* @param {?} value
* @param {?} targetIdentifiers
* @return {?}
*/
function (value, targetIdentifiers) {
targetIdentifiers.push({ reference: value });
};
return _CompileValueConverter;
}(ValueTransformer));
/**
* @param {?} type
* @return {?}
*/
function stringifyType(type) {
if (type instanceof StaticSymbol) {
return type.name + " in " + type.filePath;
}
else {
return stringify(type);
}
}
/**
* Indicates that a component is still being loaded in a synchronous compile.
* @param {?} compType
* @return {?}
*/
function componentStillLoadingError(compType) {
var /** @type {?} */ error = Error("Can't compile synchronously as " + stringify(compType) + " is still being loaded!");
(/** @type {?} */ (error))[ERROR_COMPONENT_TYPE] = compType;
return error;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/** @enum {number} */
var TypeModifier = {
Const: 0,
};
TypeModifier[TypeModifier.Const] = "Const";
/**
* @abstract
*/
var Type$1 = (function () {
function Type(modifiers) {
if (modifiers === void 0) { modifiers = null; }
this.modifiers = modifiers;
if (!modifiers) {
this.modifiers = [];
}
}
/**
* @param {?} modifier
* @return {?}
*/
Type.prototype.hasModifier = /**
* @param {?} modifier
* @return {?}
*/
function (modifier) { return /** @type {?} */ ((this.modifiers)).indexOf(modifier) !== -1; };
return Type;
}());
/** @enum {number} */
var BuiltinTypeName = {
Dynamic: 0,
Bool: 1,
String: 2,
Int: 3,
Number: 4,
Function: 5,
Inferred: 6,
};
BuiltinTypeName[BuiltinTypeName.Dynamic] = "Dynamic";
BuiltinTypeName[BuiltinTypeName.Bool] = "Bool";
BuiltinTypeName[BuiltinTypeName.String] = "String";
BuiltinTypeName[BuiltinTypeName.Int] = "Int";
BuiltinTypeName[BuiltinTypeName.Number] = "Number";
BuiltinTypeName[BuiltinTypeName.Function] = "Function";
BuiltinTypeName[BuiltinTypeName.Inferred] = "Inferred";
var BuiltinType = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(BuiltinType, _super);
function BuiltinType(name, modifiers) {
if (modifiers === void 0) { modifiers = null; }
var _this = _super.call(this, modifiers) || this;
_this.name = name;
return _this;
}
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
BuiltinType.prototype.visitType = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitBuiltintType(this, context);
};
return BuiltinType;
}(Type$1));
var ExpressionType = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ExpressionType, _super);
function ExpressionType(value, modifiers) {
if (modifiers === void 0) { modifiers = null; }
var _this = _super.call(this, modifiers) || this;
_this.value = value;
return _this;
}
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
ExpressionType.prototype.visitType = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitExpressionType(this, context);
};
return ExpressionType;
}(Type$1));
var ArrayType = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ArrayType, _super);
function ArrayType(of, modifiers) {
if (modifiers === void 0) { modifiers = null; }
var _this = _super.call(this, modifiers) || this;
_this.of = of;
return _this;
}
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
ArrayType.prototype.visitType = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitArrayType(this, context);
};
return ArrayType;
}(Type$1));
var MapType = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(MapType, _super);
function MapType(valueType, modifiers) {
if (modifiers === void 0) { modifiers = null; }
var _this = _super.call(this, modifiers) || this;
_this.valueType = valueType || null;
return _this;
}
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
MapType.prototype.visitType = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) { return visitor.visitMapType(this, context); };
return MapType;
}(Type$1));
var DYNAMIC_TYPE = new BuiltinType(BuiltinTypeName.Dynamic);
var INFERRED_TYPE = new BuiltinType(BuiltinTypeName.Inferred);
var BOOL_TYPE = new BuiltinType(BuiltinTypeName.Bool);
var INT_TYPE = new BuiltinType(BuiltinTypeName.Int);
var NUMBER_TYPE = new BuiltinType(BuiltinTypeName.Number);
var STRING_TYPE = new BuiltinType(BuiltinTypeName.String);
var FUNCTION_TYPE = new BuiltinType(BuiltinTypeName.Function);
/**
* @record
*/
/** @enum {number} */
var BinaryOperator = {
Equals: 0,
NotEquals: 1,
Identical: 2,
NotIdentical: 3,
Minus: 4,
Plus: 5,
Divide: 6,
Multiply: 7,
Modulo: 8,
And: 9,
Or: 10,
Lower: 11,
LowerEquals: 12,
Bigger: 13,
BiggerEquals: 14,
};
BinaryOperator[BinaryOperator.Equals] = "Equals";
BinaryOperator[BinaryOperator.NotEquals] = "NotEquals";
BinaryOperator[BinaryOperator.Identical] = "Identical";
BinaryOperator[BinaryOperator.NotIdentical] = "NotIdentical";
BinaryOperator[BinaryOperator.Minus] = "Minus";
BinaryOperator[BinaryOperator.Plus] = "Plus";
BinaryOperator[BinaryOperator.Divide] = "Divide";
BinaryOperator[BinaryOperator.Multiply] = "Multiply";
BinaryOperator[BinaryOperator.Modulo] = "Modulo";
BinaryOperator[BinaryOperator.And] = "And";
BinaryOperator[BinaryOperator.Or] = "Or";
BinaryOperator[BinaryOperator.Lower] = "Lower";
BinaryOperator[BinaryOperator.LowerEquals] = "LowerEquals";
BinaryOperator[BinaryOperator.Bigger] = "Bigger";
BinaryOperator[BinaryOperator.BiggerEquals] = "BiggerEquals";
/**
* @template T
* @param {?} base
* @param {?} other
* @return {?}
*/
function nullSafeIsEquivalent(base, other) {
if (base == null || other == null) {
return base == other;
}
return base.isEquivalent(other);
}
/**
* @template T
* @param {?} base
* @param {?} other
* @return {?}
*/
function areAllEquivalent(base, other) {
var /** @type {?} */ len = base.length;
if (len !== other.length) {
return false;
}
for (var /** @type {?} */ i = 0; i < len; i++) {
if (!base[i].isEquivalent(other[i])) {
return false;
}
}
return true;
}
/**
* @abstract
*/
var Expression = (function () {
function Expression(type, sourceSpan) {
this.type = type || null;
this.sourceSpan = sourceSpan || null;
}
/**
* @param {?} name
* @param {?=} sourceSpan
* @return {?}
*/
Expression.prototype.prop = /**
* @param {?} name
* @param {?=} sourceSpan
* @return {?}
*/
function (name, sourceSpan) {
return new ReadPropExpr(this, name, null, sourceSpan);
};
/**
* @param {?} index
* @param {?=} type
* @param {?=} sourceSpan
* @return {?}
*/
Expression.prototype.key = /**
* @param {?} index
* @param {?=} type
* @param {?=} sourceSpan
* @return {?}
*/
function (index, type, sourceSpan) {
return new ReadKeyExpr(this, index, type, sourceSpan);
};
/**
* @param {?} name
* @param {?} params
* @param {?=} sourceSpan
* @return {?}
*/
Expression.prototype.callMethod = /**
* @param {?} name
* @param {?} params
* @param {?=} sourceSpan
* @return {?}
*/
function (name, params, sourceSpan) {
return new InvokeMethodExpr(this, name, params, null, sourceSpan);
};
/**
* @param {?} params
* @param {?=} sourceSpan
* @return {?}
*/
Expression.prototype.callFn = /**
* @param {?} params
* @param {?=} sourceSpan
* @return {?}
*/
function (params, sourceSpan) {
return new InvokeFunctionExpr(this, params, null, sourceSpan);
};
/**
* @param {?} params
* @param {?=} type
* @param {?=} sourceSpan
* @return {?}
*/
Expression.prototype.instantiate = /**
* @param {?} params
* @param {?=} type
* @param {?=} sourceSpan
* @return {?}
*/
function (params, type, sourceSpan) {
return new InstantiateExpr(this, params, type, sourceSpan);
};
/**
* @param {?} trueCase
* @param {?=} falseCase
* @param {?=} sourceSpan
* @return {?}
*/
Expression.prototype.conditional = /**
* @param {?} trueCase
* @param {?=} falseCase
* @param {?=} sourceSpan
* @return {?}
*/
function (trueCase, falseCase, sourceSpan) {
if (falseCase === void 0) { falseCase = null; }
return new ConditionalExpr(this, trueCase, falseCase, null, sourceSpan);
};
/**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
Expression.prototype.equals = /**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
function (rhs, sourceSpan) {
return new BinaryOperatorExpr(BinaryOperator.Equals, this, rhs, null, sourceSpan);
};
/**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
Expression.prototype.notEquals = /**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
function (rhs, sourceSpan) {
return new BinaryOperatorExpr(BinaryOperator.NotEquals, this, rhs, null, sourceSpan);
};
/**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
Expression.prototype.identical = /**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
function (rhs, sourceSpan) {
return new BinaryOperatorExpr(BinaryOperator.Identical, this, rhs, null, sourceSpan);
};
/**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
Expression.prototype.notIdentical = /**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
function (rhs, sourceSpan) {
return new BinaryOperatorExpr(BinaryOperator.NotIdentical, this, rhs, null, sourceSpan);
};
/**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
Expression.prototype.minus = /**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
function (rhs, sourceSpan) {
return new BinaryOperatorExpr(BinaryOperator.Minus, this, rhs, null, sourceSpan);
};
/**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
Expression.prototype.plus = /**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
function (rhs, sourceSpan) {
return new BinaryOperatorExpr(BinaryOperator.Plus, this, rhs, null, sourceSpan);
};
/**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
Expression.prototype.divide = /**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
function (rhs, sourceSpan) {
return new BinaryOperatorExpr(BinaryOperator.Divide, this, rhs, null, sourceSpan);
};
/**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
Expression.prototype.multiply = /**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
function (rhs, sourceSpan) {
return new BinaryOperatorExpr(BinaryOperator.Multiply, this, rhs, null, sourceSpan);
};
/**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
Expression.prototype.modulo = /**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
function (rhs, sourceSpan) {
return new BinaryOperatorExpr(BinaryOperator.Modulo, this, rhs, null, sourceSpan);
};
/**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
Expression.prototype.and = /**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
function (rhs, sourceSpan) {
return new BinaryOperatorExpr(BinaryOperator.And, this, rhs, null, sourceSpan);
};
/**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
Expression.prototype.or = /**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
function (rhs, sourceSpan) {
return new BinaryOperatorExpr(BinaryOperator.Or, this, rhs, null, sourceSpan);
};
/**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
Expression.prototype.lower = /**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
function (rhs, sourceSpan) {
return new BinaryOperatorExpr(BinaryOperator.Lower, this, rhs, null, sourceSpan);
};
/**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
Expression.prototype.lowerEquals = /**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
function (rhs, sourceSpan) {
return new BinaryOperatorExpr(BinaryOperator.LowerEquals, this, rhs, null, sourceSpan);
};
/**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
Expression.prototype.bigger = /**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
function (rhs, sourceSpan) {
return new BinaryOperatorExpr(BinaryOperator.Bigger, this, rhs, null, sourceSpan);
};
/**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
Expression.prototype.biggerEquals = /**
* @param {?} rhs
* @param {?=} sourceSpan
* @return {?}
*/
function (rhs, sourceSpan) {
return new BinaryOperatorExpr(BinaryOperator.BiggerEquals, this, rhs, null, sourceSpan);
};
/**
* @param {?=} sourceSpan
* @return {?}
*/
Expression.prototype.isBlank = /**
* @param {?=} sourceSpan
* @return {?}
*/
function (sourceSpan) {
// Note: We use equals by purpose here to compare to null and undefined in JS.
// We use the typed null to allow strictNullChecks to narrow types.
return this.equals(TYPED_NULL_EXPR, sourceSpan);
};
/**
* @param {?} type
* @param {?=} sourceSpan
* @return {?}
*/
Expression.prototype.cast = /**
* @param {?} type
* @param {?=} sourceSpan
* @return {?}
*/
function (type, sourceSpan) {
return new CastExpr(this, type, sourceSpan);
};
/**
* @return {?}
*/
Expression.prototype.toStmt = /**
* @return {?}
*/
function () { return new ExpressionStatement(this, null); };
return Expression;
}());
/** @enum {number} */
var BuiltinVar = {
This: 0,
Super: 1,
CatchError: 2,
CatchStack: 3,
};
BuiltinVar[BuiltinVar.This] = "This";
BuiltinVar[BuiltinVar.Super] = "Super";
BuiltinVar[BuiltinVar.CatchError] = "CatchError";
BuiltinVar[BuiltinVar.CatchStack] = "CatchStack";
var ReadVarExpr = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ReadVarExpr, _super);
function ReadVarExpr(name, type, sourceSpan) {
var _this = _super.call(this, type, sourceSpan) || this;
if (typeof name === 'string') {
_this.name = name;
_this.builtin = null;
}
else {
_this.name = null;
_this.builtin = /** @type {?} */ (name);
}
return _this;
}
/**
* @param {?} e
* @return {?}
*/
ReadVarExpr.prototype.isEquivalent = /**
* @param {?} e
* @return {?}
*/
function (e) {
return e instanceof ReadVarExpr && this.name === e.name && this.builtin === e.builtin;
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
ReadVarExpr.prototype.visitExpression = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitReadVarExpr(this, context);
};
/**
* @param {?} value
* @return {?}
*/
ReadVarExpr.prototype.set = /**
* @param {?} value
* @return {?}
*/
function (value) {
if (!this.name) {
throw new Error("Built in variable " + this.builtin + " can not be assigned to.");
}
return new WriteVarExpr(this.name, value, null, this.sourceSpan);
};
return ReadVarExpr;
}(Expression));
var WriteVarExpr = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(WriteVarExpr, _super);
function WriteVarExpr(name, value, type, sourceSpan) {
var _this = _super.call(this, type || value.type, sourceSpan) || this;
_this.name = name;
_this.value = value;
return _this;
}
/**
* @param {?} e
* @return {?}
*/
WriteVarExpr.prototype.isEquivalent = /**
* @param {?} e
* @return {?}
*/
function (e) {
return e instanceof WriteVarExpr && this.name === e.name && this.value.isEquivalent(e.value);
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
WriteVarExpr.prototype.visitExpression = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitWriteVarExpr(this, context);
};
/**
* @param {?=} type
* @param {?=} modifiers
* @return {?}
*/
WriteVarExpr.prototype.toDeclStmt = /**
* @param {?=} type
* @param {?=} modifiers
* @return {?}
*/
function (type, modifiers) {
return new DeclareVarStmt(this.name, this.value, type, modifiers, this.sourceSpan);
};
return WriteVarExpr;
}(Expression));
var WriteKeyExpr = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(WriteKeyExpr, _super);
function WriteKeyExpr(receiver, index, value, type, sourceSpan) {
var _this = _super.call(this, type || value.type, sourceSpan) || this;
_this.receiver = receiver;
_this.index = index;
_this.value = value;
return _this;
}
/**
* @param {?} e
* @return {?}
*/
WriteKeyExpr.prototype.isEquivalent = /**
* @param {?} e
* @return {?}
*/
function (e) {
return e instanceof WriteKeyExpr && this.receiver.isEquivalent(e.receiver) &&
this.index.isEquivalent(e.index) && this.value.isEquivalent(e.value);
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
WriteKeyExpr.prototype.visitExpression = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitWriteKeyExpr(this, context);
};
return WriteKeyExpr;
}(Expression));
var WritePropExpr = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(WritePropExpr, _super);
function WritePropExpr(receiver, name, value, type, sourceSpan) {
var _this = _super.call(this, type || value.type, sourceSpan) || this;
_this.receiver = receiver;
_this.name = name;
_this.value = value;
return _this;
}
/**
* @param {?} e
* @return {?}
*/
WritePropExpr.prototype.isEquivalent = /**
* @param {?} e
* @return {?}
*/
function (e) {
return e instanceof WritePropExpr && this.receiver.isEquivalent(e.receiver) &&
this.name === e.name && this.value.isEquivalent(e.value);
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
WritePropExpr.prototype.visitExpression = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitWritePropExpr(this, context);
};
return WritePropExpr;
}(Expression));
/** @enum {number} */
var BuiltinMethod = {
ConcatArray: 0,
SubscribeObservable: 1,
Bind: 2,
};
BuiltinMethod[BuiltinMethod.ConcatArray] = "ConcatArray";
BuiltinMethod[BuiltinMethod.SubscribeObservable] = "SubscribeObservable";
BuiltinMethod[BuiltinMethod.Bind] = "Bind";
var InvokeMethodExpr = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(InvokeMethodExpr, _super);
function InvokeMethodExpr(receiver, method, args, type, sourceSpan) {
var _this = _super.call(this, type, sourceSpan) || this;
_this.receiver = receiver;
_this.args = args;
if (typeof method === 'string') {
_this.name = method;
_this.builtin = null;
}
else {
_this.name = null;
_this.builtin = /** @type {?} */ (method);
}
return _this;
}
/**
* @param {?} e
* @return {?}
*/
InvokeMethodExpr.prototype.isEquivalent = /**
* @param {?} e
* @return {?}
*/
function (e) {
return e instanceof InvokeMethodExpr && this.receiver.isEquivalent(e.receiver) &&
this.name === e.name && this.builtin === e.builtin && areAllEquivalent(this.args, e.args);
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
InvokeMethodExpr.prototype.visitExpression = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitInvokeMethodExpr(this, context);
};
return InvokeMethodExpr;
}(Expression));
var InvokeFunctionExpr = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(InvokeFunctionExpr, _super);
function InvokeFunctionExpr(fn, args, type, sourceSpan) {
var _this = _super.call(this, type, sourceSpan) || this;
_this.fn = fn;
_this.args = args;
return _this;
}
/**
* @param {?} e
* @return {?}
*/
InvokeFunctionExpr.prototype.isEquivalent = /**
* @param {?} e
* @return {?}
*/
function (e) {
return e instanceof InvokeFunctionExpr && this.fn.isEquivalent(e.fn) &&
areAllEquivalent(this.args, e.args);
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
InvokeFunctionExpr.prototype.visitExpression = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitInvokeFunctionExpr(this, context);
};
return InvokeFunctionExpr;
}(Expression));
var InstantiateExpr = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(InstantiateExpr, _super);
function InstantiateExpr(classExpr, args, type, sourceSpan) {
var _this = _super.call(this, type, sourceSpan) || this;
_this.classExpr = classExpr;
_this.args = args;
return _this;
}
/**
* @param {?} e
* @return {?}
*/
InstantiateExpr.prototype.isEquivalent = /**
* @param {?} e
* @return {?}
*/
function (e) {
return e instanceof InstantiateExpr && this.classExpr.isEquivalent(e.classExpr) &&
areAllEquivalent(this.args, e.args);
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
InstantiateExpr.prototype.visitExpression = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitInstantiateExpr(this, context);
};
return InstantiateExpr;
}(Expression));
var LiteralExpr = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(LiteralExpr, _super);
function LiteralExpr(value, type, sourceSpan) {
var _this = _super.call(this, type, sourceSpan) || this;
_this.value = value;
return _this;
}
/**
* @param {?} e
* @return {?}
*/
LiteralExpr.prototype.isEquivalent = /**
* @param {?} e
* @return {?}
*/
function (e) {
return e instanceof LiteralExpr && this.value === e.value;
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
LiteralExpr.prototype.visitExpression = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitLiteralExpr(this, context);
};
return LiteralExpr;
}(Expression));
var ExternalExpr = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ExternalExpr, _super);
function ExternalExpr(value, type, typeParams, sourceSpan) {
if (typeParams === void 0) { typeParams = null; }
var _this = _super.call(this, type, sourceSpan) || this;
_this.value = value;
_this.typeParams = typeParams;
return _this;
}
/**
* @param {?} e
* @return {?}
*/
ExternalExpr.prototype.isEquivalent = /**
* @param {?} e
* @return {?}
*/
function (e) {
return e instanceof ExternalExpr && this.value.name === e.value.name &&
this.value.moduleName === e.value.moduleName && this.value.runtime === e.value.runtime;
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
ExternalExpr.prototype.visitExpression = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitExternalExpr(this, context);
};
return ExternalExpr;
}(Expression));
var ExternalReference = (function () {
function ExternalReference(moduleName, name, runtime) {
this.moduleName = moduleName;
this.name = name;
this.runtime = runtime;
}
return ExternalReference;
}());
var ConditionalExpr = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ConditionalExpr, _super);
function ConditionalExpr(condition, trueCase, falseCase, type, sourceSpan) {
if (falseCase === void 0) { falseCase = null; }
var _this = _super.call(this, type || trueCase.type, sourceSpan) || this;
_this.condition = condition;
_this.falseCase = falseCase;
_this.trueCase = trueCase;
return _this;
}
/**
* @param {?} e
* @return {?}
*/
ConditionalExpr.prototype.isEquivalent = /**
* @param {?} e
* @return {?}
*/
function (e) {
return e instanceof ConditionalExpr && this.condition.isEquivalent(e.condition) &&
this.trueCase.isEquivalent(e.trueCase) && nullSafeIsEquivalent(this.falseCase, e.falseCase);
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
ConditionalExpr.prototype.visitExpression = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitConditionalExpr(this, context);
};
return ConditionalExpr;
}(Expression));
var NotExpr = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(NotExpr, _super);
function NotExpr(condition, sourceSpan) {
var _this = _super.call(this, BOOL_TYPE, sourceSpan) || this;
_this.condition = condition;
return _this;
}
/**
* @param {?} e
* @return {?}
*/
NotExpr.prototype.isEquivalent = /**
* @param {?} e
* @return {?}
*/
function (e) {
return e instanceof NotExpr && this.condition.isEquivalent(e.condition);
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
NotExpr.prototype.visitExpression = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitNotExpr(this, context);
};
return NotExpr;
}(Expression));
var AssertNotNull = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(AssertNotNull, _super);
function AssertNotNull(condition, sourceSpan) {
var _this = _super.call(this, condition.type, sourceSpan) || this;
_this.condition = condition;
return _this;
}
/**
* @param {?} e
* @return {?}
*/
AssertNotNull.prototype.isEquivalent = /**
* @param {?} e
* @return {?}
*/
function (e) {
return e instanceof AssertNotNull && this.condition.isEquivalent(e.condition);
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
AssertNotNull.prototype.visitExpression = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitAssertNotNullExpr(this, context);
};
return AssertNotNull;
}(Expression));
var CastExpr = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(CastExpr, _super);
function CastExpr(value, type, sourceSpan) {
var _this = _super.call(this, type, sourceSpan) || this;
_this.value = value;
return _this;
}
/**
* @param {?} e
* @return {?}
*/
CastExpr.prototype.isEquivalent = /**
* @param {?} e
* @return {?}
*/
function (e) {
return e instanceof CastExpr && this.value.isEquivalent(e.value);
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
CastExpr.prototype.visitExpression = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitCastExpr(this, context);
};
return CastExpr;
}(Expression));
var FnParam = (function () {
function FnParam(name, type) {
if (type === void 0) { type = null; }
this.name = name;
this.type = type;
}
/**
* @param {?} param
* @return {?}
*/
FnParam.prototype.isEquivalent = /**
* @param {?} param
* @return {?}
*/
function (param) { return this.name === param.name; };
return FnParam;
}());
var FunctionExpr = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(FunctionExpr, _super);
function FunctionExpr(params, statements, type, sourceSpan) {
var _this = _super.call(this, type, sourceSpan) || this;
_this.params = params;
_this.statements = statements;
return _this;
}
/**
* @param {?} e
* @return {?}
*/
FunctionExpr.prototype.isEquivalent = /**
* @param {?} e
* @return {?}
*/
function (e) {
return e instanceof FunctionExpr && areAllEquivalent(this.params, e.params) &&
areAllEquivalent(this.statements, e.statements);
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
FunctionExpr.prototype.visitExpression = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitFunctionExpr(this, context);
};
/**
* @param {?} name
* @param {?=} modifiers
* @return {?}
*/
FunctionExpr.prototype.toDeclStmt = /**
* @param {?} name
* @param {?=} modifiers
* @return {?}
*/
function (name, modifiers) {
if (modifiers === void 0) { modifiers = null; }
return new DeclareFunctionStmt(name, this.params, this.statements, this.type, modifiers, this.sourceSpan);
};
return FunctionExpr;
}(Expression));
var BinaryOperatorExpr = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(BinaryOperatorExpr, _super);
function BinaryOperatorExpr(operator, lhs, rhs, type, sourceSpan) {
var _this = _super.call(this, type || lhs.type, sourceSpan) || this;
_this.operator = operator;
_this.rhs = rhs;
_this.lhs = lhs;
return _this;
}
/**
* @param {?} e
* @return {?}
*/
BinaryOperatorExpr.prototype.isEquivalent = /**
* @param {?} e
* @return {?}
*/
function (e) {
return e instanceof BinaryOperatorExpr && this.operator === e.operator &&
this.lhs.isEquivalent(e.lhs) && this.rhs.isEquivalent(e.rhs);
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
BinaryOperatorExpr.prototype.visitExpression = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitBinaryOperatorExpr(this, context);
};
return BinaryOperatorExpr;
}(Expression));
var ReadPropExpr = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ReadPropExpr, _super);
function ReadPropExpr(receiver, name, type, sourceSpan) {
var _this = _super.call(this, type, sourceSpan) || this;
_this.receiver = receiver;
_this.name = name;
return _this;
}
/**
* @param {?} e
* @return {?}
*/
ReadPropExpr.prototype.isEquivalent = /**
* @param {?} e
* @return {?}
*/
function (e) {
return e instanceof ReadPropExpr && this.receiver.isEquivalent(e.receiver) &&
this.name === e.name;
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
ReadPropExpr.prototype.visitExpression = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitReadPropExpr(this, context);
};
/**
* @param {?} value
* @return {?}
*/
ReadPropExpr.prototype.set = /**
* @param {?} value
* @return {?}
*/
function (value) {
return new WritePropExpr(this.receiver, this.name, value, null, this.sourceSpan);
};
return ReadPropExpr;
}(Expression));
var ReadKeyExpr = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ReadKeyExpr, _super);
function ReadKeyExpr(receiver, index, type, sourceSpan) {
var _this = _super.call(this, type, sourceSpan) || this;
_this.receiver = receiver;
_this.index = index;
return _this;
}
/**
* @param {?} e
* @return {?}
*/
ReadKeyExpr.prototype.isEquivalent = /**
* @param {?} e
* @return {?}
*/
function (e) {
return e instanceof ReadKeyExpr && this.receiver.isEquivalent(e.receiver) &&
this.index.isEquivalent(e.index);
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
ReadKeyExpr.prototype.visitExpression = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitReadKeyExpr(this, context);
};
/**
* @param {?} value
* @return {?}
*/
ReadKeyExpr.prototype.set = /**
* @param {?} value
* @return {?}
*/
function (value) {
return new WriteKeyExpr(this.receiver, this.index, value, null, this.sourceSpan);
};
return ReadKeyExpr;
}(Expression));
var LiteralArrayExpr = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(LiteralArrayExpr, _super);
function LiteralArrayExpr(entries, type, sourceSpan) {
var _this = _super.call(this, type, sourceSpan) || this;
_this.entries = entries;
return _this;
}
/**
* @param {?} e
* @return {?}
*/
LiteralArrayExpr.prototype.isEquivalent = /**
* @param {?} e
* @return {?}
*/
function (e) {
return e instanceof LiteralArrayExpr && areAllEquivalent(this.entries, e.entries);
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
LiteralArrayExpr.prototype.visitExpression = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitLiteralArrayExpr(this, context);
};
return LiteralArrayExpr;
}(Expression));
var LiteralMapEntry = (function () {
function LiteralMapEntry(key, value, quoted) {
this.key = key;
this.value = value;
this.quoted = quoted;
}
/**
* @param {?} e
* @return {?}
*/
LiteralMapEntry.prototype.isEquivalent = /**
* @param {?} e
* @return {?}
*/
function (e) {
return this.key === e.key && this.value.isEquivalent(e.value);
};
return LiteralMapEntry;
}());
var LiteralMapExpr = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(LiteralMapExpr, _super);
function LiteralMapExpr(entries, type, sourceSpan) {
var _this = _super.call(this, type, sourceSpan) || this;
_this.entries = entries;
_this.valueType = null;
if (type) {
_this.valueType = type.valueType;
}
return _this;
}
/**
* @param {?} e
* @return {?}
*/
LiteralMapExpr.prototype.isEquivalent = /**
* @param {?} e
* @return {?}
*/
function (e) {
return e instanceof LiteralMapExpr && areAllEquivalent(this.entries, e.entries);
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
LiteralMapExpr.prototype.visitExpression = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitLiteralMapExpr(this, context);
};
return LiteralMapExpr;
}(Expression));
var CommaExpr = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(CommaExpr, _super);
function CommaExpr(parts, sourceSpan) {
var _this = _super.call(this, parts[parts.length - 1].type, sourceSpan) || this;
_this.parts = parts;
return _this;
}
/**
* @param {?} e
* @return {?}
*/
CommaExpr.prototype.isEquivalent = /**
* @param {?} e
* @return {?}
*/
function (e) {
return e instanceof CommaExpr && areAllEquivalent(this.parts, e.parts);
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
CommaExpr.prototype.visitExpression = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitCommaExpr(this, context);
};
return CommaExpr;
}(Expression));
/**
* @record
*/
var THIS_EXPR = new ReadVarExpr(BuiltinVar.This, null, null);
var SUPER_EXPR = new ReadVarExpr(BuiltinVar.Super, null, null);
var CATCH_ERROR_VAR = new ReadVarExpr(BuiltinVar.CatchError, null, null);
var CATCH_STACK_VAR = new ReadVarExpr(BuiltinVar.CatchStack, null, null);
var NULL_EXPR = new LiteralExpr(null, null, null);
var TYPED_NULL_EXPR = new LiteralExpr(null, INFERRED_TYPE, null);
/** @enum {number} */
var StmtModifier = {
Final: 0,
Private: 1,
Exported: 2,
};
StmtModifier[StmtModifier.Final] = "Final";
StmtModifier[StmtModifier.Private] = "Private";
StmtModifier[StmtModifier.Exported] = "Exported";
/**
* @abstract
*/
var Statement = (function () {
function Statement(modifiers, sourceSpan) {
this.modifiers = modifiers || [];
this.sourceSpan = sourceSpan || null;
}
/**
* @param {?} modifier
* @return {?}
*/
Statement.prototype.hasModifier = /**
* @param {?} modifier
* @return {?}
*/
function (modifier) { return /** @type {?} */ ((this.modifiers)).indexOf(modifier) !== -1; };
return Statement;
}());
var DeclareVarStmt = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(DeclareVarStmt, _super);
function DeclareVarStmt(name, value, type, modifiers, sourceSpan) {
if (modifiers === void 0) { modifiers = null; }
var _this = _super.call(this, modifiers, sourceSpan) || this;
_this.name = name;
_this.value = value;
_this.type = type || value.type;
return _this;
}
/**
* @param {?} stmt
* @return {?}
*/
DeclareVarStmt.prototype.isEquivalent = /**
* @param {?} stmt
* @return {?}
*/
function (stmt) {
return stmt instanceof DeclareVarStmt && this.name === stmt.name &&
this.value.isEquivalent(stmt.value);
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
DeclareVarStmt.prototype.visitStatement = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitDeclareVarStmt(this, context);
};
return DeclareVarStmt;
}(Statement));
var DeclareFunctionStmt = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(DeclareFunctionStmt, _super);
function DeclareFunctionStmt(name, params, statements, type, modifiers, sourceSpan) {
if (modifiers === void 0) { modifiers = null; }
var _this = _super.call(this, modifiers, sourceSpan) || this;
_this.name = name;
_this.params = params;
_this.statements = statements;
_this.type = type || null;
return _this;
}
/**
* @param {?} stmt
* @return {?}
*/
DeclareFunctionStmt.prototype.isEquivalent = /**
* @param {?} stmt
* @return {?}
*/
function (stmt) {
return stmt instanceof DeclareFunctionStmt && areAllEquivalent(this.params, stmt.params) &&
areAllEquivalent(this.statements, stmt.statements);
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
DeclareFunctionStmt.prototype.visitStatement = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitDeclareFunctionStmt(this, context);
};
return DeclareFunctionStmt;
}(Statement));
var ExpressionStatement = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ExpressionStatement, _super);
function ExpressionStatement(expr, sourceSpan) {
var _this = _super.call(this, null, sourceSpan) || this;
_this.expr = expr;
return _this;
}
/**
* @param {?} stmt
* @return {?}
*/
ExpressionStatement.prototype.isEquivalent = /**
* @param {?} stmt
* @return {?}
*/
function (stmt) {
return stmt instanceof ExpressionStatement && this.expr.isEquivalent(stmt.expr);
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
ExpressionStatement.prototype.visitStatement = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitExpressionStmt(this, context);
};
return ExpressionStatement;
}(Statement));
var ReturnStatement = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ReturnStatement, _super);
function ReturnStatement(value, sourceSpan) {
var _this = _super.call(this, null, sourceSpan) || this;
_this.value = value;
return _this;
}
/**
* @param {?} stmt
* @return {?}
*/
ReturnStatement.prototype.isEquivalent = /**
* @param {?} stmt
* @return {?}
*/
function (stmt) {
return stmt instanceof ReturnStatement && this.value.isEquivalent(stmt.value);
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
ReturnStatement.prototype.visitStatement = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitReturnStmt(this, context);
};
return ReturnStatement;
}(Statement));
var AbstractClassPart = (function () {
function AbstractClassPart(type, modifiers) {
this.modifiers = modifiers;
if (!modifiers) {
this.modifiers = [];
}
this.type = type || null;
}
/**
* @param {?} modifier
* @return {?}
*/
AbstractClassPart.prototype.hasModifier = /**
* @param {?} modifier
* @return {?}
*/
function (modifier) { return /** @type {?} */ ((this.modifiers)).indexOf(modifier) !== -1; };
return AbstractClassPart;
}());
var ClassField = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ClassField, _super);
function ClassField(name, type, modifiers) {
if (modifiers === void 0) { modifiers = null; }
var _this = _super.call(this, type, modifiers) || this;
_this.name = name;
return _this;
}
/**
* @param {?} f
* @return {?}
*/
ClassField.prototype.isEquivalent = /**
* @param {?} f
* @return {?}
*/
function (f) { return this.name === f.name; };
return ClassField;
}(AbstractClassPart));
var ClassMethod = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ClassMethod, _super);
function ClassMethod(name, params, body, type, modifiers) {
if (modifiers === void 0) { modifiers = null; }
var _this = _super.call(this, type, modifiers) || this;
_this.name = name;
_this.params = params;
_this.body = body;
return _this;
}
/**
* @param {?} m
* @return {?}
*/
ClassMethod.prototype.isEquivalent = /**
* @param {?} m
* @return {?}
*/
function (m) {
return this.name === m.name && areAllEquivalent(this.body, m.body);
};
return ClassMethod;
}(AbstractClassPart));
var ClassGetter = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ClassGetter, _super);
function ClassGetter(name, body, type, modifiers) {
if (modifiers === void 0) { modifiers = null; }
var _this = _super.call(this, type, modifiers) || this;
_this.name = name;
_this.body = body;
return _this;
}
/**
* @param {?} m
* @return {?}
*/
ClassGetter.prototype.isEquivalent = /**
* @param {?} m
* @return {?}
*/
function (m) {
return this.name === m.name && areAllEquivalent(this.body, m.body);
};
return ClassGetter;
}(AbstractClassPart));
var ClassStmt = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ClassStmt, _super);
function ClassStmt(name, parent, fields, getters, constructorMethod, methods, modifiers, sourceSpan) {
if (modifiers === void 0) { modifiers = null; }
var _this = _super.call(this, modifiers, sourceSpan) || this;
_this.name = name;
_this.parent = parent;
_this.fields = fields;
_this.getters = getters;
_this.constructorMethod = constructorMethod;
_this.methods = methods;
return _this;
}
/**
* @param {?} stmt
* @return {?}
*/
ClassStmt.prototype.isEquivalent = /**
* @param {?} stmt
* @return {?}
*/
function (stmt) {
return stmt instanceof ClassStmt && this.name === stmt.name &&
nullSafeIsEquivalent(this.parent, stmt.parent) &&
areAllEquivalent(this.fields, stmt.fields) &&
areAllEquivalent(this.getters, stmt.getters) &&
this.constructorMethod.isEquivalent(stmt.constructorMethod) &&
areAllEquivalent(this.methods, stmt.methods);
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
ClassStmt.prototype.visitStatement = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitDeclareClassStmt(this, context);
};
return ClassStmt;
}(Statement));
var IfStmt = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(IfStmt, _super);
function IfStmt(condition, trueCase, falseCase, sourceSpan) {
if (falseCase === void 0) { falseCase = []; }
var _this = _super.call(this, null, sourceSpan) || this;
_this.condition = condition;
_this.trueCase = trueCase;
_this.falseCase = falseCase;
return _this;
}
/**
* @param {?} stmt
* @return {?}
*/
IfStmt.prototype.isEquivalent = /**
* @param {?} stmt
* @return {?}
*/
function (stmt) {
return stmt instanceof IfStmt && this.condition.isEquivalent(stmt.condition) &&
areAllEquivalent(this.trueCase, stmt.trueCase) &&
areAllEquivalent(this.falseCase, stmt.falseCase);
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
IfStmt.prototype.visitStatement = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitIfStmt(this, context);
};
return IfStmt;
}(Statement));
var CommentStmt = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(CommentStmt, _super);
function CommentStmt(comment, sourceSpan) {
var _this = _super.call(this, null, sourceSpan) || this;
_this.comment = comment;
return _this;
}
/**
* @param {?} stmt
* @return {?}
*/
CommentStmt.prototype.isEquivalent = /**
* @param {?} stmt
* @return {?}
*/
function (stmt) { return stmt instanceof CommentStmt; };
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
CommentStmt.prototype.visitStatement = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitCommentStmt(this, context);
};
return CommentStmt;
}(Statement));
var TryCatchStmt = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(TryCatchStmt, _super);
function TryCatchStmt(bodyStmts, catchStmts, sourceSpan) {
var _this = _super.call(this, null, sourceSpan) || this;
_this.bodyStmts = bodyStmts;
_this.catchStmts = catchStmts;
return _this;
}
/**
* @param {?} stmt
* @return {?}
*/
TryCatchStmt.prototype.isEquivalent = /**
* @param {?} stmt
* @return {?}
*/
function (stmt) {
return stmt instanceof TryCatchStmt && areAllEquivalent(this.bodyStmts, stmt.bodyStmts) &&
areAllEquivalent(this.catchStmts, stmt.catchStmts);
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
TryCatchStmt.prototype.visitStatement = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitTryCatchStmt(this, context);
};
return TryCatchStmt;
}(Statement));
var ThrowStmt = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ThrowStmt, _super);
function ThrowStmt(error, sourceSpan) {
var _this = _super.call(this, null, sourceSpan) || this;
_this.error = error;
return _this;
}
/**
* @param {?} stmt
* @return {?}
*/
ThrowStmt.prototype.isEquivalent = /**
* @param {?} stmt
* @return {?}
*/
function (stmt) {
return stmt instanceof TryCatchStmt && this.error.isEquivalent(stmt.error);
};
/**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
ThrowStmt.prototype.visitStatement = /**
* @param {?} visitor
* @param {?} context
* @return {?}
*/
function (visitor, context) {
return visitor.visitThrowStmt(this, context);
};
return ThrowStmt;
}(Statement));
/**
* @record
*/
var AstTransformer$1 = (function () {
function AstTransformer() {
}
/**
* @param {?} expr
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.transformExpr = /**
* @param {?} expr
* @param {?} context
* @return {?}
*/
function (expr, context) { return expr; };
/**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.transformStmt = /**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
function (stmt, context) { return stmt; };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitReadVarExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { return this.transformExpr(ast, context); };
/**
* @param {?} expr
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitWriteVarExpr = /**
* @param {?} expr
* @param {?} context
* @return {?}
*/
function (expr, context) {
return this.transformExpr(new WriteVarExpr(expr.name, expr.value.visitExpression(this, context), expr.type, expr.sourceSpan), context);
};
/**
* @param {?} expr
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitWriteKeyExpr = /**
* @param {?} expr
* @param {?} context
* @return {?}
*/
function (expr, context) {
return this.transformExpr(new WriteKeyExpr(expr.receiver.visitExpression(this, context), expr.index.visitExpression(this, context), expr.value.visitExpression(this, context), expr.type, expr.sourceSpan), context);
};
/**
* @param {?} expr
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitWritePropExpr = /**
* @param {?} expr
* @param {?} context
* @return {?}
*/
function (expr, context) {
return this.transformExpr(new WritePropExpr(expr.receiver.visitExpression(this, context), expr.name, expr.value.visitExpression(this, context), expr.type, expr.sourceSpan), context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitInvokeMethodExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
var /** @type {?} */ method = ast.builtin || ast.name;
return this.transformExpr(new InvokeMethodExpr(ast.receiver.visitExpression(this, context), /** @type {?} */ ((method)), this.visitAllExpressions(ast.args, context), ast.type, ast.sourceSpan), context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitInvokeFunctionExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return this.transformExpr(new InvokeFunctionExpr(ast.fn.visitExpression(this, context), this.visitAllExpressions(ast.args, context), ast.type, ast.sourceSpan), context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitInstantiateExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return this.transformExpr(new InstantiateExpr(ast.classExpr.visitExpression(this, context), this.visitAllExpressions(ast.args, context), ast.type, ast.sourceSpan), context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitLiteralExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { return this.transformExpr(ast, context); };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitExternalExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return this.transformExpr(ast, context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitConditionalExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return this.transformExpr(new ConditionalExpr(ast.condition.visitExpression(this, context), ast.trueCase.visitExpression(this, context), /** @type {?} */ ((ast.falseCase)).visitExpression(this, context), ast.type, ast.sourceSpan), context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitNotExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return this.transformExpr(new NotExpr(ast.condition.visitExpression(this, context), ast.sourceSpan), context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitAssertNotNullExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return this.transformExpr(new AssertNotNull(ast.condition.visitExpression(this, context), ast.sourceSpan), context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitCastExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return this.transformExpr(new CastExpr(ast.value.visitExpression(this, context), ast.type, ast.sourceSpan), context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitFunctionExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return this.transformExpr(new FunctionExpr(ast.params, this.visitAllStatements(ast.statements, context), ast.type, ast.sourceSpan), context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitBinaryOperatorExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return this.transformExpr(new BinaryOperatorExpr(ast.operator, ast.lhs.visitExpression(this, context), ast.rhs.visitExpression(this, context), ast.type, ast.sourceSpan), context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitReadPropExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return this.transformExpr(new ReadPropExpr(ast.receiver.visitExpression(this, context), ast.name, ast.type, ast.sourceSpan), context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitReadKeyExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return this.transformExpr(new ReadKeyExpr(ast.receiver.visitExpression(this, context), ast.index.visitExpression(this, context), ast.type, ast.sourceSpan), context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitLiteralArrayExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return this.transformExpr(new LiteralArrayExpr(this.visitAllExpressions(ast.entries, context), ast.type, ast.sourceSpan), context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitLiteralMapExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
var _this = this;
var /** @type {?} */ entries = ast.entries.map(function (entry) {
return new LiteralMapEntry(entry.key, entry.value.visitExpression(_this, context), entry.quoted);
});
var /** @type {?} */ mapType = new MapType(ast.valueType, null);
return this.transformExpr(new LiteralMapExpr(entries, mapType, ast.sourceSpan), context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitCommaExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return this.transformExpr(new CommaExpr(this.visitAllExpressions(ast.parts, context), ast.sourceSpan), context);
};
/**
* @param {?} exprs
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitAllExpressions = /**
* @param {?} exprs
* @param {?} context
* @return {?}
*/
function (exprs, context) {
var _this = this;
return exprs.map(function (expr) { return expr.visitExpression(_this, context); });
};
/**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitDeclareVarStmt = /**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
function (stmt, context) {
return this.transformStmt(new DeclareVarStmt(stmt.name, stmt.value.visitExpression(this, context), stmt.type, stmt.modifiers, stmt.sourceSpan), context);
};
/**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitDeclareFunctionStmt = /**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
function (stmt, context) {
return this.transformStmt(new DeclareFunctionStmt(stmt.name, stmt.params, this.visitAllStatements(stmt.statements, context), stmt.type, stmt.modifiers, stmt.sourceSpan), context);
};
/**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitExpressionStmt = /**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
function (stmt, context) {
return this.transformStmt(new ExpressionStatement(stmt.expr.visitExpression(this, context), stmt.sourceSpan), context);
};
/**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitReturnStmt = /**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
function (stmt, context) {
return this.transformStmt(new ReturnStatement(stmt.value.visitExpression(this, context), stmt.sourceSpan), context);
};
/**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitDeclareClassStmt = /**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
function (stmt, context) {
var _this = this;
var /** @type {?} */ parent = /** @type {?} */ ((stmt.parent)).visitExpression(this, context);
var /** @type {?} */ getters = stmt.getters.map(function (getter) {
return new ClassGetter(getter.name, _this.visitAllStatements(getter.body, context), getter.type, getter.modifiers);
});
var /** @type {?} */ ctorMethod = stmt.constructorMethod &&
new ClassMethod(stmt.constructorMethod.name, stmt.constructorMethod.params, this.visitAllStatements(stmt.constructorMethod.body, context), stmt.constructorMethod.type, stmt.constructorMethod.modifiers);
var /** @type {?} */ methods = stmt.methods.map(function (method) {
return new ClassMethod(method.name, method.params, _this.visitAllStatements(method.body, context), method.type, method.modifiers);
});
return this.transformStmt(new ClassStmt(stmt.name, parent, stmt.fields, getters, ctorMethod, methods, stmt.modifiers, stmt.sourceSpan), context);
};
/**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitIfStmt = /**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
function (stmt, context) {
return this.transformStmt(new IfStmt(stmt.condition.visitExpression(this, context), this.visitAllStatements(stmt.trueCase, context), this.visitAllStatements(stmt.falseCase, context), stmt.sourceSpan), context);
};
/**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitTryCatchStmt = /**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
function (stmt, context) {
return this.transformStmt(new TryCatchStmt(this.visitAllStatements(stmt.bodyStmts, context), this.visitAllStatements(stmt.catchStmts, context), stmt.sourceSpan), context);
};
/**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitThrowStmt = /**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
function (stmt, context) {
return this.transformStmt(new ThrowStmt(stmt.error.visitExpression(this, context), stmt.sourceSpan), context);
};
/**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitCommentStmt = /**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
function (stmt, context) {
return this.transformStmt(stmt, context);
};
/**
* @param {?} stmts
* @param {?} context
* @return {?}
*/
AstTransformer.prototype.visitAllStatements = /**
* @param {?} stmts
* @param {?} context
* @return {?}
*/
function (stmts, context) {
var _this = this;
return stmts.map(function (stmt) { return stmt.visitStatement(_this, context); });
};
return AstTransformer;
}());
var RecursiveAstVisitor$1 = (function () {
function RecursiveAstVisitor() {
}
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitType = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { return ast; };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitExpression = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
if (ast.type) {
ast.type.visitType(this, context);
}
return ast;
};
/**
* @param {?} type
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitBuiltintType = /**
* @param {?} type
* @param {?} context
* @return {?}
*/
function (type, context) { return this.visitType(type, context); };
/**
* @param {?} type
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitExpressionType = /**
* @param {?} type
* @param {?} context
* @return {?}
*/
function (type, context) {
type.value.visitExpression(this, context);
return this.visitType(type, context);
};
/**
* @param {?} type
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitArrayType = /**
* @param {?} type
* @param {?} context
* @return {?}
*/
function (type, context) { return this.visitType(type, context); };
/**
* @param {?} type
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitMapType = /**
* @param {?} type
* @param {?} context
* @return {?}
*/
function (type, context) { return this.visitType(type, context); };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitReadVarExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return this.visitExpression(ast, context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitWriteVarExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
ast.value.visitExpression(this, context);
return this.visitExpression(ast, context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitWriteKeyExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
ast.receiver.visitExpression(this, context);
ast.index.visitExpression(this, context);
ast.value.visitExpression(this, context);
return this.visitExpression(ast, context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitWritePropExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
ast.receiver.visitExpression(this, context);
ast.value.visitExpression(this, context);
return this.visitExpression(ast, context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitInvokeMethodExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
ast.receiver.visitExpression(this, context);
this.visitAllExpressions(ast.args, context);
return this.visitExpression(ast, context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitInvokeFunctionExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
ast.fn.visitExpression(this, context);
this.visitAllExpressions(ast.args, context);
return this.visitExpression(ast, context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitInstantiateExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
ast.classExpr.visitExpression(this, context);
this.visitAllExpressions(ast.args, context);
return this.visitExpression(ast, context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitLiteralExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
return this.visitExpression(ast, context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitExternalExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
var _this = this;
if (ast.typeParams) {
ast.typeParams.forEach(function (type) { return type.visitType(_this, context); });
}
return this.visitExpression(ast, context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitConditionalExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
ast.condition.visitExpression(this, context);
ast.trueCase.visitExpression(this, context); /** @type {?} */
((ast.falseCase)).visitExpression(this, context);
return this.visitExpression(ast, context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitNotExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
ast.condition.visitExpression(this, context);
return this.visitExpression(ast, context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitAssertNotNullExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
ast.condition.visitExpression(this, context);
return this.visitExpression(ast, context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitCastExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
ast.value.visitExpression(this, context);
return this.visitExpression(ast, context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitFunctionExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
this.visitAllStatements(ast.statements, context);
return this.visitExpression(ast, context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitBinaryOperatorExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
ast.lhs.visitExpression(this, context);
ast.rhs.visitExpression(this, context);
return this.visitExpression(ast, context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitReadPropExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
ast.receiver.visitExpression(this, context);
return this.visitExpression(ast, context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitReadKeyExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
ast.receiver.visitExpression(this, context);
ast.index.visitExpression(this, context);
return this.visitExpression(ast, context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitLiteralArrayExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
this.visitAllExpressions(ast.entries, context);
return this.visitExpression(ast, context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitLiteralMapExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
var _this = this;
ast.entries.forEach(function (entry) { return entry.value.visitExpression(_this, context); });
return this.visitExpression(ast, context);
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitCommaExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
this.visitAllExpressions(ast.parts, context);
return this.visitExpression(ast, context);
};
/**
* @param {?} exprs
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitAllExpressions = /**
* @param {?} exprs
* @param {?} context
* @return {?}
*/
function (exprs, context) {
var _this = this;
exprs.forEach(function (expr) { return expr.visitExpression(_this, context); });
};
/**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitDeclareVarStmt = /**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
function (stmt, context) {
stmt.value.visitExpression(this, context);
if (stmt.type) {
stmt.type.visitType(this, context);
}
return stmt;
};
/**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitDeclareFunctionStmt = /**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
function (stmt, context) {
this.visitAllStatements(stmt.statements, context);
if (stmt.type) {
stmt.type.visitType(this, context);
}
return stmt;
};
/**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitExpressionStmt = /**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
function (stmt, context) {
stmt.expr.visitExpression(this, context);
return stmt;
};
/**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitReturnStmt = /**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
function (stmt, context) {
stmt.value.visitExpression(this, context);
return stmt;
};
/**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitDeclareClassStmt = /**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
function (stmt, context) {
var _this = this;
/** @type {?} */ ((stmt.parent)).visitExpression(this, context);
stmt.getters.forEach(function (getter) { return _this.visitAllStatements(getter.body, context); });
if (stmt.constructorMethod) {
this.visitAllStatements(stmt.constructorMethod.body, context);
}
stmt.methods.forEach(function (method) { return _this.visitAllStatements(method.body, context); });
return stmt;
};
/**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitIfStmt = /**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
function (stmt, context) {
stmt.condition.visitExpression(this, context);
this.visitAllStatements(stmt.trueCase, context);
this.visitAllStatements(stmt.falseCase, context);
return stmt;
};
/**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitTryCatchStmt = /**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
function (stmt, context) {
this.visitAllStatements(stmt.bodyStmts, context);
this.visitAllStatements(stmt.catchStmts, context);
return stmt;
};
/**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitThrowStmt = /**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
function (stmt, context) {
stmt.error.visitExpression(this, context);
return stmt;
};
/**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitCommentStmt = /**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
function (stmt, context) { return stmt; };
/**
* @param {?} stmts
* @param {?} context
* @return {?}
*/
RecursiveAstVisitor.prototype.visitAllStatements = /**
* @param {?} stmts
* @param {?} context
* @return {?}
*/
function (stmts, context) {
var _this = this;
stmts.forEach(function (stmt) { return stmt.visitStatement(_this, context); });
};
return RecursiveAstVisitor;
}());
/**
* @param {?} stmts
* @return {?}
*/
function findReadVarNames(stmts) {
var /** @type {?} */ visitor = new _ReadVarVisitor();
visitor.visitAllStatements(stmts, null);
return visitor.varNames;
}
var _ReadVarVisitor = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(_ReadVarVisitor, _super);
function _ReadVarVisitor() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.varNames = new Set();
return _this;
}
/**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
_ReadVarVisitor.prototype.visitDeclareFunctionStmt = /**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
function (stmt, context) {
// Don't descend into nested functions
return stmt;
};
/**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
_ReadVarVisitor.prototype.visitDeclareClassStmt = /**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
function (stmt, context) {
// Don't descend into nested classes
return stmt;
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
_ReadVarVisitor.prototype.visitReadVarExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
if (ast.name) {
this.varNames.add(ast.name);
}
return null;
};
return _ReadVarVisitor;
}(RecursiveAstVisitor$1));
/**
* @param {?} stmts
* @return {?}
*/
function collectExternalReferences(stmts) {
var /** @type {?} */ visitor = new _FindExternalReferencesVisitor();
visitor.visitAllStatements(stmts, null);
return visitor.externalReferences;
}
var _FindExternalReferencesVisitor = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(_FindExternalReferencesVisitor, _super);
function _FindExternalReferencesVisitor() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.externalReferences = [];
return _this;
}
/**
* @param {?} e
* @param {?} context
* @return {?}
*/
_FindExternalReferencesVisitor.prototype.visitExternalExpr = /**
* @param {?} e
* @param {?} context
* @return {?}
*/
function (e, context) {
this.externalReferences.push(e.value);
return _super.prototype.visitExternalExpr.call(this, e, context);
};
return _FindExternalReferencesVisitor;
}(RecursiveAstVisitor$1));
/**
* @param {?} stmt
* @param {?} sourceSpan
* @return {?}
*/
function applySourceSpanToStatementIfNeeded(stmt, sourceSpan) {
if (!sourceSpan) {
return stmt;
}
var /** @type {?} */ transformer = new _ApplySourceSpanTransformer(sourceSpan);
return stmt.visitStatement(transformer, null);
}
/**
* @param {?} expr
* @param {?} sourceSpan
* @return {?}
*/
function applySourceSpanToExpressionIfNeeded(expr, sourceSpan) {
if (!sourceSpan) {
return expr;
}
var /** @type {?} */ transformer = new _ApplySourceSpanTransformer(sourceSpan);
return expr.visitExpression(transformer, null);
}
var _ApplySourceSpanTransformer = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(_ApplySourceSpanTransformer, _super);
function _ApplySourceSpanTransformer(sourceSpan) {
var _this = _super.call(this) || this;
_this.sourceSpan = sourceSpan;
return _this;
}
/**
* @param {?} obj
* @return {?}
*/
_ApplySourceSpanTransformer.prototype._clone = /**
* @param {?} obj
* @return {?}
*/
function (obj) {
var /** @type {?} */ clone = Object.create(obj.constructor.prototype);
for (var /** @type {?} */ prop in obj) {
clone[prop] = obj[prop];
}
return clone;
};
/**
* @param {?} expr
* @param {?} context
* @return {?}
*/
_ApplySourceSpanTransformer.prototype.transformExpr = /**
* @param {?} expr
* @param {?} context
* @return {?}
*/
function (expr, context) {
if (!expr.sourceSpan) {
expr = this._clone(expr);
expr.sourceSpan = this.sourceSpan;
}
return expr;
};
/**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
_ApplySourceSpanTransformer.prototype.transformStmt = /**
* @param {?} stmt
* @param {?} context
* @return {?}
*/
function (stmt, context) {
if (!stmt.sourceSpan) {
stmt = this._clone(stmt);
stmt.sourceSpan = this.sourceSpan;
}
return stmt;
};
return _ApplySourceSpanTransformer;
}(AstTransformer$1));
/**
* @param {?} name
* @param {?=} type
* @param {?=} sourceSpan
* @return {?}
*/
function variable(name, type, sourceSpan) {
return new ReadVarExpr(name, type, sourceSpan);
}
/**
* @param {?} id
* @param {?=} typeParams
* @param {?=} sourceSpan
* @return {?}
*/
function importExpr(id, typeParams, sourceSpan) {
if (typeParams === void 0) { typeParams = null; }
return new ExternalExpr(id, null, typeParams, sourceSpan);
}
/**
* @param {?} id
* @param {?=} typeParams
* @param {?=} typeModifiers
* @return {?}
*/
function importType(id, typeParams, typeModifiers) {
if (typeParams === void 0) { typeParams = null; }
if (typeModifiers === void 0) { typeModifiers = null; }
return id != null ? expressionType(importExpr(id, typeParams, null), typeModifiers) : null;
}
/**
* @param {?} expr
* @param {?=} typeModifiers
* @return {?}
*/
function expressionType(expr, typeModifiers) {
if (typeModifiers === void 0) { typeModifiers = null; }
return new ExpressionType(expr, typeModifiers);
}
/**
* @param {?} values
* @param {?=} type
* @param {?=} sourceSpan
* @return {?}
*/
function literalArr(values, type, sourceSpan) {
return new LiteralArrayExpr(values, type, sourceSpan);
}
/**
* @param {?} values
* @param {?=} type
* @return {?}
*/
function literalMap(values, type) {
if (type === void 0) { type = null; }
return new LiteralMapExpr(values.map(function (e) { return new LiteralMapEntry(e.key, e.value, e.quoted); }), type, null);
}
/**
* @param {?} expr
* @param {?=} sourceSpan
* @return {?}
*/
function not(expr, sourceSpan) {
return new NotExpr(expr, sourceSpan);
}
/**
* @param {?} expr
* @param {?=} sourceSpan
* @return {?}
*/
function assertNotNull(expr, sourceSpan) {
return new AssertNotNull(expr, sourceSpan);
}
/**
* @param {?} params
* @param {?} body
* @param {?=} type
* @param {?=} sourceSpan
* @return {?}
*/
function fn(params, body, type, sourceSpan) {
return new FunctionExpr(params, body, type, sourceSpan);
}
/**
* @param {?} value
* @param {?=} type
* @param {?=} sourceSpan
* @return {?}
*/
function literal(value, type, sourceSpan) {
return new LiteralExpr(value, type, sourceSpan);
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var ProviderError = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ProviderError, _super);
function ProviderError(message, span) {
return _super.call(this, span, message) || this;
}
return ProviderError;
}(ParseError));
/**
* @record
*/
var ProviderViewContext = (function () {
function ProviderViewContext(reflector, component) {
var _this = this;
this.reflector = reflector;
this.component = component;
this.errors = [];
this.viewQueries = _getViewQueries(component);
this.viewProviders = new Map();
component.viewProviders.forEach(function (provider) {
if (_this.viewProviders.get(tokenReference(provider.token)) == null) {
_this.viewProviders.set(tokenReference(provider.token), true);
}
});
}
return ProviderViewContext;
}());
var ProviderElementContext = (function () {
function ProviderElementContext(viewContext, _parent, _isViewRoot, _directiveAsts, attrs, refs, isTemplate, contentQueryStartId, _sourceSpan) {
var _this = this;
this.viewContext = viewContext;
this._parent = _parent;
this._isViewRoot = _isViewRoot;
this._directiveAsts = _directiveAsts;
this._sourceSpan = _sourceSpan;
this._transformedProviders = new Map();
this._seenProviders = new Map();
this._queriedTokens = new Map();
this.transformedHasViewContainer = false;
this._attrs = {};
attrs.forEach(function (attrAst) { return _this._attrs[attrAst.name] = attrAst.value; });
var /** @type {?} */ directivesMeta = _directiveAsts.map(function (directiveAst) { return directiveAst.directive; });
this._allProviders =
_resolveProvidersFromDirectives(directivesMeta, _sourceSpan, viewContext.errors);
this._contentQueries = _getContentQueries(contentQueryStartId, directivesMeta);
Array.from(this._allProviders.values()).forEach(function (provider) {
_this._addQueryReadsTo(provider.token, provider.token, _this._queriedTokens);
});
if (isTemplate) {
var /** @type {?} */ templateRefId = createTokenForExternalReference(this.viewContext.reflector, Identifiers.TemplateRef);
this._addQueryReadsTo(templateRefId, templateRefId, this._queriedTokens);
}
refs.forEach(function (refAst) {
var /** @type {?} */ defaultQueryValue = refAst.value ||
createTokenForExternalReference(_this.viewContext.reflector, Identifiers.ElementRef);
_this._addQueryReadsTo({ value: refAst.name }, defaultQueryValue, _this._queriedTokens);
});
if (this._queriedTokens.get(this.viewContext.reflector.resolveExternalReference(Identifiers.ViewContainerRef))) {
this.transformedHasViewContainer = true;
}
// create the providers that we know are eager first
Array.from(this._allProviders.values()).forEach(function (provider) {
var /** @type {?} */ eager = provider.eager || _this._queriedTokens.get(tokenReference(provider.token));
if (eager) {
_this._getOrCreateLocalProvider(provider.providerType, provider.token, true);
}
});
}
/**
* @return {?}
*/
ProviderElementContext.prototype.afterElement = /**
* @return {?}
*/
function () {
var _this = this;
// collect lazy providers
Array.from(this._allProviders.values()).forEach(function (provider) {
_this._getOrCreateLocalProvider(provider.providerType, provider.token, false);
});
};
Object.defineProperty(ProviderElementContext.prototype, "transformProviders", {
get: /**
* @return {?}
*/
function () {
// Note: Maps keep their insertion order.
var /** @type {?} */ lazyProviders = [];
var /** @type {?} */ eagerProviders = [];
this._transformedProviders.forEach(function (provider) {
if (provider.eager) {
eagerProviders.push(provider);
}
else {
lazyProviders.push(provider);
}
});
return lazyProviders.concat(eagerProviders);
},
enumerable: true,
configurable: true
});
Object.defineProperty(ProviderElementContext.prototype, "transformedDirectiveAsts", {
get: /**
* @return {?}
*/
function () {
var /** @type {?} */ sortedProviderTypes = this.transformProviders.map(function (provider) { return provider.token.identifier; });
var /** @type {?} */ sortedDirectives = this._directiveAsts.slice();
sortedDirectives.sort(function (dir1, dir2) {
return sortedProviderTypes.indexOf(dir1.directive.type) -
sortedProviderTypes.indexOf(dir2.directive.type);
});
return sortedDirectives;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ProviderElementContext.prototype, "queryMatches", {
get: /**
* @return {?}
*/
function () {
var /** @type {?} */ allMatches = [];
this._queriedTokens.forEach(function (matches) { allMatches.push.apply(allMatches, matches); });
return allMatches;
},
enumerable: true,
configurable: true
});
/**
* @param {?} token
* @param {?} defaultValue
* @param {?} queryReadTokens
* @return {?}
*/
ProviderElementContext.prototype._addQueryReadsTo = /**
* @param {?} token
* @param {?} defaultValue
* @param {?} queryReadTokens
* @return {?}
*/
function (token, defaultValue, queryReadTokens) {
this._getQueriesFor(token).forEach(function (query) {
var /** @type {?} */ queryValue = query.meta.read || defaultValue;
var /** @type {?} */ tokenRef = tokenReference(queryValue);
var /** @type {?} */ queryMatches = queryReadTokens.get(tokenRef);
if (!queryMatches) {
queryMatches = [];
queryReadTokens.set(tokenRef, queryMatches);
}
queryMatches.push({ queryId: query.queryId, value: queryValue });
});
};
/**
* @param {?} token
* @return {?}
*/
ProviderElementContext.prototype._getQueriesFor = /**
* @param {?} token
* @return {?}
*/
function (token) {
var /** @type {?} */ result = [];
var /** @type {?} */ currentEl = this;
var /** @type {?} */ distance = 0;
var /** @type {?} */ queries;
while (currentEl !== null) {
queries = currentEl._contentQueries.get(tokenReference(token));
if (queries) {
result.push.apply(result, queries.filter(function (query) { return query.meta.descendants || distance <= 1; }));
}
if (currentEl._directiveAsts.length > 0) {
distance++;
}
currentEl = currentEl._parent;
}
queries = this.viewContext.viewQueries.get(tokenReference(token));
if (queries) {
result.push.apply(result, queries);
}
return result;
};
/**
* @param {?} requestingProviderType
* @param {?} token
* @param {?} eager
* @return {?}
*/
ProviderElementContext.prototype._getOrCreateLocalProvider = /**
* @param {?} requestingProviderType
* @param {?} token
* @param {?} eager
* @return {?}
*/
function (requestingProviderType, token, eager) {
var _this = this;
var /** @type {?} */ resolvedProvider = this._allProviders.get(tokenReference(token));
if (!resolvedProvider || ((requestingProviderType === ProviderAstType.Directive ||
requestingProviderType === ProviderAstType.PublicService) &&
resolvedProvider.providerType === ProviderAstType.PrivateService) ||
((requestingProviderType === ProviderAstType.PrivateService ||
requestingProviderType === ProviderAstType.PublicService) &&
resolvedProvider.providerType === ProviderAstType.Builtin)) {
return null;
}
var /** @type {?} */ transformedProviderAst = this._transformedProviders.get(tokenReference(token));
if (transformedProviderAst) {
return transformedProviderAst;
}
if (this._seenProviders.get(tokenReference(token)) != null) {
this.viewContext.errors.push(new ProviderError("Cannot instantiate cyclic dependency! " + tokenName(token), this._sourceSpan));
return null;
}
this._seenProviders.set(tokenReference(token), true);
var /** @type {?} */ transformedProviders = resolvedProvider.providers.map(function (provider) {
var /** @type {?} */ transformedUseValue = provider.useValue;
var /** @type {?} */ transformedUseExisting = /** @type {?} */ ((provider.useExisting));
var /** @type {?} */ transformedDeps = /** @type {?} */ ((undefined));
if (provider.useExisting != null) {
var /** @type {?} */ existingDiDep = /** @type {?} */ ((_this._getDependency(resolvedProvider.providerType, { token: provider.useExisting }, eager)));
if (existingDiDep.token != null) {
transformedUseExisting = existingDiDep.token;
}
else {
transformedUseExisting = /** @type {?} */ ((null));
transformedUseValue = existingDiDep.value;
}
}
else if (provider.useFactory) {
var /** @type {?} */ deps = provider.deps || provider.useFactory.diDeps;
transformedDeps =
deps.map(function (dep) { return /** @type {?} */ ((_this._getDependency(resolvedProvider.providerType, dep, eager))); });
}
else if (provider.useClass) {
var /** @type {?} */ deps = provider.deps || provider.useClass.diDeps;
transformedDeps =
deps.map(function (dep) { return /** @type {?} */ ((_this._getDependency(resolvedProvider.providerType, dep, eager))); });
}
return _transformProvider(provider, {
useExisting: transformedUseExisting,
useValue: transformedUseValue,
deps: transformedDeps
});
});
transformedProviderAst =
_transformProviderAst(resolvedProvider, { eager: eager, providers: transformedProviders });
this._transformedProviders.set(tokenReference(token), transformedProviderAst);
return transformedProviderAst;
};
/**
* @param {?} requestingProviderType
* @param {?} dep
* @param {?=} eager
* @return {?}
*/
ProviderElementContext.prototype._getLocalDependency = /**
* @param {?} requestingProviderType
* @param {?} dep
* @param {?=} eager
* @return {?}
*/
function (requestingProviderType, dep, eager) {
if (eager === void 0) { eager = false; }
if (dep.isAttribute) {
var /** @type {?} */ attrValue = this._attrs[/** @type {?} */ ((dep.token)).value];
return { isValue: true, value: attrValue == null ? null : attrValue };
}
if (dep.token != null) {
// access builtints
if ((requestingProviderType === ProviderAstType.Directive ||
requestingProviderType === ProviderAstType.Component)) {
if (tokenReference(dep.token) ===
this.viewContext.reflector.resolveExternalReference(Identifiers.Renderer) ||
tokenReference(dep.token) ===
this.viewContext.reflector.resolveExternalReference(Identifiers.ElementRef) ||
tokenReference(dep.token) ===
this.viewContext.reflector.resolveExternalReference(Identifiers.ChangeDetectorRef) ||
tokenReference(dep.token) ===
this.viewContext.reflector.resolveExternalReference(Identifiers.TemplateRef)) {
return dep;
}
if (tokenReference(dep.token) ===
this.viewContext.reflector.resolveExternalReference(Identifiers.ViewContainerRef)) {
(/** @type {?} */ (this)).transformedHasViewContainer = true;
}
}
// access the injector
if (tokenReference(dep.token) ===
this.viewContext.reflector.resolveExternalReference(Identifiers.Injector)) {
return dep;
}
// access providers
if (this._getOrCreateLocalProvider(requestingProviderType, dep.token, eager) != null) {
return dep;
}
}
return null;
};
/**
* @param {?} requestingProviderType
* @param {?} dep
* @param {?=} eager
* @return {?}
*/
ProviderElementContext.prototype._getDependency = /**
* @param {?} requestingProviderType
* @param {?} dep
* @param {?=} eager
* @return {?}
*/
function (requestingProviderType, dep, eager) {
if (eager === void 0) { eager = false; }
var /** @type {?} */ currElement = this;
var /** @type {?} */ currEager = eager;
var /** @type {?} */ result = null;
if (!dep.isSkipSelf) {
result = this._getLocalDependency(requestingProviderType, dep, eager);
}
if (dep.isSelf) {
if (!result && dep.isOptional) {
result = { isValue: true, value: null };
}
}
else {
// check parent elements
while (!result && currElement._parent) {
var /** @type {?} */ prevElement = currElement;
currElement = currElement._parent;
if (prevElement._isViewRoot) {
currEager = false;
}
result = currElement._getLocalDependency(ProviderAstType.PublicService, dep, currEager);
}
// check @Host restriction
if (!result) {
if (!dep.isHost || this.viewContext.component.isHost ||
this.viewContext.component.type.reference === tokenReference(/** @type {?} */ ((dep.token))) ||
this.viewContext.viewProviders.get(tokenReference(/** @type {?} */ ((dep.token)))) != null) {
result = dep;
}
else {
result = dep.isOptional ? result = { isValue: true, value: null } : null;
}
}
}
if (!result) {
this.viewContext.errors.push(new ProviderError("No provider for " + tokenName((/** @type {?} */ ((dep.token)))), this._sourceSpan));
}
return result;
};
return ProviderElementContext;
}());
var NgModuleProviderAnalyzer = (function () {
function NgModuleProviderAnalyzer(reflector, ngModule, extraProviders, sourceSpan) {
var _this = this;
this.reflector = reflector;
this._transformedProviders = new Map();
this._seenProviders = new Map();
this._errors = [];
this._allProviders = new Map();
ngModule.transitiveModule.modules.forEach(function (ngModuleType) {
var /** @type {?} */ ngModuleProvider = { token: { identifier: ngModuleType }, useClass: ngModuleType };
_resolveProviders([ngModuleProvider], ProviderAstType.PublicService, true, sourceSpan, _this._errors, _this._allProviders);
});
_resolveProviders(ngModule.transitiveModule.providers.map(function (entry) { return entry.provider; }).concat(extraProviders), ProviderAstType.PublicService, false, sourceSpan, this._errors, this._allProviders);
}
/**
* @return {?}
*/
NgModuleProviderAnalyzer.prototype.parse = /**
* @return {?}
*/
function () {
var _this = this;
Array.from(this._allProviders.values()).forEach(function (provider) {
_this._getOrCreateLocalProvider(provider.token, provider.eager);
});
if (this._errors.length > 0) {
var /** @type {?} */ errorString = this._errors.join('\n');
throw new Error("Provider parse errors:\n" + errorString);
}
// Note: Maps keep their insertion order.
var /** @type {?} */ lazyProviders = [];
var /** @type {?} */ eagerProviders = [];
this._transformedProviders.forEach(function (provider) {
if (provider.eager) {
eagerProviders.push(provider);
}
else {
lazyProviders.push(provider);
}
});
return lazyProviders.concat(eagerProviders);
};
/**
* @param {?} token
* @param {?} eager
* @return {?}
*/
NgModuleProviderAnalyzer.prototype._getOrCreateLocalProvider = /**
* @param {?} token
* @param {?} eager
* @return {?}
*/
function (token, eager) {
var _this = this;
var /** @type {?} */ resolvedProvider = this._allProviders.get(tokenReference(token));
if (!resolvedProvider) {
return null;
}
var /** @type {?} */ transformedProviderAst = this._transformedProviders.get(tokenReference(token));
if (transformedProviderAst) {
return transformedProviderAst;
}
if (this._seenProviders.get(tokenReference(token)) != null) {
this._errors.push(new ProviderError("Cannot instantiate cyclic dependency! " + tokenName(token), resolvedProvider.sourceSpan));
return null;
}
this._seenProviders.set(tokenReference(token), true);
var /** @type {?} */ transformedProviders = resolvedProvider.providers.map(function (provider) {
var /** @type {?} */ transformedUseValue = provider.useValue;
var /** @type {?} */ transformedUseExisting = /** @type {?} */ ((provider.useExisting));
var /** @type {?} */ transformedDeps = /** @type {?} */ ((undefined));
if (provider.useExisting != null) {
var /** @type {?} */ existingDiDep = _this._getDependency({ token: provider.useExisting }, eager, resolvedProvider.sourceSpan);
if (existingDiDep.token != null) {
transformedUseExisting = existingDiDep.token;
}
else {
transformedUseExisting = /** @type {?} */ ((null));
transformedUseValue = existingDiDep.value;
}
}
else if (provider.useFactory) {
var /** @type {?} */ deps = provider.deps || provider.useFactory.diDeps;
transformedDeps =
deps.map(function (dep) { return _this._getDependency(dep, eager, resolvedProvider.sourceSpan); });
}
else if (provider.useClass) {
var /** @type {?} */ deps = provider.deps || provider.useClass.diDeps;
transformedDeps =
deps.map(function (dep) { return _this._getDependency(dep, eager, resolvedProvider.sourceSpan); });
}
return _transformProvider(provider, {
useExisting: transformedUseExisting,
useValue: transformedUseValue,
deps: transformedDeps
});
});
transformedProviderAst =
_transformProviderAst(resolvedProvider, { eager: eager, providers: transformedProviders });
this._transformedProviders.set(tokenReference(token), transformedProviderAst);
return transformedProviderAst;
};
/**
* @param {?} dep
* @param {?=} eager
* @param {?=} requestorSourceSpan
* @return {?}
*/
NgModuleProviderAnalyzer.prototype._getDependency = /**
* @param {?} dep
* @param {?=} eager
* @param {?=} requestorSourceSpan
* @return {?}
*/
function (dep, eager, requestorSourceSpan) {
if (eager === void 0) { eager = false; }
var /** @type {?} */ foundLocal = false;
if (!dep.isSkipSelf && dep.token != null) {
// access the injector
if (tokenReference(dep.token) ===
this.reflector.resolveExternalReference(Identifiers.Injector) ||
tokenReference(dep.token) ===
this.reflector.resolveExternalReference(Identifiers.ComponentFactoryResolver)) {
foundLocal = true;
// access providers
}
else if (this._getOrCreateLocalProvider(dep.token, eager) != null) {
foundLocal = true;
}
}
var /** @type {?} */ result = dep;
if (dep.isSelf && !foundLocal) {
if (dep.isOptional) {
result = { isValue: true, value: null };
}
else {
this._errors.push(new ProviderError("No provider for " + tokenName((/** @type {?} */ ((dep.token)))), requestorSourceSpan));
}
}
return result;
};
return NgModuleProviderAnalyzer;
}());
/**
* @param {?} provider
* @param {?} __1
* @return {?}
*/
function _transformProvider(provider, _a) {
var useExisting = _a.useExisting, useValue = _a.useValue, deps = _a.deps;
return {
token: provider.token,
useClass: provider.useClass,
useExisting: useExisting,
useFactory: provider.useFactory,
useValue: useValue,
deps: deps,
multi: provider.multi
};
}
/**
* @param {?} provider
* @param {?} __1
* @return {?}
*/
function _transformProviderAst(provider, _a) {
var eager = _a.eager, providers = _a.providers;
return new ProviderAst(provider.token, provider.multiProvider, provider.eager || eager, providers, provider.providerType, provider.lifecycleHooks, provider.sourceSpan);
}
/**
* @param {?} directives
* @param {?} sourceSpan
* @param {?} targetErrors
* @return {?}
*/
function _resolveProvidersFromDirectives(directives, sourceSpan, targetErrors) {
var /** @type {?} */ providersByToken = new Map();
directives.forEach(function (directive) {
var /** @type {?} */ dirProvider = { token: { identifier: directive.type }, useClass: directive.type };
_resolveProviders([dirProvider], directive.isComponent ? ProviderAstType.Component : ProviderAstType.Directive, true, sourceSpan, targetErrors, providersByToken);
});
// Note: directives need to be able to overwrite providers of a component!
var /** @type {?} */ directivesWithComponentFirst = directives.filter(function (dir) { return dir.isComponent; }).concat(directives.filter(function (dir) { return !dir.isComponent; }));
directivesWithComponentFirst.forEach(function (directive) {
_resolveProviders(directive.providers, ProviderAstType.PublicService, false, sourceSpan, targetErrors, providersByToken);
_resolveProviders(directive.viewProviders, ProviderAstType.PrivateService, false, sourceSpan, targetErrors, providersByToken);
});
return providersByToken;
}
/**
* @param {?} providers
* @param {?} providerType
* @param {?} eager
* @param {?} sourceSpan
* @param {?} targetErrors
* @param {?} targetProvidersByToken
* @return {?}
*/
function _resolveProviders(providers, providerType, eager, sourceSpan, targetErrors, targetProvidersByToken) {
providers.forEach(function (provider) {
var /** @type {?} */ resolvedProvider = targetProvidersByToken.get(tokenReference(provider.token));
if (resolvedProvider != null && !!resolvedProvider.multiProvider !== !!provider.multi) {
targetErrors.push(new ProviderError("Mixing multi and non multi provider is not possible for token " + tokenName(resolvedProvider.token), sourceSpan));
}
if (!resolvedProvider) {
var /** @type {?} */ lifecycleHooks = provider.token.identifier &&
(/** @type {?} */ (provider.token.identifier)).lifecycleHooks ?
(/** @type {?} */ (provider.token.identifier)).lifecycleHooks :
[];
var /** @type {?} */ isUseValue = !(provider.useClass || provider.useExisting || provider.useFactory);
resolvedProvider = new ProviderAst(provider.token, !!provider.multi, eager || isUseValue, [provider], providerType, lifecycleHooks, sourceSpan);
targetProvidersByToken.set(tokenReference(provider.token), resolvedProvider);
}
else {
if (!provider.multi) {
resolvedProvider.providers.length = 0;
}
resolvedProvider.providers.push(provider);
}
});
}
/**
* @param {?} component
* @return {?}
*/
function _getViewQueries(component) {
// Note: queries start with id 1 so we can use the number in a Bloom filter!
var /** @type {?} */ viewQueryId = 1;
var /** @type {?} */ viewQueries = new Map();
if (component.viewQueries) {
component.viewQueries.forEach(function (query) { return _addQueryToTokenMap(viewQueries, { meta: query, queryId: viewQueryId++ }); });
}
return viewQueries;
}
/**
* @param {?} contentQueryStartId
* @param {?} directives
* @return {?}
*/
function _getContentQueries(contentQueryStartId, directives) {
var /** @type {?} */ contentQueryId = contentQueryStartId;
var /** @type {?} */ contentQueries = new Map();
directives.forEach(function (directive, directiveIndex) {
if (directive.queries) {
directive.queries.forEach(function (query) { return _addQueryToTokenMap(contentQueries, { meta: query, queryId: contentQueryId++ }); });
}
});
return contentQueries;
}
/**
* @param {?} map
* @param {?} query
* @return {?}
*/
function _addQueryToTokenMap(map, query) {
query.meta.selectors.forEach(function (token) {
var /** @type {?} */ entry = map.get(tokenReference(token));
if (!entry) {
entry = [];
map.set(tokenReference(token), entry);
}
entry.push(query);
});
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var QUOTED_KEYS = '$quoted$';
/**
* @param {?} ctx
* @param {?} value
* @param {?=} type
* @return {?}
*/
function convertValueToOutputAst(ctx, value, type) {
if (type === void 0) { type = null; }
return visitValue(value, new _ValueOutputAstTransformer(ctx), type);
}
var _ValueOutputAstTransformer = (function () {
function _ValueOutputAstTransformer(ctx) {
this.ctx = ctx;
}
/**
* @param {?} arr
* @param {?} type
* @return {?}
*/
_ValueOutputAstTransformer.prototype.visitArray = /**
* @param {?} arr
* @param {?} type
* @return {?}
*/
function (arr, type) {
var _this = this;
return literalArr(arr.map(function (value) { return visitValue(value, _this, null); }), type);
};
/**
* @param {?} map
* @param {?} type
* @return {?}
*/
_ValueOutputAstTransformer.prototype.visitStringMap = /**
* @param {?} map
* @param {?} type
* @return {?}
*/
function (map, type) {
var _this = this;
var /** @type {?} */ entries = [];
var /** @type {?} */ quotedSet = new Set(map && map[QUOTED_KEYS]);
Object.keys(map).forEach(function (key) {
entries.push(new LiteralMapEntry(key, visitValue(map[key], _this, null), quotedSet.has(key)));
});
return new LiteralMapExpr(entries, type);
};
/**
* @param {?} value
* @param {?} type
* @return {?}
*/
_ValueOutputAstTransformer.prototype.visitPrimitive = /**
* @param {?} value
* @param {?} type
* @return {?}
*/
function (value, type) { return literal(value, type); };
/**
* @param {?} value
* @param {?} type
* @return {?}
*/
_ValueOutputAstTransformer.prototype.visitOther = /**
* @param {?} value
* @param {?} type
* @return {?}
*/
function (value, type) {
if (value instanceof Expression) {
return value;
}
else {
return this.ctx.importExpr(value);
}
};
return _ValueOutputAstTransformer;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @param {?} ctx
* @param {?} providerAst
* @return {?}
*/
function providerDef(ctx, providerAst) {
var /** @type {?} */ flags = 0;
if (!providerAst.eager) {
flags |= 4096 /* LazyProvider */;
}
if (providerAst.providerType === ProviderAstType.PrivateService) {
flags |= 8192 /* PrivateProvider */;
}
providerAst.lifecycleHooks.forEach(function (lifecycleHook) {
// for regular providers, we only support ngOnDestroy
if (lifecycleHook === LifecycleHooks.OnDestroy ||
providerAst.providerType === ProviderAstType.Directive ||
providerAst.providerType === ProviderAstType.Component) {
flags |= lifecycleHookToNodeFlag(lifecycleHook);
}
});
var _a = providerAst.multiProvider ?
multiProviderDef(ctx, flags, providerAst.providers) :
singleProviderDef(ctx, flags, providerAst.providerType, providerAst.providers[0]), providerExpr = _a.providerExpr, providerFlags = _a.flags, depsExpr = _a.depsExpr;
return {
providerExpr: providerExpr,
flags: providerFlags, depsExpr: depsExpr,
tokenExpr: tokenExpr(ctx, providerAst.token),
};
}
/**
* @param {?} ctx
* @param {?} flags
* @param {?} providers
* @return {?}
*/
function multiProviderDef(ctx, flags, providers) {
var /** @type {?} */ allDepDefs = [];
var /** @type {?} */ allParams = [];
var /** @type {?} */ exprs = providers.map(function (provider, providerIndex) {
var /** @type {?} */ expr;
if (provider.useClass) {
var /** @type {?} */ depExprs = convertDeps(providerIndex, provider.deps || provider.useClass.diDeps);
expr = ctx.importExpr(provider.useClass.reference).instantiate(depExprs);
}
else if (provider.useFactory) {
var /** @type {?} */ depExprs = convertDeps(providerIndex, provider.deps || provider.useFactory.diDeps);
expr = ctx.importExpr(provider.useFactory.reference).callFn(depExprs);
}
else if (provider.useExisting) {
var /** @type {?} */ depExprs = convertDeps(providerIndex, [{ token: provider.useExisting }]);
expr = depExprs[0];
}
else {
expr = convertValueToOutputAst(ctx, provider.useValue);
}
return expr;
});
var /** @type {?} */ providerExpr = fn(allParams, [new ReturnStatement(literalArr(exprs))], INFERRED_TYPE);
return {
providerExpr: providerExpr,
flags: flags | 1024 /* TypeFactoryProvider */,
depsExpr: literalArr(allDepDefs)
};
/**
* @param {?} providerIndex
* @param {?} deps
* @return {?}
*/
function convertDeps(providerIndex, deps) {
return deps.map(function (dep, depIndex) {
var /** @type {?} */ paramName = "p" + providerIndex + "_" + depIndex;
allParams.push(new FnParam(paramName, DYNAMIC_TYPE));
allDepDefs.push(depDef(ctx, dep));
return variable(paramName);
});
}
}
/**
* @param {?} ctx
* @param {?} flags
* @param {?} providerType
* @param {?} providerMeta
* @return {?}
*/
function singleProviderDef(ctx, flags, providerType, providerMeta) {
var /** @type {?} */ providerExpr;
var /** @type {?} */ deps;
if (providerType === ProviderAstType.Directive || providerType === ProviderAstType.Component) {
providerExpr = ctx.importExpr(/** @type {?} */ ((providerMeta.useClass)).reference);
flags |= 16384 /* TypeDirective */;
deps = providerMeta.deps || /** @type {?} */ ((providerMeta.useClass)).diDeps;
}
else {
if (providerMeta.useClass) {
providerExpr = ctx.importExpr(providerMeta.useClass.reference);
flags |= 512 /* TypeClassProvider */;
deps = providerMeta.deps || providerMeta.useClass.diDeps;
}
else if (providerMeta.useFactory) {
providerExpr = ctx.importExpr(providerMeta.useFactory.reference);
flags |= 1024 /* TypeFactoryProvider */;
deps = providerMeta.deps || providerMeta.useFactory.diDeps;
}
else if (providerMeta.useExisting) {
providerExpr = NULL_EXPR;
flags |= 2048 /* TypeUseExistingProvider */;
deps = [{ token: providerMeta.useExisting }];
}
else {
providerExpr = convertValueToOutputAst(ctx, providerMeta.useValue);
flags |= 256 /* TypeValueProvider */;
deps = [];
}
}
var /** @type {?} */ depsExpr = literalArr(deps.map(function (dep) { return depDef(ctx, dep); }));
return { providerExpr: providerExpr, flags: flags, depsExpr: depsExpr };
}
/**
* @param {?} ctx
* @param {?} tokenMeta
* @return {?}
*/
function tokenExpr(ctx, tokenMeta) {
return tokenMeta.identifier ? ctx.importExpr(tokenMeta.identifier.reference) :
literal(tokenMeta.value);
}
/**
* @param {?} ctx
* @param {?} dep
* @return {?}
*/
function depDef(ctx, dep) {
// Note: the following fields have already been normalized out by provider_analyzer:
// - isAttribute, isSelf, isHost
var /** @type {?} */ expr = dep.isValue ? convertValueToOutputAst(ctx, dep.value) : tokenExpr(ctx, /** @type {?} */ ((dep.token)));
var /** @type {?} */ flags = 0;
if (dep.isSkipSelf) {
flags |= 1 /* SkipSelf */;
}
if (dep.isOptional) {
flags |= 2 /* Optional */;
}
if (dep.isValue) {
flags |= 8 /* Value */;
}
return flags === 0 /* None */ ? expr : literalArr([literal(flags), expr]);
}
/**
* @param {?} lifecycleHook
* @return {?}
*/
function lifecycleHookToNodeFlag(lifecycleHook) {
var /** @type {?} */ nodeFlag = 0;
switch (lifecycleHook) {
case LifecycleHooks.AfterContentChecked:
nodeFlag = 2097152 /* AfterContentChecked */;
break;
case LifecycleHooks.AfterContentInit:
nodeFlag = 1048576 /* AfterContentInit */;
break;
case LifecycleHooks.AfterViewChecked:
nodeFlag = 8388608 /* AfterViewChecked */;
break;
case LifecycleHooks.AfterViewInit:
nodeFlag = 4194304 /* AfterViewInit */;
break;
case LifecycleHooks.DoCheck:
nodeFlag = 262144 /* DoCheck */;
break;
case LifecycleHooks.OnChanges:
nodeFlag = 524288 /* OnChanges */;
break;
case LifecycleHooks.OnDestroy:
nodeFlag = 131072 /* OnDestroy */;
break;
case LifecycleHooks.OnInit:
nodeFlag = 65536 /* OnInit */;
break;
}
return nodeFlag;
}
/**
* @param {?} reflector
* @param {?} ctx
* @param {?} flags
* @param {?} entryComponents
* @return {?}
*/
function componentFactoryResolverProviderDef(reflector, ctx, flags, entryComponents) {
var /** @type {?} */ entryComponentFactories = entryComponents.map(function (entryComponent) { return ctx.importExpr(entryComponent.componentFactory); });
var /** @type {?} */ token = createTokenForExternalReference(reflector, Identifiers.ComponentFactoryResolver);
var /** @type {?} */ classMeta = {
diDeps: [
{ isValue: true, value: literalArr(entryComponentFactories) },
{ token: token, isSkipSelf: true, isOptional: true },
{ token: createTokenForExternalReference(reflector, Identifiers.NgModuleRef) },
],
lifecycleHooks: [],
reference: reflector.resolveExternalReference(Identifiers.CodegenComponentFactoryResolver)
};
var _a = singleProviderDef(ctx, flags, ProviderAstType.PrivateService, {
token: token,
multi: false,
useClass: classMeta,
}), providerExpr = _a.providerExpr, providerFlags = _a.flags, depsExpr = _a.depsExpr;
return { providerExpr: providerExpr, flags: providerFlags, depsExpr: depsExpr, tokenExpr: tokenExpr(ctx, token) };
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var NgModuleCompileResult = (function () {
function NgModuleCompileResult(ngModuleFactoryVar) {
this.ngModuleFactoryVar = ngModuleFactoryVar;
}
return NgModuleCompileResult;
}());
var LOG_VAR = variable('_l');
var NgModuleCompiler = (function () {
function NgModuleCompiler(reflector) {
this.reflector = reflector;
}
/**
* @param {?} ctx
* @param {?} ngModuleMeta
* @param {?} extraProviders
* @return {?}
*/
NgModuleCompiler.prototype.compile = /**
* @param {?} ctx
* @param {?} ngModuleMeta
* @param {?} extraProviders
* @return {?}
*/
function (ctx, ngModuleMeta, extraProviders) {
var /** @type {?} */ sourceSpan = typeSourceSpan('NgModule', ngModuleMeta.type);
var /** @type {?} */ entryComponentFactories = ngModuleMeta.transitiveModule.entryComponents;
var /** @type {?} */ bootstrapComponents = ngModuleMeta.bootstrapComponents;
var /** @type {?} */ providerParser = new NgModuleProviderAnalyzer(this.reflector, ngModuleMeta, extraProviders, sourceSpan);
var /** @type {?} */ providerDefs = [componentFactoryResolverProviderDef(this.reflector, ctx, 0 /* None */, entryComponentFactories)]
.concat(providerParser.parse().map(function (provider) { return providerDef(ctx, provider); }))
.map(function (_a) {
var providerExpr = _a.providerExpr, depsExpr = _a.depsExpr, flags = _a.flags, tokenExpr = _a.tokenExpr;
return importExpr(Identifiers.moduleProviderDef).callFn([
literal(flags), tokenExpr, providerExpr, depsExpr
]);
});
var /** @type {?} */ ngModuleDef = importExpr(Identifiers.moduleDef).callFn([literalArr(providerDefs)]);
var /** @type {?} */ ngModuleDefFactory = fn([new FnParam(/** @type {?} */ ((LOG_VAR.name)))], [new ReturnStatement(ngModuleDef)], INFERRED_TYPE);
var /** @type {?} */ ngModuleFactoryVar = identifierName(ngModuleMeta.type) + "NgFactory";
this._createNgModuleFactory(ctx, ngModuleMeta.type.reference, importExpr(Identifiers.createModuleFactory).callFn([
ctx.importExpr(ngModuleMeta.type.reference),
literalArr(bootstrapComponents.map(function (id) { return ctx.importExpr(id.reference); })),
ngModuleDefFactory
]));
if (ngModuleMeta.id) {
var /** @type {?} */ registerFactoryStmt = importExpr(Identifiers.RegisterModuleFactoryFn)
.callFn([literal(ngModuleMeta.id), variable(ngModuleFactoryVar)])
.toStmt();
ctx.statements.push(registerFactoryStmt);
}
return new NgModuleCompileResult(ngModuleFactoryVar);
};
/**
* @param {?} ctx
* @param {?} ngModuleReference
* @return {?}
*/
NgModuleCompiler.prototype.createStub = /**
* @param {?} ctx
* @param {?} ngModuleReference
* @return {?}
*/
function (ctx, ngModuleReference) {
this._createNgModuleFactory(ctx, ngModuleReference, NULL_EXPR);
};
/**
* @param {?} ctx
* @param {?} reference
* @param {?} value
* @return {?}
*/
NgModuleCompiler.prototype._createNgModuleFactory = /**
* @param {?} ctx
* @param {?} reference
* @param {?} value
* @return {?}
*/
function (ctx, reference, value) {
var /** @type {?} */ ngModuleFactoryVar = identifierName({ reference: reference }) + "NgFactory";
var /** @type {?} */ ngModuleFactoryStmt = variable(ngModuleFactoryVar)
.set(value)
.toDeclStmt(importType(Identifiers.NgModuleFactory, [/** @type {?} */ ((expressionType(ctx.importExpr(reference))))], [TypeModifier.Const]), [StmtModifier.Final, StmtModifier.Exported]);
ctx.statements.push(ngModuleFactoryStmt);
};
return NgModuleCompiler;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Resolves types to {\@link NgModule}.
*/
var NgModuleResolver = (function () {
function NgModuleResolver(_reflector) {
this._reflector = _reflector;
}
/**
* @param {?} type
* @return {?}
*/
NgModuleResolver.prototype.isNgModule = /**
* @param {?} type
* @return {?}
*/
function (type) { return this._reflector.annotations(type).some(createNgModule.isTypeOf); };
/**
* @param {?} type
* @param {?=} throwIfNotFound
* @return {?}
*/
NgModuleResolver.prototype.resolve = /**
* @param {?} type
* @param {?=} throwIfNotFound
* @return {?}
*/
function (type, throwIfNotFound) {
if (throwIfNotFound === void 0) { throwIfNotFound = true; }
var /** @type {?} */ ngModuleMeta = findLast(this._reflector.annotations(type), createNgModule.isTypeOf);
if (ngModuleMeta) {
return ngModuleMeta;
}
else {
if (throwIfNotFound) {
throw new Error("No NgModule metadata found for '" + stringify(type) + "'.");
}
return null;
}
};
return NgModuleResolver;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit
var VERSION$1 = 3;
var JS_B64_PREFIX = '# sourceMappingURL=data:application/json;base64,';
var SourceMapGenerator = (function () {
function SourceMapGenerator(file) {
if (file === void 0) { file = null; }
this.file = file;
this.sourcesContent = new Map();
this.lines = [];
this.lastCol0 = 0;
this.hasMappings = false;
}
// The content is `null` when the content is expected to be loaded using the URL
/**
* @param {?} url
* @param {?=} content
* @return {?}
*/
SourceMapGenerator.prototype.addSource = /**
* @param {?} url
* @param {?=} content
* @return {?}
*/
function (url, content) {
if (content === void 0) { content = null; }
if (!this.sourcesContent.has(url)) {
this.sourcesContent.set(url, content);
}
return this;
};
/**
* @return {?}
*/
SourceMapGenerator.prototype.addLine = /**
* @return {?}
*/
function () {
this.lines.push([]);
this.lastCol0 = 0;
return this;
};
/**
* @param {?} col0
* @param {?=} sourceUrl
* @param {?=} sourceLine0
* @param {?=} sourceCol0
* @return {?}
*/
SourceMapGenerator.prototype.addMapping = /**
* @param {?} col0
* @param {?=} sourceUrl
* @param {?=} sourceLine0
* @param {?=} sourceCol0
* @return {?}
*/
function (col0, sourceUrl, sourceLine0, sourceCol0) {
if (!this.currentLine) {
throw new Error("A line must be added before mappings can be added");
}
if (sourceUrl != null && !this.sourcesContent.has(sourceUrl)) {
throw new Error("Unknown source file \"" + sourceUrl + "\"");
}
if (col0 == null) {
throw new Error("The column in the generated code must be provided");
}
if (col0 < this.lastCol0) {
throw new Error("Mapping should be added in output order");
}
if (sourceUrl && (sourceLine0 == null || sourceCol0 == null)) {
throw new Error("The source location must be provided when a source url is provided");
}
this.hasMappings = true;
this.lastCol0 = col0;
this.currentLine.push({ col0: col0, sourceUrl: sourceUrl, sourceLine0: sourceLine0, sourceCol0: sourceCol0 });
return this;
};
Object.defineProperty(SourceMapGenerator.prototype, "currentLine", {
get: /**
* @return {?}
*/
function () { return this.lines.slice(-1)[0]; },
enumerable: true,
configurable: true
});
/**
* @return {?}
*/
SourceMapGenerator.prototype.toJSON = /**
* @return {?}
*/
function () {
var _this = this;
if (!this.hasMappings) {
return null;
}
var /** @type {?} */ sourcesIndex = new Map();
var /** @type {?} */ sources = [];
var /** @type {?} */ sourcesContent = [];
Array.from(this.sourcesContent.keys()).forEach(function (url, i) {
sourcesIndex.set(url, i);
sources.push(url);
sourcesContent.push(_this.sourcesContent.get(url) || null);
});
var /** @type {?} */ mappings = '';
var /** @type {?} */ lastCol0 = 0;
var /** @type {?} */ lastSourceIndex = 0;
var /** @type {?} */ lastSourceLine0 = 0;
var /** @type {?} */ lastSourceCol0 = 0;
this.lines.forEach(function (segments) {
lastCol0 = 0;
mappings += segments
.map(function (segment) {
// zero-based starting column of the line in the generated code
var /** @type {?} */ segAsStr = toBase64VLQ(segment.col0 - lastCol0);
lastCol0 = segment.col0;
if (segment.sourceUrl != null) {
// zero-based index into the “sources” list
segAsStr +=
toBase64VLQ(/** @type {?} */ ((sourcesIndex.get(segment.sourceUrl))) - lastSourceIndex);
lastSourceIndex = /** @type {?} */ ((sourcesIndex.get(segment.sourceUrl)));
// the zero-based starting line in the original source
segAsStr += toBase64VLQ(/** @type {?} */ ((segment.sourceLine0)) - lastSourceLine0);
lastSourceLine0 = /** @type {?} */ ((segment.sourceLine0));
// the zero-based starting column in the original source
segAsStr += toBase64VLQ(/** @type {?} */ ((segment.sourceCol0)) - lastSourceCol0);
lastSourceCol0 = /** @type {?} */ ((segment.sourceCol0));
}
return segAsStr;
})
.join(',');
mappings += ';';
});
mappings = mappings.slice(0, -1);
return {
'file': this.file || '',
'version': VERSION$1,
'sourceRoot': '',
'sources': sources,
'sourcesContent': sourcesContent,
'mappings': mappings,
};
};
/**
* @return {?}
*/
SourceMapGenerator.prototype.toJsComment = /**
* @return {?}
*/
function () {
return this.hasMappings ? '//' + JS_B64_PREFIX + toBase64String(JSON.stringify(this, null, 0)) :
'';
};
return SourceMapGenerator;
}());
/**
* @param {?} value
* @return {?}
*/
function toBase64String(value) {
var /** @type {?} */ b64 = '';
value = utf8Encode(value);
for (var /** @type {?} */ i = 0; i < value.length;) {
var /** @type {?} */ i1 = value.charCodeAt(i++);
var /** @type {?} */ i2 = value.charCodeAt(i++);
var /** @type {?} */ i3 = value.charCodeAt(i++);
b64 += toBase64Digit(i1 >> 2);
b64 += toBase64Digit(((i1 & 3) << 4) | (isNaN(i2) ? 0 : i2 >> 4));
b64 += isNaN(i2) ? '=' : toBase64Digit(((i2 & 15) << 2) | (i3 >> 6));
b64 += isNaN(i2) || isNaN(i3) ? '=' : toBase64Digit(i3 & 63);
}
return b64;
}
/**
* @param {?} value
* @return {?}
*/
function toBase64VLQ(value) {
value = value < 0 ? ((-value) << 1) + 1 : value << 1;
var /** @type {?} */ out = '';
do {
var /** @type {?} */ digit = value & 31;
value = value >> 5;
if (value > 0) {
digit = digit | 32;
}
out += toBase64Digit(digit);
} while (value > 0);
return out;
}
var B64_DIGITS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
/**
* @param {?} value
* @return {?}
*/
function toBase64Digit(value) {
if (value < 0 || value >= 64) {
throw new Error("Can only encode value in the range [0, 63]");
}
return B64_DIGITS[value];
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var _SINGLE_QUOTE_ESCAPE_STRING_RE = /'|\\|\n|\r|\$/g;
var _LEGAL_IDENTIFIER_RE = /^[$A-Z_][0-9A-Z_$]*$/i;
var _INDENT_WITH = ' ';
var CATCH_ERROR_VAR$1 = variable('error', null, null);
var CATCH_STACK_VAR$1 = variable('stack', null, null);
/**
* @record
*/
var _EmittedLine = (function () {
function _EmittedLine(indent) {
this.indent = indent;
this.partsLength = 0;
this.parts = [];
this.srcSpans = [];
}
return _EmittedLine;
}());
var EmitterVisitorContext = (function () {
function EmitterVisitorContext(_indent) {
this._indent = _indent;
this._classes = [];
this._preambleLineCount = 0;
this._lines = [new _EmittedLine(_indent)];
}
/**
* @return {?}
*/
EmitterVisitorContext.createRoot = /**
* @return {?}
*/
function () { return new EmitterVisitorContext(0); };
Object.defineProperty(EmitterVisitorContext.prototype, "_currentLine", {
get: /**
* @return {?}
*/
function () { return this._lines[this._lines.length - 1]; },
enumerable: true,
configurable: true
});
/**
* @param {?=} from
* @param {?=} lastPart
* @return {?}
*/
EmitterVisitorContext.prototype.println = /**
* @param {?=} from
* @param {?=} lastPart
* @return {?}
*/
function (from, lastPart) {
if (lastPart === void 0) { lastPart = ''; }
this.print(from || null, lastPart, true);
};
/**
* @return {?}
*/
EmitterVisitorContext.prototype.lineIsEmpty = /**
* @return {?}
*/
function () { return this._currentLine.parts.length === 0; };
/**
* @return {?}
*/
EmitterVisitorContext.prototype.lineLength = /**
* @return {?}
*/
function () {
return this._currentLine.indent * _INDENT_WITH.length + this._currentLine.partsLength;
};
/**
* @param {?} from
* @param {?} part
* @param {?=} newLine
* @return {?}
*/
EmitterVisitorContext.prototype.print = /**
* @param {?} from
* @param {?} part
* @param {?=} newLine
* @return {?}
*/
function (from, part, newLine) {
if (newLine === void 0) { newLine = false; }
if (part.length > 0) {
this._currentLine.parts.push(part);
this._currentLine.partsLength += part.length;
this._currentLine.srcSpans.push(from && from.sourceSpan || null);
}
if (newLine) {
this._lines.push(new _EmittedLine(this._indent));
}
};
/**
* @return {?}
*/
EmitterVisitorContext.prototype.removeEmptyLastLine = /**
* @return {?}
*/
function () {
if (this.lineIsEmpty()) {
this._lines.pop();
}
};
/**
* @return {?}
*/
EmitterVisitorContext.prototype.incIndent = /**
* @return {?}
*/
function () {
this._indent++;
if (this.lineIsEmpty()) {
this._currentLine.indent = this._indent;
}
};
/**
* @return {?}
*/
EmitterVisitorContext.prototype.decIndent = /**
* @return {?}
*/
function () {
this._indent--;
if (this.lineIsEmpty()) {
this._currentLine.indent = this._indent;
}
};
/**
* @param {?} clazz
* @return {?}
*/
EmitterVisitorContext.prototype.pushClass = /**
* @param {?} clazz
* @return {?}
*/
function (clazz) { this._classes.push(clazz); };
/**
* @return {?}
*/
EmitterVisitorContext.prototype.popClass = /**
* @return {?}
*/
function () { return /** @type {?} */ ((this._classes.pop())); };
Object.defineProperty(EmitterVisitorContext.prototype, "currentClass", {
get: /**
* @return {?}
*/
function () {
return this._classes.length > 0 ? this._classes[this._classes.length - 1] : null;
},
enumerable: true,
configurable: true
});
/**
* @return {?}
*/
EmitterVisitorContext.prototype.toSource = /**
* @return {?}
*/
function () {
return this.sourceLines
.map(function (l) { return l.parts.length > 0 ? _createIndent(l.indent) + l.parts.join('') : ''; })
.join('\n');
};
/**
* @param {?} genFilePath
* @param {?=} startsAtLine
* @return {?}
*/
EmitterVisitorContext.prototype.toSourceMapGenerator = /**
* @param {?} genFilePath
* @param {?=} startsAtLine
* @return {?}
*/
function (genFilePath, startsAtLine) {
if (startsAtLine === void 0) { startsAtLine = 0; }
var /** @type {?} */ map = new SourceMapGenerator(genFilePath);
var /** @type {?} */ firstOffsetMapped = false;
var /** @type {?} */ mapFirstOffsetIfNeeded = function () {
if (!firstOffsetMapped) {
// Add a single space so that tools won't try to load the file from disk.
// Note: We are using virtual urls like `ng:///`, so we have to
// provide a content here.
map.addSource(genFilePath, ' ').addMapping(0, genFilePath, 0, 0);
firstOffsetMapped = true;
}
};
for (var /** @type {?} */ i = 0; i < startsAtLine; i++) {
map.addLine();
mapFirstOffsetIfNeeded();
}
this.sourceLines.forEach(function (line, lineIdx) {
map.addLine();
var /** @type {?} */ spans = line.srcSpans;
var /** @type {?} */ parts = line.parts;
var /** @type {?} */ col0 = line.indent * _INDENT_WITH.length;
var /** @type {?} */ spanIdx = 0;
// skip leading parts without source spans
while (spanIdx < spans.length && !spans[spanIdx]) {
col0 += parts[spanIdx].length;
spanIdx++;
}
if (spanIdx < spans.length && lineIdx === 0 && col0 === 0) {
firstOffsetMapped = true;
}
else {
mapFirstOffsetIfNeeded();
}
while (spanIdx < spans.length) {
var /** @type {?} */ span = /** @type {?} */ ((spans[spanIdx]));
var /** @type {?} */ source = span.start.file;
var /** @type {?} */ sourceLine = span.start.line;
var /** @type {?} */ sourceCol = span.start.col;
map.addSource(source.url, source.content)
.addMapping(col0, source.url, sourceLine, sourceCol);
col0 += parts[spanIdx].length;
spanIdx++;
// assign parts without span or the same span to the previous segment
while (spanIdx < spans.length && (span === spans[spanIdx] || !spans[spanIdx])) {
col0 += parts[spanIdx].length;
spanIdx++;
}
}
});
return map;
};
/**
* @param {?} count
* @return {?}
*/
EmitterVisitorContext.prototype.setPreambleLineCount = /**
* @param {?} count
* @return {?}
*/
function (count) { return this._preambleLineCount = count; };
/**
* @param {?} line
* @param {?} column
* @return {?}
*/
EmitterVisitorContext.prototype.spanOf = /**
* @param {?} line
* @param {?} column
* @return {?}
*/
function (line, column) {
var /** @type {?} */ emittedLine = this._lines[line - this._preambleLineCount];
if (emittedLine) {
var /** @type {?} */ columnsLeft = column - _createIndent(emittedLine.indent).length;
for (var /** @type {?} */ partIndex = 0; partIndex < emittedLine.parts.length; partIndex++) {
var /** @type {?} */ part = emittedLine.parts[partIndex];
if (part.length > columnsLeft) {
return emittedLine.srcSpans[partIndex];
}
columnsLeft -= part.length;
}
}
return null;
};
Object.defineProperty(EmitterVisitorContext.prototype, "sourceLines", {
get: /**
* @return {?}
*/
function () {
if (this._lines.length && this._lines[this._lines.length - 1].parts.length === 0) {
return this._lines.slice(0, -1);
}
return this._lines;
},
enumerable: true,
configurable: true
});
return EmitterVisitorContext;
}());
/**
* @abstract
*/
var AbstractEmitterVisitor = (function () {
function AbstractEmitterVisitor(_escapeDollarInStrings) {
this._escapeDollarInStrings = _escapeDollarInStrings;
}
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
AbstractEmitterVisitor.prototype.visitExpressionStmt = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
stmt.expr.visitExpression(this, ctx);
ctx.println(stmt, ';');
return null;
};
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
AbstractEmitterVisitor.prototype.visitReturnStmt = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
ctx.print(stmt, "return ");
stmt.value.visitExpression(this, ctx);
ctx.println(stmt, ';');
return null;
};
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
AbstractEmitterVisitor.prototype.visitIfStmt = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
ctx.print(stmt, "if (");
stmt.condition.visitExpression(this, ctx);
ctx.print(stmt, ") {");
var /** @type {?} */ hasElseCase = stmt.falseCase != null && stmt.falseCase.length > 0;
if (stmt.trueCase.length <= 1 && !hasElseCase) {
ctx.print(stmt, " ");
this.visitAllStatements(stmt.trueCase, ctx);
ctx.removeEmptyLastLine();
ctx.print(stmt, " ");
}
else {
ctx.println();
ctx.incIndent();
this.visitAllStatements(stmt.trueCase, ctx);
ctx.decIndent();
if (hasElseCase) {
ctx.println(stmt, "} else {");
ctx.incIndent();
this.visitAllStatements(stmt.falseCase, ctx);
ctx.decIndent();
}
}
ctx.println(stmt, "}");
return null;
};
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
AbstractEmitterVisitor.prototype.visitThrowStmt = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
ctx.print(stmt, "throw ");
stmt.error.visitExpression(this, ctx);
ctx.println(stmt, ";");
return null;
};
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
AbstractEmitterVisitor.prototype.visitCommentStmt = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
var /** @type {?} */ lines = stmt.comment.split('\n');
lines.forEach(function (line) { ctx.println(stmt, "// " + line); });
return null;
};
/**
* @param {?} expr
* @param {?} ctx
* @return {?}
*/
AbstractEmitterVisitor.prototype.visitWriteVarExpr = /**
* @param {?} expr
* @param {?} ctx
* @return {?}
*/
function (expr, ctx) {
var /** @type {?} */ lineWasEmpty = ctx.lineIsEmpty();
if (!lineWasEmpty) {
ctx.print(expr, '(');
}
ctx.print(expr, expr.name + " = ");
expr.value.visitExpression(this, ctx);
if (!lineWasEmpty) {
ctx.print(expr, ')');
}
return null;
};
/**
* @param {?} expr
* @param {?} ctx
* @return {?}
*/
AbstractEmitterVisitor.prototype.visitWriteKeyExpr = /**
* @param {?} expr
* @param {?} ctx
* @return {?}
*/
function (expr, ctx) {
var /** @type {?} */ lineWasEmpty = ctx.lineIsEmpty();
if (!lineWasEmpty) {
ctx.print(expr, '(');
}
expr.receiver.visitExpression(this, ctx);
ctx.print(expr, "[");
expr.index.visitExpression(this, ctx);
ctx.print(expr, "] = ");
expr.value.visitExpression(this, ctx);
if (!lineWasEmpty) {
ctx.print(expr, ')');
}
return null;
};
/**
* @param {?} expr
* @param {?} ctx
* @return {?}
*/
AbstractEmitterVisitor.prototype.visitWritePropExpr = /**
* @param {?} expr
* @param {?} ctx
* @return {?}
*/
function (expr, ctx) {
var /** @type {?} */ lineWasEmpty = ctx.lineIsEmpty();
if (!lineWasEmpty) {
ctx.print(expr, '(');
}
expr.receiver.visitExpression(this, ctx);
ctx.print(expr, "." + expr.name + " = ");
expr.value.visitExpression(this, ctx);
if (!lineWasEmpty) {
ctx.print(expr, ')');
}
return null;
};
/**
* @param {?} expr
* @param {?} ctx
* @return {?}
*/
AbstractEmitterVisitor.prototype.visitInvokeMethodExpr = /**
* @param {?} expr
* @param {?} ctx
* @return {?}
*/
function (expr, ctx) {
expr.receiver.visitExpression(this, ctx);
var /** @type {?} */ name = expr.name;
if (expr.builtin != null) {
name = this.getBuiltinMethodName(expr.builtin);
if (name == null) {
// some builtins just mean to skip the call.
return null;
}
}
ctx.print(expr, "." + name + "(");
this.visitAllExpressions(expr.args, ctx, ",");
ctx.print(expr, ")");
return null;
};
/**
* @param {?} expr
* @param {?} ctx
* @return {?}
*/
AbstractEmitterVisitor.prototype.visitInvokeFunctionExpr = /**
* @param {?} expr
* @param {?} ctx
* @return {?}
*/
function (expr, ctx) {
expr.fn.visitExpression(this, ctx);
ctx.print(expr, "(");
this.visitAllExpressions(expr.args, ctx, ',');
ctx.print(expr, ")");
return null;
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
AbstractEmitterVisitor.prototype.visitReadVarExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
var /** @type {?} */ varName = /** @type {?} */ ((ast.name));
if (ast.builtin != null) {
switch (ast.builtin) {
case BuiltinVar.Super:
varName = 'super';
break;
case BuiltinVar.This:
varName = 'this';
break;
case BuiltinVar.CatchError:
varName = /** @type {?} */ ((CATCH_ERROR_VAR$1.name));
break;
case BuiltinVar.CatchStack:
varName = /** @type {?} */ ((CATCH_STACK_VAR$1.name));
break;
default:
throw new Error("Unknown builtin variable " + ast.builtin);
}
}
ctx.print(ast, varName);
return null;
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
AbstractEmitterVisitor.prototype.visitInstantiateExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
ctx.print(ast, "new ");
ast.classExpr.visitExpression(this, ctx);
ctx.print(ast, "(");
this.visitAllExpressions(ast.args, ctx, ',');
ctx.print(ast, ")");
return null;
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
AbstractEmitterVisitor.prototype.visitLiteralExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
var /** @type {?} */ value = ast.value;
if (typeof value === 'string') {
ctx.print(ast, escapeIdentifier(value, this._escapeDollarInStrings));
}
else {
ctx.print(ast, "" + value);
}
return null;
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
AbstractEmitterVisitor.prototype.visitConditionalExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
ctx.print(ast, "(");
ast.condition.visitExpression(this, ctx);
ctx.print(ast, '? ');
ast.trueCase.visitExpression(this, ctx);
ctx.print(ast, ': '); /** @type {?} */
((ast.falseCase)).visitExpression(this, ctx);
ctx.print(ast, ")");
return null;
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
AbstractEmitterVisitor.prototype.visitNotExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
ctx.print(ast, '!');
ast.condition.visitExpression(this, ctx);
return null;
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
AbstractEmitterVisitor.prototype.visitAssertNotNullExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
ast.condition.visitExpression(this, ctx);
return null;
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
AbstractEmitterVisitor.prototype.visitBinaryOperatorExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
var /** @type {?} */ opStr;
switch (ast.operator) {
case BinaryOperator.Equals:
opStr = '==';
break;
case BinaryOperator.Identical:
opStr = '===';
break;
case BinaryOperator.NotEquals:
opStr = '!=';
break;
case BinaryOperator.NotIdentical:
opStr = '!==';
break;
case BinaryOperator.And:
opStr = '&&';
break;
case BinaryOperator.Or:
opStr = '||';
break;
case BinaryOperator.Plus:
opStr = '+';
break;
case BinaryOperator.Minus:
opStr = '-';
break;
case BinaryOperator.Divide:
opStr = '/';
break;
case BinaryOperator.Multiply:
opStr = '*';
break;
case BinaryOperator.Modulo:
opStr = '%';
break;
case BinaryOperator.Lower:
opStr = '<';
break;
case BinaryOperator.LowerEquals:
opStr = '<=';
break;
case BinaryOperator.Bigger:
opStr = '>';
break;
case BinaryOperator.BiggerEquals:
opStr = '>=';
break;
default:
throw new Error("Unknown operator " + ast.operator);
}
ctx.print(ast, "(");
ast.lhs.visitExpression(this, ctx);
ctx.print(ast, " " + opStr + " ");
ast.rhs.visitExpression(this, ctx);
ctx.print(ast, ")");
return null;
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
AbstractEmitterVisitor.prototype.visitReadPropExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
ast.receiver.visitExpression(this, ctx);
ctx.print(ast, ".");
ctx.print(ast, ast.name);
return null;
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
AbstractEmitterVisitor.prototype.visitReadKeyExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
ast.receiver.visitExpression(this, ctx);
ctx.print(ast, "[");
ast.index.visitExpression(this, ctx);
ctx.print(ast, "]");
return null;
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
AbstractEmitterVisitor.prototype.visitLiteralArrayExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
ctx.print(ast, "[");
this.visitAllExpressions(ast.entries, ctx, ',');
ctx.print(ast, "]");
return null;
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
AbstractEmitterVisitor.prototype.visitLiteralMapExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
var _this = this;
ctx.print(ast, "{");
this.visitAllObjects(function (entry) {
ctx.print(ast, escapeIdentifier(entry.key, _this._escapeDollarInStrings, entry.quoted) + ":");
entry.value.visitExpression(_this, ctx);
}, ast.entries, ctx, ',');
ctx.print(ast, "}");
return null;
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
AbstractEmitterVisitor.prototype.visitCommaExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
ctx.print(ast, '(');
this.visitAllExpressions(ast.parts, ctx, ',');
ctx.print(ast, ')');
return null;
};
/**
* @param {?} expressions
* @param {?} ctx
* @param {?} separator
* @return {?}
*/
AbstractEmitterVisitor.prototype.visitAllExpressions = /**
* @param {?} expressions
* @param {?} ctx
* @param {?} separator
* @return {?}
*/
function (expressions, ctx, separator) {
var _this = this;
this.visitAllObjects(function (expr) { return expr.visitExpression(_this, ctx); }, expressions, ctx, separator);
};
/**
* @template T
* @param {?} handler
* @param {?} expressions
* @param {?} ctx
* @param {?} separator
* @return {?}
*/
AbstractEmitterVisitor.prototype.visitAllObjects = /**
* @template T
* @param {?} handler
* @param {?} expressions
* @param {?} ctx
* @param {?} separator
* @return {?}
*/
function (handler, expressions, ctx, separator) {
var /** @type {?} */ incrementedIndent = false;
for (var /** @type {?} */ i = 0; i < expressions.length; i++) {
if (i > 0) {
if (ctx.lineLength() > 80) {
ctx.print(null, separator, true);
if (!incrementedIndent) {
// continuation are marked with double indent.
ctx.incIndent();
ctx.incIndent();
incrementedIndent = true;
}
}
else {
ctx.print(null, separator, false);
}
}
handler(expressions[i]);
}
if (incrementedIndent) {
// continuation are marked with double indent.
ctx.decIndent();
ctx.decIndent();
}
};
/**
* @param {?} statements
* @param {?} ctx
* @return {?}
*/
AbstractEmitterVisitor.prototype.visitAllStatements = /**
* @param {?} statements
* @param {?} ctx
* @return {?}
*/
function (statements, ctx) {
var _this = this;
statements.forEach(function (stmt) { return stmt.visitStatement(_this, ctx); });
};
return AbstractEmitterVisitor;
}());
/**
* @param {?} input
* @param {?} escapeDollar
* @param {?=} alwaysQuote
* @return {?}
*/
function escapeIdentifier(input, escapeDollar, alwaysQuote) {
if (alwaysQuote === void 0) { alwaysQuote = true; }
if (input == null) {
return null;
}
var /** @type {?} */ body = input.replace(_SINGLE_QUOTE_ESCAPE_STRING_RE, function () {
var match = [];
for (var _i = 0; _i < arguments.length; _i++) {
match[_i] = arguments[_i];
}
if (match[0] == '$') {
return escapeDollar ? '\\$' : '$';
}
else if (match[0] == '\n') {
return '\\n';
}
else if (match[0] == '\r') {
return '\\r';
}
else {
return "\\" + match[0];
}
});
var /** @type {?} */ requiresQuotes = alwaysQuote || !_LEGAL_IDENTIFIER_RE.test(body);
return requiresQuotes ? "'" + body + "'" : body;
}
/**
* @param {?} count
* @return {?}
*/
function _createIndent(count) {
var /** @type {?} */ res = '';
for (var /** @type {?} */ i = 0; i < count; i++) {
res += _INDENT_WITH;
}
return res;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @param {?} ast
* @return {?}
*/
function debugOutputAstAsTypeScript(ast) {
var /** @type {?} */ converter = new _TsEmitterVisitor();
var /** @type {?} */ ctx = EmitterVisitorContext.createRoot();
var /** @type {?} */ asts = Array.isArray(ast) ? ast : [ast];
asts.forEach(function (ast) {
if (ast instanceof Statement) {
ast.visitStatement(converter, ctx);
}
else if (ast instanceof Expression) {
ast.visitExpression(converter, ctx);
}
else if (ast instanceof Type$1) {
ast.visitType(converter, ctx);
}
else {
throw new Error("Don't know how to print debug info for " + ast);
}
});
return ctx.toSource();
}
var TypeScriptEmitter = (function () {
function TypeScriptEmitter() {
}
/**
* @param {?} genFilePath
* @param {?} stmts
* @param {?=} preamble
* @param {?=} emitSourceMaps
* @param {?=} referenceFilter
* @return {?}
*/
TypeScriptEmitter.prototype.emitStatementsAndContext = /**
* @param {?} genFilePath
* @param {?} stmts
* @param {?=} preamble
* @param {?=} emitSourceMaps
* @param {?=} referenceFilter
* @return {?}
*/
function (genFilePath, stmts, preamble, emitSourceMaps, referenceFilter) {
if (preamble === void 0) { preamble = ''; }
if (emitSourceMaps === void 0) { emitSourceMaps = true; }
var /** @type {?} */ converter = new _TsEmitterVisitor(referenceFilter);
var /** @type {?} */ ctx = EmitterVisitorContext.createRoot();
converter.visitAllStatements(stmts, ctx);
var /** @type {?} */ preambleLines = preamble ? preamble.split('\n') : [];
converter.reexports.forEach(function (reexports, exportedModuleName) {
var /** @type {?} */ reexportsCode = reexports.map(function (reexport) { return reexport.name + " as " + reexport.as; }).join(',');
preambleLines.push("export {" + reexportsCode + "} from '" + exportedModuleName + "';");
});
converter.importsWithPrefixes.forEach(function (prefix, importedModuleName) {
// Note: can't write the real word for import as it screws up system.js auto detection...
preambleLines.push("imp" +
("ort * as " + prefix + " from '" + importedModuleName + "';"));
});
var /** @type {?} */ sm = emitSourceMaps ?
ctx.toSourceMapGenerator(genFilePath, preambleLines.length).toJsComment() :
'';
var /** @type {?} */ lines = preambleLines.concat([ctx.toSource(), sm]);
if (sm) {
// always add a newline at the end, as some tools have bugs without it.
lines.push('');
}
ctx.setPreambleLineCount(preambleLines.length);
return { sourceText: lines.join('\n'), context: ctx };
};
/**
* @param {?} genFilePath
* @param {?} stmts
* @param {?=} preamble
* @return {?}
*/
TypeScriptEmitter.prototype.emitStatements = /**
* @param {?} genFilePath
* @param {?} stmts
* @param {?=} preamble
* @return {?}
*/
function (genFilePath, stmts, preamble) {
if (preamble === void 0) { preamble = ''; }
return this.emitStatementsAndContext(genFilePath, stmts, preamble).sourceText;
};
return TypeScriptEmitter;
}());
var _TsEmitterVisitor = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(_TsEmitterVisitor, _super);
function _TsEmitterVisitor(referenceFilter) {
var _this = _super.call(this, false) || this;
_this.referenceFilter = referenceFilter;
_this.typeExpression = 0;
_this.importsWithPrefixes = new Map();
_this.reexports = new Map();
return _this;
}
/**
* @param {?} t
* @param {?} ctx
* @param {?=} defaultType
* @return {?}
*/
_TsEmitterVisitor.prototype.visitType = /**
* @param {?} t
* @param {?} ctx
* @param {?=} defaultType
* @return {?}
*/
function (t, ctx, defaultType) {
if (defaultType === void 0) { defaultType = 'any'; }
if (t) {
this.typeExpression++;
t.visitType(this, ctx);
this.typeExpression--;
}
else {
ctx.print(null, defaultType);
}
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
_TsEmitterVisitor.prototype.visitLiteralExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
var /** @type {?} */ value = ast.value;
if (value == null && ast.type != INFERRED_TYPE) {
ctx.print(ast, "(" + value + " as any)");
return null;
}
return _super.prototype.visitLiteralExpr.call(this, ast, ctx);
};
// Temporary workaround to support strictNullCheck enabled consumers of ngc emit.
// In SNC mode, [] have the type never[], so we cast here to any[].
// TODO: narrow the cast to a more explicit type, or use a pattern that does not
// start with [].concat. see https://github.com/angular/angular/pull/11846
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
_TsEmitterVisitor.prototype.visitLiteralArrayExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
if (ast.entries.length === 0) {
ctx.print(ast, '(');
}
var /** @type {?} */ result = _super.prototype.visitLiteralArrayExpr.call(this, ast, ctx);
if (ast.entries.length === 0) {
ctx.print(ast, ' as any[])');
}
return result;
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
_TsEmitterVisitor.prototype.visitExternalExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
this._visitIdentifier(ast.value, ast.typeParams, ctx);
return null;
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
_TsEmitterVisitor.prototype.visitAssertNotNullExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
var /** @type {?} */ result = _super.prototype.visitAssertNotNullExpr.call(this, ast, ctx);
ctx.print(ast, '!');
return result;
};
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
_TsEmitterVisitor.prototype.visitDeclareVarStmt = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
if (stmt.hasModifier(StmtModifier.Exported) && stmt.value instanceof ExternalExpr &&
!stmt.type) {
// check for a reexport
var _a = stmt.value.value, name_1 = _a.name, moduleName = _a.moduleName;
if (moduleName) {
var /** @type {?} */ reexports = this.reexports.get(moduleName);
if (!reexports) {
reexports = [];
this.reexports.set(moduleName, reexports);
}
reexports.push({ name: /** @type {?} */ ((name_1)), as: stmt.name });
return null;
}
}
if (stmt.hasModifier(StmtModifier.Exported)) {
ctx.print(stmt, "export ");
}
if (stmt.hasModifier(StmtModifier.Final)) {
ctx.print(stmt, "const");
}
else {
ctx.print(stmt, "var");
}
ctx.print(stmt, " " + stmt.name);
this._printColonType(stmt.type, ctx);
ctx.print(stmt, " = ");
stmt.value.visitExpression(this, ctx);
ctx.println(stmt, ";");
return null;
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
_TsEmitterVisitor.prototype.visitCastExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
ctx.print(ast, "(<"); /** @type {?} */
((ast.type)).visitType(this, ctx);
ctx.print(ast, ">");
ast.value.visitExpression(this, ctx);
ctx.print(ast, ")");
return null;
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
_TsEmitterVisitor.prototype.visitInstantiateExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
ctx.print(ast, "new ");
this.typeExpression++;
ast.classExpr.visitExpression(this, ctx);
this.typeExpression--;
ctx.print(ast, "(");
this.visitAllExpressions(ast.args, ctx, ',');
ctx.print(ast, ")");
return null;
};
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
_TsEmitterVisitor.prototype.visitDeclareClassStmt = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
var _this = this;
ctx.pushClass(stmt);
if (stmt.hasModifier(StmtModifier.Exported)) {
ctx.print(stmt, "export ");
}
ctx.print(stmt, "class " + stmt.name);
if (stmt.parent != null) {
ctx.print(stmt, " extends ");
this.typeExpression++;
stmt.parent.visitExpression(this, ctx);
this.typeExpression--;
}
ctx.println(stmt, " {");
ctx.incIndent();
stmt.fields.forEach(function (field) { return _this._visitClassField(field, ctx); });
if (stmt.constructorMethod != null) {
this._visitClassConstructor(stmt, ctx);
}
stmt.getters.forEach(function (getter) { return _this._visitClassGetter(getter, ctx); });
stmt.methods.forEach(function (method) { return _this._visitClassMethod(method, ctx); });
ctx.decIndent();
ctx.println(stmt, "}");
ctx.popClass();
return null;
};
/**
* @param {?} field
* @param {?} ctx
* @return {?}
*/
_TsEmitterVisitor.prototype._visitClassField = /**
* @param {?} field
* @param {?} ctx
* @return {?}
*/
function (field, ctx) {
if (field.hasModifier(StmtModifier.Private)) {
// comment out as a workaround for #10967
ctx.print(null, "/*private*/ ");
}
ctx.print(null, field.name);
this._printColonType(field.type, ctx);
ctx.println(null, ";");
};
/**
* @param {?} getter
* @param {?} ctx
* @return {?}
*/
_TsEmitterVisitor.prototype._visitClassGetter = /**
* @param {?} getter
* @param {?} ctx
* @return {?}
*/
function (getter, ctx) {
if (getter.hasModifier(StmtModifier.Private)) {
ctx.print(null, "private ");
}
ctx.print(null, "get " + getter.name + "()");
this._printColonType(getter.type, ctx);
ctx.println(null, " {");
ctx.incIndent();
this.visitAllStatements(getter.body, ctx);
ctx.decIndent();
ctx.println(null, "}");
};
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
_TsEmitterVisitor.prototype._visitClassConstructor = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
ctx.print(stmt, "constructor(");
this._visitParams(stmt.constructorMethod.params, ctx);
ctx.println(stmt, ") {");
ctx.incIndent();
this.visitAllStatements(stmt.constructorMethod.body, ctx);
ctx.decIndent();
ctx.println(stmt, "}");
};
/**
* @param {?} method
* @param {?} ctx
* @return {?}
*/
_TsEmitterVisitor.prototype._visitClassMethod = /**
* @param {?} method
* @param {?} ctx
* @return {?}
*/
function (method, ctx) {
if (method.hasModifier(StmtModifier.Private)) {
ctx.print(null, "private ");
}
ctx.print(null, method.name + "(");
this._visitParams(method.params, ctx);
ctx.print(null, ")");
this._printColonType(method.type, ctx, 'void');
ctx.println(null, " {");
ctx.incIndent();
this.visitAllStatements(method.body, ctx);
ctx.decIndent();
ctx.println(null, "}");
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
_TsEmitterVisitor.prototype.visitFunctionExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
ctx.print(ast, "(");
this._visitParams(ast.params, ctx);
ctx.print(ast, ")");
this._printColonType(ast.type, ctx, 'void');
ctx.println(ast, " => {");
ctx.incIndent();
this.visitAllStatements(ast.statements, ctx);
ctx.decIndent();
ctx.print(ast, "}");
return null;
};
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
_TsEmitterVisitor.prototype.visitDeclareFunctionStmt = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
if (stmt.hasModifier(StmtModifier.Exported)) {
ctx.print(stmt, "export ");
}
ctx.print(stmt, "function " + stmt.name + "(");
this._visitParams(stmt.params, ctx);
ctx.print(stmt, ")");
this._printColonType(stmt.type, ctx, 'void');
ctx.println(stmt, " {");
ctx.incIndent();
this.visitAllStatements(stmt.statements, ctx);
ctx.decIndent();
ctx.println(stmt, "}");
return null;
};
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
_TsEmitterVisitor.prototype.visitTryCatchStmt = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
ctx.println(stmt, "try {");
ctx.incIndent();
this.visitAllStatements(stmt.bodyStmts, ctx);
ctx.decIndent();
ctx.println(stmt, "} catch (" + CATCH_ERROR_VAR$1.name + ") {");
ctx.incIndent();
var /** @type {?} */ catchStmts = [/** @type {?} */ (CATCH_STACK_VAR$1.set(CATCH_ERROR_VAR$1.prop('stack', null)).toDeclStmt(null, [
StmtModifier.Final
]))].concat(stmt.catchStmts);
this.visitAllStatements(catchStmts, ctx);
ctx.decIndent();
ctx.println(stmt, "}");
return null;
};
/**
* @param {?} type
* @param {?} ctx
* @return {?}
*/
_TsEmitterVisitor.prototype.visitBuiltintType = /**
* @param {?} type
* @param {?} ctx
* @return {?}
*/
function (type, ctx) {
var /** @type {?} */ typeStr;
switch (type.name) {
case BuiltinTypeName.Bool:
typeStr = 'boolean';
break;
case BuiltinTypeName.Dynamic:
typeStr = 'any';
break;
case BuiltinTypeName.Function:
typeStr = 'Function';
break;
case BuiltinTypeName.Number:
typeStr = 'number';
break;
case BuiltinTypeName.Int:
typeStr = 'number';
break;
case BuiltinTypeName.String:
typeStr = 'string';
break;
default:
throw new Error("Unsupported builtin type " + type.name);
}
ctx.print(null, typeStr);
return null;
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
_TsEmitterVisitor.prototype.visitExpressionType = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
ast.value.visitExpression(this, ctx);
return null;
};
/**
* @param {?} type
* @param {?} ctx
* @return {?}
*/
_TsEmitterVisitor.prototype.visitArrayType = /**
* @param {?} type
* @param {?} ctx
* @return {?}
*/
function (type, ctx) {
this.visitType(type.of, ctx);
ctx.print(null, "[]");
return null;
};
/**
* @param {?} type
* @param {?} ctx
* @return {?}
*/
_TsEmitterVisitor.prototype.visitMapType = /**
* @param {?} type
* @param {?} ctx
* @return {?}
*/
function (type, ctx) {
ctx.print(null, "{[key: string]:");
this.visitType(type.valueType, ctx);
ctx.print(null, "}");
return null;
};
/**
* @param {?} method
* @return {?}
*/
_TsEmitterVisitor.prototype.getBuiltinMethodName = /**
* @param {?} method
* @return {?}
*/
function (method) {
var /** @type {?} */ name;
switch (method) {
case BuiltinMethod.ConcatArray:
name = 'concat';
break;
case BuiltinMethod.SubscribeObservable:
name = 'subscribe';
break;
case BuiltinMethod.Bind:
name = 'bind';
break;
default:
throw new Error("Unknown builtin method: " + method);
}
return name;
};
/**
* @param {?} params
* @param {?} ctx
* @return {?}
*/
_TsEmitterVisitor.prototype._visitParams = /**
* @param {?} params
* @param {?} ctx
* @return {?}
*/
function (params, ctx) {
var _this = this;
this.visitAllObjects(function (param) {
ctx.print(null, param.name);
_this._printColonType(param.type, ctx);
}, params, ctx, ',');
};
/**
* @param {?} value
* @param {?} typeParams
* @param {?} ctx
* @return {?}
*/
_TsEmitterVisitor.prototype._visitIdentifier = /**
* @param {?} value
* @param {?} typeParams
* @param {?} ctx
* @return {?}
*/
function (value, typeParams, ctx) {
var _this = this;
var name = value.name, moduleName = value.moduleName;
if (this.referenceFilter && this.referenceFilter(value)) {
ctx.print(null, '(null as any)');
return;
}
if (moduleName) {
var /** @type {?} */ prefix = this.importsWithPrefixes.get(moduleName);
if (prefix == null) {
prefix = "i" + this.importsWithPrefixes.size;
this.importsWithPrefixes.set(moduleName, prefix);
}
ctx.print(null, prefix + ".");
}
ctx.print(null, /** @type {?} */ ((name)));
if (this.typeExpression > 0) {
// If we are in a type expression that refers to a generic type then supply
// the required type parameters. If there were not enough type parameters
// supplied, supply any as the type. Outside a type expression the reference
// should not supply type parameters and be treated as a simple value reference
// to the constructor function itself.
var /** @type {?} */ suppliedParameters = typeParams || [];
if (suppliedParameters.length > 0) {
ctx.print(null, "<");
this.visitAllObjects(function (type) { return type.visitType(_this, ctx); }, /** @type {?} */ ((typeParams)), ctx, ',');
ctx.print(null, ">");
}
}
};
/**
* @param {?} type
* @param {?} ctx
* @param {?=} defaultType
* @return {?}
*/
_TsEmitterVisitor.prototype._printColonType = /**
* @param {?} type
* @param {?} ctx
* @param {?=} defaultType
* @return {?}
*/
function (type, ctx, defaultType) {
if (type !== INFERRED_TYPE) {
ctx.print(null, ':');
this.visitType(type, ctx, defaultType);
}
};
return _TsEmitterVisitor;
}(AbstractEmitterVisitor));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Resolve a `Type` for {\@link Pipe}.
*
* This interface can be overridden by the application developer to create custom behavior.
*
* See {\@link Compiler}
*/
var PipeResolver = (function () {
function PipeResolver(_reflector) {
this._reflector = _reflector;
}
/**
* @param {?} type
* @return {?}
*/
PipeResolver.prototype.isPipe = /**
* @param {?} type
* @return {?}
*/
function (type) {
var /** @type {?} */ typeMetadata = this._reflector.annotations(resolveForwardRef(type));
return typeMetadata && typeMetadata.some(createPipe.isTypeOf);
};
/**
* Return {@link Pipe} for a given `Type`.
*/
/**
* Return {\@link Pipe} for a given `Type`.
* @param {?} type
* @param {?=} throwIfNotFound
* @return {?}
*/
PipeResolver.prototype.resolve = /**
* Return {\@link Pipe} for a given `Type`.
* @param {?} type
* @param {?=} throwIfNotFound
* @return {?}
*/
function (type, throwIfNotFound) {
if (throwIfNotFound === void 0) { throwIfNotFound = true; }
var /** @type {?} */ metas = this._reflector.annotations(resolveForwardRef(type));
if (metas) {
var /** @type {?} */ annotation = findLast(metas, createPipe.isTypeOf);
if (annotation) {
return annotation;
}
}
if (throwIfNotFound) {
throw new Error("No Pipe decorator found on " + stringify(type));
}
return null;
};
return PipeResolver;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Map from tagName|propertyName SecurityContext. Properties applying to all tags use '*'.
*/
var SECURITY_SCHEMA = {};
/**
* @param {?} ctx
* @param {?} specs
* @return {?}
*/
function registerContext(ctx, specs) {
for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) {
var spec = specs_1[_i];
SECURITY_SCHEMA[spec.toLowerCase()] = ctx;
}
}
// Case is insignificant below, all element and attribute names are lower-cased for lookup.
registerContext(SecurityContext.HTML, [
'iframe|srcdoc',
'*|innerHTML',
'*|outerHTML',
]);
registerContext(SecurityContext.STYLE, ['*|style']);
// NB: no SCRIPT contexts here, they are never allowed due to the parser stripping them.
registerContext(SecurityContext.URL, [
'*|formAction', 'area|href', 'area|ping', 'audio|src', 'a|href',
'a|ping', 'blockquote|cite', 'body|background', 'del|cite', 'form|action',
'img|src', 'img|srcset', 'input|src', 'ins|cite', 'q|cite',
'source|src', 'source|srcset', 'track|src', 'video|poster', 'video|src',
]);
registerContext(SecurityContext.RESOURCE_URL, [
'applet|code',
'applet|codebase',
'base|href',
'embed|src',
'frame|src',
'head|profile',
'html|manifest',
'iframe|src',
'link|href',
'media|src',
'object|codebase',
'object|data',
'script|src',
]);
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @abstract
*/
var ElementSchemaRegistry = (function () {
function ElementSchemaRegistry() {
}
return ElementSchemaRegistry;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var BOOLEAN = 'boolean';
var NUMBER = 'number';
var STRING = 'string';
var OBJECT = 'object';
/**
* This array represents the DOM schema. It encodes inheritance, properties, and events.
*
* ## Overview
*
* Each line represents one kind of element. The `element_inheritance` and properties are joined
* using `element_inheritance|properties` syntax.
*
* ## Element Inheritance
*
* The `element_inheritance` can be further subdivided as `element1,element2,...^parentElement`.
* Here the individual elements are separated by `,` (commas). Every element in the list
* has identical properties.
*
* An `element` may inherit additional properties from `parentElement` If no `^parentElement` is
* specified then `""` (blank) element is assumed.
*
* NOTE: The blank element inherits from root `[Element]` element, the super element of all
* elements.
*
* NOTE an element prefix such as `:svg:` has no special meaning to the schema.
*
* ## Properties
*
* Each element has a set of properties separated by `,` (commas). Each property can be prefixed
* by a special character designating its type:
*
* - (no prefix): property is a string.
* - `*`: property represents an event.
* - `!`: property is a boolean.
* - `#`: property is a number.
* - `%`: property is an object.
*
* ## Query
*
* The class creates an internal squas representation which allows to easily answer the query of
* if a given property exist on a given element.
*
* NOTE: We don't yet support querying for types or events.
* NOTE: This schema is auto extracted from `schema_extractor.ts` located in the test folder,
* see dom_element_schema_registry_spec.ts
*/
var SCHEMA = [
'[Element]|textContent,%classList,className,id,innerHTML,*beforecopy,*beforecut,*beforepaste,*copy,*cut,*paste,*search,*selectstart,*webkitfullscreenchange,*webkitfullscreenerror,*wheel,outerHTML,#scrollLeft,#scrollTop,slot' +
',*message,*mozfullscreenchange,*mozfullscreenerror,*mozpointerlockchange,*mozpointerlockerror,*webglcontextcreationerror,*webglcontextlost,*webglcontextrestored',
'[HTMLElement]^[Element]|accessKey,contentEditable,dir,!draggable,!hidden,innerText,lang,*abort,*auxclick,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*cuechange,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*gotpointercapture,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*lostpointercapture,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*pause,*play,*playing,*pointercancel,*pointerdown,*pointerenter,*pointerleave,*pointermove,*pointerout,*pointerover,*pointerup,*progress,*ratechange,*reset,*resize,*scroll,*seeked,*seeking,*select,*show,*stalled,*submit,*suspend,*timeupdate,*toggle,*volumechange,*waiting,outerText,!spellcheck,%style,#tabIndex,title,!translate',
'abbr,address,article,aside,b,bdi,bdo,cite,code,dd,dfn,dt,em,figcaption,figure,footer,header,i,kbd,main,mark,nav,noscript,rb,rp,rt,rtc,ruby,s,samp,section,small,strong,sub,sup,u,var,wbr^[HTMLElement]|accessKey,contentEditable,dir,!draggable,!hidden,innerText,lang,*abort,*auxclick,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*cuechange,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*gotpointercapture,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*lostpointercapture,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*pause,*play,*playing,*pointercancel,*pointerdown,*pointerenter,*pointerleave,*pointermove,*pointerout,*pointerover,*pointerup,*progress,*ratechange,*reset,*resize,*scroll,*seeked,*seeking,*select,*show,*stalled,*submit,*suspend,*timeupdate,*toggle,*volumechange,*waiting,outerText,!spellcheck,%style,#tabIndex,title,!translate',
'media^[HTMLElement]|!autoplay,!controls,%controlsList,%crossOrigin,#currentTime,!defaultMuted,#defaultPlaybackRate,!disableRemotePlayback,!loop,!muted,*encrypted,*waitingforkey,#playbackRate,preload,src,%srcObject,#volume',
':svg:^[HTMLElement]|*abort,*auxclick,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*cuechange,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*gotpointercapture,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*lostpointercapture,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*pause,*play,*playing,*pointercancel,*pointerdown,*pointerenter,*pointerleave,*pointermove,*pointerout,*pointerover,*pointerup,*progress,*ratechange,*reset,*resize,*scroll,*seeked,*seeking,*select,*show,*stalled,*submit,*suspend,*timeupdate,*toggle,*volumechange,*waiting,%style,#tabIndex',
':svg:graphics^:svg:|',
':svg:animation^:svg:|*begin,*end,*repeat',
':svg:geometry^:svg:|',
':svg:componentTransferFunction^:svg:|',
':svg:gradient^:svg:|',
':svg:textContent^:svg:graphics|',
':svg:textPositioning^:svg:textContent|',
'a^[HTMLElement]|charset,coords,download,hash,host,hostname,href,hreflang,name,password,pathname,ping,port,protocol,referrerPolicy,rel,rev,search,shape,target,text,type,username',
'area^[HTMLElement]|alt,coords,download,hash,host,hostname,href,!noHref,password,pathname,ping,port,protocol,referrerPolicy,rel,search,shape,target,username',
'audio^media|',
'br^[HTMLElement]|clear',
'base^[HTMLElement]|href,target',
'body^[HTMLElement]|aLink,background,bgColor,link,*beforeunload,*blur,*error,*focus,*hashchange,*languagechange,*load,*message,*offline,*online,*pagehide,*pageshow,*popstate,*rejectionhandled,*resize,*scroll,*storage,*unhandledrejection,*unload,text,vLink',
'button^[HTMLElement]|!autofocus,!disabled,formAction,formEnctype,formMethod,!formNoValidate,formTarget,name,type,value',
'canvas^[HTMLElement]|#height,#width',
'content^[HTMLElement]|select',
'dl^[HTMLElement]|!compact',
'datalist^[HTMLElement]|',
'details^[HTMLElement]|!open',
'dialog^[HTMLElement]|!open,returnValue',
'dir^[HTMLElement]|!compact',
'div^[HTMLElement]|align',
'embed^[HTMLElement]|align,height,name,src,type,width',
'fieldset^[HTMLElement]|!disabled,name',
'font^[HTMLElement]|color,face,size',
'form^[HTMLElement]|acceptCharset,action,autocomplete,encoding,enctype,method,name,!noValidate,target',
'frame^[HTMLElement]|frameBorder,longDesc,marginHeight,marginWidth,name,!noResize,scrolling,src',
'frameset^[HTMLElement]|cols,*beforeunload,*blur,*error,*focus,*hashchange,*languagechange,*load,*message,*offline,*online,*pagehide,*pageshow,*popstate,*rejectionhandled,*resize,*scroll,*storage,*unhandledrejection,*unload,rows',
'hr^[HTMLElement]|align,color,!noShade,size,width',
'head^[HTMLElement]|',
'h1,h2,h3,h4,h5,h6^[HTMLElement]|align',
'html^[HTMLElement]|version',
'iframe^[HTMLElement]|align,!allowFullscreen,frameBorder,height,longDesc,marginHeight,marginWidth,name,referrerPolicy,%sandbox,scrolling,src,srcdoc,width',
'img^[HTMLElement]|align,alt,border,%crossOrigin,#height,#hspace,!isMap,longDesc,lowsrc,name,referrerPolicy,sizes,src,srcset,useMap,#vspace,#width',
'input^[HTMLElement]|accept,align,alt,autocapitalize,autocomplete,!autofocus,!checked,!defaultChecked,defaultValue,dirName,!disabled,%files,formAction,formEnctype,formMethod,!formNoValidate,formTarget,#height,!incremental,!indeterminate,max,#maxLength,min,#minLength,!multiple,name,pattern,placeholder,!readOnly,!required,selectionDirection,#selectionEnd,#selectionStart,#size,src,step,type,useMap,value,%valueAsDate,#valueAsNumber,#width',
'li^[HTMLElement]|type,#value',
'label^[HTMLElement]|htmlFor',
'legend^[HTMLElement]|align',
'link^[HTMLElement]|as,charset,%crossOrigin,!disabled,href,hreflang,integrity,media,referrerPolicy,rel,%relList,rev,%sizes,target,type',
'map^[HTMLElement]|name',
'marquee^[HTMLElement]|behavior,bgColor,direction,height,#hspace,#loop,#scrollAmount,#scrollDelay,!trueSpeed,#vspace,width',
'menu^[HTMLElement]|!compact',
'meta^[HTMLElement]|content,httpEquiv,name,scheme',
'meter^[HTMLElement]|#high,#low,#max,#min,#optimum,#value',
'ins,del^[HTMLElement]|cite,dateTime',
'ol^[HTMLElement]|!compact,!reversed,#start,type',
'object^[HTMLElement]|align,archive,border,code,codeBase,codeType,data,!declare,height,#hspace,name,standby,type,useMap,#vspace,width',
'optgroup^[HTMLElement]|!disabled,label',
'option^[HTMLElement]|!defaultSelected,!disabled,label,!selected,text,value',
'output^[HTMLElement]|defaultValue,%htmlFor,name,value',
'p^[HTMLElement]|align',
'param^[HTMLElement]|name,type,value,valueType',
'picture^[HTMLElement]|',
'pre^[HTMLElement]|#width',
'progress^[HTMLElement]|#max,#value',
'q,blockquote,cite^[HTMLElement]|',
'script^[HTMLElement]|!async,charset,%crossOrigin,!defer,event,htmlFor,integrity,src,text,type',
'select^[HTMLElement]|!autofocus,!disabled,#length,!multiple,name,!required,#selectedIndex,#size,value',
'shadow^[HTMLElement]|',
'slot^[HTMLElement]|name',
'source^[HTMLElement]|media,sizes,src,srcset,type',
'span^[HTMLElement]|',
'style^[HTMLElement]|!disabled,media,type',
'caption^[HTMLElement]|align',
'th,td^[HTMLElement]|abbr,align,axis,bgColor,ch,chOff,#colSpan,headers,height,!noWrap,#rowSpan,scope,vAlign,width',
'col,colgroup^[HTMLElement]|align,ch,chOff,#span,vAlign,width',
'table^[HTMLElement]|align,bgColor,border,%caption,cellPadding,cellSpacing,frame,rules,summary,%tFoot,%tHead,width',
'tr^[HTMLElement]|align,bgColor,ch,chOff,vAlign',
'tfoot,thead,tbody^[HTMLElement]|align,ch,chOff,vAlign',
'template^[HTMLElement]|',
'textarea^[HTMLElement]|autocapitalize,!autofocus,#cols,defaultValue,dirName,!disabled,#maxLength,#minLength,name,placeholder,!readOnly,!required,#rows,selectionDirection,#selectionEnd,#selectionStart,value,wrap',
'title^[HTMLElement]|text',
'track^[HTMLElement]|!default,kind,label,src,srclang',
'ul^[HTMLElement]|!compact,type',
'unknown^[HTMLElement]|',
'video^media|#height,poster,#width',
':svg:a^:svg:graphics|',
':svg:animate^:svg:animation|',
':svg:animateMotion^:svg:animation|',
':svg:animateTransform^:svg:animation|',
':svg:circle^:svg:geometry|',
':svg:clipPath^:svg:graphics|',
':svg:defs^:svg:graphics|',
':svg:desc^:svg:|',
':svg:discard^:svg:|',
':svg:ellipse^:svg:geometry|',
':svg:feBlend^:svg:|',
':svg:feColorMatrix^:svg:|',
':svg:feComponentTransfer^:svg:|',
':svg:feComposite^:svg:|',
':svg:feConvolveMatrix^:svg:|',
':svg:feDiffuseLighting^:svg:|',
':svg:feDisplacementMap^:svg:|',
':svg:feDistantLight^:svg:|',
':svg:feDropShadow^:svg:|',
':svg:feFlood^:svg:|',
':svg:feFuncA^:svg:componentTransferFunction|',
':svg:feFuncB^:svg:componentTransferFunction|',
':svg:feFuncG^:svg:componentTransferFunction|',
':svg:feFuncR^:svg:componentTransferFunction|',
':svg:feGaussianBlur^:svg:|',
':svg:feImage^:svg:|',
':svg:feMerge^:svg:|',
':svg:feMergeNode^:svg:|',
':svg:feMorphology^:svg:|',
':svg:feOffset^:svg:|',
':svg:fePointLight^:svg:|',
':svg:feSpecularLighting^:svg:|',
':svg:feSpotLight^:svg:|',
':svg:feTile^:svg:|',
':svg:feTurbulence^:svg:|',
':svg:filter^:svg:|',
':svg:foreignObject^:svg:graphics|',
':svg:g^:svg:graphics|',
':svg:image^:svg:graphics|',
':svg:line^:svg:geometry|',
':svg:linearGradient^:svg:gradient|',
':svg:mpath^:svg:|',
':svg:marker^:svg:|',
':svg:mask^:svg:|',
':svg:metadata^:svg:|',
':svg:path^:svg:geometry|',
':svg:pattern^:svg:|',
':svg:polygon^:svg:geometry|',
':svg:polyline^:svg:geometry|',
':svg:radialGradient^:svg:gradient|',
':svg:rect^:svg:geometry|',
':svg:svg^:svg:graphics|#currentScale,#zoomAndPan',
':svg:script^:svg:|type',
':svg:set^:svg:animation|',
':svg:stop^:svg:|',
':svg:style^:svg:|!disabled,media,title,type',
':svg:switch^:svg:graphics|',
':svg:symbol^:svg:|',
':svg:tspan^:svg:textPositioning|',
':svg:text^:svg:textPositioning|',
':svg:textPath^:svg:textContent|',
':svg:title^:svg:|',
':svg:use^:svg:graphics|',
':svg:view^:svg:|#zoomAndPan',
'data^[HTMLElement]|value',
'keygen^[HTMLElement]|!autofocus,challenge,!disabled,form,keytype,name',
'menuitem^[HTMLElement]|type,label,icon,!disabled,!checked,radiogroup,!default',
'summary^[HTMLElement]|',
'time^[HTMLElement]|dateTime',
':svg:cursor^:svg:|',
];
var _ATTR_TO_PROP = {
'class': 'className',
'for': 'htmlFor',
'formaction': 'formAction',
'innerHtml': 'innerHTML',
'readonly': 'readOnly',
'tabindex': 'tabIndex',
};
var DomElementSchemaRegistry = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(DomElementSchemaRegistry, _super);
function DomElementSchemaRegistry() {
var _this = _super.call(this) || this;
_this._schema = {};
SCHEMA.forEach(function (encodedType) {
var /** @type {?} */ type = {};
var _a = encodedType.split('|'), strType = _a[0], strProperties = _a[1];
var /** @type {?} */ properties = strProperties.split(',');
var _b = strType.split('^'), typeNames = _b[0], superName = _b[1];
typeNames.split(',').forEach(function (tag) { return _this._schema[tag.toLowerCase()] = type; });
var /** @type {?} */ superType = superName && _this._schema[superName.toLowerCase()];
if (superType) {
Object.keys(superType).forEach(function (prop) { type[prop] = superType[prop]; });
}
properties.forEach(function (property) {
if (property.length > 0) {
switch (property[0]) {
case '*':
// We don't yet support events.
// If ever allowing to bind to events, GO THROUGH A SECURITY REVIEW, allowing events
// will
// almost certainly introduce bad XSS vulnerabilities.
// type[property.substring(1)] = EVENT;
break;
case '!':
type[property.substring(1)] = BOOLEAN;
break;
case '#':
type[property.substring(1)] = NUMBER;
break;
case '%':
type[property.substring(1)] = OBJECT;
break;
default:
type[property] = STRING;
}
}
});
});
return _this;
}
/**
* @param {?} tagName
* @param {?} propName
* @param {?} schemaMetas
* @return {?}
*/
DomElementSchemaRegistry.prototype.hasProperty = /**
* @param {?} tagName
* @param {?} propName
* @param {?} schemaMetas
* @return {?}
*/
function (tagName, propName, schemaMetas) {
if (schemaMetas.some(function (schema) { return schema.name === NO_ERRORS_SCHEMA.name; })) {
return true;
}
if (tagName.indexOf('-') > -1) {
if (isNgContainer(tagName) || isNgContent(tagName)) {
return false;
}
if (schemaMetas.some(function (schema) { return schema.name === CUSTOM_ELEMENTS_SCHEMA.name; })) {
// Can't tell now as we don't know which properties a custom element will get
// once it is instantiated
return true;
}
}
var /** @type {?} */ elementProperties = this._schema[tagName.toLowerCase()] || this._schema['unknown'];
return !!elementProperties[propName];
};
/**
* @param {?} tagName
* @param {?} schemaMetas
* @return {?}
*/
DomElementSchemaRegistry.prototype.hasElement = /**
* @param {?} tagName
* @param {?} schemaMetas
* @return {?}
*/
function (tagName, schemaMetas) {
if (schemaMetas.some(function (schema) { return schema.name === NO_ERRORS_SCHEMA.name; })) {
return true;
}
if (tagName.indexOf('-') > -1) {
if (isNgContainer(tagName) || isNgContent(tagName)) {
return true;
}
if (schemaMetas.some(function (schema) { return schema.name === CUSTOM_ELEMENTS_SCHEMA.name; })) {
// Allow any custom elements
return true;
}
}
return !!this._schema[tagName.toLowerCase()];
};
/**
* securityContext returns the security context for the given property on the given DOM tag.
*
* Tag and property name are statically known and cannot change at runtime, i.e. it is not
* possible to bind a value into a changing attribute or tag name.
*
* The filtering is white list based. All attributes in the schema above are assumed to have the
* 'NONE' security context, i.e. that they are safe inert string values. Only specific well known
* attack vectors are assigned their appropriate context.
*/
/**
* securityContext returns the security context for the given property on the given DOM tag.
*
* Tag and property name are statically known and cannot change at runtime, i.e. it is not
* possible to bind a value into a changing attribute or tag name.
*
* The filtering is white list based. All attributes in the schema above are assumed to have the
* 'NONE' security context, i.e. that they are safe inert string values. Only specific well known
* attack vectors are assigned their appropriate context.
* @param {?} tagName
* @param {?} propName
* @param {?} isAttribute
* @return {?}
*/
DomElementSchemaRegistry.prototype.securityContext = /**
* securityContext returns the security context for the given property on the given DOM tag.
*
* Tag and property name are statically known and cannot change at runtime, i.e. it is not
* possible to bind a value into a changing attribute or tag name.
*
* The filtering is white list based. All attributes in the schema above are assumed to have the
* 'NONE' security context, i.e. that they are safe inert string values. Only specific well known
* attack vectors are assigned their appropriate context.
* @param {?} tagName
* @param {?} propName
* @param {?} isAttribute
* @return {?}
*/
function (tagName, propName, isAttribute) {
if (isAttribute) {
// NB: For security purposes, use the mapped property name, not the attribute name.
propName = this.getMappedPropName(propName);
}
// Make sure comparisons are case insensitive, so that case differences between attribute and
// property names do not have a security impact.
tagName = tagName.toLowerCase();
propName = propName.toLowerCase();
var /** @type {?} */ ctx = SECURITY_SCHEMA[tagName + '|' + propName];
if (ctx) {
return ctx;
}
ctx = SECURITY_SCHEMA['*|' + propName];
return ctx ? ctx : SecurityContext.NONE;
};
/**
* @param {?} propName
* @return {?}
*/
DomElementSchemaRegistry.prototype.getMappedPropName = /**
* @param {?} propName
* @return {?}
*/
function (propName) { return _ATTR_TO_PROP[propName] || propName; };
/**
* @return {?}
*/
DomElementSchemaRegistry.prototype.getDefaultComponentElementName = /**
* @return {?}
*/
function () { return 'ng-component'; };
/**
* @param {?} name
* @return {?}
*/
DomElementSchemaRegistry.prototype.validateProperty = /**
* @param {?} name
* @return {?}
*/
function (name) {
if (name.toLowerCase().startsWith('on')) {
var /** @type {?} */ msg = "Binding to event property '" + name + "' is disallowed for security reasons, " +
("please use (" + name.slice(2) + ")=...") +
("\nIf '" + name + "' is a directive input, make sure the directive is imported by the") +
" current module.";
return { error: true, msg: msg };
}
else {
return { error: false };
}
};
/**
* @param {?} name
* @return {?}
*/
DomElementSchemaRegistry.prototype.validateAttribute = /**
* @param {?} name
* @return {?}
*/
function (name) {
if (name.toLowerCase().startsWith('on')) {
var /** @type {?} */ msg = "Binding to event attribute '" + name + "' is disallowed for security reasons, " +
("please use (" + name.slice(2) + ")=...");
return { error: true, msg: msg };
}
else {
return { error: false };
}
};
/**
* @return {?}
*/
DomElementSchemaRegistry.prototype.allKnownElementNames = /**
* @return {?}
*/
function () { return Object.keys(this._schema); };
/**
* @param {?} propName
* @return {?}
*/
DomElementSchemaRegistry.prototype.normalizeAnimationStyleProperty = /**
* @param {?} propName
* @return {?}
*/
function (propName) {
return dashCaseToCamelCase(propName);
};
/**
* @param {?} camelCaseProp
* @param {?} userProvidedProp
* @param {?} val
* @return {?}
*/
DomElementSchemaRegistry.prototype.normalizeAnimationStyleValue = /**
* @param {?} camelCaseProp
* @param {?} userProvidedProp
* @param {?} val
* @return {?}
*/
function (camelCaseProp, userProvidedProp, val) {
var /** @type {?} */ unit = '';
var /** @type {?} */ strVal = val.toString().trim();
var /** @type {?} */ errorMsg = /** @type {?} */ ((null));
if (_isPixelDimensionStyle(camelCaseProp) && val !== 0 && val !== '0') {
if (typeof val === 'number') {
unit = 'px';
}
else {
var /** @type {?} */ valAndSuffixMatch = val.match(/^[+-]?[\d\.]+([a-z]*)$/);
if (valAndSuffixMatch && valAndSuffixMatch[1].length == 0) {
errorMsg = "Please provide a CSS unit value for " + userProvidedProp + ":" + val;
}
}
}
return { error: errorMsg, value: strVal + unit };
};
return DomElementSchemaRegistry;
}(ElementSchemaRegistry));
/**
* @param {?} prop
* @return {?}
*/
function _isPixelDimensionStyle(prop) {
switch (prop) {
case 'width':
case 'height':
case 'minWidth':
case 'minHeight':
case 'maxWidth':
case 'maxHeight':
case 'left':
case 'top':
case 'bottom':
case 'right':
case 'fontSize':
case 'outlineWidth':
case 'outlineOffset':
case 'paddingTop':
case 'paddingLeft':
case 'paddingBottom':
case 'paddingRight':
case 'marginTop':
case 'marginLeft':
case 'marginBottom':
case 'marginRight':
case 'borderRadius':
case 'borderWidth':
case 'borderTopWidth':
case 'borderLeftWidth':
case 'borderRightWidth':
case 'borderBottomWidth':
case 'textIndent':
return true;
default:
return false;
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var ShadowCss = (function () {
function ShadowCss() {
this.strictStyling = true;
}
/*
* Shim some cssText with the given selector. Returns cssText that can
* be included in the document via WebComponents.ShadowCSS.addCssToDocument(css).
*
* When strictStyling is true:
* - selector is the attribute added to all elements inside the host,
* - hostSelector is the attribute added to the host itself.
*/
/**
* @param {?} cssText
* @param {?} selector
* @param {?=} hostSelector
* @return {?}
*/
ShadowCss.prototype.shimCssText = /**
* @param {?} cssText
* @param {?} selector
* @param {?=} hostSelector
* @return {?}
*/
function (cssText, selector, hostSelector) {
if (hostSelector === void 0) { hostSelector = ''; }
var /** @type {?} */ sourceMappingUrl = extractSourceMappingUrl(cssText);
cssText = stripComments(cssText);
cssText = this._insertDirectives(cssText);
return this._scopeCssText(cssText, selector, hostSelector) + sourceMappingUrl;
};
/**
* @param {?} cssText
* @return {?}
*/
ShadowCss.prototype._insertDirectives = /**
* @param {?} cssText
* @return {?}
*/
function (cssText) {
cssText = this._insertPolyfillDirectivesInCssText(cssText);
return this._insertPolyfillRulesInCssText(cssText);
};
/**
* @param {?} cssText
* @return {?}
*/
ShadowCss.prototype._insertPolyfillDirectivesInCssText = /**
* @param {?} cssText
* @return {?}
*/
function (cssText) {
// Difference with webcomponents.js: does not handle comments
return cssText.replace(_cssContentNextSelectorRe, function () {
var m = [];
for (var _i = 0; _i < arguments.length; _i++) {
m[_i] = arguments[_i];
}
return m[2] + '{';
});
};
/**
* @param {?} cssText
* @return {?}
*/
ShadowCss.prototype._insertPolyfillRulesInCssText = /**
* @param {?} cssText
* @return {?}
*/
function (cssText) {
// Difference with webcomponents.js: does not handle comments
return cssText.replace(_cssContentRuleRe, function () {
var m = [];
for (var _i = 0; _i < arguments.length; _i++) {
m[_i] = arguments[_i];
}
var /** @type {?} */ rule = m[0].replace(m[1], '').replace(m[2], '');
return m[4] + rule;
});
};
/**
* @param {?} cssText
* @param {?} scopeSelector
* @param {?} hostSelector
* @return {?}
*/
ShadowCss.prototype._scopeCssText = /**
* @param {?} cssText
* @param {?} scopeSelector
* @param {?} hostSelector
* @return {?}
*/
function (cssText, scopeSelector, hostSelector) {
var /** @type {?} */ unscopedRules = this._extractUnscopedRulesFromCssText(cssText);
// replace :host and :host-context -shadowcsshost and -shadowcsshost respectively
cssText = this._insertPolyfillHostInCssText(cssText);
cssText = this._convertColonHost(cssText);
cssText = this._convertColonHostContext(cssText);
cssText = this._convertShadowDOMSelectors(cssText);
if (scopeSelector) {
cssText = this._scopeSelectors(cssText, scopeSelector, hostSelector);
}
cssText = cssText + '\n' + unscopedRules;
return cssText.trim();
};
/**
* @param {?} cssText
* @return {?}
*/
ShadowCss.prototype._extractUnscopedRulesFromCssText = /**
* @param {?} cssText
* @return {?}
*/
function (cssText) {
// Difference with webcomponents.js: does not handle comments
var /** @type {?} */ r = '';
var /** @type {?} */ m;
_cssContentUnscopedRuleRe.lastIndex = 0;
while ((m = _cssContentUnscopedRuleRe.exec(cssText)) !== null) {
var /** @type {?} */ rule = m[0].replace(m[2], '').replace(m[1], m[4]);
r += rule + '\n\n';
}
return r;
};
/**
* @param {?} cssText
* @return {?}
*/
ShadowCss.prototype._convertColonHost = /**
* @param {?} cssText
* @return {?}
*/
function (cssText) {
return this._convertColonRule(cssText, _cssColonHostRe, this._colonHostPartReplacer);
};
/**
* @param {?} cssText
* @return {?}
*/
ShadowCss.prototype._convertColonHostContext = /**
* @param {?} cssText
* @return {?}
*/
function (cssText) {
return this._convertColonRule(cssText, _cssColonHostContextRe, this._colonHostContextPartReplacer);
};
/**
* @param {?} cssText
* @param {?} regExp
* @param {?} partReplacer
* @return {?}
*/
ShadowCss.prototype._convertColonRule = /**
* @param {?} cssText
* @param {?} regExp
* @param {?} partReplacer
* @return {?}
*/
function (cssText, regExp, partReplacer) {
// m[1] = :host(-context), m[2] = contents of (), m[3] rest of rule
return cssText.replace(regExp, function () {
var m = [];
for (var _i = 0; _i < arguments.length; _i++) {
m[_i] = arguments[_i];
}
if (m[2]) {
var /** @type {?} */ parts = m[2].split(',');
var /** @type {?} */ r = [];
for (var /** @type {?} */ i = 0; i < parts.length; i++) {
var /** @type {?} */ p = parts[i].trim();
if (!p)
break;
r.push(partReplacer(_polyfillHostNoCombinator, p, m[3]));
}
return r.join(',');
}
else {
return _polyfillHostNoCombinator + m[3];
}
});
};
/**
* @param {?} host
* @param {?} part
* @param {?} suffix
* @return {?}
*/
ShadowCss.prototype._colonHostContextPartReplacer = /**
* @param {?} host
* @param {?} part
* @param {?} suffix
* @return {?}
*/
function (host, part, suffix) {
if (part.indexOf(_polyfillHost) > -1) {
return this._colonHostPartReplacer(host, part, suffix);
}
else {
return host + part + suffix + ', ' + part + ' ' + host + suffix;
}
};
/**
* @param {?} host
* @param {?} part
* @param {?} suffix
* @return {?}
*/
ShadowCss.prototype._colonHostPartReplacer = /**
* @param {?} host
* @param {?} part
* @param {?} suffix
* @return {?}
*/
function (host, part, suffix) {
return host + part.replace(_polyfillHost, '') + suffix;
};
/**
* @param {?} cssText
* @return {?}
*/
ShadowCss.prototype._convertShadowDOMSelectors = /**
* @param {?} cssText
* @return {?}
*/
function (cssText) {
return _shadowDOMSelectorsRe.reduce(function (result, pattern) { return result.replace(pattern, ' '); }, cssText);
};
/**
* @param {?} cssText
* @param {?} scopeSelector
* @param {?} hostSelector
* @return {?}
*/
ShadowCss.prototype._scopeSelectors = /**
* @param {?} cssText
* @param {?} scopeSelector
* @param {?} hostSelector
* @return {?}
*/
function (cssText, scopeSelector, hostSelector) {
var _this = this;
return processRules(cssText, function (rule) {
var /** @type {?} */ selector = rule.selector;
var /** @type {?} */ content = rule.content;
if (rule.selector[0] != '@') {
selector =
_this._scopeSelector(rule.selector, scopeSelector, hostSelector, _this.strictStyling);
}
else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports') ||
rule.selector.startsWith('@page') || rule.selector.startsWith('@document')) {
content = _this._scopeSelectors(rule.content, scopeSelector, hostSelector);
}
return new CssRule(selector, content);
});
};
/**
* @param {?} selector
* @param {?} scopeSelector
* @param {?} hostSelector
* @param {?} strict
* @return {?}
*/
ShadowCss.prototype._scopeSelector = /**
* @param {?} selector
* @param {?} scopeSelector
* @param {?} hostSelector
* @param {?} strict
* @return {?}
*/
function (selector, scopeSelector, hostSelector, strict) {
var _this = this;
return selector.split(',')
.map(function (part) { return part.trim().split(_shadowDeepSelectors); })
.map(function (deepParts) {
var shallowPart = deepParts[0], otherParts = deepParts.slice(1);
var /** @type {?} */ applyScope = function (shallowPart) {
if (_this._selectorNeedsScoping(shallowPart, scopeSelector)) {
return strict ?
_this._applyStrictSelectorScope(shallowPart, scopeSelector, hostSelector) :
_this._applySelectorScope(shallowPart, scopeSelector, hostSelector);
}
else {
return shallowPart;
}
};
return [applyScope(shallowPart)].concat(otherParts).join(' ');
})
.join(', ');
};
/**
* @param {?} selector
* @param {?} scopeSelector
* @return {?}
*/
ShadowCss.prototype._selectorNeedsScoping = /**
* @param {?} selector
* @param {?} scopeSelector
* @return {?}
*/
function (selector, scopeSelector) {
var /** @type {?} */ re = this._makeScopeMatcher(scopeSelector);
return !re.test(selector);
};
/**
* @param {?} scopeSelector
* @return {?}
*/
ShadowCss.prototype._makeScopeMatcher = /**
* @param {?} scopeSelector
* @return {?}
*/
function (scopeSelector) {
var /** @type {?} */ lre = /\[/g;
var /** @type {?} */ rre = /\]/g;
scopeSelector = scopeSelector.replace(lre, '\\[').replace(rre, '\\]');
return new RegExp('^(' + scopeSelector + ')' + _selectorReSuffix, 'm');
};
/**
* @param {?} selector
* @param {?} scopeSelector
* @param {?} hostSelector
* @return {?}
*/
ShadowCss.prototype._applySelectorScope = /**
* @param {?} selector
* @param {?} scopeSelector
* @param {?} hostSelector
* @return {?}
*/
function (selector, scopeSelector, hostSelector) {
// Difference from webcomponents.js: scopeSelector could not be an array
return this._applySimpleSelectorScope(selector, scopeSelector, hostSelector);
};
/**
* @param {?} selector
* @param {?} scopeSelector
* @param {?} hostSelector
* @return {?}
*/
ShadowCss.prototype._applySimpleSelectorScope = /**
* @param {?} selector
* @param {?} scopeSelector
* @param {?} hostSelector
* @return {?}
*/
function (selector, scopeSelector, hostSelector) {
// In Android browser, the lastIndex is not reset when the regex is used in String.replace()
_polyfillHostRe.lastIndex = 0;
if (_polyfillHostRe.test(selector)) {
var /** @type {?} */ replaceBy_1 = this.strictStyling ? "[" + hostSelector + "]" : scopeSelector;
return selector
.replace(_polyfillHostNoCombinatorRe, function (hnc, selector) {
return selector.replace(/([^:]*)(:*)(.*)/, function (_, before, colon, after) {
return before + replaceBy_1 + colon + after;
});
})
.replace(_polyfillHostRe, replaceBy_1 + ' ');
}
return scopeSelector + ' ' + selector;
};
/**
* @param {?} selector
* @param {?} scopeSelector
* @param {?} hostSelector
* @return {?}
*/
ShadowCss.prototype._applyStrictSelectorScope = /**
* @param {?} selector
* @param {?} scopeSelector
* @param {?} hostSelector
* @return {?}
*/
function (selector, scopeSelector, hostSelector) {
var _this = this;
var /** @type {?} */ isRe = /\[is=([^\]]*)\]/g;
scopeSelector = scopeSelector.replace(isRe, function (_) {
var parts = [];
for (var _i = 1; _i < arguments.length; _i++) {
parts[_i - 1] = arguments[_i];
}
return parts[0];
});
var /** @type {?} */ attrName = '[' + scopeSelector + ']';
var /** @type {?} */ _scopeSelectorPart = function (p) {
var /** @type {?} */ scopedP = p.trim();
if (!scopedP) {
return '';
}
if (p.indexOf(_polyfillHostNoCombinator) > -1) {
scopedP = _this._applySimpleSelectorScope(p, scopeSelector, hostSelector);
}
else {
// remove :host since it should be unnecessary
var /** @type {?} */ t = p.replace(_polyfillHostRe, '');
if (t.length > 0) {
var /** @type {?} */ matches = t.match(/([^:]*)(:*)(.*)/);
if (matches) {
scopedP = matches[1] + attrName + matches[2] + matches[3];
}
}
}
return scopedP;
};
var /** @type {?} */ safeContent = new SafeSelector(selector);
selector = safeContent.content();
var /** @type {?} */ scopedSelector = '';
var /** @type {?} */ startIndex = 0;
var /** @type {?} */ res;
var /** @type {?} */ sep = /( |>|\+|~(?!=))\s*/g;
// If a selector appears before :host it should not be shimmed as it
// matches on ancestor elements and not on elements in the host's shadow
// `:host-context(div)` is transformed to
// `-shadowcsshost-no-combinatordiv, div -shadowcsshost-no-combinator`
// the `div` is not part of the component in the 2nd selectors and should not be scoped.
// Historically `component-tag:host` was matching the component so we also want to preserve
// this behavior to avoid breaking legacy apps (it should not match).
// The behavior should be:
// - `tag:host` -> `tag[h]` (this is to avoid breaking legacy apps, should not match anything)
// - `tag :host` -> `tag [h]` (`tag` is not scoped because it's considered part of a
// `:host-context(tag)`)
var /** @type {?} */ hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1;
// Only scope parts after the first `-shadowcsshost-no-combinator` when it is present
var /** @type {?} */ shouldScope = !hasHost;
while ((res = sep.exec(selector)) !== null) {
var /** @type {?} */ separator = res[1];
var /** @type {?} */ part_1 = selector.slice(startIndex, res.index).trim();
shouldScope = shouldScope || part_1.indexOf(_polyfillHostNoCombinator) > -1;
var /** @type {?} */ scopedPart = shouldScope ? _scopeSelectorPart(part_1) : part_1;
scopedSelector += scopedPart + " " + separator + " ";
startIndex = sep.lastIndex;
}
var /** @type {?} */ part = selector.substring(startIndex);
shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
scopedSelector += shouldScope ? _scopeSelectorPart(part) : part;
// replace the placeholders with their original values
return safeContent.restore(scopedSelector);
};
/**
* @param {?} selector
* @return {?}
*/
ShadowCss.prototype._insertPolyfillHostInCssText = /**
* @param {?} selector
* @return {?}
*/
function (selector) {
return selector.replace(_colonHostContextRe, _polyfillHostContext)
.replace(_colonHostRe, _polyfillHost);
};
return ShadowCss;
}());
var SafeSelector = (function () {
function SafeSelector(selector) {
var _this = this;
this.placeholders = [];
this.index = 0;
// Replaces attribute selectors with placeholders.
// The WS in [attr="va lue"] would otherwise be interpreted as a selector separator.
selector = selector.replace(/(\[[^\]]*\])/g, function (_, keep) {
var /** @type {?} */ replaceBy = "__ph-" + _this.index + "__";
_this.placeholders.push(keep);
_this.index++;
return replaceBy;
});
// Replaces the expression in `:nth-child(2n + 1)` with a placeholder.
// WS and "+" would otherwise be interpreted as selector separators.
this._content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, function (_, pseudo, exp) {
var /** @type {?} */ replaceBy = "__ph-" + _this.index + "__";
_this.placeholders.push(exp);
_this.index++;
return pseudo + replaceBy;
});
}
/**
* @param {?} content
* @return {?}
*/
SafeSelector.prototype.restore = /**
* @param {?} content
* @return {?}
*/
function (content) {
var _this = this;
return content.replace(/__ph-(\d+)__/g, function (ph, index) { return _this.placeholders[+index]; });
};
/**
* @return {?}
*/
SafeSelector.prototype.content = /**
* @return {?}
*/
function () { return this._content; };
return SafeSelector;
}());
var _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?(['"])(.*?)\1[;\s]*}([^{]*?){/gim;
var _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim;
var _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim;
var _polyfillHost = '-shadowcsshost';
// note: :host-context pre-processed to -shadowcsshostcontext.
var _polyfillHostContext = '-shadowcsscontext';
var _parenSuffix = ')(?:\\((' +
'(?:\\([^)(]*\\)|[^)(]*)+?' +
')\\))?([^,{]*)';
var _cssColonHostRe = new RegExp('(' + _polyfillHost + _parenSuffix, 'gim');
var _cssColonHostContextRe = new RegExp('(' + _polyfillHostContext + _parenSuffix, 'gim');
var _polyfillHostNoCombinator = _polyfillHost + '-no-combinator';
var _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
var _shadowDOMSelectorsRe = [
/::shadow/g,
/::content/g,
/\/shadow-deep\//g,
/\/shadow\//g,
];
// The deep combinator is deprecated in the CSS spec
// Support for `>>>`, `deep`, `::ng-deep` is then also deprecated and will be removed in the future.
// see https://github.com/angular/angular/pull/17677
var _shadowDeepSelectors = /(?:>>>)|(?:\/deep\/)|(?:::ng-deep)/g;
var _selectorReSuffix = '([>\\s~+\[.,{:][\\s\\S]*)?$';
var _polyfillHostRe = /-shadowcsshost/gim;
var _colonHostRe = /:host/gim;
var _colonHostContextRe = /:host-context/gim;
var _commentRe = /\/\*\s*[\s\S]*?\*\//g;
/**
* @param {?} input
* @return {?}
*/
function stripComments(input) {
return input.replace(_commentRe, '');
}
// all comments except inline source mapping
var _sourceMappingUrlRe = /\/\*\s*#\s*sourceMappingURL=[\s\S]+?\*\//;
/**
* @param {?} input
* @return {?}
*/
function extractSourceMappingUrl(input) {
var /** @type {?} */ matcher = input.match(_sourceMappingUrlRe);
return matcher ? matcher[0] : '';
}
var _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
var _curlyRe = /([{}])/g;
var OPEN_CURLY = '{';
var CLOSE_CURLY = '}';
var BLOCK_PLACEHOLDER = '%BLOCK%';
var CssRule = (function () {
function CssRule(selector, content) {
this.selector = selector;
this.content = content;
}
return CssRule;
}());
/**
* @param {?} input
* @param {?} ruleCallback
* @return {?}
*/
function processRules(input, ruleCallback) {
var /** @type {?} */ inputWithEscapedBlocks = escapeBlocks(input);
var /** @type {?} */ nextBlockIndex = 0;
return inputWithEscapedBlocks.escapedString.replace(_ruleRe, function () {
var m = [];
for (var _i = 0; _i < arguments.length; _i++) {
m[_i] = arguments[_i];
}
var /** @type {?} */ selector = m[2];
var /** @type {?} */ content = '';
var /** @type {?} */ suffix = m[4];
var /** @type {?} */ contentPrefix = '';
if (suffix && suffix.startsWith('{' + BLOCK_PLACEHOLDER)) {
content = inputWithEscapedBlocks.blocks[nextBlockIndex++];
suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1);
contentPrefix = '{';
}
var /** @type {?} */ rule = ruleCallback(new CssRule(selector, content));
return "" + m[1] + rule.selector + m[3] + contentPrefix + rule.content + suffix;
});
}
var StringWithEscapedBlocks = (function () {
function StringWithEscapedBlocks(escapedString, blocks) {
this.escapedString = escapedString;
this.blocks = blocks;
}
return StringWithEscapedBlocks;
}());
/**
* @param {?} input
* @return {?}
*/
function escapeBlocks(input) {
var /** @type {?} */ inputParts = input.split(_curlyRe);
var /** @type {?} */ resultParts = [];
var /** @type {?} */ escapedBlocks = [];
var /** @type {?} */ bracketCount = 0;
var /** @type {?} */ currentBlockParts = [];
for (var /** @type {?} */ partIndex = 0; partIndex < inputParts.length; partIndex++) {
var /** @type {?} */ part = inputParts[partIndex];
if (part == CLOSE_CURLY) {
bracketCount--;
}
if (bracketCount > 0) {
currentBlockParts.push(part);
}
else {
if (currentBlockParts.length > 0) {
escapedBlocks.push(currentBlockParts.join(''));
resultParts.push(BLOCK_PLACEHOLDER);
currentBlockParts = [];
}
resultParts.push(part);
}
if (part == OPEN_CURLY) {
bracketCount++;
}
}
if (currentBlockParts.length > 0) {
escapedBlocks.push(currentBlockParts.join(''));
resultParts.push(BLOCK_PLACEHOLDER);
}
return new StringWithEscapedBlocks(resultParts.join(''), escapedBlocks);
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var COMPONENT_VARIABLE = '%COMP%';
var HOST_ATTR = "_nghost-" + COMPONENT_VARIABLE;
var CONTENT_ATTR = "_ngcontent-" + COMPONENT_VARIABLE;
var StylesCompileDependency = (function () {
function StylesCompileDependency(name, moduleUrl, setValue) {
this.name = name;
this.moduleUrl = moduleUrl;
this.setValue = setValue;
}
return StylesCompileDependency;
}());
var CompiledStylesheet = (function () {
function CompiledStylesheet(outputCtx, stylesVar, dependencies, isShimmed, meta) {
this.outputCtx = outputCtx;
this.stylesVar = stylesVar;
this.dependencies = dependencies;
this.isShimmed = isShimmed;
this.meta = meta;
}
return CompiledStylesheet;
}());
var StyleCompiler = (function () {
function StyleCompiler(_urlResolver) {
this._urlResolver = _urlResolver;
this._shadowCss = new ShadowCss();
}
/**
* @param {?} outputCtx
* @param {?} comp
* @return {?}
*/
StyleCompiler.prototype.compileComponent = /**
* @param {?} outputCtx
* @param {?} comp
* @return {?}
*/
function (outputCtx, comp) {
var /** @type {?} */ template = /** @type {?} */ ((comp.template));
return this._compileStyles(outputCtx, comp, new CompileStylesheetMetadata({
styles: template.styles,
styleUrls: template.styleUrls,
moduleUrl: identifierModuleUrl(comp.type)
}), this.needsStyleShim(comp), true);
};
/**
* @param {?} outputCtx
* @param {?} comp
* @param {?} stylesheet
* @param {?=} shim
* @return {?}
*/
StyleCompiler.prototype.compileStyles = /**
* @param {?} outputCtx
* @param {?} comp
* @param {?} stylesheet
* @param {?=} shim
* @return {?}
*/
function (outputCtx, comp, stylesheet, shim) {
if (shim === void 0) { shim = this.needsStyleShim(comp); }
return this._compileStyles(outputCtx, comp, stylesheet, shim, false);
};
/**
* @param {?} comp
* @return {?}
*/
StyleCompiler.prototype.needsStyleShim = /**
* @param {?} comp
* @return {?}
*/
function (comp) {
return /** @type {?} */ ((comp.template)).encapsulation === ViewEncapsulation.Emulated;
};
/**
* @param {?} outputCtx
* @param {?} comp
* @param {?} stylesheet
* @param {?} shim
* @param {?} isComponentStylesheet
* @return {?}
*/
StyleCompiler.prototype._compileStyles = /**
* @param {?} outputCtx
* @param {?} comp
* @param {?} stylesheet
* @param {?} shim
* @param {?} isComponentStylesheet
* @return {?}
*/
function (outputCtx, comp, stylesheet, shim, isComponentStylesheet) {
var _this = this;
var /** @type {?} */ styleExpressions = stylesheet.styles.map(function (plainStyle) { return literal(_this._shimIfNeeded(plainStyle, shim)); });
var /** @type {?} */ dependencies = [];
stylesheet.styleUrls.forEach(function (styleUrl) {
var /** @type {?} */ exprIndex = styleExpressions.length;
// Note: This placeholder will be filled later.
styleExpressions.push(/** @type {?} */ ((null)));
dependencies.push(new StylesCompileDependency(getStylesVarName(null), styleUrl, function (value) { return styleExpressions[exprIndex] = outputCtx.importExpr(value); }));
});
// styles variable contains plain strings and arrays of other styles arrays (recursive),
// so we set its type to dynamic.
var /** @type {?} */ stylesVar = getStylesVarName(isComponentStylesheet ? comp : null);
var /** @type {?} */ stmt = variable(stylesVar)
.set(literalArr(styleExpressions, new ArrayType(DYNAMIC_TYPE, [TypeModifier.Const])))
.toDeclStmt(null, isComponentStylesheet ? [StmtModifier.Final] : [
StmtModifier.Final, StmtModifier.Exported
]);
outputCtx.statements.push(stmt);
return new CompiledStylesheet(outputCtx, stylesVar, dependencies, shim, stylesheet);
};
/**
* @param {?} style
* @param {?} shim
* @return {?}
*/
StyleCompiler.prototype._shimIfNeeded = /**
* @param {?} style
* @param {?} shim
* @return {?}
*/
function (style, shim) {
return shim ? this._shadowCss.shimCssText(style, CONTENT_ATTR, HOST_ATTR) : style;
};
return StyleCompiler;
}());
/**
* @param {?} component
* @return {?}
*/
function getStylesVarName(component) {
var /** @type {?} */ result = "styles";
if (component) {
result += "_" + identifierName(component.type);
}
return result;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var PRESERVE_WS_ATTR_NAME = 'ngPreserveWhitespaces';
var SKIP_WS_TRIM_TAGS = new Set(['pre', 'template', 'textarea', 'script', 'style']);
// Equivalent to \s with \u00a0 (non-breaking space) excluded.
// Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
var WS_CHARS = ' \f\n\r\t\v\u1680\u180e\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff';
var NO_WS_REGEXP = new RegExp("[^" + WS_CHARS + "]");
var WS_REPLACE_REGEXP = new RegExp("[" + WS_CHARS + "]{2,}", 'g');
/**
* @param {?} attrs
* @return {?}
*/
function hasPreserveWhitespacesAttr(attrs) {
return attrs.some(function (attr) { return attr.name === PRESERVE_WS_ATTR_NAME; });
}
/**
* Angular Dart introduced &ngsp; as a placeholder for non-removable space, see:
* https://github.com/dart-lang/angular/blob/0bb611387d29d65b5af7f9d2515ab571fd3fbee4/_tests/test/compiler/preserve_whitespace_test.dart#L25-L32
* In Angular Dart &ngsp; is converted to the 0xE500 PUA (Private Use Areas) unicode character
* and later on replaced by a space. We are re-implementing the same idea here.
* @param {?} value
* @return {?}
*/
function replaceNgsp(value) {
// lexer is replacing the &ngsp; pseudo-entity with NGSP_UNICODE
return value.replace(new RegExp(NGSP_UNICODE, 'g'), ' ');
}
/**
* This visitor can walk HTML parse tree and remove / trim text nodes using the following rules:
* - consider spaces, tabs and new lines as whitespace characters;
* - drop text nodes consisting of whitespace characters only;
* - for all other text nodes replace consecutive whitespace characters with one space;
* - convert &ngsp; pseudo-entity to a single space;
*
* Removal and trimming of whitespaces have positive performance impact (less code to generate
* while compiling templates, faster view creation). At the same time it can be "destructive"
* in some cases (whitespaces can influence layout). Because of the potential of breaking layout
* this visitor is not activated by default in Angular 5 and people need to explicitly opt-in for
* whitespace removal. The default option for whitespace removal will be revisited in Angular 6
* and might be changed to "on" by default.
*/
var WhitespaceVisitor = (function () {
function WhitespaceVisitor() {
}
/**
* @param {?} element
* @param {?} context
* @return {?}
*/
WhitespaceVisitor.prototype.visitElement = /**
* @param {?} element
* @param {?} context
* @return {?}
*/
function (element, context) {
if (SKIP_WS_TRIM_TAGS.has(element.name) || hasPreserveWhitespacesAttr(element.attrs)) {
// don't descent into elements where we need to preserve whitespaces
// but still visit all attributes to eliminate one used as a market to preserve WS
return new Element(element.name, visitAll(this, element.attrs), element.children, element.sourceSpan, element.startSourceSpan, element.endSourceSpan);
}
return new Element(element.name, element.attrs, visitAll(this, element.children), element.sourceSpan, element.startSourceSpan, element.endSourceSpan);
};
/**
* @param {?} attribute
* @param {?} context
* @return {?}
*/
WhitespaceVisitor.prototype.visitAttribute = /**
* @param {?} attribute
* @param {?} context
* @return {?}
*/
function (attribute, context) {
return attribute.name !== PRESERVE_WS_ATTR_NAME ? attribute : null;
};
/**
* @param {?} text
* @param {?} context
* @return {?}
*/
WhitespaceVisitor.prototype.visitText = /**
* @param {?} text
* @param {?} context
* @return {?}
*/
function (text, context) {
var /** @type {?} */ isNotBlank = text.value.match(NO_WS_REGEXP);
if (isNotBlank) {
return new Text(replaceNgsp(text.value).replace(WS_REPLACE_REGEXP, ' '), text.sourceSpan);
}
return null;
};
/**
* @param {?} comment
* @param {?} context
* @return {?}
*/
WhitespaceVisitor.prototype.visitComment = /**
* @param {?} comment
* @param {?} context
* @return {?}
*/
function (comment, context) { return comment; };
/**
* @param {?} expansion
* @param {?} context
* @return {?}
*/
WhitespaceVisitor.prototype.visitExpansion = /**
* @param {?} expansion
* @param {?} context
* @return {?}
*/
function (expansion, context) { return expansion; };
/**
* @param {?} expansionCase
* @param {?} context
* @return {?}
*/
WhitespaceVisitor.prototype.visitExpansionCase = /**
* @param {?} expansionCase
* @param {?} context
* @return {?}
*/
function (expansionCase, context) { return expansionCase; };
return WhitespaceVisitor;
}());
/**
* @param {?} htmlAstWithErrors
* @return {?}
*/
function removeWhitespaces(htmlAstWithErrors) {
return new ParseTreeResult(visitAll(new WhitespaceVisitor(), htmlAstWithErrors.rootNodes), htmlAstWithErrors.errors);
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// http://cldr.unicode.org/index/cldr-spec/plural-rules
var PLURAL_CASES = ['zero', 'one', 'two', 'few', 'many', 'other'];
/**
* Expands special forms into elements.
*
* For example,
*
* ```
* { messages.length, plural,
* =0 {zero}
* =1 {one}
* other {more than one}
* }
* ```
*
* will be expanded into
*
* ```
* <ng-container [ngPlural]="messages.length">
* <ng-template ngPluralCase="=0">zero</ng-template>
* <ng-template ngPluralCase="=1">one</ng-template>
* <ng-template ngPluralCase="other">more than one</ng-template>
* </ng-container>
* ```
* @param {?} nodes
* @return {?}
*/
function expandNodes(nodes) {
var /** @type {?} */ expander = new _Expander();
return new ExpansionResult(visitAll(expander, nodes), expander.isExpanded, expander.errors);
}
var ExpansionResult = (function () {
function ExpansionResult(nodes, expanded, errors) {
this.nodes = nodes;
this.expanded = expanded;
this.errors = errors;
}
return ExpansionResult;
}());
var ExpansionError = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ExpansionError, _super);
function ExpansionError(span, errorMsg) {
return _super.call(this, span, errorMsg) || this;
}
return ExpansionError;
}(ParseError));
/**
* Expand expansion forms (plural, select) to directives
*
* \@internal
*/
var _Expander = (function () {
function _Expander() {
this.isExpanded = false;
this.errors = [];
}
/**
* @param {?} element
* @param {?} context
* @return {?}
*/
_Expander.prototype.visitElement = /**
* @param {?} element
* @param {?} context
* @return {?}
*/
function (element, context) {
return new Element(element.name, element.attrs, visitAll(this, element.children), element.sourceSpan, element.startSourceSpan, element.endSourceSpan);
};
/**
* @param {?} attribute
* @param {?} context
* @return {?}
*/
_Expander.prototype.visitAttribute = /**
* @param {?} attribute
* @param {?} context
* @return {?}
*/
function (attribute, context) { return attribute; };
/**
* @param {?} text
* @param {?} context
* @return {?}
*/
_Expander.prototype.visitText = /**
* @param {?} text
* @param {?} context
* @return {?}
*/
function (text, context) { return text; };
/**
* @param {?} comment
* @param {?} context
* @return {?}
*/
_Expander.prototype.visitComment = /**
* @param {?} comment
* @param {?} context
* @return {?}
*/
function (comment, context) { return comment; };
/**
* @param {?} icu
* @param {?} context
* @return {?}
*/
_Expander.prototype.visitExpansion = /**
* @param {?} icu
* @param {?} context
* @return {?}
*/
function (icu, context) {
this.isExpanded = true;
return icu.type == 'plural' ? _expandPluralForm(icu, this.errors) :
_expandDefaultForm(icu, this.errors);
};
/**
* @param {?} icuCase
* @param {?} context
* @return {?}
*/
_Expander.prototype.visitExpansionCase = /**
* @param {?} icuCase
* @param {?} context
* @return {?}
*/
function (icuCase, context) {
throw new Error('Should not be reached');
};
return _Expander;
}());
/**
* @param {?} ast
* @param {?} errors
* @return {?}
*/
function _expandPluralForm(ast, errors) {
var /** @type {?} */ children = ast.cases.map(function (c) {
if (PLURAL_CASES.indexOf(c.value) == -1 && !c.value.match(/^=\d+$/)) {
errors.push(new ExpansionError(c.valueSourceSpan, "Plural cases should be \"=<number>\" or one of " + PLURAL_CASES.join(", ")));
}
var /** @type {?} */ expansionResult = expandNodes(c.expression);
errors.push.apply(errors, expansionResult.errors);
return new Element("ng-template", [new Attribute$1('ngPluralCase', "" + c.value, c.valueSourceSpan)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan);
});
var /** @type {?} */ switchAttr = new Attribute$1('[ngPlural]', ast.switchValue, ast.switchValueSourceSpan);
return new Element('ng-container', [switchAttr], children, ast.sourceSpan, ast.sourceSpan, ast.sourceSpan);
}
/**
* @param {?} ast
* @param {?} errors
* @return {?}
*/
function _expandDefaultForm(ast, errors) {
var /** @type {?} */ children = ast.cases.map(function (c) {
var /** @type {?} */ expansionResult = expandNodes(c.expression);
errors.push.apply(errors, expansionResult.errors);
if (c.value === 'other') {
// other is the default case when no values match
return new Element("ng-template", [new Attribute$1('ngSwitchDefault', '', c.valueSourceSpan)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan);
}
return new Element("ng-template", [new Attribute$1('ngSwitchCase', "" + c.value, c.valueSourceSpan)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan);
});
var /** @type {?} */ switchAttr = new Attribute$1('[ngSwitch]', ast.switchValue, ast.switchValueSourceSpan);
return new Element('ng-container', [switchAttr], children, ast.sourceSpan, ast.sourceSpan, ast.sourceSpan);
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var PROPERTY_PARTS_SEPARATOR = '.';
var ATTRIBUTE_PREFIX = 'attr';
var CLASS_PREFIX = 'class';
var STYLE_PREFIX = 'style';
var ANIMATE_PROP_PREFIX = 'animate-';
/** @enum {number} */
var BoundPropertyType = {
DEFAULT: 0,
LITERAL_ATTR: 1,
ANIMATION: 2,
};
BoundPropertyType[BoundPropertyType.DEFAULT] = "DEFAULT";
BoundPropertyType[BoundPropertyType.LITERAL_ATTR] = "LITERAL_ATTR";
BoundPropertyType[BoundPropertyType.ANIMATION] = "ANIMATION";
/**
* Represents a parsed property.
*/
var BoundProperty = (function () {
function BoundProperty(name, expression, type, sourceSpan) {
this.name = name;
this.expression = expression;
this.type = type;
this.sourceSpan = sourceSpan;
this.isLiteral = this.type === BoundPropertyType.LITERAL_ATTR;
this.isAnimation = this.type === BoundPropertyType.ANIMATION;
}
return BoundProperty;
}());
/**
* Parses bindings in templates and in the directive host area.
*/
var BindingParser = (function () {
function BindingParser(_exprParser, _interpolationConfig, _schemaRegistry, pipes, _targetErrors) {
var _this = this;
this._exprParser = _exprParser;
this._interpolationConfig = _interpolationConfig;
this._schemaRegistry = _schemaRegistry;
this._targetErrors = _targetErrors;
this.pipesByName = new Map();
this._usedPipes = new Map();
pipes.forEach(function (pipe) { return _this.pipesByName.set(pipe.name, pipe); });
}
/**
* @return {?}
*/
BindingParser.prototype.getUsedPipes = /**
* @return {?}
*/
function () { return Array.from(this._usedPipes.values()); };
/**
* @param {?} dirMeta
* @param {?} elementSelector
* @param {?} sourceSpan
* @return {?}
*/
BindingParser.prototype.createDirectiveHostPropertyAsts = /**
* @param {?} dirMeta
* @param {?} elementSelector
* @param {?} sourceSpan
* @return {?}
*/
function (dirMeta, elementSelector, sourceSpan) {
var _this = this;
if (dirMeta.hostProperties) {
var /** @type {?} */ boundProps_1 = [];
Object.keys(dirMeta.hostProperties).forEach(function (propName) {
var /** @type {?} */ expression = dirMeta.hostProperties[propName];
if (typeof expression === 'string') {
_this.parsePropertyBinding(propName, expression, true, sourceSpan, [], boundProps_1);
}
else {
_this._reportError("Value of the host property binding \"" + propName + "\" needs to be a string representing an expression but got \"" + expression + "\" (" + typeof expression + ")", sourceSpan);
}
});
return boundProps_1.map(function (prop) { return _this.createElementPropertyAst(elementSelector, prop); });
}
return null;
};
/**
* @param {?} dirMeta
* @param {?} sourceSpan
* @return {?}
*/
BindingParser.prototype.createDirectiveHostEventAsts = /**
* @param {?} dirMeta
* @param {?} sourceSpan
* @return {?}
*/
function (dirMeta, sourceSpan) {
var _this = this;
if (dirMeta.hostListeners) {
var /** @type {?} */ targetEventAsts_1 = [];
Object.keys(dirMeta.hostListeners).forEach(function (propName) {
var /** @type {?} */ expression = dirMeta.hostListeners[propName];
if (typeof expression === 'string') {
_this.parseEvent(propName, expression, sourceSpan, [], targetEventAsts_1);
}
else {
_this._reportError("Value of the host listener \"" + propName + "\" needs to be a string representing an expression but got \"" + expression + "\" (" + typeof expression + ")", sourceSpan);
}
});
return targetEventAsts_1;
}
return null;
};
/**
* @param {?} value
* @param {?} sourceSpan
* @return {?}
*/
BindingParser.prototype.parseInterpolation = /**
* @param {?} value
* @param {?} sourceSpan
* @return {?}
*/
function (value, sourceSpan) {
var /** @type {?} */ sourceInfo = sourceSpan.start.toString();
try {
var /** @type {?} */ ast = /** @type {?} */ ((this._exprParser.parseInterpolation(value, sourceInfo, this._interpolationConfig)));
if (ast)
this._reportExpressionParserErrors(ast.errors, sourceSpan);
this._checkPipes(ast, sourceSpan);
return ast;
}
catch (/** @type {?} */ e) {
this._reportError("" + e, sourceSpan);
return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo);
}
};
/**
* @param {?} prefixToken
* @param {?} value
* @param {?} sourceSpan
* @param {?} targetMatchableAttrs
* @param {?} targetProps
* @param {?} targetVars
* @return {?}
*/
BindingParser.prototype.parseInlineTemplateBinding = /**
* @param {?} prefixToken
* @param {?} value
* @param {?} sourceSpan
* @param {?} targetMatchableAttrs
* @param {?} targetProps
* @param {?} targetVars
* @return {?}
*/
function (prefixToken, value, sourceSpan, targetMatchableAttrs, targetProps, targetVars) {
var /** @type {?} */ bindings = this._parseTemplateBindings(prefixToken, value, sourceSpan);
for (var /** @type {?} */ i = 0; i < bindings.length; i++) {
var /** @type {?} */ binding = bindings[i];
if (binding.keyIsVar) {
targetVars.push(new VariableAst(binding.key, binding.name, sourceSpan));
}
else if (binding.expression) {
this._parsePropertyAst(binding.key, binding.expression, sourceSpan, targetMatchableAttrs, targetProps);
}
else {
targetMatchableAttrs.push([binding.key, '']);
this.parseLiteralAttr(binding.key, null, sourceSpan, targetMatchableAttrs, targetProps);
}
}
};
/**
* @param {?} prefixToken
* @param {?} value
* @param {?} sourceSpan
* @return {?}
*/
BindingParser.prototype._parseTemplateBindings = /**
* @param {?} prefixToken
* @param {?} value
* @param {?} sourceSpan
* @return {?}
*/
function (prefixToken, value, sourceSpan) {
var _this = this;
var /** @type {?} */ sourceInfo = sourceSpan.start.toString();
try {
var /** @type {?} */ bindingsResult = this._exprParser.parseTemplateBindings(prefixToken, value, sourceInfo);
this._reportExpressionParserErrors(bindingsResult.errors, sourceSpan);
bindingsResult.templateBindings.forEach(function (binding) {
if (binding.expression) {
_this._checkPipes(binding.expression, sourceSpan);
}
});
bindingsResult.warnings.forEach(function (warning) { _this._reportError(warning, sourceSpan, ParseErrorLevel.WARNING); });
return bindingsResult.templateBindings;
}
catch (/** @type {?} */ e) {
this._reportError("" + e, sourceSpan);
return [];
}
};
/**
* @param {?} name
* @param {?} value
* @param {?} sourceSpan
* @param {?} targetMatchableAttrs
* @param {?} targetProps
* @return {?}
*/
BindingParser.prototype.parseLiteralAttr = /**
* @param {?} name
* @param {?} value
* @param {?} sourceSpan
* @param {?} targetMatchableAttrs
* @param {?} targetProps
* @return {?}
*/
function (name, value, sourceSpan, targetMatchableAttrs, targetProps) {
if (_isAnimationLabel(name)) {
name = name.substring(1);
if (value) {
this._reportError("Assigning animation triggers via @prop=\"exp\" attributes with an expression is invalid." +
" Use property bindings (e.g. [@prop]=\"exp\") or use an attribute without a value (e.g. @prop) instead.", sourceSpan, ParseErrorLevel.ERROR);
}
this._parseAnimation(name, value, sourceSpan, targetMatchableAttrs, targetProps);
}
else {
targetProps.push(new BoundProperty(name, this._exprParser.wrapLiteralPrimitive(value, ''), BoundPropertyType.LITERAL_ATTR, sourceSpan));
}
};
/**
* @param {?} name
* @param {?} expression
* @param {?} isHost
* @param {?} sourceSpan
* @param {?} targetMatchableAttrs
* @param {?} targetProps
* @return {?}
*/
BindingParser.prototype.parsePropertyBinding = /**
* @param {?} name
* @param {?} expression
* @param {?} isHost
* @param {?} sourceSpan
* @param {?} targetMatchableAttrs
* @param {?} targetProps
* @return {?}
*/
function (name, expression, isHost, sourceSpan, targetMatchableAttrs, targetProps) {
var /** @type {?} */ isAnimationProp = false;
if (name.startsWith(ANIMATE_PROP_PREFIX)) {
isAnimationProp = true;
name = name.substring(ANIMATE_PROP_PREFIX.length);
}
else if (_isAnimationLabel(name)) {
isAnimationProp = true;
name = name.substring(1);
}
if (isAnimationProp) {
this._parseAnimation(name, expression, sourceSpan, targetMatchableAttrs, targetProps);
}
else {
this._parsePropertyAst(name, this._parseBinding(expression, isHost, sourceSpan), sourceSpan, targetMatchableAttrs, targetProps);
}
};
/**
* @param {?} name
* @param {?} value
* @param {?} sourceSpan
* @param {?} targetMatchableAttrs
* @param {?} targetProps
* @return {?}
*/
BindingParser.prototype.parsePropertyInterpolation = /**
* @param {?} name
* @param {?} value
* @param {?} sourceSpan
* @param {?} targetMatchableAttrs
* @param {?} targetProps
* @return {?}
*/
function (name, value, sourceSpan, targetMatchableAttrs, targetProps) {
var /** @type {?} */ expr = this.parseInterpolation(value, sourceSpan);
if (expr) {
this._parsePropertyAst(name, expr, sourceSpan, targetMatchableAttrs, targetProps);
return true;
}
return false;
};
/**
* @param {?} name
* @param {?} ast
* @param {?} sourceSpan
* @param {?} targetMatchableAttrs
* @param {?} targetProps
* @return {?}
*/
BindingParser.prototype._parsePropertyAst = /**
* @param {?} name
* @param {?} ast
* @param {?} sourceSpan
* @param {?} targetMatchableAttrs
* @param {?} targetProps
* @return {?}
*/
function (name, ast, sourceSpan, targetMatchableAttrs, targetProps) {
targetMatchableAttrs.push([name, /** @type {?} */ ((ast.source))]);
targetProps.push(new BoundProperty(name, ast, BoundPropertyType.DEFAULT, sourceSpan));
};
/**
* @param {?} name
* @param {?} expression
* @param {?} sourceSpan
* @param {?} targetMatchableAttrs
* @param {?} targetProps
* @return {?}
*/
BindingParser.prototype._parseAnimation = /**
* @param {?} name
* @param {?} expression
* @param {?} sourceSpan
* @param {?} targetMatchableAttrs
* @param {?} targetProps
* @return {?}
*/
function (name, expression, sourceSpan, targetMatchableAttrs, targetProps) {
// This will occur when a @trigger is not paired with an expression.
// For animations it is valid to not have an expression since */void
// states will be applied by angular when the element is attached/detached
var /** @type {?} */ ast = this._parseBinding(expression || 'undefined', false, sourceSpan);
targetMatchableAttrs.push([name, /** @type {?} */ ((ast.source))]);
targetProps.push(new BoundProperty(name, ast, BoundPropertyType.ANIMATION, sourceSpan));
};
/**
* @param {?} value
* @param {?} isHostBinding
* @param {?} sourceSpan
* @return {?}
*/
BindingParser.prototype._parseBinding = /**
* @param {?} value
* @param {?} isHostBinding
* @param {?} sourceSpan
* @return {?}
*/
function (value, isHostBinding, sourceSpan) {
var /** @type {?} */ sourceInfo = sourceSpan.start.toString();
try {
var /** @type {?} */ ast = isHostBinding ?
this._exprParser.parseSimpleBinding(value, sourceInfo, this._interpolationConfig) :
this._exprParser.parseBinding(value, sourceInfo, this._interpolationConfig);
if (ast)
this._reportExpressionParserErrors(ast.errors, sourceSpan);
this._checkPipes(ast, sourceSpan);
return ast;
}
catch (/** @type {?} */ e) {
this._reportError("" + e, sourceSpan);
return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo);
}
};
/**
* @param {?} elementSelector
* @param {?} boundProp
* @return {?}
*/
BindingParser.prototype.createElementPropertyAst = /**
* @param {?} elementSelector
* @param {?} boundProp
* @return {?}
*/
function (elementSelector, boundProp) {
if (boundProp.isAnimation) {
return new BoundElementPropertyAst(boundProp.name, PropertyBindingType.Animation, SecurityContext.NONE, boundProp.expression, null, boundProp.sourceSpan);
}
var /** @type {?} */ unit = null;
var /** @type {?} */ bindingType = /** @type {?} */ ((undefined));
var /** @type {?} */ boundPropertyName = null;
var /** @type {?} */ parts = boundProp.name.split(PROPERTY_PARTS_SEPARATOR);
var /** @type {?} */ securityContexts = /** @type {?} */ ((undefined));
// Check check for special cases (prefix style, attr, class)
if (parts.length > 1) {
if (parts[0] == ATTRIBUTE_PREFIX) {
boundPropertyName = parts[1];
this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, true);
securityContexts = calcPossibleSecurityContexts(this._schemaRegistry, elementSelector, boundPropertyName, true);
var /** @type {?} */ nsSeparatorIdx = boundPropertyName.indexOf(':');
if (nsSeparatorIdx > -1) {
var /** @type {?} */ ns = boundPropertyName.substring(0, nsSeparatorIdx);
var /** @type {?} */ name_1 = boundPropertyName.substring(nsSeparatorIdx + 1);
boundPropertyName = mergeNsAndName(ns, name_1);
}
bindingType = PropertyBindingType.Attribute;
}
else if (parts[0] == CLASS_PREFIX) {
boundPropertyName = parts[1];
bindingType = PropertyBindingType.Class;
securityContexts = [SecurityContext.NONE];
}
else if (parts[0] == STYLE_PREFIX) {
unit = parts.length > 2 ? parts[2] : null;
boundPropertyName = parts[1];
bindingType = PropertyBindingType.Style;
securityContexts = [SecurityContext.STYLE];
}
}
// If not a special case, use the full property name
if (boundPropertyName === null) {
boundPropertyName = this._schemaRegistry.getMappedPropName(boundProp.name);
securityContexts = calcPossibleSecurityContexts(this._schemaRegistry, elementSelector, boundPropertyName, false);
bindingType = PropertyBindingType.Property;
this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, false);
}
return new BoundElementPropertyAst(boundPropertyName, bindingType, securityContexts[0], boundProp.expression, unit, boundProp.sourceSpan);
};
/**
* @param {?} name
* @param {?} expression
* @param {?} sourceSpan
* @param {?} targetMatchableAttrs
* @param {?} targetEvents
* @return {?}
*/
BindingParser.prototype.parseEvent = /**
* @param {?} name
* @param {?} expression
* @param {?} sourceSpan
* @param {?} targetMatchableAttrs
* @param {?} targetEvents
* @return {?}
*/
function (name, expression, sourceSpan, targetMatchableAttrs, targetEvents) {
if (_isAnimationLabel(name)) {
name = name.substr(1);
this._parseAnimationEvent(name, expression, sourceSpan, targetEvents);
}
else {
this._parseEvent(name, expression, sourceSpan, targetMatchableAttrs, targetEvents);
}
};
/**
* @param {?} name
* @param {?} expression
* @param {?} sourceSpan
* @param {?} targetEvents
* @return {?}
*/
BindingParser.prototype._parseAnimationEvent = /**
* @param {?} name
* @param {?} expression
* @param {?} sourceSpan
* @param {?} targetEvents
* @return {?}
*/
function (name, expression, sourceSpan, targetEvents) {
var /** @type {?} */ matches = splitAtPeriod(name, [name, '']);
var /** @type {?} */ eventName = matches[0];
var /** @type {?} */ phase = matches[1].toLowerCase();
if (phase) {
switch (phase) {
case 'start':
case 'done':
var /** @type {?} */ ast = this._parseAction(expression, sourceSpan);
targetEvents.push(new BoundEventAst(eventName, null, phase, ast, sourceSpan));
break;
default:
this._reportError("The provided animation output phase value \"" + phase + "\" for \"@" + eventName + "\" is not supported (use start or done)", sourceSpan);
break;
}
}
else {
this._reportError("The animation trigger output event (@" + eventName + ") is missing its phase value name (start or done are currently supported)", sourceSpan);
}
};
/**
* @param {?} name
* @param {?} expression
* @param {?} sourceSpan
* @param {?} targetMatchableAttrs
* @param {?} targetEvents
* @return {?}
*/
BindingParser.prototype._parseEvent = /**
* @param {?} name
* @param {?} expression
* @param {?} sourceSpan
* @param {?} targetMatchableAttrs
* @param {?} targetEvents
* @return {?}
*/
function (name, expression, sourceSpan, targetMatchableAttrs, targetEvents) {
// long format: 'target: eventName'
var _a = splitAtColon(name, [/** @type {?} */ ((null)), name]), target = _a[0], eventName = _a[1];
var /** @type {?} */ ast = this._parseAction(expression, sourceSpan);
targetMatchableAttrs.push([/** @type {?} */ ((name)), /** @type {?} */ ((ast.source))]);
targetEvents.push(new BoundEventAst(eventName, target, null, ast, sourceSpan));
// Don't detect directives for event names for now,
// so don't add the event name to the matchableAttrs
};
/**
* @param {?} value
* @param {?} sourceSpan
* @return {?}
*/
BindingParser.prototype._parseAction = /**
* @param {?} value
* @param {?} sourceSpan
* @return {?}
*/
function (value, sourceSpan) {
var /** @type {?} */ sourceInfo = sourceSpan.start.toString();
try {
var /** @type {?} */ ast = this._exprParser.parseAction(value, sourceInfo, this._interpolationConfig);
if (ast) {
this._reportExpressionParserErrors(ast.errors, sourceSpan);
}
if (!ast || ast.ast instanceof EmptyExpr) {
this._reportError("Empty expressions are not allowed", sourceSpan);
return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo);
}
this._checkPipes(ast, sourceSpan);
return ast;
}
catch (/** @type {?} */ e) {
this._reportError("" + e, sourceSpan);
return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo);
}
};
/**
* @param {?} message
* @param {?} sourceSpan
* @param {?=} level
* @return {?}
*/
BindingParser.prototype._reportError = /**
* @param {?} message
* @param {?} sourceSpan
* @param {?=} level
* @return {?}
*/
function (message, sourceSpan, level) {
if (level === void 0) { level = ParseErrorLevel.ERROR; }
this._targetErrors.push(new ParseError(sourceSpan, message, level));
};
/**
* @param {?} errors
* @param {?} sourceSpan
* @return {?}
*/
BindingParser.prototype._reportExpressionParserErrors = /**
* @param {?} errors
* @param {?} sourceSpan
* @return {?}
*/
function (errors, sourceSpan) {
for (var _i = 0, errors_1 = errors; _i < errors_1.length; _i++) {
var error = errors_1[_i];
this._reportError(error.message, sourceSpan);
}
};
/**
* @param {?} ast
* @param {?} sourceSpan
* @return {?}
*/
BindingParser.prototype._checkPipes = /**
* @param {?} ast
* @param {?} sourceSpan
* @return {?}
*/
function (ast, sourceSpan) {
var _this = this;
if (ast) {
var /** @type {?} */ collector = new PipeCollector();
ast.visit(collector);
collector.pipes.forEach(function (ast, pipeName) {
var /** @type {?} */ pipeMeta = _this.pipesByName.get(pipeName);
if (!pipeMeta) {
_this._reportError("The pipe '" + pipeName + "' could not be found", new ParseSourceSpan(sourceSpan.start.moveBy(ast.span.start), sourceSpan.start.moveBy(ast.span.end)));
}
else {
_this._usedPipes.set(pipeName, pipeMeta);
}
});
}
};
/**
* @param {?} propName the name of the property / attribute
* @param {?} sourceSpan
* @param {?} isAttr true when binding to an attribute
* @return {?}
*/
BindingParser.prototype._validatePropertyOrAttributeName = /**
* @param {?} propName the name of the property / attribute
* @param {?} sourceSpan
* @param {?} isAttr true when binding to an attribute
* @return {?}
*/
function (propName, sourceSpan, isAttr) {
var /** @type {?} */ report = isAttr ? this._schemaRegistry.validateAttribute(propName) :
this._schemaRegistry.validateProperty(propName);
if (report.error) {
this._reportError(/** @type {?} */ ((report.msg)), sourceSpan, ParseErrorLevel.ERROR);
}
};
return BindingParser;
}());
var PipeCollector = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(PipeCollector, _super);
function PipeCollector() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.pipes = new Map();
return _this;
}
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
PipeCollector.prototype.visitPipe = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
this.pipes.set(ast.name, ast);
ast.exp.visit(this);
this.visitAll(ast.args, context);
return null;
};
return PipeCollector;
}(RecursiveAstVisitor));
/**
* @param {?} name
* @return {?}
*/
function _isAnimationLabel(name) {
return name[0] == '@';
}
/**
* @param {?} registry
* @param {?} selector
* @param {?} propName
* @param {?} isAttribute
* @return {?}
*/
function calcPossibleSecurityContexts(registry, selector, propName, isAttribute) {
var /** @type {?} */ ctxs = [];
CssSelector.parse(selector).forEach(function (selector) {
var /** @type {?} */ elementNames = selector.element ? [selector.element] : registry.allKnownElementNames();
var /** @type {?} */ notElementNames = new Set(selector.notSelectors.filter(function (selector) { return selector.isElementSelector(); })
.map(function (selector) { return selector.element; }));
var /** @type {?} */ possibleElementNames = elementNames.filter(function (elementName) { return !notElementNames.has(elementName); });
ctxs.push.apply(ctxs, possibleElementNames.map(function (elementName) { return registry.securityContext(elementName, propName, isAttribute); }));
});
return ctxs.length === 0 ? [SecurityContext.NONE] : Array.from(new Set(ctxs)).sort();
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(let-)|(ref-|#)|(on-)|(bindon-)|(@))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/;
// Group 1 = "bind-"
var KW_BIND_IDX = 1;
// Group 2 = "let-"
var KW_LET_IDX = 2;
// Group 3 = "ref-/#"
var KW_REF_IDX = 3;
// Group 4 = "on-"
var KW_ON_IDX = 4;
// Group 5 = "bindon-"
var KW_BINDON_IDX = 5;
// Group 6 = "@"
var KW_AT_IDX = 6;
// Group 7 = the identifier after "bind-", "let-", "ref-/#", "on-", "bindon-" or "@"
var IDENT_KW_IDX = 7;
// Group 8 = identifier inside [()]
var IDENT_BANANA_BOX_IDX = 8;
// Group 9 = identifier inside []
var IDENT_PROPERTY_IDX = 9;
// Group 10 = identifier inside ()
var IDENT_EVENT_IDX = 10;
// deprecated in 4.x
var TEMPLATE_ELEMENT = 'template';
// deprecated in 4.x
var TEMPLATE_ATTR = 'template';
var TEMPLATE_ATTR_PREFIX = '*';
var CLASS_ATTR = 'class';
var TEXT_CSS_SELECTOR = CssSelector.parse('*')[0];
var TEMPLATE_ELEMENT_DEPRECATION_WARNING = 'The <template> element is deprecated. Use <ng-template> instead';
var TEMPLATE_ATTR_DEPRECATION_WARNING = 'The template attribute is deprecated. Use an ng-template element instead.';
var warningCounts = {};
/**
* @param {?} warnings
* @return {?}
*/
function warnOnlyOnce(warnings) {
return function (error) {
if (warnings.indexOf(error.msg) !== -1) {
warningCounts[error.msg] = (warningCounts[error.msg] || 0) + 1;
return warningCounts[error.msg] <= 1;
}
return true;
};
}
var TemplateParseError = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(TemplateParseError, _super);
function TemplateParseError(message, span, level) {
return _super.call(this, span, message, level) || this;
}
return TemplateParseError;
}(ParseError));
var TemplateParseResult = (function () {
function TemplateParseResult(templateAst, usedPipes, errors) {
this.templateAst = templateAst;
this.usedPipes = usedPipes;
this.errors = errors;
}
return TemplateParseResult;
}());
var TemplateParser = (function () {
function TemplateParser(_config, _reflector, _exprParser, _schemaRegistry, _htmlParser, _console, transforms) {
this._config = _config;
this._reflector = _reflector;
this._exprParser = _exprParser;
this._schemaRegistry = _schemaRegistry;
this._htmlParser = _htmlParser;
this._console = _console;
this.transforms = transforms;
}
/**
* @param {?} component
* @param {?} template
* @param {?} directives
* @param {?} pipes
* @param {?} schemas
* @param {?} templateUrl
* @param {?} preserveWhitespaces
* @return {?}
*/
TemplateParser.prototype.parse = /**
* @param {?} component
* @param {?} template
* @param {?} directives
* @param {?} pipes
* @param {?} schemas
* @param {?} templateUrl
* @param {?} preserveWhitespaces
* @return {?}
*/
function (component, template, directives, pipes, schemas, templateUrl, preserveWhitespaces) {
var /** @type {?} */ result = this.tryParse(component, template, directives, pipes, schemas, templateUrl, preserveWhitespaces);
var /** @type {?} */ warnings = /** @type {?} */ ((result.errors)).filter(function (error) { return error.level === ParseErrorLevel.WARNING; }).filter(warnOnlyOnce([TEMPLATE_ATTR_DEPRECATION_WARNING, TEMPLATE_ELEMENT_DEPRECATION_WARNING]));
var /** @type {?} */ errors = /** @type {?} */ ((result.errors)).filter(function (error) { return error.level === ParseErrorLevel.ERROR; });
if (warnings.length > 0) {
this._console.warn("Template parse warnings:\n" + warnings.join('\n'));
}
if (errors.length > 0) {
var /** @type {?} */ errorString = errors.join('\n');
throw syntaxError("Template parse errors:\n" + errorString, errors);
}
return { template: /** @type {?} */ ((result.templateAst)), pipes: /** @type {?} */ ((result.usedPipes)) };
};
/**
* @param {?} component
* @param {?} template
* @param {?} directives
* @param {?} pipes
* @param {?} schemas
* @param {?} templateUrl
* @param {?} preserveWhitespaces
* @return {?}
*/
TemplateParser.prototype.tryParse = /**
* @param {?} component
* @param {?} template
* @param {?} directives
* @param {?} pipes
* @param {?} schemas
* @param {?} templateUrl
* @param {?} preserveWhitespaces
* @return {?}
*/
function (component, template, directives, pipes, schemas, templateUrl, preserveWhitespaces) {
var /** @type {?} */ htmlParseResult = typeof template === 'string' ? /** @type {?} */ ((this._htmlParser)).parse(template, templateUrl, true, this.getInterpolationConfig(component)) :
template;
if (!preserveWhitespaces) {
htmlParseResult = removeWhitespaces(htmlParseResult);
}
return this.tryParseHtml(this.expandHtml(htmlParseResult), component, directives, pipes, schemas);
};
/**
* @param {?} htmlAstWithErrors
* @param {?} component
* @param {?} directives
* @param {?} pipes
* @param {?} schemas
* @return {?}
*/
TemplateParser.prototype.tryParseHtml = /**
* @param {?} htmlAstWithErrors
* @param {?} component
* @param {?} directives
* @param {?} pipes
* @param {?} schemas
* @return {?}
*/
function (htmlAstWithErrors, component, directives, pipes, schemas) {
var /** @type {?} */ result;
var /** @type {?} */ errors = htmlAstWithErrors.errors;
var /** @type {?} */ usedPipes = [];
if (htmlAstWithErrors.rootNodes.length > 0) {
var /** @type {?} */ uniqDirectives = removeSummaryDuplicates(directives);
var /** @type {?} */ uniqPipes = removeSummaryDuplicates(pipes);
var /** @type {?} */ providerViewContext = new ProviderViewContext(this._reflector, component);
var /** @type {?} */ interpolationConfig = /** @type {?} */ ((undefined));
if (component.template && component.template.interpolation) {
interpolationConfig = {
start: component.template.interpolation[0],
end: component.template.interpolation[1]
};
}
var /** @type {?} */ bindingParser = new BindingParser(this._exprParser, /** @type {?} */ ((interpolationConfig)), this._schemaRegistry, uniqPipes, errors);
var /** @type {?} */ parseVisitor = new TemplateParseVisitor(this._reflector, this._config, providerViewContext, uniqDirectives, bindingParser, this._schemaRegistry, schemas, errors);
result = visitAll(parseVisitor, htmlAstWithErrors.rootNodes, EMPTY_ELEMENT_CONTEXT);
errors.push.apply(errors, providerViewContext.errors);
usedPipes.push.apply(usedPipes, bindingParser.getUsedPipes());
}
else {
result = [];
}
this._assertNoReferenceDuplicationOnTemplate(result, errors);
if (errors.length > 0) {
return new TemplateParseResult(result, usedPipes, errors);
}
if (this.transforms) {
this.transforms.forEach(function (transform) { result = templateVisitAll(transform, result); });
}
return new TemplateParseResult(result, usedPipes, errors);
};
/**
* @param {?} htmlAstWithErrors
* @param {?=} forced
* @return {?}
*/
TemplateParser.prototype.expandHtml = /**
* @param {?} htmlAstWithErrors
* @param {?=} forced
* @return {?}
*/
function (htmlAstWithErrors, forced) {
if (forced === void 0) { forced = false; }
var /** @type {?} */ errors = htmlAstWithErrors.errors;
if (errors.length == 0 || forced) {
// Transform ICU messages to angular directives
var /** @type {?} */ expandedHtmlAst = expandNodes(htmlAstWithErrors.rootNodes);
errors.push.apply(errors, expandedHtmlAst.errors);
htmlAstWithErrors = new ParseTreeResult(expandedHtmlAst.nodes, errors);
}
return htmlAstWithErrors;
};
/**
* @param {?} component
* @return {?}
*/
TemplateParser.prototype.getInterpolationConfig = /**
* @param {?} component
* @return {?}
*/
function (component) {
if (component.template) {
return InterpolationConfig.fromArray(component.template.interpolation);
}
return undefined;
};
/** @internal */
/**
* \@internal
* @param {?} result
* @param {?} errors
* @return {?}
*/
TemplateParser.prototype._assertNoReferenceDuplicationOnTemplate = /**
* \@internal
* @param {?} result
* @param {?} errors
* @return {?}
*/
function (result, errors) {
var /** @type {?} */ existingReferences = [];
result.filter(function (element) { return !!(/** @type {?} */ (element)).references; })
.forEach(function (element) {
return (/** @type {?} */ (element)).references.forEach(function (reference) {
var /** @type {?} */ name = reference.name;
if (existingReferences.indexOf(name) < 0) {
existingReferences.push(name);
}
else {
var /** @type {?} */ error = new TemplateParseError("Reference \"#" + name + "\" is defined several times", reference.sourceSpan, ParseErrorLevel.ERROR);
errors.push(error);
}
});
});
};
return TemplateParser;
}());
var TemplateParseVisitor = (function () {
function TemplateParseVisitor(reflector, config, providerViewContext, directives, _bindingParser, _schemaRegistry, _schemas, _targetErrors) {
var _this = this;
this.reflector = reflector;
this.config = config;
this.providerViewContext = providerViewContext;
this._bindingParser = _bindingParser;
this._schemaRegistry = _schemaRegistry;
this._schemas = _schemas;
this._targetErrors = _targetErrors;
this.selectorMatcher = new SelectorMatcher();
this.directivesIndex = new Map();
this.ngContentCount = 0;
// Note: queries start with id 1 so we can use the number in a Bloom filter!
this.contentQueryStartId = providerViewContext.component.viewQueries.length + 1;
directives.forEach(function (directive, index) {
var /** @type {?} */ selector = CssSelector.parse(/** @type {?} */ ((directive.selector)));
_this.selectorMatcher.addSelectables(selector, directive);
_this.directivesIndex.set(directive, index);
});
}
/**
* @param {?} expansion
* @param {?} context
* @return {?}
*/
TemplateParseVisitor.prototype.visitExpansion = /**
* @param {?} expansion
* @param {?} context
* @return {?}
*/
function (expansion, context) { return null; };
/**
* @param {?} expansionCase
* @param {?} context
* @return {?}
*/
TemplateParseVisitor.prototype.visitExpansionCase = /**
* @param {?} expansionCase
* @param {?} context
* @return {?}
*/
function (expansionCase, context) { return null; };
/**
* @param {?} text
* @param {?} parent
* @return {?}
*/
TemplateParseVisitor.prototype.visitText = /**
* @param {?} text
* @param {?} parent
* @return {?}
*/
function (text, parent) {
var /** @type {?} */ ngContentIndex = /** @type {?} */ ((parent.findNgContentIndex(TEXT_CSS_SELECTOR)));
var /** @type {?} */ valueNoNgsp = replaceNgsp(text.value);
var /** @type {?} */ expr = this._bindingParser.parseInterpolation(valueNoNgsp, /** @type {?} */ ((text.sourceSpan)));
return expr ? new BoundTextAst(expr, ngContentIndex, /** @type {?} */ ((text.sourceSpan))) :
new TextAst(valueNoNgsp, ngContentIndex, /** @type {?} */ ((text.sourceSpan)));
};
/**
* @param {?} attribute
* @param {?} context
* @return {?}
*/
TemplateParseVisitor.prototype.visitAttribute = /**
* @param {?} attribute
* @param {?} context
* @return {?}
*/
function (attribute, context) {
return new AttrAst(attribute.name, attribute.value, attribute.sourceSpan);
};
/**
* @param {?} comment
* @param {?} context
* @return {?}
*/
TemplateParseVisitor.prototype.visitComment = /**
* @param {?} comment
* @param {?} context
* @return {?}
*/
function (comment, context) { return null; };
/**
* @param {?} element
* @param {?} parent
* @return {?}
*/
TemplateParseVisitor.prototype.visitElement = /**
* @param {?} element
* @param {?} parent
* @return {?}
*/
function (element, parent) {
var _this = this;
var /** @type {?} */ queryStartIndex = this.contentQueryStartId;
var /** @type {?} */ nodeName = element.name;
var /** @type {?} */ preparsedElement = preparseElement(element);
if (preparsedElement.type === PreparsedElementType.SCRIPT ||
preparsedElement.type === PreparsedElementType.STYLE) {
// Skipping <script> for security reasons
// Skipping <style> as we already processed them
// in the StyleCompiler
return null;
}
if (preparsedElement.type === PreparsedElementType.STYLESHEET &&
isStyleUrlResolvable(preparsedElement.hrefAttr)) {
// Skipping stylesheets with either relative urls or package scheme as we already processed
// them in the StyleCompiler
return null;
}
var /** @type {?} */ matchableAttrs = [];
var /** @type {?} */ elementOrDirectiveProps = [];
var /** @type {?} */ elementOrDirectiveRefs = [];
var /** @type {?} */ elementVars = [];
var /** @type {?} */ events = [];
var /** @type {?} */ templateElementOrDirectiveProps = [];
var /** @type {?} */ templateMatchableAttrs = [];
var /** @type {?} */ templateElementVars = [];
var /** @type {?} */ hasInlineTemplates = false;
var /** @type {?} */ attrs = [];
var /** @type {?} */ isTemplateElement = isTemplate(element, this.config.enableLegacyTemplate, function (m, span) { return _this._reportError(m, span, ParseErrorLevel.WARNING); });
element.attrs.forEach(function (attr) {
var /** @type {?} */ hasBinding = _this._parseAttr(isTemplateElement, attr, matchableAttrs, elementOrDirectiveProps, events, elementOrDirectiveRefs, elementVars);
var /** @type {?} */ templateBindingsSource;
var /** @type {?} */ prefixToken;
var /** @type {?} */ normalizedName = _this._normalizeAttributeName(attr.name);
if (_this.config.enableLegacyTemplate && normalizedName == TEMPLATE_ATTR) {
_this._reportError(TEMPLATE_ATTR_DEPRECATION_WARNING, attr.sourceSpan, ParseErrorLevel.WARNING);
templateBindingsSource = attr.value;
}
else if (normalizedName.startsWith(TEMPLATE_ATTR_PREFIX)) {
templateBindingsSource = attr.value;
prefixToken = normalizedName.substring(TEMPLATE_ATTR_PREFIX.length) + ':';
}
var /** @type {?} */ hasTemplateBinding = templateBindingsSource != null;
if (hasTemplateBinding) {
if (hasInlineTemplates) {
_this._reportError("Can't have multiple template bindings on one element. Use only one attribute named 'template' or prefixed with *", attr.sourceSpan);
}
hasInlineTemplates = true;
_this._bindingParser.parseInlineTemplateBinding(/** @type {?} */ ((prefixToken)), /** @type {?} */ ((templateBindingsSource)), attr.sourceSpan, templateMatchableAttrs, templateElementOrDirectiveProps, templateElementVars);
}
if (!hasBinding && !hasTemplateBinding) {
// don't include the bindings as attributes as well in the AST
attrs.push(_this.visitAttribute(attr, null));
matchableAttrs.push([attr.name, attr.value]);
}
});
var /** @type {?} */ elementCssSelector = createElementCssSelector(nodeName, matchableAttrs);
var _a = this._parseDirectives(this.selectorMatcher, elementCssSelector), directiveMetas = _a.directives, matchElement = _a.matchElement;
var /** @type {?} */ references = [];
var /** @type {?} */ boundDirectivePropNames = new Set();
var /** @type {?} */ directiveAsts = this._createDirectiveAsts(isTemplateElement, element.name, directiveMetas, elementOrDirectiveProps, elementOrDirectiveRefs, /** @type {?} */ ((element.sourceSpan)), references, boundDirectivePropNames);
var /** @type {?} */ elementProps = this._createElementPropertyAsts(element.name, elementOrDirectiveProps, boundDirectivePropNames);
var /** @type {?} */ isViewRoot = parent.isTemplateElement || hasInlineTemplates;
var /** @type {?} */ providerContext = new ProviderElementContext(this.providerViewContext, /** @type {?} */ ((parent.providerContext)), isViewRoot, directiveAsts, attrs, references, isTemplateElement, queryStartIndex, /** @type {?} */ ((element.sourceSpan)));
var /** @type {?} */ children = visitAll(preparsedElement.nonBindable ? NON_BINDABLE_VISITOR : this, element.children, ElementContext.create(isTemplateElement, directiveAsts, isTemplateElement ? /** @type {?} */ ((parent.providerContext)) : providerContext));
providerContext.afterElement();
// Override the actual selector when the `ngProjectAs` attribute is provided
var /** @type {?} */ projectionSelector = preparsedElement.projectAs != null ?
CssSelector.parse(preparsedElement.projectAs)[0] :
elementCssSelector;
var /** @type {?} */ ngContentIndex = /** @type {?} */ ((parent.findNgContentIndex(projectionSelector)));
var /** @type {?} */ parsedElement;
if (preparsedElement.type === PreparsedElementType.NG_CONTENT) {
if (element.children && !element.children.every(_isEmptyTextNode)) {
this._reportError("<ng-content> element cannot have content.", /** @type {?} */ ((element.sourceSpan)));
}
parsedElement = new NgContentAst(this.ngContentCount++, hasInlineTemplates ? /** @type {?} */ ((null)) : ngContentIndex, /** @type {?} */ ((element.sourceSpan)));
}
else if (isTemplateElement) {
this._assertAllEventsPublishedByDirectives(directiveAsts, events);
this._assertNoComponentsNorElementBindingsOnTemplate(directiveAsts, elementProps, /** @type {?} */ ((element.sourceSpan)));
parsedElement = new EmbeddedTemplateAst(attrs, events, references, elementVars, providerContext.transformedDirectiveAsts, providerContext.transformProviders, providerContext.transformedHasViewContainer, providerContext.queryMatches, children, hasInlineTemplates ? /** @type {?} */ ((null)) : ngContentIndex, /** @type {?} */ ((element.sourceSpan)));
}
else {
this._assertElementExists(matchElement, element);
this._assertOnlyOneComponent(directiveAsts, /** @type {?} */ ((element.sourceSpan)));
var /** @type {?} */ ngContentIndex_1 = hasInlineTemplates ? null : parent.findNgContentIndex(projectionSelector);
parsedElement = new ElementAst(nodeName, attrs, elementProps, events, references, providerContext.transformedDirectiveAsts, providerContext.transformProviders, providerContext.transformedHasViewContainer, providerContext.queryMatches, children, hasInlineTemplates ? null : ngContentIndex_1, element.sourceSpan, element.endSourceSpan || null);
}
if (hasInlineTemplates) {
var /** @type {?} */ templateQueryStartIndex = this.contentQueryStartId;
var /** @type {?} */ templateSelector = createElementCssSelector(TEMPLATE_ELEMENT, templateMatchableAttrs);
var templateDirectiveMetas = this._parseDirectives(this.selectorMatcher, templateSelector).directives;
var /** @type {?} */ templateBoundDirectivePropNames = new Set();
var /** @type {?} */ templateDirectiveAsts = this._createDirectiveAsts(true, element.name, templateDirectiveMetas, templateElementOrDirectiveProps, [], /** @type {?} */ ((element.sourceSpan)), [], templateBoundDirectivePropNames);
var /** @type {?} */ templateElementProps = this._createElementPropertyAsts(element.name, templateElementOrDirectiveProps, templateBoundDirectivePropNames);
this._assertNoComponentsNorElementBindingsOnTemplate(templateDirectiveAsts, templateElementProps, /** @type {?} */ ((element.sourceSpan)));
var /** @type {?} */ templateProviderContext = new ProviderElementContext(this.providerViewContext, /** @type {?} */ ((parent.providerContext)), parent.isTemplateElement, templateDirectiveAsts, [], [], true, templateQueryStartIndex, /** @type {?} */ ((element.sourceSpan)));
templateProviderContext.afterElement();
parsedElement = new EmbeddedTemplateAst([], [], [], templateElementVars, templateProviderContext.transformedDirectiveAsts, templateProviderContext.transformProviders, templateProviderContext.transformedHasViewContainer, templateProviderContext.queryMatches, [parsedElement], ngContentIndex, /** @type {?} */ ((element.sourceSpan)));
}
return parsedElement;
};
/**
* @param {?} isTemplateElement
* @param {?} attr
* @param {?} targetMatchableAttrs
* @param {?} targetProps
* @param {?} targetEvents
* @param {?} targetRefs
* @param {?} targetVars
* @return {?}
*/
TemplateParseVisitor.prototype._parseAttr = /**
* @param {?} isTemplateElement
* @param {?} attr
* @param {?} targetMatchableAttrs
* @param {?} targetProps
* @param {?} targetEvents
* @param {?} targetRefs
* @param {?} targetVars
* @return {?}
*/
function (isTemplateElement, attr, targetMatchableAttrs, targetProps, targetEvents, targetRefs, targetVars) {
var /** @type {?} */ name = this._normalizeAttributeName(attr.name);
var /** @type {?} */ value = attr.value;
var /** @type {?} */ srcSpan = attr.sourceSpan;
var /** @type {?} */ bindParts = name.match(BIND_NAME_REGEXP);
var /** @type {?} */ hasBinding = false;
if (bindParts !== null) {
hasBinding = true;
if (bindParts[KW_BIND_IDX] != null) {
this._bindingParser.parsePropertyBinding(bindParts[IDENT_KW_IDX], value, false, srcSpan, targetMatchableAttrs, targetProps);
}
else if (bindParts[KW_LET_IDX]) {
if (isTemplateElement) {
var /** @type {?} */ identifier = bindParts[IDENT_KW_IDX];
this._parseVariable(identifier, value, srcSpan, targetVars);
}
else {
this._reportError("\"let-\" is only supported on ng-template elements.", srcSpan);
}
}
else if (bindParts[KW_REF_IDX]) {
var /** @type {?} */ identifier = bindParts[IDENT_KW_IDX];
this._parseReference(identifier, value, srcSpan, targetRefs);
}
else if (bindParts[KW_ON_IDX]) {
this._bindingParser.parseEvent(bindParts[IDENT_KW_IDX], value, srcSpan, targetMatchableAttrs, targetEvents);
}
else if (bindParts[KW_BINDON_IDX]) {
this._bindingParser.parsePropertyBinding(bindParts[IDENT_KW_IDX], value, false, srcSpan, targetMatchableAttrs, targetProps);
this._parseAssignmentEvent(bindParts[IDENT_KW_IDX], value, srcSpan, targetMatchableAttrs, targetEvents);
}
else if (bindParts[KW_AT_IDX]) {
this._bindingParser.parseLiteralAttr(name, value, srcSpan, targetMatchableAttrs, targetProps);
}
else if (bindParts[IDENT_BANANA_BOX_IDX]) {
this._bindingParser.parsePropertyBinding(bindParts[IDENT_BANANA_BOX_IDX], value, false, srcSpan, targetMatchableAttrs, targetProps);
this._parseAssignmentEvent(bindParts[IDENT_BANANA_BOX_IDX], value, srcSpan, targetMatchableAttrs, targetEvents);
}
else if (bindParts[IDENT_PROPERTY_IDX]) {
this._bindingParser.parsePropertyBinding(bindParts[IDENT_PROPERTY_IDX], value, false, srcSpan, targetMatchableAttrs, targetProps);
}
else if (bindParts[IDENT_EVENT_IDX]) {
this._bindingParser.parseEvent(bindParts[IDENT_EVENT_IDX], value, srcSpan, targetMatchableAttrs, targetEvents);
}
}
else {
hasBinding = this._bindingParser.parsePropertyInterpolation(name, value, srcSpan, targetMatchableAttrs, targetProps);
}
if (!hasBinding) {
this._bindingParser.parseLiteralAttr(name, value, srcSpan, targetMatchableAttrs, targetProps);
}
return hasBinding;
};
/**
* @param {?} attrName
* @return {?}
*/
TemplateParseVisitor.prototype._normalizeAttributeName = /**
* @param {?} attrName
* @return {?}
*/
function (attrName) {
return /^data-/i.test(attrName) ? attrName.substring(5) : attrName;
};
/**
* @param {?} identifier
* @param {?} value
* @param {?} sourceSpan
* @param {?} targetVars
* @return {?}
*/
TemplateParseVisitor.prototype._parseVariable = /**
* @param {?} identifier
* @param {?} value
* @param {?} sourceSpan
* @param {?} targetVars
* @return {?}
*/
function (identifier, value, sourceSpan, targetVars) {
if (identifier.indexOf('-') > -1) {
this._reportError("\"-\" is not allowed in variable names", sourceSpan);
}
targetVars.push(new VariableAst(identifier, value, sourceSpan));
};
/**
* @param {?} identifier
* @param {?} value
* @param {?} sourceSpan
* @param {?} targetRefs
* @return {?}
*/
TemplateParseVisitor.prototype._parseReference = /**
* @param {?} identifier
* @param {?} value
* @param {?} sourceSpan
* @param {?} targetRefs
* @return {?}
*/
function (identifier, value, sourceSpan, targetRefs) {
if (identifier.indexOf('-') > -1) {
this._reportError("\"-\" is not allowed in reference names", sourceSpan);
}
targetRefs.push(new ElementOrDirectiveRef(identifier, value, sourceSpan));
};
/**
* @param {?} name
* @param {?} expression
* @param {?} sourceSpan
* @param {?} targetMatchableAttrs
* @param {?} targetEvents
* @return {?}
*/
TemplateParseVisitor.prototype._parseAssignmentEvent = /**
* @param {?} name
* @param {?} expression
* @param {?} sourceSpan
* @param {?} targetMatchableAttrs
* @param {?} targetEvents
* @return {?}
*/
function (name, expression, sourceSpan, targetMatchableAttrs, targetEvents) {
this._bindingParser.parseEvent(name + "Change", expression + "=$event", sourceSpan, targetMatchableAttrs, targetEvents);
};
/**
* @param {?} selectorMatcher
* @param {?} elementCssSelector
* @return {?}
*/
TemplateParseVisitor.prototype._parseDirectives = /**
* @param {?} selectorMatcher
* @param {?} elementCssSelector
* @return {?}
*/
function (selectorMatcher, elementCssSelector) {
var _this = this;
// Need to sort the directives so that we get consistent results throughout,
// as selectorMatcher uses Maps inside.
// Also deduplicate directives as they might match more than one time!
var /** @type {?} */ directives = new Array(this.directivesIndex.size);
// Whether any directive selector matches on the element name
var /** @type {?} */ matchElement = false;
selectorMatcher.match(elementCssSelector, function (selector, directive) {
directives[/** @type {?} */ ((_this.directivesIndex.get(directive)))] = directive;
matchElement = matchElement || selector.hasElementSelector();
});
return {
directives: directives.filter(function (dir) { return !!dir; }),
matchElement: matchElement,
};
};
/**
* @param {?} isTemplateElement
* @param {?} elementName
* @param {?} directives
* @param {?} props
* @param {?} elementOrDirectiveRefs
* @param {?} elementSourceSpan
* @param {?} targetReferences
* @param {?} targetBoundDirectivePropNames
* @return {?}
*/
TemplateParseVisitor.prototype._createDirectiveAsts = /**
* @param {?} isTemplateElement
* @param {?} elementName
* @param {?} directives
* @param {?} props
* @param {?} elementOrDirectiveRefs
* @param {?} elementSourceSpan
* @param {?} targetReferences
* @param {?} targetBoundDirectivePropNames
* @return {?}
*/
function (isTemplateElement, elementName, directives, props, elementOrDirectiveRefs, elementSourceSpan, targetReferences, targetBoundDirectivePropNames) {
var _this = this;
var /** @type {?} */ matchedReferences = new Set();
var /** @type {?} */ component = /** @type {?} */ ((null));
var /** @type {?} */ directiveAsts = directives.map(function (directive) {
var /** @type {?} */ sourceSpan = new ParseSourceSpan(elementSourceSpan.start, elementSourceSpan.end, "Directive " + identifierName(directive.type));
if (directive.isComponent) {
component = directive;
}
var /** @type {?} */ directiveProperties = [];
var /** @type {?} */ hostProperties = /** @type {?} */ ((_this._bindingParser.createDirectiveHostPropertyAsts(directive, elementName, sourceSpan)));
// Note: We need to check the host properties here as well,
// as we don't know the element name in the DirectiveWrapperCompiler yet.
hostProperties = _this._checkPropertiesInSchema(elementName, hostProperties);
var /** @type {?} */ hostEvents = /** @type {?} */ ((_this._bindingParser.createDirectiveHostEventAsts(directive, sourceSpan)));
_this._createDirectivePropertyAsts(directive.inputs, props, directiveProperties, targetBoundDirectivePropNames);
elementOrDirectiveRefs.forEach(function (elOrDirRef) {
if ((elOrDirRef.value.length === 0 && directive.isComponent) ||
(elOrDirRef.isReferenceToDirective(directive))) {
targetReferences.push(new ReferenceAst(elOrDirRef.name, createTokenForReference(directive.type.reference), elOrDirRef.sourceSpan));
matchedReferences.add(elOrDirRef.name);
}
});
var /** @type {?} */ contentQueryStartId = _this.contentQueryStartId;
_this.contentQueryStartId += directive.queries.length;
return new DirectiveAst(directive, directiveProperties, hostProperties, hostEvents, contentQueryStartId, sourceSpan);
});
elementOrDirectiveRefs.forEach(function (elOrDirRef) {
if (elOrDirRef.value.length > 0) {
if (!matchedReferences.has(elOrDirRef.name)) {
_this._reportError("There is no directive with \"exportAs\" set to \"" + elOrDirRef.value + "\"", elOrDirRef.sourceSpan);
}
}
else if (!component) {
var /** @type {?} */ refToken = /** @type {?} */ ((null));
if (isTemplateElement) {
refToken = createTokenForExternalReference(_this.reflector, Identifiers.TemplateRef);
}
targetReferences.push(new ReferenceAst(elOrDirRef.name, refToken, elOrDirRef.sourceSpan));
}
});
return directiveAsts;
};
/**
* @param {?} directiveProperties
* @param {?} boundProps
* @param {?} targetBoundDirectiveProps
* @param {?} targetBoundDirectivePropNames
* @return {?}
*/
TemplateParseVisitor.prototype._createDirectivePropertyAsts = /**
* @param {?} directiveProperties
* @param {?} boundProps
* @param {?} targetBoundDirectiveProps
* @param {?} targetBoundDirectivePropNames
* @return {?}
*/
function (directiveProperties, boundProps, targetBoundDirectiveProps, targetBoundDirectivePropNames) {
if (directiveProperties) {
var /** @type {?} */ boundPropsByName_1 = new Map();
boundProps.forEach(function (boundProp) {
var /** @type {?} */ prevValue = boundPropsByName_1.get(boundProp.name);
if (!prevValue || prevValue.isLiteral) {
// give [a]="b" a higher precedence than a="b" on the same element
// give [a]="b" a higher precedence than a="b" on the same element
boundPropsByName_1.set(boundProp.name, boundProp);
}
});
Object.keys(directiveProperties).forEach(function (dirProp) {
var /** @type {?} */ elProp = directiveProperties[dirProp];
var /** @type {?} */ boundProp = boundPropsByName_1.get(elProp);
// Bindings are optional, so this binding only needs to be set up if an expression is given.
if (boundProp) {
targetBoundDirectivePropNames.add(boundProp.name);
if (!isEmptyExpression(boundProp.expression)) {
targetBoundDirectiveProps.push(new BoundDirectivePropertyAst(dirProp, boundProp.name, boundProp.expression, boundProp.sourceSpan));
}
}
});
}
};
/**
* @param {?} elementName
* @param {?} props
* @param {?} boundDirectivePropNames
* @return {?}
*/
TemplateParseVisitor.prototype._createElementPropertyAsts = /**
* @param {?} elementName
* @param {?} props
* @param {?} boundDirectivePropNames
* @return {?}
*/
function (elementName, props, boundDirectivePropNames) {
var _this = this;
var /** @type {?} */ boundElementProps = [];
props.forEach(function (prop) {
if (!prop.isLiteral && !boundDirectivePropNames.has(prop.name)) {
boundElementProps.push(_this._bindingParser.createElementPropertyAst(elementName, prop));
}
});
return this._checkPropertiesInSchema(elementName, boundElementProps);
};
/**
* @param {?} directives
* @return {?}
*/
TemplateParseVisitor.prototype._findComponentDirectives = /**
* @param {?} directives
* @return {?}
*/
function (directives) {
return directives.filter(function (directive) { return directive.directive.isComponent; });
};
/**
* @param {?} directives
* @return {?}
*/
TemplateParseVisitor.prototype._findComponentDirectiveNames = /**
* @param {?} directives
* @return {?}
*/
function (directives) {
return this._findComponentDirectives(directives)
.map(function (directive) { return /** @type {?} */ ((identifierName(directive.directive.type))); });
};
/**
* @param {?} directives
* @param {?} sourceSpan
* @return {?}
*/
TemplateParseVisitor.prototype._assertOnlyOneComponent = /**
* @param {?} directives
* @param {?} sourceSpan
* @return {?}
*/
function (directives, sourceSpan) {
var /** @type {?} */ componentTypeNames = this._findComponentDirectiveNames(directives);
if (componentTypeNames.length > 1) {
this._reportError("More than one component matched on this element.\n" +
"Make sure that only one component's selector can match a given element.\n" +
("Conflicting components: " + componentTypeNames.join(',')), sourceSpan);
}
};
/**
* Make sure that non-angular tags conform to the schemas.
*
* Note: An element is considered an angular tag when at least one directive selector matches the
* tag name.
*
* @param {?} matchElement Whether any directive has matched on the tag name
* @param {?} element the html element
* @return {?}
*/
TemplateParseVisitor.prototype._assertElementExists = /**
* Make sure that non-angular tags conform to the schemas.
*
* Note: An element is considered an angular tag when at least one directive selector matches the
* tag name.
*
* @param {?} matchElement Whether any directive has matched on the tag name
* @param {?} element the html element
* @return {?}
*/
function (matchElement, element) {
var /** @type {?} */ elName = element.name.replace(/^:xhtml:/, '');
if (!matchElement && !this._schemaRegistry.hasElement(elName, this._schemas)) {
var /** @type {?} */ errorMsg = "'" + elName + "' is not a known element:\n";
errorMsg +=
"1. If '" + elName + "' is an Angular component, then verify that it is part of this module.\n";
if (elName.indexOf('-') > -1) {
errorMsg +=
"2. If '" + elName + "' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.";
}
else {
errorMsg +=
"2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.";
}
this._reportError(errorMsg, /** @type {?} */ ((element.sourceSpan)));
}
};
/**
* @param {?} directives
* @param {?} elementProps
* @param {?} sourceSpan
* @return {?}
*/
TemplateParseVisitor.prototype._assertNoComponentsNorElementBindingsOnTemplate = /**
* @param {?} directives
* @param {?} elementProps
* @param {?} sourceSpan
* @return {?}
*/
function (directives, elementProps, sourceSpan) {
var _this = this;
var /** @type {?} */ componentTypeNames = this._findComponentDirectiveNames(directives);
if (componentTypeNames.length > 0) {
this._reportError("Components on an embedded template: " + componentTypeNames.join(','), sourceSpan);
}
elementProps.forEach(function (prop) {
_this._reportError("Property binding " + prop.name + " not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the \"@NgModule.declarations\".", sourceSpan);
});
};
/**
* @param {?} directives
* @param {?} events
* @return {?}
*/
TemplateParseVisitor.prototype._assertAllEventsPublishedByDirectives = /**
* @param {?} directives
* @param {?} events
* @return {?}
*/
function (directives, events) {
var _this = this;
var /** @type {?} */ allDirectiveEvents = new Set();
directives.forEach(function (directive) {
Object.keys(directive.directive.outputs).forEach(function (k) {
var /** @type {?} */ eventName = directive.directive.outputs[k];
allDirectiveEvents.add(eventName);
});
});
events.forEach(function (event) {
if (event.target != null || !allDirectiveEvents.has(event.name)) {
_this._reportError("Event binding " + event.fullName + " not emitted by any directive on an embedded template. Make sure that the event name is spelled correctly and all directives are listed in the \"@NgModule.declarations\".", event.sourceSpan);
}
});
};
/**
* @param {?} elementName
* @param {?} boundProps
* @return {?}
*/
TemplateParseVisitor.prototype._checkPropertiesInSchema = /**
* @param {?} elementName
* @param {?} boundProps
* @return {?}
*/
function (elementName, boundProps) {
var _this = this;
// Note: We can't filter out empty expressions before this method,
// as we still want to validate them!
return boundProps.filter(function (boundProp) {
if (boundProp.type === PropertyBindingType.Property &&
!_this._schemaRegistry.hasProperty(elementName, boundProp.name, _this._schemas)) {
var /** @type {?} */ errorMsg = "Can't bind to '" + boundProp.name + "' since it isn't a known property of '" + elementName + "'.";
if (elementName.startsWith('ng-')) {
errorMsg +=
"\n1. If '" + boundProp.name + "' is an Angular directive, then add 'CommonModule' to the '@NgModule.imports' of this component." +
"\n2. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.";
}
else if (elementName.indexOf('-') > -1) {
errorMsg +=
"\n1. If '" + elementName + "' is an Angular component and it has '" + boundProp.name + "' input, then verify that it is part of this module." +
("\n2. If '" + elementName + "' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.") +
"\n3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.";
}
_this._reportError(errorMsg, boundProp.sourceSpan);
}
return !isEmptyExpression(boundProp.value);
});
};
/**
* @param {?} message
* @param {?} sourceSpan
* @param {?=} level
* @return {?}
*/
TemplateParseVisitor.prototype._reportError = /**
* @param {?} message
* @param {?} sourceSpan
* @param {?=} level
* @return {?}
*/
function (message, sourceSpan, level) {
if (level === void 0) { level = ParseErrorLevel.ERROR; }
this._targetErrors.push(new ParseError(sourceSpan, message, level));
};
return TemplateParseVisitor;
}());
var NonBindableVisitor = (function () {
function NonBindableVisitor() {
}
/**
* @param {?} ast
* @param {?} parent
* @return {?}
*/
NonBindableVisitor.prototype.visitElement = /**
* @param {?} ast
* @param {?} parent
* @return {?}
*/
function (ast, parent) {
var /** @type {?} */ preparsedElement = preparseElement(ast);
if (preparsedElement.type === PreparsedElementType.SCRIPT ||
preparsedElement.type === PreparsedElementType.STYLE ||
preparsedElement.type === PreparsedElementType.STYLESHEET) {
// Skipping <script> for security reasons
// Skipping <style> and stylesheets as we already processed them
// in the StyleCompiler
return null;
}
var /** @type {?} */ attrNameAndValues = ast.attrs.map(function (attr) { return [attr.name, attr.value]; });
var /** @type {?} */ selector = createElementCssSelector(ast.name, attrNameAndValues);
var /** @type {?} */ ngContentIndex = parent.findNgContentIndex(selector);
var /** @type {?} */ children = visitAll(this, ast.children, EMPTY_ELEMENT_CONTEXT);
return new ElementAst(ast.name, visitAll(this, ast.attrs), [], [], [], [], [], false, [], children, ngContentIndex, ast.sourceSpan, ast.endSourceSpan);
};
/**
* @param {?} comment
* @param {?} context
* @return {?}
*/
NonBindableVisitor.prototype.visitComment = /**
* @param {?} comment
* @param {?} context
* @return {?}
*/
function (comment, context) { return null; };
/**
* @param {?} attribute
* @param {?} context
* @return {?}
*/
NonBindableVisitor.prototype.visitAttribute = /**
* @param {?} attribute
* @param {?} context
* @return {?}
*/
function (attribute, context) {
return new AttrAst(attribute.name, attribute.value, attribute.sourceSpan);
};
/**
* @param {?} text
* @param {?} parent
* @return {?}
*/
NonBindableVisitor.prototype.visitText = /**
* @param {?} text
* @param {?} parent
* @return {?}
*/
function (text, parent) {
var /** @type {?} */ ngContentIndex = /** @type {?} */ ((parent.findNgContentIndex(TEXT_CSS_SELECTOR)));
return new TextAst(text.value, ngContentIndex, /** @type {?} */ ((text.sourceSpan)));
};
/**
* @param {?} expansion
* @param {?} context
* @return {?}
*/
NonBindableVisitor.prototype.visitExpansion = /**
* @param {?} expansion
* @param {?} context
* @return {?}
*/
function (expansion, context) { return expansion; };
/**
* @param {?} expansionCase
* @param {?} context
* @return {?}
*/
NonBindableVisitor.prototype.visitExpansionCase = /**
* @param {?} expansionCase
* @param {?} context
* @return {?}
*/
function (expansionCase, context) { return expansionCase; };
return NonBindableVisitor;
}());
/**
* A reference to an element or directive in a template. E.g., the reference in this template:
*
* <div #myMenu="coolMenu">
*
* would be {name: 'myMenu', value: 'coolMenu', sourceSpan: ...}
*/
var ElementOrDirectiveRef = (function () {
function ElementOrDirectiveRef(name, value, sourceSpan) {
this.name = name;
this.value = value;
this.sourceSpan = sourceSpan;
}
/** Gets whether this is a reference to the given directive. */
/**
* Gets whether this is a reference to the given directive.
* @param {?} directive
* @return {?}
*/
ElementOrDirectiveRef.prototype.isReferenceToDirective = /**
* Gets whether this is a reference to the given directive.
* @param {?} directive
* @return {?}
*/
function (directive) {
return splitExportAs(directive.exportAs).indexOf(this.value) !== -1;
};
return ElementOrDirectiveRef;
}());
/**
* Splits a raw, potentially comma-delimted `exportAs` value into an array of names.
* @param {?} exportAs
* @return {?}
*/
function splitExportAs(exportAs) {
return exportAs ? exportAs.split(',').map(function (e) { return e.trim(); }) : [];
}
/**
* @param {?} classAttrValue
* @return {?}
*/
function splitClasses(classAttrValue) {
return classAttrValue.trim().split(/\s+/g);
}
var ElementContext = (function () {
function ElementContext(isTemplateElement, _ngContentIndexMatcher, _wildcardNgContentIndex, providerContext) {
this.isTemplateElement = isTemplateElement;
this._ngContentIndexMatcher = _ngContentIndexMatcher;
this._wildcardNgContentIndex = _wildcardNgContentIndex;
this.providerContext = providerContext;
}
/**
* @param {?} isTemplateElement
* @param {?} directives
* @param {?} providerContext
* @return {?}
*/
ElementContext.create = /**
* @param {?} isTemplateElement
* @param {?} directives
* @param {?} providerContext
* @return {?}
*/
function (isTemplateElement, directives, providerContext) {
var /** @type {?} */ matcher = new SelectorMatcher();
var /** @type {?} */ wildcardNgContentIndex = /** @type {?} */ ((null));
var /** @type {?} */ component = directives.find(function (directive) { return directive.directive.isComponent; });
if (component) {
var /** @type {?} */ ngContentSelectors = /** @type {?} */ ((component.directive.template)).ngContentSelectors;
for (var /** @type {?} */ i = 0; i < ngContentSelectors.length; i++) {
var /** @type {?} */ selector = ngContentSelectors[i];
if (selector === '*') {
wildcardNgContentIndex = i;
}
else {
matcher.addSelectables(CssSelector.parse(ngContentSelectors[i]), i);
}
}
}
return new ElementContext(isTemplateElement, matcher, wildcardNgContentIndex, providerContext);
};
/**
* @param {?} selector
* @return {?}
*/
ElementContext.prototype.findNgContentIndex = /**
* @param {?} selector
* @return {?}
*/
function (selector) {
var /** @type {?} */ ngContentIndices = [];
this._ngContentIndexMatcher.match(selector, function (selector, ngContentIndex) { ngContentIndices.push(ngContentIndex); });
ngContentIndices.sort();
if (this._wildcardNgContentIndex != null) {
ngContentIndices.push(this._wildcardNgContentIndex);
}
return ngContentIndices.length > 0 ? ngContentIndices[0] : null;
};
return ElementContext;
}());
/**
* @param {?} elementName
* @param {?} attributes
* @return {?}
*/
function createElementCssSelector(elementName, attributes) {
var /** @type {?} */ cssSelector = new CssSelector();
var /** @type {?} */ elNameNoNs = splitNsName(elementName)[1];
cssSelector.setElement(elNameNoNs);
for (var /** @type {?} */ i = 0; i < attributes.length; i++) {
var /** @type {?} */ attrName = attributes[i][0];
var /** @type {?} */ attrNameNoNs = splitNsName(attrName)[1];
var /** @type {?} */ attrValue = attributes[i][1];
cssSelector.addAttribute(attrNameNoNs, attrValue);
if (attrName.toLowerCase() == CLASS_ATTR) {
var /** @type {?} */ classes = splitClasses(attrValue);
classes.forEach(function (className) { return cssSelector.addClassName(className); });
}
}
return cssSelector;
}
var EMPTY_ELEMENT_CONTEXT = new ElementContext(true, new SelectorMatcher(), null, null);
var NON_BINDABLE_VISITOR = new NonBindableVisitor();
/**
* @param {?} node
* @return {?}
*/
function _isEmptyTextNode(node) {
return node instanceof Text && node.value.trim().length == 0;
}
/**
* @template T
* @param {?} items
* @return {?}
*/
function removeSummaryDuplicates(items) {
var /** @type {?} */ map = new Map();
items.forEach(function (item) {
if (!map.get(item.type.reference)) {
map.set(item.type.reference, item);
}
});
return Array.from(map.values());
}
/**
* @param {?} ast
* @return {?}
*/
function isEmptyExpression(ast) {
if (ast instanceof ASTWithSource) {
ast = ast.ast;
}
return ast instanceof EmptyExpr;
}
/**
* @param {?} el
* @param {?} enableLegacyTemplate
* @param {?} reportDeprecation
* @return {?}
*/
function isTemplate(el, enableLegacyTemplate, reportDeprecation) {
if (isNgTemplate(el.name))
return true;
var /** @type {?} */ tagNoNs = splitNsName(el.name)[1];
// `<template>` is HTML and case insensitive
if (tagNoNs.toLowerCase() === TEMPLATE_ELEMENT) {
if (enableLegacyTemplate && tagNoNs.toLowerCase() === TEMPLATE_ELEMENT) {
reportDeprecation(TEMPLATE_ELEMENT_DEPRECATION_WARNING, /** @type {?} */ ((el.sourceSpan)));
return true;
}
}
return false;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var EventHandlerVars = (function () {
function EventHandlerVars() {
}
EventHandlerVars.event = variable('$event');
return EventHandlerVars;
}());
/**
* @record
*/
var ConvertActionBindingResult = (function () {
function ConvertActionBindingResult(stmts, allowDefault) {
this.stmts = stmts;
this.allowDefault = allowDefault;
}
return ConvertActionBindingResult;
}());
/**
* Converts the given expression AST into an executable output AST, assuming the expression is
* used in an action binding (e.g. an event handler).
* @param {?} localResolver
* @param {?} implicitReceiver
* @param {?} action
* @param {?} bindingId
* @return {?}
*/
function convertActionBinding(localResolver, implicitReceiver, action, bindingId) {
if (!localResolver) {
localResolver = new DefaultLocalResolver();
}
var /** @type {?} */ actionWithoutBuiltins = convertPropertyBindingBuiltins({
createLiteralArrayConverter: function (argCount) {
// Note: no caching for literal arrays in actions.
return function (args) { return literalArr(args); };
},
createLiteralMapConverter: function (keys) {
// Note: no caching for literal maps in actions.
return function (values) {
var /** @type {?} */ entries = keys.map(function (k, i) {
return ({
key: k.key,
value: values[i],
quoted: k.quoted,
});
});
return literalMap(entries);
};
},
createPipeConverter: function (name) {
throw new Error("Illegal State: Actions are not allowed to contain pipes. Pipe: " + name);
}
}, action);
var /** @type {?} */ visitor = new _AstToIrVisitor(localResolver, implicitReceiver, bindingId);
var /** @type {?} */ actionStmts = [];
flattenStatements(actionWithoutBuiltins.visit(visitor, _Mode.Statement), actionStmts);
prependTemporaryDecls(visitor.temporaryCount, bindingId, actionStmts);
var /** @type {?} */ lastIndex = actionStmts.length - 1;
var /** @type {?} */ preventDefaultVar = /** @type {?} */ ((null));
if (lastIndex >= 0) {
var /** @type {?} */ lastStatement = actionStmts[lastIndex];
var /** @type {?} */ returnExpr = convertStmtIntoExpression(lastStatement);
if (returnExpr) {
// Note: We need to cast the result of the method call to dynamic,
// as it might be a void method!
preventDefaultVar = createPreventDefaultVar(bindingId);
actionStmts[lastIndex] =
preventDefaultVar.set(returnExpr.cast(DYNAMIC_TYPE).notIdentical(literal(false)))
.toDeclStmt(null, [StmtModifier.Final]);
}
}
return new ConvertActionBindingResult(actionStmts, preventDefaultVar);
}
/**
* @record
*/
/**
* @record
*/
/**
* @param {?} converterFactory
* @param {?} ast
* @return {?}
*/
function convertPropertyBindingBuiltins(converterFactory, ast) {
return convertBuiltins(converterFactory, ast);
}
var ConvertPropertyBindingResult = (function () {
function ConvertPropertyBindingResult(stmts, currValExpr) {
this.stmts = stmts;
this.currValExpr = currValExpr;
}
return ConvertPropertyBindingResult;
}());
/**
* Converts the given expression AST into an executable output AST, assuming the expression
* is used in property binding. The expression has to be preprocessed via
* `convertPropertyBindingBuiltins`.
* @param {?} localResolver
* @param {?} implicitReceiver
* @param {?} expressionWithoutBuiltins
* @param {?} bindingId
* @return {?}
*/
function convertPropertyBinding(localResolver, implicitReceiver, expressionWithoutBuiltins, bindingId) {
if (!localResolver) {
localResolver = new DefaultLocalResolver();
}
var /** @type {?} */ currValExpr = createCurrValueExpr(bindingId);
var /** @type {?} */ stmts = [];
var /** @type {?} */ visitor = new _AstToIrVisitor(localResolver, implicitReceiver, bindingId);
var /** @type {?} */ outputExpr = expressionWithoutBuiltins.visit(visitor, _Mode.Expression);
if (visitor.temporaryCount) {
for (var /** @type {?} */ i = 0; i < visitor.temporaryCount; i++) {
stmts.push(temporaryDeclaration(bindingId, i));
}
}
stmts.push(currValExpr.set(outputExpr).toDeclStmt(null, [StmtModifier.Final]));
return new ConvertPropertyBindingResult(stmts, currValExpr);
}
/**
* @param {?} converterFactory
* @param {?} ast
* @return {?}
*/
function convertBuiltins(converterFactory, ast) {
var /** @type {?} */ visitor = new _BuiltinAstConverter(converterFactory);
return ast.visit(visitor);
}
/**
* @param {?} bindingId
* @param {?} temporaryNumber
* @return {?}
*/
function temporaryName(bindingId, temporaryNumber) {
return "tmp_" + bindingId + "_" + temporaryNumber;
}
/**
* @param {?} bindingId
* @param {?} temporaryNumber
* @return {?}
*/
function temporaryDeclaration(bindingId, temporaryNumber) {
return new DeclareVarStmt(temporaryName(bindingId, temporaryNumber), NULL_EXPR);
}
/**
* @param {?} temporaryCount
* @param {?} bindingId
* @param {?} statements
* @return {?}
*/
function prependTemporaryDecls(temporaryCount, bindingId, statements) {
for (var /** @type {?} */ i = temporaryCount - 1; i >= 0; i--) {
statements.unshift(temporaryDeclaration(bindingId, i));
}
}
/** @enum {number} */
var _Mode = {
Statement: 0,
Expression: 1,
};
_Mode[_Mode.Statement] = "Statement";
_Mode[_Mode.Expression] = "Expression";
/**
* @param {?} mode
* @param {?} ast
* @return {?}
*/
function ensureStatementMode(mode, ast) {
if (mode !== _Mode.Statement) {
throw new Error("Expected a statement, but saw " + ast);
}
}
/**
* @param {?} mode
* @param {?} ast
* @return {?}
*/
function ensureExpressionMode(mode, ast) {
if (mode !== _Mode.Expression) {
throw new Error("Expected an expression, but saw " + ast);
}
}
/**
* @param {?} mode
* @param {?} expr
* @return {?}
*/
function convertToStatementIfNeeded(mode, expr) {
if (mode === _Mode.Statement) {
return expr.toStmt();
}
else {
return expr;
}
}
var _BuiltinAstConverter = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(_BuiltinAstConverter, _super);
function _BuiltinAstConverter(_converterFactory) {
var _this = _super.call(this) || this;
_this._converterFactory = _converterFactory;
return _this;
}
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
_BuiltinAstConverter.prototype.visitPipe = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
var _this = this;
var /** @type {?} */ args = [ast.exp].concat(ast.args).map(function (ast) { return ast.visit(_this, context); });
return new BuiltinFunctionCall(ast.span, args, this._converterFactory.createPipeConverter(ast.name, args.length));
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
_BuiltinAstConverter.prototype.visitLiteralArray = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
var _this = this;
var /** @type {?} */ args = ast.expressions.map(function (ast) { return ast.visit(_this, context); });
return new BuiltinFunctionCall(ast.span, args, this._converterFactory.createLiteralArrayConverter(ast.expressions.length));
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
_BuiltinAstConverter.prototype.visitLiteralMap = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
var _this = this;
var /** @type {?} */ args = ast.values.map(function (ast) { return ast.visit(_this, context); });
return new BuiltinFunctionCall(ast.span, args, this._converterFactory.createLiteralMapConverter(ast.keys));
};
return _BuiltinAstConverter;
}(AstTransformer));
var _AstToIrVisitor = (function () {
function _AstToIrVisitor(_localResolver, _implicitReceiver, bindingId) {
this._localResolver = _localResolver;
this._implicitReceiver = _implicitReceiver;
this.bindingId = bindingId;
this._nodeMap = new Map();
this._resultMap = new Map();
this._currentTemporary = 0;
this.temporaryCount = 0;
}
/**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
_AstToIrVisitor.prototype.visitBinary = /**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
function (ast, mode) {
var /** @type {?} */ op;
switch (ast.operation) {
case '+':
op = BinaryOperator.Plus;
break;
case '-':
op = BinaryOperator.Minus;
break;
case '*':
op = BinaryOperator.Multiply;
break;
case '/':
op = BinaryOperator.Divide;
break;
case '%':
op = BinaryOperator.Modulo;
break;
case '&&':
op = BinaryOperator.And;
break;
case '||':
op = BinaryOperator.Or;
break;
case '==':
op = BinaryOperator.Equals;
break;
case '!=':
op = BinaryOperator.NotEquals;
break;
case '===':
op = BinaryOperator.Identical;
break;
case '!==':
op = BinaryOperator.NotIdentical;
break;
case '<':
op = BinaryOperator.Lower;
break;
case '>':
op = BinaryOperator.Bigger;
break;
case '<=':
op = BinaryOperator.LowerEquals;
break;
case '>=':
op = BinaryOperator.BiggerEquals;
break;
default:
throw new Error("Unsupported operation " + ast.operation);
}
return convertToStatementIfNeeded(mode, new BinaryOperatorExpr(op, this._visit(ast.left, _Mode.Expression), this._visit(ast.right, _Mode.Expression)));
};
/**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
_AstToIrVisitor.prototype.visitChain = /**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
function (ast, mode) {
ensureStatementMode(mode, ast);
return this.visitAll(ast.expressions, mode);
};
/**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
_AstToIrVisitor.prototype.visitConditional = /**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
function (ast, mode) {
var /** @type {?} */ value = this._visit(ast.condition, _Mode.Expression);
return convertToStatementIfNeeded(mode, value.conditional(this._visit(ast.trueExp, _Mode.Expression), this._visit(ast.falseExp, _Mode.Expression)));
};
/**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
_AstToIrVisitor.prototype.visitPipe = /**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
function (ast, mode) {
throw new Error("Illegal state: Pipes should have been converted into functions. Pipe: " + ast.name);
};
/**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
_AstToIrVisitor.prototype.visitFunctionCall = /**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
function (ast, mode) {
var /** @type {?} */ convertedArgs = this.visitAll(ast.args, _Mode.Expression);
var /** @type {?} */ fnResult;
if (ast instanceof BuiltinFunctionCall) {
fnResult = ast.converter(convertedArgs);
}
else {
fnResult = this._visit(/** @type {?} */ ((ast.target)), _Mode.Expression).callFn(convertedArgs);
}
return convertToStatementIfNeeded(mode, fnResult);
};
/**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
_AstToIrVisitor.prototype.visitImplicitReceiver = /**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
function (ast, mode) {
ensureExpressionMode(mode, ast);
return this._implicitReceiver;
};
/**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
_AstToIrVisitor.prototype.visitInterpolation = /**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
function (ast, mode) {
ensureExpressionMode(mode, ast);
var /** @type {?} */ args = [literal(ast.expressions.length)];
for (var /** @type {?} */ i = 0; i < ast.strings.length - 1; i++) {
args.push(literal(ast.strings[i]));
args.push(this._visit(ast.expressions[i], _Mode.Expression));
}
args.push(literal(ast.strings[ast.strings.length - 1]));
return ast.expressions.length <= 9 ?
importExpr(Identifiers.inlineInterpolate).callFn(args) :
importExpr(Identifiers.interpolate).callFn([args[0], literalArr(args.slice(1))]);
};
/**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
_AstToIrVisitor.prototype.visitKeyedRead = /**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
function (ast, mode) {
var /** @type {?} */ leftMostSafe = this.leftMostSafeNode(ast);
if (leftMostSafe) {
return this.convertSafeAccess(ast, leftMostSafe, mode);
}
else {
return convertToStatementIfNeeded(mode, this._visit(ast.obj, _Mode.Expression).key(this._visit(ast.key, _Mode.Expression)));
}
};
/**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
_AstToIrVisitor.prototype.visitKeyedWrite = /**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
function (ast, mode) {
var /** @type {?} */ obj = this._visit(ast.obj, _Mode.Expression);
var /** @type {?} */ key = this._visit(ast.key, _Mode.Expression);
var /** @type {?} */ value = this._visit(ast.value, _Mode.Expression);
return convertToStatementIfNeeded(mode, obj.key(key).set(value));
};
/**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
_AstToIrVisitor.prototype.visitLiteralArray = /**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
function (ast, mode) {
throw new Error("Illegal State: literal arrays should have been converted into functions");
};
/**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
_AstToIrVisitor.prototype.visitLiteralMap = /**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
function (ast, mode) {
throw new Error("Illegal State: literal maps should have been converted into functions");
};
/**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
_AstToIrVisitor.prototype.visitLiteralPrimitive = /**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
function (ast, mode) {
return convertToStatementIfNeeded(mode, literal(ast.value));
};
/**
* @param {?} name
* @return {?}
*/
_AstToIrVisitor.prototype._getLocal = /**
* @param {?} name
* @return {?}
*/
function (name) { return this._localResolver.getLocal(name); };
/**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
_AstToIrVisitor.prototype.visitMethodCall = /**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
function (ast, mode) {
var /** @type {?} */ leftMostSafe = this.leftMostSafeNode(ast);
if (leftMostSafe) {
return this.convertSafeAccess(ast, leftMostSafe, mode);
}
else {
var /** @type {?} */ args = this.visitAll(ast.args, _Mode.Expression);
var /** @type {?} */ result = null;
var /** @type {?} */ receiver = this._visit(ast.receiver, _Mode.Expression);
if (receiver === this._implicitReceiver) {
var /** @type {?} */ varExpr = this._getLocal(ast.name);
if (varExpr) {
result = varExpr.callFn(args);
}
}
if (result == null) {
result = receiver.callMethod(ast.name, args);
}
return convertToStatementIfNeeded(mode, result);
}
};
/**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
_AstToIrVisitor.prototype.visitPrefixNot = /**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
function (ast, mode) {
return convertToStatementIfNeeded(mode, not(this._visit(ast.expression, _Mode.Expression)));
};
/**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
_AstToIrVisitor.prototype.visitNonNullAssert = /**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
function (ast, mode) {
return convertToStatementIfNeeded(mode, assertNotNull(this._visit(ast.expression, _Mode.Expression)));
};
/**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
_AstToIrVisitor.prototype.visitPropertyRead = /**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
function (ast, mode) {
var /** @type {?} */ leftMostSafe = this.leftMostSafeNode(ast);
if (leftMostSafe) {
return this.convertSafeAccess(ast, leftMostSafe, mode);
}
else {
var /** @type {?} */ result = null;
var /** @type {?} */ receiver = this._visit(ast.receiver, _Mode.Expression);
if (receiver === this._implicitReceiver) {
result = this._getLocal(ast.name);
}
if (result == null) {
result = receiver.prop(ast.name);
}
return convertToStatementIfNeeded(mode, result);
}
};
/**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
_AstToIrVisitor.prototype.visitPropertyWrite = /**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
function (ast, mode) {
var /** @type {?} */ receiver = this._visit(ast.receiver, _Mode.Expression);
if (receiver === this._implicitReceiver) {
var /** @type {?} */ varExpr = this._getLocal(ast.name);
if (varExpr) {
throw new Error('Cannot assign to a reference or variable!');
}
}
return convertToStatementIfNeeded(mode, receiver.prop(ast.name).set(this._visit(ast.value, _Mode.Expression)));
};
/**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
_AstToIrVisitor.prototype.visitSafePropertyRead = /**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
function (ast, mode) {
return this.convertSafeAccess(ast, this.leftMostSafeNode(ast), mode);
};
/**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
_AstToIrVisitor.prototype.visitSafeMethodCall = /**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
function (ast, mode) {
return this.convertSafeAccess(ast, this.leftMostSafeNode(ast), mode);
};
/**
* @param {?} asts
* @param {?} mode
* @return {?}
*/
_AstToIrVisitor.prototype.visitAll = /**
* @param {?} asts
* @param {?} mode
* @return {?}
*/
function (asts, mode) {
var _this = this;
return asts.map(function (ast) { return _this._visit(ast, mode); });
};
/**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
_AstToIrVisitor.prototype.visitQuote = /**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
function (ast, mode) {
throw new Error("Quotes are not supported for evaluation!\n Statement: " + ast.uninterpretedExpression + " located at " + ast.location);
};
/**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
_AstToIrVisitor.prototype._visit = /**
* @param {?} ast
* @param {?} mode
* @return {?}
*/
function (ast, mode) {
var /** @type {?} */ result = this._resultMap.get(ast);
if (result)
return result;
return (this._nodeMap.get(ast) || ast).visit(this, mode);
};
/**
* @param {?} ast
* @param {?} leftMostSafe
* @param {?} mode
* @return {?}
*/
_AstToIrVisitor.prototype.convertSafeAccess = /**
* @param {?} ast
* @param {?} leftMostSafe
* @param {?} mode
* @return {?}
*/
function (ast, leftMostSafe, mode) {
// If the expression contains a safe access node on the left it needs to be converted to
// an expression that guards the access to the member by checking the receiver for blank. As
// execution proceeds from left to right, the left most part of the expression must be guarded
// first but, because member access is left associative, the right side of the expression is at
// the top of the AST. The desired result requires lifting a copy of the the left part of the
// expression up to test it for blank before generating the unguarded version.
// Consider, for example the following expression: a?.b.c?.d.e
// This results in the ast:
// .
// / \
// ?. e
// / \
// . d
// / \
// ?. c
// / \
// a b
// The following tree should be generated:
//
// /---- ? ----\
// / | \
// a /--- ? ---\ null
// / | \
// . . null
// / \ / \
// . c . e
// / \ / \
// a b , d
// / \
// . c
// / \
// a b
//
// Notice that the first guard condition is the left hand of the left most safe access node
// which comes in as leftMostSafe to this routine.
var /** @type {?} */ guardedExpression = this._visit(leftMostSafe.receiver, _Mode.Expression);
var /** @type {?} */ temporary = /** @type {?} */ ((undefined));
if (this.needsTemporary(leftMostSafe.receiver)) {
// If the expression has method calls or pipes then we need to save the result into a
// temporary variable to avoid calling stateful or impure code more than once.
temporary = this.allocateTemporary();
// Preserve the result in the temporary variable
guardedExpression = temporary.set(guardedExpression);
// Ensure all further references to the guarded expression refer to the temporary instead.
this._resultMap.set(leftMostSafe.receiver, temporary);
}
var /** @type {?} */ condition = guardedExpression.isBlank();
// Convert the ast to an unguarded access to the receiver's member. The map will substitute
// leftMostNode with its unguarded version in the call to `this.visit()`.
if (leftMostSafe instanceof SafeMethodCall) {
this._nodeMap.set(leftMostSafe, new MethodCall(leftMostSafe.span, leftMostSafe.receiver, leftMostSafe.name, leftMostSafe.args));
}
else {
this._nodeMap.set(leftMostSafe, new PropertyRead(leftMostSafe.span, leftMostSafe.receiver, leftMostSafe.name));
}
// Recursively convert the node now without the guarded member access.
var /** @type {?} */ access = this._visit(ast, _Mode.Expression);
// Remove the mapping. This is not strictly required as the converter only traverses each node
// once but is safer if the conversion is changed to traverse the nodes more than once.
this._nodeMap.delete(leftMostSafe);
// If we allocated a temporary, release it.
if (temporary) {
this.releaseTemporary(temporary);
}
// Produce the conditional
return convertToStatementIfNeeded(mode, condition.conditional(literal(null), access));
};
/**
* @param {?} ast
* @return {?}
*/
_AstToIrVisitor.prototype.leftMostSafeNode = /**
* @param {?} ast
* @return {?}
*/
function (ast) {
var _this = this;
var /** @type {?} */ visit = function (visitor, ast) {
return (_this._nodeMap.get(ast) || ast).visit(visitor);
};
return ast.visit({
visitBinary: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return null; },
visitChain: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return null; },
visitConditional: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return null; },
visitFunctionCall: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return null; },
visitImplicitReceiver: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return null; },
visitInterpolation: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return null; },
visitKeyedRead: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return visit(this, ast.obj); },
visitKeyedWrite: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return null; },
visitLiteralArray: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return null; },
visitLiteralMap: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return null; },
visitLiteralPrimitive: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return null; },
visitMethodCall: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return visit(this, ast.receiver); },
visitPipe: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return null; },
visitPrefixNot: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return null; },
visitNonNullAssert: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return null; },
visitPropertyRead: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return visit(this, ast.receiver); },
visitPropertyWrite: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return null; },
visitQuote: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return null; },
visitSafeMethodCall: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return visit(this, ast.receiver) || ast; },
visitSafePropertyRead: /**
* @param {?} ast
* @return {?}
*/
function (ast) {
return visit(this, ast.receiver) || ast;
}
});
};
/**
* @param {?} ast
* @return {?}
*/
_AstToIrVisitor.prototype.needsTemporary = /**
* @param {?} ast
* @return {?}
*/
function (ast) {
var _this = this;
var /** @type {?} */ visit = function (visitor, ast) {
return ast && (_this._nodeMap.get(ast) || ast).visit(visitor);
};
var /** @type {?} */ visitSome = function (visitor, ast) {
return ast.some(function (ast) { return visit(visitor, ast); });
};
return ast.visit({
visitBinary: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return visit(this, ast.left) || visit(this, ast.right); },
visitChain: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return false; },
visitConditional: /**
* @param {?} ast
* @return {?}
*/
function (ast) {
return visit(this, ast.condition) || visit(this, ast.trueExp) ||
visit(this, ast.falseExp);
},
visitFunctionCall: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return true; },
visitImplicitReceiver: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return false; },
visitInterpolation: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return visitSome(this, ast.expressions); },
visitKeyedRead: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return false; },
visitKeyedWrite: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return false; },
visitLiteralArray: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return true; },
visitLiteralMap: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return true; },
visitLiteralPrimitive: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return false; },
visitMethodCall: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return true; },
visitPipe: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return true; },
visitPrefixNot: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return visit(this, ast.expression); },
visitNonNullAssert: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return visit(this, ast.expression); },
visitPropertyRead: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return false; },
visitPropertyWrite: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return false; },
visitQuote: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return false; },
visitSafeMethodCall: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return true; },
visitSafePropertyRead: /**
* @param {?} ast
* @return {?}
*/
function (ast) { return false; }
});
};
/**
* @return {?}
*/
_AstToIrVisitor.prototype.allocateTemporary = /**
* @return {?}
*/
function () {
var /** @type {?} */ tempNumber = this._currentTemporary++;
this.temporaryCount = Math.max(this._currentTemporary, this.temporaryCount);
return new ReadVarExpr(temporaryName(this.bindingId, tempNumber));
};
/**
* @param {?} temporary
* @return {?}
*/
_AstToIrVisitor.prototype.releaseTemporary = /**
* @param {?} temporary
* @return {?}
*/
function (temporary) {
this._currentTemporary--;
if (temporary.name != temporaryName(this.bindingId, this._currentTemporary)) {
throw new Error("Temporary " + temporary.name + " released out of order");
}
};
return _AstToIrVisitor;
}());
/**
* @param {?} arg
* @param {?} output
* @return {?}
*/
function flattenStatements(arg, output) {
if (Array.isArray(arg)) {
(/** @type {?} */ (arg)).forEach(function (entry) { return flattenStatements(entry, output); });
}
else {
output.push(arg);
}
}
var DefaultLocalResolver = (function () {
function DefaultLocalResolver() {
}
/**
* @param {?} name
* @return {?}
*/
DefaultLocalResolver.prototype.getLocal = /**
* @param {?} name
* @return {?}
*/
function (name) {
if (name === EventHandlerVars.event.name) {
return EventHandlerVars.event;
}
return null;
};
return DefaultLocalResolver;
}());
/**
* @param {?} bindingId
* @return {?}
*/
function createCurrValueExpr(bindingId) {
return variable("currVal_" + bindingId); // fix syntax highlighting: `
}
/**
* @param {?} bindingId
* @return {?}
*/
function createPreventDefaultVar(bindingId) {
return variable("pd_" + bindingId);
}
/**
* @param {?} stmt
* @return {?}
*/
function convertStmtIntoExpression(stmt) {
if (stmt instanceof ExpressionStatement) {
return stmt.expr;
}
else if (stmt instanceof ReturnStatement) {
return stmt.value;
}
return null;
}
var BuiltinFunctionCall = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(BuiltinFunctionCall, _super);
function BuiltinFunctionCall(span, args, converter) {
var _this = _super.call(this, span, null, args) || this;
_this.args = args;
_this.converter = converter;
return _this;
}
return BuiltinFunctionCall;
}(FunctionCall));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Generates code that is used to type check templates.
*/
var TypeCheckCompiler = (function () {
function TypeCheckCompiler(options, reflector) {
this.options = options;
this.reflector = reflector;
}
/**
* Important notes:
* - This must not produce new `import` statements, but only refer to types outside
* of the file via the variables provided via externalReferenceVars.
* This allows Typescript to reuse the old program's structure as no imports have changed.
* - This must not produce any exports, as this would pollute the .d.ts file
* and also violate the point above.
*/
/**
* Important notes:
* - This must not produce new `import` statements, but only refer to types outside
* of the file via the variables provided via externalReferenceVars.
* This allows Typescript to reuse the old program's structure as no imports have changed.
* - This must not produce any exports, as this would pollute the .d.ts file
* and also violate the point above.
* @param {?} componentId
* @param {?} component
* @param {?} template
* @param {?} usedPipes
* @param {?} externalReferenceVars
* @return {?}
*/
TypeCheckCompiler.prototype.compileComponent = /**
* Important notes:
* - This must not produce new `import` statements, but only refer to types outside
* of the file via the variables provided via externalReferenceVars.
* This allows Typescript to reuse the old program's structure as no imports have changed.
* - This must not produce any exports, as this would pollute the .d.ts file
* and also violate the point above.
* @param {?} componentId
* @param {?} component
* @param {?} template
* @param {?} usedPipes
* @param {?} externalReferenceVars
* @return {?}
*/
function (componentId, component, template, usedPipes, externalReferenceVars) {
var _this = this;
var /** @type {?} */ pipes = new Map();
usedPipes.forEach(function (p) { return pipes.set(p.name, p.type.reference); });
var /** @type {?} */ embeddedViewCount = 0;
var /** @type {?} */ viewBuilderFactory = function (parent) {
var /** @type {?} */ embeddedViewIndex = embeddedViewCount++;
return new ViewBuilder(_this.options, _this.reflector, externalReferenceVars, parent, component.type.reference, component.isHost, embeddedViewIndex, pipes, viewBuilderFactory);
};
var /** @type {?} */ visitor = viewBuilderFactory(null);
visitor.visitAll([], template);
return visitor.build(componentId);
};
return TypeCheckCompiler;
}());
var DYNAMIC_VAR_NAME = '_any';
var TypeCheckLocalResolver = (function () {
function TypeCheckLocalResolver() {
}
/**
* @param {?} name
* @return {?}
*/
TypeCheckLocalResolver.prototype.getLocal = /**
* @param {?} name
* @return {?}
*/
function (name) {
if (name === EventHandlerVars.event.name) {
// References to the event should not be type-checked.
// TODO(chuckj): determine a better type for the event.
return variable(DYNAMIC_VAR_NAME);
}
return null;
};
return TypeCheckLocalResolver;
}());
var defaultResolver = new TypeCheckLocalResolver();
var ViewBuilder = (function () {
function ViewBuilder(options, reflector, externalReferenceVars, parent, component, isHostComponent, embeddedViewIndex, pipes, viewBuilderFactory) {
this.options = options;
this.reflector = reflector;
this.externalReferenceVars = externalReferenceVars;
this.parent = parent;
this.component = component;
this.isHostComponent = isHostComponent;
this.embeddedViewIndex = embeddedViewIndex;
this.pipes = pipes;
this.viewBuilderFactory = viewBuilderFactory;
this.refOutputVars = new Map();
this.variables = [];
this.children = [];
this.updates = [];
this.actions = [];
}
/**
* @param {?} type
* @return {?}
*/
ViewBuilder.prototype.getOutputVar = /**
* @param {?} type
* @return {?}
*/
function (type) {
var /** @type {?} */ varName;
if (type === this.component && this.isHostComponent) {
varName = DYNAMIC_VAR_NAME;
}
else if (type instanceof StaticSymbol) {
varName = this.externalReferenceVars.get(type);
}
else {
varName = DYNAMIC_VAR_NAME;
}
if (!varName) {
throw new Error("Illegal State: referring to a type without a variable " + JSON.stringify(type));
}
return varName;
};
/**
* @param {?} variables
* @param {?} astNodes
* @return {?}
*/
ViewBuilder.prototype.visitAll = /**
* @param {?} variables
* @param {?} astNodes
* @return {?}
*/
function (variables, astNodes) {
this.variables = variables;
templateVisitAll(this, astNodes);
};
/**
* @param {?} componentId
* @param {?=} targetStatements
* @return {?}
*/
ViewBuilder.prototype.build = /**
* @param {?} componentId
* @param {?=} targetStatements
* @return {?}
*/
function (componentId, targetStatements) {
var _this = this;
if (targetStatements === void 0) { targetStatements = []; }
this.children.forEach(function (child) { return child.build(componentId, targetStatements); });
var /** @type {?} */ viewStmts = [variable(DYNAMIC_VAR_NAME).set(NULL_EXPR).toDeclStmt(DYNAMIC_TYPE)];
var /** @type {?} */ bindingCount = 0;
this.updates.forEach(function (expression) {
var _a = _this.preprocessUpdateExpression(expression), sourceSpan = _a.sourceSpan, context = _a.context, value = _a.value;
var /** @type {?} */ bindingId = "" + bindingCount++;
var /** @type {?} */ nameResolver = context === _this.component ? _this : defaultResolver;
var _b = convertPropertyBinding(nameResolver, variable(_this.getOutputVar(context)), value, bindingId), stmts = _b.stmts, currValExpr = _b.currValExpr;
stmts.push(new ExpressionStatement(currValExpr));
viewStmts.push.apply(viewStmts, stmts.map(function (stmt) { return applySourceSpanToStatementIfNeeded(stmt, sourceSpan); }));
});
this.actions.forEach(function (_a) {
var sourceSpan = _a.sourceSpan, context = _a.context, value = _a.value;
var /** @type {?} */ bindingId = "" + bindingCount++;
var /** @type {?} */ nameResolver = context === _this.component ? _this : defaultResolver;
var stmts = convertActionBinding(nameResolver, variable(_this.getOutputVar(context)), value, bindingId).stmts;
viewStmts.push.apply(viewStmts, stmts.map(function (stmt) { return applySourceSpanToStatementIfNeeded(stmt, sourceSpan); }));
});
var /** @type {?} */ viewName = "_View_" + componentId + "_" + this.embeddedViewIndex;
var /** @type {?} */ viewFactory = new DeclareFunctionStmt(viewName, [], viewStmts);
targetStatements.push(viewFactory);
return targetStatements;
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
ViewBuilder.prototype.visitBoundText = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
var _this = this;
var /** @type {?} */ astWithSource = /** @type {?} */ (ast.value);
var /** @type {?} */ inter = /** @type {?} */ (astWithSource.ast);
inter.expressions.forEach(function (expr) {
return _this.updates.push({ context: _this.component, value: expr, sourceSpan: ast.sourceSpan });
});
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
ViewBuilder.prototype.visitEmbeddedTemplate = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
this.visitElementOrTemplate(ast);
// Note: The old view compiler used to use an `any` type
// for the context in any embedded view.
// We keep this behaivor behind a flag for now.
if (this.options.fullTemplateTypeCheck) {
var /** @type {?} */ childVisitor = this.viewBuilderFactory(this);
this.children.push(childVisitor);
childVisitor.visitAll(ast.variables, ast.children);
}
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
ViewBuilder.prototype.visitElement = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
var _this = this;
this.visitElementOrTemplate(ast);
var /** @type {?} */ inputDefs = [];
var /** @type {?} */ updateRendererExpressions = [];
var /** @type {?} */ outputDefs = [];
ast.inputs.forEach(function (inputAst) {
_this.updates.push({ context: _this.component, value: inputAst.value, sourceSpan: inputAst.sourceSpan });
});
templateVisitAll(this, ast.children);
};
/**
* @param {?} ast
* @return {?}
*/
ViewBuilder.prototype.visitElementOrTemplate = /**
* @param {?} ast
* @return {?}
*/
function (ast) {
var _this = this;
ast.directives.forEach(function (dirAst) { _this.visitDirective(dirAst); });
ast.references.forEach(function (ref) {
var /** @type {?} */ outputVarType = /** @type {?} */ ((null));
// Note: The old view compiler used to use an `any` type
// for directives exposed via `exportAs`.
// We keep this behaivor behind a flag for now.
if (ref.value && ref.value.identifier && _this.options.fullTemplateTypeCheck) {
outputVarType = ref.value.identifier.reference;
}
else {
outputVarType = BuiltinTypeName.Dynamic;
}
_this.refOutputVars.set(ref.name, outputVarType);
});
ast.outputs.forEach(function (outputAst) {
_this.actions.push({ context: _this.component, value: outputAst.handler, sourceSpan: outputAst.sourceSpan });
});
};
/**
* @param {?} dirAst
* @return {?}
*/
ViewBuilder.prototype.visitDirective = /**
* @param {?} dirAst
* @return {?}
*/
function (dirAst) {
var _this = this;
var /** @type {?} */ dirType = dirAst.directive.type.reference;
dirAst.inputs.forEach(function (input) {
return _this.updates.push({ context: _this.component, value: input.value, sourceSpan: input.sourceSpan });
});
// Note: The old view compiler used to use an `any` type
// for expressions in host properties / events.
// We keep this behaivor behind a flag for now.
if (this.options.fullTemplateTypeCheck) {
dirAst.hostProperties.forEach(function (inputAst) {
return _this.updates.push({ context: dirType, value: inputAst.value, sourceSpan: inputAst.sourceSpan });
});
dirAst.hostEvents.forEach(function (hostEventAst) {
return _this.actions.push({
context: dirType,
value: hostEventAst.handler,
sourceSpan: hostEventAst.sourceSpan
});
});
}
};
/**
* @param {?} name
* @return {?}
*/
ViewBuilder.prototype.getLocal = /**
* @param {?} name
* @return {?}
*/
function (name) {
if (name == EventHandlerVars.event.name) {
return variable(this.getOutputVar(BuiltinTypeName.Dynamic));
}
for (var /** @type {?} */ currBuilder = this; currBuilder; currBuilder = currBuilder.parent) {
var /** @type {?} */ outputVarType = void 0;
// check references
outputVarType = currBuilder.refOutputVars.get(name);
if (outputVarType == null) {
// check variables
var /** @type {?} */ varAst = currBuilder.variables.find(function (varAst) { return varAst.name === name; });
if (varAst) {
outputVarType = BuiltinTypeName.Dynamic;
}
}
if (outputVarType != null) {
return variable(this.getOutputVar(outputVarType));
}
}
return null;
};
/**
* @param {?} name
* @return {?}
*/
ViewBuilder.prototype.pipeOutputVar = /**
* @param {?} name
* @return {?}
*/
function (name) {
var /** @type {?} */ pipe = this.pipes.get(name);
if (!pipe) {
throw new Error("Illegal State: Could not find pipe " + name + " in template of " + this.component);
}
return this.getOutputVar(pipe);
};
/**
* @param {?} expression
* @return {?}
*/
ViewBuilder.prototype.preprocessUpdateExpression = /**
* @param {?} expression
* @return {?}
*/
function (expression) {
var _this = this;
return {
sourceSpan: expression.sourceSpan,
context: expression.context,
value: convertPropertyBindingBuiltins({
createLiteralArrayConverter: function (argCount) {
return function (args) {
var /** @type {?} */ arr = literalArr(args);
// Note: The old view compiler used to use an `any` type
// for arrays.
return _this.options.fullTemplateTypeCheck ? arr : arr.cast(DYNAMIC_TYPE);
};
},
createLiteralMapConverter: function (keys) {
return function (values) {
var /** @type {?} */ entries = keys.map(function (k, i) {
return ({
key: k.key,
value: values[i],
quoted: k.quoted,
});
});
var /** @type {?} */ map = literalMap(entries);
// Note: The old view compiler used to use an `any` type
// for maps.
return _this.options.fullTemplateTypeCheck ? map : map.cast(DYNAMIC_TYPE);
};
},
createPipeConverter: function (name, argCount) {
return function (args) {
// Note: The old view compiler used to use an `any` type
// for pipes.
var /** @type {?} */ pipeExpr = _this.options.fullTemplateTypeCheck ?
variable(_this.pipeOutputVar(name)) :
variable(_this.getOutputVar(BuiltinTypeName.Dynamic));
return pipeExpr.callMethod('transform', args);
};
},
}, expression.value)
};
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
ViewBuilder.prototype.visitNgContent = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
ViewBuilder.prototype.visitText = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
ViewBuilder.prototype.visitDirectiveProperty = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
ViewBuilder.prototype.visitReference = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
ViewBuilder.prototype.visitVariable = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
ViewBuilder.prototype.visitEvent = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
ViewBuilder.prototype.visitElementProperty = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
ViewBuilder.prototype.visitAttr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
return ViewBuilder;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var CLASS_ATTR$1 = 'class';
var STYLE_ATTR = 'style';
var IMPLICIT_TEMPLATE_VAR = '\$implicit';
var ViewCompileResult = (function () {
function ViewCompileResult(viewClassVar, rendererTypeVar) {
this.viewClassVar = viewClassVar;
this.rendererTypeVar = rendererTypeVar;
}
return ViewCompileResult;
}());
var ViewCompiler = (function () {
function ViewCompiler(_reflector) {
this._reflector = _reflector;
}
/**
* @param {?} outputCtx
* @param {?} component
* @param {?} template
* @param {?} styles
* @param {?} usedPipes
* @return {?}
*/
ViewCompiler.prototype.compileComponent = /**
* @param {?} outputCtx
* @param {?} component
* @param {?} template
* @param {?} styles
* @param {?} usedPipes
* @return {?}
*/
function (outputCtx, component, template, styles, usedPipes) {
var _this = this;
var /** @type {?} */ embeddedViewCount = 0;
var /** @type {?} */ staticQueryIds = findStaticQueryIds(template);
var /** @type {?} */ renderComponentVarName = /** @type {?} */ ((undefined));
if (!component.isHost) {
var /** @type {?} */ template_1 = /** @type {?} */ ((component.template));
var /** @type {?} */ customRenderData = [];
if (template_1.animations && template_1.animations.length) {
customRenderData.push(new LiteralMapEntry('animation', convertValueToOutputAst(outputCtx, template_1.animations), true));
}
var /** @type {?} */ renderComponentVar = variable(rendererTypeName(component.type.reference));
renderComponentVarName = /** @type {?} */ ((renderComponentVar.name));
outputCtx.statements.push(renderComponentVar
.set(importExpr(Identifiers.createRendererType2).callFn([new LiteralMapExpr([
new LiteralMapEntry('encapsulation', literal(template_1.encapsulation), false),
new LiteralMapEntry('styles', styles, false),
new LiteralMapEntry('data', new LiteralMapExpr(customRenderData), false)
])]))
.toDeclStmt(importType(Identifiers.RendererType2), [StmtModifier.Final, StmtModifier.Exported]));
}
var /** @type {?} */ viewBuilderFactory = function (parent) {
var /** @type {?} */ embeddedViewIndex = embeddedViewCount++;
return new ViewBuilder$1(_this._reflector, outputCtx, parent, component, embeddedViewIndex, usedPipes, staticQueryIds, viewBuilderFactory);
};
var /** @type {?} */ visitor = viewBuilderFactory(null);
visitor.visitAll([], template);
(_a = outputCtx.statements).push.apply(_a, visitor.build());
return new ViewCompileResult(visitor.viewName, renderComponentVarName);
var _a;
};
return ViewCompiler;
}());
var LOG_VAR$1 = variable('_l');
var VIEW_VAR = variable('_v');
var CHECK_VAR = variable('_ck');
var COMP_VAR = variable('_co');
var EVENT_NAME_VAR = variable('en');
var ALLOW_DEFAULT_VAR = variable("ad");
var ViewBuilder$1 = (function () {
function ViewBuilder(reflector, outputCtx, parent, component, embeddedViewIndex, usedPipes, staticQueryIds, viewBuilderFactory) {
this.reflector = reflector;
this.outputCtx = outputCtx;
this.parent = parent;
this.component = component;
this.embeddedViewIndex = embeddedViewIndex;
this.usedPipes = usedPipes;
this.staticQueryIds = staticQueryIds;
this.viewBuilderFactory = viewBuilderFactory;
this.nodes = [];
this.purePipeNodeIndices = Object.create(null);
this.refNodeIndices = Object.create(null);
this.variables = [];
this.children = [];
// TODO(tbosch): The old view compiler used to use an `any` type
// for the context in any embedded view. We keep this behaivor for now
// to be able to introduce the new view compiler without too many errors.
this.compType = this.embeddedViewIndex > 0 ?
DYNAMIC_TYPE :
/** @type {?} */ ((expressionType(outputCtx.importExpr(this.component.type.reference))));
this.viewName = viewClassName(this.component.type.reference, this.embeddedViewIndex);
}
/**
* @param {?} variables
* @param {?} astNodes
* @return {?}
*/
ViewBuilder.prototype.visitAll = /**
* @param {?} variables
* @param {?} astNodes
* @return {?}
*/
function (variables, astNodes) {
var _this = this;
this.variables = variables;
// create the pipes for the pure pipes immediately, so that we know their indices.
if (!this.parent) {
this.usedPipes.forEach(function (pipe) {
if (pipe.pure) {
_this.purePipeNodeIndices[pipe.name] = _this._createPipe(null, pipe);
}
});
}
if (!this.parent) {
var /** @type {?} */ queryIds_1 = staticViewQueryIds(this.staticQueryIds);
this.component.viewQueries.forEach(function (query, queryIndex) {
// Note: queries start with id 1 so we can use the number in a Bloom filter!
var /** @type {?} */ queryId = queryIndex + 1;
var /** @type {?} */ bindingType = query.first ? 0 /* First */ : 1;
var /** @type {?} */ flags = 134217728 /* TypeViewQuery */ | calcStaticDynamicQueryFlags(queryIds_1, queryId, query.first);
_this.nodes.push(function () {
return ({
sourceSpan: null,
nodeFlags: flags,
nodeDef: importExpr(Identifiers.queryDef).callFn([
literal(flags), literal(queryId),
new LiteralMapExpr([new LiteralMapEntry(query.propertyName, literal(bindingType), false)])
])
});
});
});
}
templateVisitAll(this, astNodes);
if (this.parent && (astNodes.length === 0 || needsAdditionalRootNode(astNodes))) {
// if the view is an embedded view, then we need to add an additional root node in some cases
this.nodes.push(function () {
return ({
sourceSpan: null,
nodeFlags: 1 /* TypeElement */,
nodeDef: importExpr(Identifiers.anchorDef).callFn([
literal(0 /* None */), NULL_EXPR, NULL_EXPR, literal(0)
])
});
});
}
};
/**
* @param {?=} targetStatements
* @return {?}
*/
ViewBuilder.prototype.build = /**
* @param {?=} targetStatements
* @return {?}
*/
function (targetStatements) {
if (targetStatements === void 0) { targetStatements = []; }
this.children.forEach(function (child) { return child.build(targetStatements); });
var _a = this._createNodeExpressions(), updateRendererStmts = _a.updateRendererStmts, updateDirectivesStmts = _a.updateDirectivesStmts, nodeDefExprs = _a.nodeDefExprs;
var /** @type {?} */ updateRendererFn = this._createUpdateFn(updateRendererStmts);
var /** @type {?} */ updateDirectivesFn = this._createUpdateFn(updateDirectivesStmts);
var /** @type {?} */ viewFlags = 0;
if (!this.parent && this.component.changeDetection === ChangeDetectionStrategy.OnPush) {
viewFlags |= 2 /* OnPush */;
}
var /** @type {?} */ viewFactory = new DeclareFunctionStmt(this.viewName, [new FnParam(/** @type {?} */ ((LOG_VAR$1.name)))], [new ReturnStatement(importExpr(Identifiers.viewDef).callFn([
literal(viewFlags),
literalArr(nodeDefExprs),
updateDirectivesFn,
updateRendererFn,
]))], importType(Identifiers.ViewDefinition), this.embeddedViewIndex === 0 ? [StmtModifier.Exported] : []);
targetStatements.push(viewFactory);
return targetStatements;
};
/**
* @param {?} updateStmts
* @return {?}
*/
ViewBuilder.prototype._createUpdateFn = /**
* @param {?} updateStmts
* @return {?}
*/
function (updateStmts) {
var /** @type {?} */ updateFn;
if (updateStmts.length > 0) {
var /** @type {?} */ preStmts = [];
if (!this.component.isHost && findReadVarNames(updateStmts).has(/** @type {?} */ ((COMP_VAR.name)))) {
preStmts.push(COMP_VAR.set(VIEW_VAR.prop('component')).toDeclStmt(this.compType));
}
updateFn = fn([
new FnParam(/** @type {?} */ ((CHECK_VAR.name)), INFERRED_TYPE),
new FnParam(/** @type {?} */ ((VIEW_VAR.name)), INFERRED_TYPE)
], preStmts.concat(updateStmts), INFERRED_TYPE);
}
else {
updateFn = NULL_EXPR;
}
return updateFn;
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
ViewBuilder.prototype.visitNgContent = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
// ngContentDef(ngContentIndex: number, index: number): NodeDef;
this.nodes.push(function () {
return ({
sourceSpan: ast.sourceSpan,
nodeFlags: 8 /* TypeNgContent */,
nodeDef: importExpr(Identifiers.ngContentDef).callFn([
literal(ast.ngContentIndex), literal(ast.index)
])
});
});
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
ViewBuilder.prototype.visitText = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
// Static text nodes have no check function
var /** @type {?} */ checkIndex = -1;
this.nodes.push(function () {
return ({
sourceSpan: ast.sourceSpan,
nodeFlags: 2 /* TypeText */,
nodeDef: importExpr(Identifiers.textDef).callFn([
literal(checkIndex),
literal(ast.ngContentIndex),
literalArr([literal(ast.value)]),
])
});
});
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
ViewBuilder.prototype.visitBoundText = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
var _this = this;
var /** @type {?} */ nodeIndex = this.nodes.length;
// reserve the space in the nodeDefs array
this.nodes.push(/** @type {?} */ ((null)));
var /** @type {?} */ astWithSource = /** @type {?} */ (ast.value);
var /** @type {?} */ inter = /** @type {?} */ (astWithSource.ast);
var /** @type {?} */ updateRendererExpressions = inter.expressions.map(function (expr, bindingIndex) {
return _this._preprocessUpdateExpression({ nodeIndex: nodeIndex, bindingIndex: bindingIndex, sourceSpan: ast.sourceSpan, context: COMP_VAR, value: expr });
});
// Check index is the same as the node index during compilation
// They might only differ at runtime
var /** @type {?} */ checkIndex = nodeIndex;
this.nodes[nodeIndex] = function () {
return ({
sourceSpan: ast.sourceSpan,
nodeFlags: 2 /* TypeText */,
nodeDef: importExpr(Identifiers.textDef).callFn([
literal(checkIndex),
literal(ast.ngContentIndex),
literalArr(inter.strings.map(function (s) { return literal(s); })),
]),
updateRenderer: updateRendererExpressions
});
};
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
ViewBuilder.prototype.visitEmbeddedTemplate = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
var _this = this;
var /** @type {?} */ nodeIndex = this.nodes.length;
// reserve the space in the nodeDefs array
this.nodes.push(/** @type {?} */ ((null)));
var _a = this._visitElementOrTemplate(nodeIndex, ast), flags = _a.flags, queryMatchesExpr = _a.queryMatchesExpr, hostEvents = _a.hostEvents;
var /** @type {?} */ childVisitor = this.viewBuilderFactory(this);
this.children.push(childVisitor);
childVisitor.visitAll(ast.variables, ast.children);
var /** @type {?} */ childCount = this.nodes.length - nodeIndex - 1;
// anchorDef(
// flags: NodeFlags, matchedQueries: [string, QueryValueType][], ngContentIndex: number,
// childCount: number, handleEventFn?: ElementHandleEventFn, templateFactory?:
// ViewDefinitionFactory): NodeDef;
this.nodes[nodeIndex] = function () {
return ({
sourceSpan: ast.sourceSpan,
nodeFlags: 1 /* TypeElement */ | flags,
nodeDef: importExpr(Identifiers.anchorDef).callFn([
literal(flags),
queryMatchesExpr,
literal(ast.ngContentIndex),
literal(childCount),
_this._createElementHandleEventFn(nodeIndex, hostEvents),
variable(childVisitor.viewName),
])
});
};
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
ViewBuilder.prototype.visitElement = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
var _this = this;
var /** @type {?} */ nodeIndex = this.nodes.length;
// reserve the space in the nodeDefs array so we can add children
this.nodes.push(/** @type {?} */ ((null)));
// Using a null element name creates an anchor.
var /** @type {?} */ elName = isNgContainer(ast.name) ? null : ast.name;
var _a = this._visitElementOrTemplate(nodeIndex, ast), flags = _a.flags, usedEvents = _a.usedEvents, queryMatchesExpr = _a.queryMatchesExpr, dirHostBindings = _a.hostBindings, hostEvents = _a.hostEvents;
var /** @type {?} */ inputDefs = [];
var /** @type {?} */ updateRendererExpressions = [];
var /** @type {?} */ outputDefs = [];
if (elName) {
var /** @type {?} */ hostBindings = ast.inputs
.map(function (inputAst) {
return ({
context: /** @type {?} */ (COMP_VAR),
inputAst: inputAst,
dirAst: /** @type {?} */ (null),
});
})
.concat(dirHostBindings);
if (hostBindings.length) {
updateRendererExpressions =
hostBindings.map(function (hostBinding, bindingIndex) {
return _this._preprocessUpdateExpression({
context: hostBinding.context,
nodeIndex: nodeIndex,
bindingIndex: bindingIndex,
sourceSpan: hostBinding.inputAst.sourceSpan,
value: hostBinding.inputAst.value
});
});
inputDefs = hostBindings.map(function (hostBinding) { return elementBindingDef(hostBinding.inputAst, hostBinding.dirAst); });
}
outputDefs = usedEvents.map(function (_a) {
var target = _a[0], eventName = _a[1];
return literalArr([literal(target), literal(eventName)]);
});
}
templateVisitAll(this, ast.children);
var /** @type {?} */ childCount = this.nodes.length - nodeIndex - 1;
var /** @type {?} */ compAst = ast.directives.find(function (dirAst) { return dirAst.directive.isComponent; });
var /** @type {?} */ compRendererType = /** @type {?} */ (NULL_EXPR);
var /** @type {?} */ compView = /** @type {?} */ (NULL_EXPR);
if (compAst) {
compView = this.outputCtx.importExpr(compAst.directive.componentViewType);
compRendererType = this.outputCtx.importExpr(compAst.directive.rendererType);
}
// Check index is the same as the node index during compilation
// They might only differ at runtime
var /** @type {?} */ checkIndex = nodeIndex;
this.nodes[nodeIndex] = function () {
return ({
sourceSpan: ast.sourceSpan,
nodeFlags: 1 /* TypeElement */ | flags,
nodeDef: importExpr(Identifiers.elementDef).callFn([
literal(checkIndex),
literal(flags),
queryMatchesExpr,
literal(ast.ngContentIndex),
literal(childCount),
literal(elName),
elName ? fixedAttrsDef(ast) : NULL_EXPR,
inputDefs.length ? literalArr(inputDefs) : NULL_EXPR,
outputDefs.length ? literalArr(outputDefs) : NULL_EXPR,
_this._createElementHandleEventFn(nodeIndex, hostEvents),
compView,
compRendererType,
]),
updateRenderer: updateRendererExpressions
});
};
};
/**
* @param {?} nodeIndex
* @param {?} ast
* @return {?}
*/
ViewBuilder.prototype._visitElementOrTemplate = /**
* @param {?} nodeIndex
* @param {?} ast
* @return {?}
*/
function (nodeIndex, ast) {
var _this = this;
var /** @type {?} */ flags = 0;
if (ast.hasViewContainer) {
flags |= 16777216 /* EmbeddedViews */;
}
var /** @type {?} */ usedEvents = new Map();
ast.outputs.forEach(function (event) {
var _a = elementEventNameAndTarget(event, null), name = _a.name, target = _a.target;
usedEvents.set(elementEventFullName(target, name), [target, name]);
});
ast.directives.forEach(function (dirAst) {
dirAst.hostEvents.forEach(function (event) {
var _a = elementEventNameAndTarget(event, dirAst), name = _a.name, target = _a.target;
usedEvents.set(elementEventFullName(target, name), [target, name]);
});
});
var /** @type {?} */ hostBindings = [];
var /** @type {?} */ hostEvents = [];
this._visitComponentFactoryResolverProvider(ast.directives);
ast.providers.forEach(function (providerAst, providerIndex) {
var /** @type {?} */ dirAst = /** @type {?} */ ((undefined));
var /** @type {?} */ dirIndex = /** @type {?} */ ((undefined));
ast.directives.forEach(function (localDirAst, i) {
if (localDirAst.directive.type.reference === tokenReference(providerAst.token)) {
dirAst = localDirAst;
dirIndex = i;
}
});
if (dirAst) {
var _a = _this._visitDirective(providerAst, dirAst, dirIndex, nodeIndex, ast.references, ast.queryMatches, usedEvents, /** @type {?} */ ((_this.staticQueryIds.get(/** @type {?} */ (ast))))), dirHostBindings = _a.hostBindings, dirHostEvents = _a.hostEvents;
hostBindings.push.apply(hostBindings, dirHostBindings);
hostEvents.push.apply(hostEvents, dirHostEvents);
}
else {
_this._visitProvider(providerAst, ast.queryMatches);
}
});
var /** @type {?} */ queryMatchExprs = [];
ast.queryMatches.forEach(function (match) {
var /** @type {?} */ valueType = /** @type {?} */ ((undefined));
if (tokenReference(match.value) ===
_this.reflector.resolveExternalReference(Identifiers.ElementRef)) {
valueType = 0 /* ElementRef */;
}
else if (tokenReference(match.value) ===
_this.reflector.resolveExternalReference(Identifiers.ViewContainerRef)) {
valueType = 3 /* ViewContainerRef */;
}
else if (tokenReference(match.value) ===
_this.reflector.resolveExternalReference(Identifiers.TemplateRef)) {
valueType = 2 /* TemplateRef */;
}
if (valueType != null) {
queryMatchExprs.push(literalArr([literal(match.queryId), literal(valueType)]));
}
});
ast.references.forEach(function (ref) {
var /** @type {?} */ valueType = /** @type {?} */ ((undefined));
if (!ref.value) {
valueType = 1 /* RenderElement */;
}
else if (tokenReference(ref.value) ===
_this.reflector.resolveExternalReference(Identifiers.TemplateRef)) {
valueType = 2 /* TemplateRef */;
}
if (valueType != null) {
_this.refNodeIndices[ref.name] = nodeIndex;
queryMatchExprs.push(literalArr([literal(ref.name), literal(valueType)]));
}
});
ast.outputs.forEach(function (outputAst) {
hostEvents.push({ context: COMP_VAR, eventAst: outputAst, dirAst: /** @type {?} */ ((null)) });
});
return {
flags: flags,
usedEvents: Array.from(usedEvents.values()),
queryMatchesExpr: queryMatchExprs.length ? literalArr(queryMatchExprs) : NULL_EXPR,
hostBindings: hostBindings,
hostEvents: hostEvents
};
};
/**
* @param {?} providerAst
* @param {?} dirAst
* @param {?} directiveIndex
* @param {?} elementNodeIndex
* @param {?} refs
* @param {?} queryMatches
* @param {?} usedEvents
* @param {?} queryIds
* @return {?}
*/
ViewBuilder.prototype._visitDirective = /**
* @param {?} providerAst
* @param {?} dirAst
* @param {?} directiveIndex
* @param {?} elementNodeIndex
* @param {?} refs
* @param {?} queryMatches
* @param {?} usedEvents
* @param {?} queryIds
* @return {?}
*/
function (providerAst, dirAst, directiveIndex, elementNodeIndex, refs, queryMatches, usedEvents, queryIds) {
var _this = this;
var /** @type {?} */ nodeIndex = this.nodes.length;
// reserve the space in the nodeDefs array so we can add children
this.nodes.push(/** @type {?} */ ((null)));
dirAst.directive.queries.forEach(function (query, queryIndex) {
var /** @type {?} */ queryId = dirAst.contentQueryStartId + queryIndex;
var /** @type {?} */ flags = 67108864 /* TypeContentQuery */ | calcStaticDynamicQueryFlags(queryIds, queryId, query.first);
var /** @type {?} */ bindingType = query.first ? 0 /* First */ : 1;
_this.nodes.push(function () {
return ({
sourceSpan: dirAst.sourceSpan,
nodeFlags: flags,
nodeDef: importExpr(Identifiers.queryDef).callFn([
literal(flags), literal(queryId),
new LiteralMapExpr([new LiteralMapEntry(query.propertyName, literal(bindingType), false)])
]),
});
});
});
// Note: the operation below might also create new nodeDefs,
// but we don't want them to be a child of a directive,
// as they might be a provider/pipe on their own.
// I.e. we only allow queries as children of directives nodes.
var /** @type {?} */ childCount = this.nodes.length - nodeIndex - 1;
var _a = this._visitProviderOrDirective(providerAst, queryMatches), flags = _a.flags, queryMatchExprs = _a.queryMatchExprs, providerExpr = _a.providerExpr, depsExpr = _a.depsExpr;
refs.forEach(function (ref) {
if (ref.value && tokenReference(ref.value) === tokenReference(providerAst.token)) {
_this.refNodeIndices[ref.name] = nodeIndex;
queryMatchExprs.push(literalArr([literal(ref.name), literal(4 /* Provider */)]));
}
});
if (dirAst.directive.isComponent) {
flags |= 32768 /* Component */;
}
var /** @type {?} */ inputDefs = dirAst.inputs.map(function (inputAst, inputIndex) {
var /** @type {?} */ mapValue = literalArr([literal(inputIndex), literal(inputAst.directiveName)]);
// Note: it's important to not quote the key so that we can capture renames by minifiers!
return new LiteralMapEntry(inputAst.directiveName, mapValue, false);
});
var /** @type {?} */ outputDefs = [];
var /** @type {?} */ dirMeta = dirAst.directive;
Object.keys(dirMeta.outputs).forEach(function (propName) {
var /** @type {?} */ eventName = dirMeta.outputs[propName];
if (usedEvents.has(eventName)) {
// Note: it's important to not quote the key so that we can capture renames by minifiers!
outputDefs.push(new LiteralMapEntry(propName, literal(eventName), false));
}
});
var /** @type {?} */ updateDirectiveExpressions = [];
if (dirAst.inputs.length || (flags & (262144 /* DoCheck */ | 65536 /* OnInit */)) > 0) {
updateDirectiveExpressions =
dirAst.inputs.map(function (input, bindingIndex) {
return _this._preprocessUpdateExpression({
nodeIndex: nodeIndex,
bindingIndex: bindingIndex,
sourceSpan: input.sourceSpan,
context: COMP_VAR,
value: input.value
});
});
}
var /** @type {?} */ dirContextExpr = importExpr(Identifiers.nodeValue).callFn([VIEW_VAR, literal(nodeIndex)]);
var /** @type {?} */ hostBindings = dirAst.hostProperties.map(function (inputAst) {
return ({
context: dirContextExpr,
dirAst: dirAst,
inputAst: inputAst,
});
});
var /** @type {?} */ hostEvents = dirAst.hostEvents.map(function (hostEventAst) {
return ({
context: dirContextExpr,
eventAst: hostEventAst, dirAst: dirAst,
});
});
// Check index is the same as the node index during compilation
// They might only differ at runtime
var /** @type {?} */ checkIndex = nodeIndex;
this.nodes[nodeIndex] = function () {
return ({
sourceSpan: dirAst.sourceSpan,
nodeFlags: 16384 /* TypeDirective */ | flags,
nodeDef: importExpr(Identifiers.directiveDef).callFn([
literal(checkIndex),
literal(flags),
queryMatchExprs.length ? literalArr(queryMatchExprs) : NULL_EXPR,
literal(childCount),
providerExpr,
depsExpr,
inputDefs.length ? new LiteralMapExpr(inputDefs) : NULL_EXPR,
outputDefs.length ? new LiteralMapExpr(outputDefs) : NULL_EXPR,
]),
updateDirectives: updateDirectiveExpressions,
directive: dirAst.directive.type,
});
};
return { hostBindings: hostBindings, hostEvents: hostEvents };
};
/**
* @param {?} providerAst
* @param {?} queryMatches
* @return {?}
*/
ViewBuilder.prototype._visitProvider = /**
* @param {?} providerAst
* @param {?} queryMatches
* @return {?}
*/
function (providerAst, queryMatches) {
this._addProviderNode(this._visitProviderOrDirective(providerAst, queryMatches));
};
/**
* @param {?} directives
* @return {?}
*/
ViewBuilder.prototype._visitComponentFactoryResolverProvider = /**
* @param {?} directives
* @return {?}
*/
function (directives) {
var /** @type {?} */ componentDirMeta = directives.find(function (dirAst) { return dirAst.directive.isComponent; });
if (componentDirMeta && componentDirMeta.directive.entryComponents.length) {
var _a = componentFactoryResolverProviderDef(this.reflector, this.outputCtx, 8192 /* PrivateProvider */, componentDirMeta.directive.entryComponents), providerExpr = _a.providerExpr, depsExpr = _a.depsExpr, flags = _a.flags, tokenExpr = _a.tokenExpr;
this._addProviderNode({
providerExpr: providerExpr,
depsExpr: depsExpr,
flags: flags,
tokenExpr: tokenExpr,
queryMatchExprs: [],
sourceSpan: componentDirMeta.sourceSpan
});
}
};
/**
* @param {?} data
* @return {?}
*/
ViewBuilder.prototype._addProviderNode = /**
* @param {?} data
* @return {?}
*/
function (data) {
var /** @type {?} */ nodeIndex = this.nodes.length;
// providerDef(
// flags: NodeFlags, matchedQueries: [string, QueryValueType][], token:any,
// value: any, deps: ([DepFlags, any] | any)[]): NodeDef;
this.nodes.push(function () {
return ({
sourceSpan: data.sourceSpan,
nodeFlags: data.flags,
nodeDef: importExpr(Identifiers.providerDef).callFn([
literal(data.flags),
data.queryMatchExprs.length ? literalArr(data.queryMatchExprs) : NULL_EXPR,
data.tokenExpr, data.providerExpr, data.depsExpr
])
});
});
};
/**
* @param {?} providerAst
* @param {?} queryMatches
* @return {?}
*/
ViewBuilder.prototype._visitProviderOrDirective = /**
* @param {?} providerAst
* @param {?} queryMatches
* @return {?}
*/
function (providerAst, queryMatches) {
var /** @type {?} */ flags = 0;
var /** @type {?} */ queryMatchExprs = [];
queryMatches.forEach(function (match) {
if (tokenReference(match.value) === tokenReference(providerAst.token)) {
queryMatchExprs.push(literalArr([literal(match.queryId), literal(4 /* Provider */)]));
}
});
var _a = providerDef(this.outputCtx, providerAst), providerExpr = _a.providerExpr, depsExpr = _a.depsExpr, providerFlags = _a.flags, tokenExpr = _a.tokenExpr;
return {
flags: flags | providerFlags,
queryMatchExprs: queryMatchExprs,
providerExpr: providerExpr,
depsExpr: depsExpr,
tokenExpr: tokenExpr,
sourceSpan: providerAst.sourceSpan
};
};
/**
* @param {?} name
* @return {?}
*/
ViewBuilder.prototype.getLocal = /**
* @param {?} name
* @return {?}
*/
function (name) {
if (name == EventHandlerVars.event.name) {
return EventHandlerVars.event;
}
var /** @type {?} */ currViewExpr = VIEW_VAR;
for (var /** @type {?} */ currBuilder = this; currBuilder; currBuilder = currBuilder.parent,
currViewExpr = currViewExpr.prop('parent').cast(DYNAMIC_TYPE)) {
// check references
var /** @type {?} */ refNodeIndex = currBuilder.refNodeIndices[name];
if (refNodeIndex != null) {
return importExpr(Identifiers.nodeValue).callFn([currViewExpr, literal(refNodeIndex)]);
}
// check variables
var /** @type {?} */ varAst = currBuilder.variables.find(function (varAst) { return varAst.name === name; });
if (varAst) {
var /** @type {?} */ varValue = varAst.value || IMPLICIT_TEMPLATE_VAR;
return currViewExpr.prop('context').prop(varValue);
}
}
return null;
};
/**
* @param {?} sourceSpan
* @param {?} argCount
* @return {?}
*/
ViewBuilder.prototype._createLiteralArrayConverter = /**
* @param {?} sourceSpan
* @param {?} argCount
* @return {?}
*/
function (sourceSpan, argCount) {
if (argCount === 0) {
var /** @type {?} */ valueExpr_1 = importExpr(Identifiers.EMPTY_ARRAY);
return function () { return valueExpr_1; };
}
var /** @type {?} */ checkIndex = this.nodes.length;
this.nodes.push(function () {
return ({
sourceSpan: sourceSpan,
nodeFlags: 32 /* TypePureArray */,
nodeDef: importExpr(Identifiers.pureArrayDef).callFn([
literal(checkIndex),
literal(argCount),
])
});
});
return function (args) { return callCheckStmt(checkIndex, args); };
};
/**
* @param {?} sourceSpan
* @param {?} keys
* @return {?}
*/
ViewBuilder.prototype._createLiteralMapConverter = /**
* @param {?} sourceSpan
* @param {?} keys
* @return {?}
*/
function (sourceSpan, keys) {
if (keys.length === 0) {
var /** @type {?} */ valueExpr_2 = importExpr(Identifiers.EMPTY_MAP);
return function () { return valueExpr_2; };
}
var /** @type {?} */ map = literalMap(keys.map(function (e, i) { return (Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __assign */])({}, e, { value: literal(i) })); }));
var /** @type {?} */ checkIndex = this.nodes.length;
this.nodes.push(function () {
return ({
sourceSpan: sourceSpan,
nodeFlags: 64 /* TypePureObject */,
nodeDef: importExpr(Identifiers.pureObjectDef).callFn([
literal(checkIndex),
map,
])
});
});
return function (args) { return callCheckStmt(checkIndex, args); };
};
/**
* @param {?} expression
* @param {?} name
* @param {?} argCount
* @return {?}
*/
ViewBuilder.prototype._createPipeConverter = /**
* @param {?} expression
* @param {?} name
* @param {?} argCount
* @return {?}
*/
function (expression, name, argCount) {
var /** @type {?} */ pipe = /** @type {?} */ ((this.usedPipes.find(function (pipeSummary) { return pipeSummary.name === name; })));
if (pipe.pure) {
var /** @type {?} */ checkIndex_1 = this.nodes.length;
this.nodes.push(function () {
return ({
sourceSpan: expression.sourceSpan,
nodeFlags: 128 /* TypePurePipe */,
nodeDef: importExpr(Identifiers.purePipeDef).callFn([
literal(checkIndex_1),
literal(argCount),
])
});
});
// find underlying pipe in the component view
var /** @type {?} */ compViewExpr = VIEW_VAR;
var /** @type {?} */ compBuilder = this;
while (compBuilder.parent) {
compBuilder = compBuilder.parent;
compViewExpr = compViewExpr.prop('parent').cast(DYNAMIC_TYPE);
}
var /** @type {?} */ pipeNodeIndex = compBuilder.purePipeNodeIndices[name];
var /** @type {?} */ pipeValueExpr_1 = importExpr(Identifiers.nodeValue).callFn([compViewExpr, literal(pipeNodeIndex)]);
return function (args) {
return callUnwrapValue(expression.nodeIndex, expression.bindingIndex, callCheckStmt(checkIndex_1, [pipeValueExpr_1].concat(args)));
};
}
else {
var /** @type {?} */ nodeIndex = this._createPipe(expression.sourceSpan, pipe);
var /** @type {?} */ nodeValueExpr_1 = importExpr(Identifiers.nodeValue).callFn([VIEW_VAR, literal(nodeIndex)]);
return function (args) {
return callUnwrapValue(expression.nodeIndex, expression.bindingIndex, nodeValueExpr_1.callMethod('transform', args));
};
}
};
/**
* @param {?} sourceSpan
* @param {?} pipe
* @return {?}
*/
ViewBuilder.prototype._createPipe = /**
* @param {?} sourceSpan
* @param {?} pipe
* @return {?}
*/
function (sourceSpan, pipe) {
var _this = this;
var /** @type {?} */ nodeIndex = this.nodes.length;
var /** @type {?} */ flags = 0;
pipe.type.lifecycleHooks.forEach(function (lifecycleHook) {
// for pipes, we only support ngOnDestroy
if (lifecycleHook === LifecycleHooks.OnDestroy) {
flags |= lifecycleHookToNodeFlag(lifecycleHook);
}
});
var /** @type {?} */ depExprs = pipe.type.diDeps.map(function (diDep) { return depDef(_this.outputCtx, diDep); });
// function pipeDef(
// flags: NodeFlags, ctor: any, deps: ([DepFlags, any] | any)[]): NodeDef
this.nodes.push(function () {
return ({
sourceSpan: sourceSpan,
nodeFlags: 16 /* TypePipe */,
nodeDef: importExpr(Identifiers.pipeDef).callFn([
literal(flags), _this.outputCtx.importExpr(pipe.type.reference), literalArr(depExprs)
])
});
});
return nodeIndex;
};
/**
* For the AST in `UpdateExpression.value`:
* - create nodes for pipes, literal arrays and, literal maps,
* - update the AST to replace pipes, literal arrays and, literal maps with calls to check fn.
*
* WARNING: This might create new nodeDefs (for pipes and literal arrays and literal maps)!
* @param {?} expression
* @return {?}
*/
ViewBuilder.prototype._preprocessUpdateExpression = /**
* For the AST in `UpdateExpression.value`:
* - create nodes for pipes, literal arrays and, literal maps,
* - update the AST to replace pipes, literal arrays and, literal maps with calls to check fn.
*
* WARNING: This might create new nodeDefs (for pipes and literal arrays and literal maps)!
* @param {?} expression
* @return {?}
*/
function (expression) {
var _this = this;
return {
nodeIndex: expression.nodeIndex,
bindingIndex: expression.bindingIndex,
sourceSpan: expression.sourceSpan,
context: expression.context,
value: convertPropertyBindingBuiltins({
createLiteralArrayConverter: function (argCount) {
return _this._createLiteralArrayConverter(expression.sourceSpan, argCount);
},
createLiteralMapConverter: function (keys) {
return _this._createLiteralMapConverter(expression.sourceSpan, keys);
},
createPipeConverter: function (name, argCount) {
return _this._createPipeConverter(expression, name, argCount);
}
}, expression.value)
};
};
/**
* @return {?}
*/
ViewBuilder.prototype._createNodeExpressions = /**
* @return {?}
*/
function () {
var /** @type {?} */ self = this;
var /** @type {?} */ updateBindingCount = 0;
var /** @type {?} */ updateRendererStmts = [];
var /** @type {?} */ updateDirectivesStmts = [];
var /** @type {?} */ nodeDefExprs = this.nodes.map(function (factory, nodeIndex) {
var _a = factory(), nodeDef = _a.nodeDef, nodeFlags = _a.nodeFlags, updateDirectives = _a.updateDirectives, updateRenderer = _a.updateRenderer, sourceSpan = _a.sourceSpan;
if (updateRenderer) {
updateRendererStmts.push.apply(updateRendererStmts, createUpdateStatements(nodeIndex, sourceSpan, updateRenderer, false));
}
if (updateDirectives) {
updateDirectivesStmts.push.apply(updateDirectivesStmts, createUpdateStatements(nodeIndex, sourceSpan, updateDirectives, (nodeFlags & (262144 /* DoCheck */ | 65536 /* OnInit */)) > 0));
}
// We use a comma expression to call the log function before
// the nodeDef function, but still use the result of the nodeDef function
// as the value.
// Note: We only add the logger to elements / text nodes,
// so we don't generate too much code.
var /** @type {?} */ logWithNodeDef = nodeFlags & 3 /* CatRenderNode */ ?
new CommaExpr([LOG_VAR$1.callFn([]).callFn([]), nodeDef]) :
nodeDef;
return applySourceSpanToExpressionIfNeeded(logWithNodeDef, sourceSpan);
});
return { updateRendererStmts: updateRendererStmts, updateDirectivesStmts: updateDirectivesStmts, nodeDefExprs: nodeDefExprs };
/**
* @param {?} nodeIndex
* @param {?} sourceSpan
* @param {?} expressions
* @param {?} allowEmptyExprs
* @return {?}
*/
function createUpdateStatements(nodeIndex, sourceSpan, expressions, allowEmptyExprs) {
var /** @type {?} */ updateStmts = [];
var /** @type {?} */ exprs = expressions.map(function (_a) {
var sourceSpan = _a.sourceSpan, context = _a.context, value = _a.value;
var /** @type {?} */ bindingId = "" + updateBindingCount++;
var /** @type {?} */ nameResolver = context === COMP_VAR ? self : null;
var _b = convertPropertyBinding(nameResolver, context, value, bindingId), stmts = _b.stmts, currValExpr = _b.currValExpr;
updateStmts.push.apply(updateStmts, stmts.map(function (stmt) { return applySourceSpanToStatementIfNeeded(stmt, sourceSpan); }));
return applySourceSpanToExpressionIfNeeded(currValExpr, sourceSpan);
});
if (expressions.length || allowEmptyExprs) {
updateStmts.push(applySourceSpanToStatementIfNeeded(callCheckStmt(nodeIndex, exprs).toStmt(), sourceSpan));
}
return updateStmts;
}
};
/**
* @param {?} nodeIndex
* @param {?} handlers
* @return {?}
*/
ViewBuilder.prototype._createElementHandleEventFn = /**
* @param {?} nodeIndex
* @param {?} handlers
* @return {?}
*/
function (nodeIndex, handlers) {
var _this = this;
var /** @type {?} */ handleEventStmts = [];
var /** @type {?} */ handleEventBindingCount = 0;
handlers.forEach(function (_a) {
var context = _a.context, eventAst = _a.eventAst, dirAst = _a.dirAst;
var /** @type {?} */ bindingId = "" + handleEventBindingCount++;
var /** @type {?} */ nameResolver = context === COMP_VAR ? _this : null;
var _b = convertActionBinding(nameResolver, context, eventAst.handler, bindingId), stmts = _b.stmts, allowDefault = _b.allowDefault;
var /** @type {?} */ trueStmts = stmts;
if (allowDefault) {
trueStmts.push(ALLOW_DEFAULT_VAR.set(allowDefault.and(ALLOW_DEFAULT_VAR)).toStmt());
}
var _c = elementEventNameAndTarget(eventAst, dirAst), eventTarget = _c.target, eventName = _c.name;
var /** @type {?} */ fullEventName = elementEventFullName(eventTarget, eventName);
handleEventStmts.push(applySourceSpanToStatementIfNeeded(new IfStmt(literal(fullEventName).identical(EVENT_NAME_VAR), trueStmts), eventAst.sourceSpan));
});
var /** @type {?} */ handleEventFn;
if (handleEventStmts.length > 0) {
var /** @type {?} */ preStmts = [ALLOW_DEFAULT_VAR.set(literal(true)).toDeclStmt(BOOL_TYPE)];
if (!this.component.isHost && findReadVarNames(handleEventStmts).has(/** @type {?} */ ((COMP_VAR.name)))) {
preStmts.push(COMP_VAR.set(VIEW_VAR.prop('component')).toDeclStmt(this.compType));
}
handleEventFn = fn([
new FnParam(/** @type {?} */ ((VIEW_VAR.name)), INFERRED_TYPE),
new FnParam(/** @type {?} */ ((EVENT_NAME_VAR.name)), INFERRED_TYPE),
new FnParam(/** @type {?} */ ((EventHandlerVars.event.name)), INFERRED_TYPE)
], preStmts.concat(handleEventStmts, [new ReturnStatement(ALLOW_DEFAULT_VAR)]), INFERRED_TYPE);
}
else {
handleEventFn = NULL_EXPR;
}
return handleEventFn;
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
ViewBuilder.prototype.visitDirective = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
ViewBuilder.prototype.visitDirectiveProperty = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
ViewBuilder.prototype.visitReference = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
ViewBuilder.prototype.visitVariable = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
ViewBuilder.prototype.visitEvent = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
ViewBuilder.prototype.visitElementProperty = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
ViewBuilder.prototype.visitAttr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) { };
return ViewBuilder;
}());
/**
* @param {?} astNodes
* @return {?}
*/
function needsAdditionalRootNode(astNodes) {
var /** @type {?} */ lastAstNode = astNodes[astNodes.length - 1];
if (lastAstNode instanceof EmbeddedTemplateAst) {
return lastAstNode.hasViewContainer;
}
if (lastAstNode instanceof ElementAst) {
if (isNgContainer(lastAstNode.name) && lastAstNode.children.length) {
return needsAdditionalRootNode(lastAstNode.children);
}
return lastAstNode.hasViewContainer;
}
return lastAstNode instanceof NgContentAst;
}
/**
* @param {?} inputAst
* @param {?} dirAst
* @return {?}
*/
function elementBindingDef(inputAst, dirAst) {
switch (inputAst.type) {
case PropertyBindingType.Attribute:
return literalArr([
literal(1 /* TypeElementAttribute */), literal(inputAst.name),
literal(inputAst.securityContext)
]);
case PropertyBindingType.Property:
return literalArr([
literal(8 /* TypeProperty */), literal(inputAst.name),
literal(inputAst.securityContext)
]);
case PropertyBindingType.Animation:
var /** @type {?} */ bindingType = 8 /* TypeProperty */ |
(dirAst && dirAst.directive.isComponent ? 32 /* SyntheticHostProperty */ :
16 /* SyntheticProperty */);
return literalArr([
literal(bindingType), literal('@' + inputAst.name), literal(inputAst.securityContext)
]);
case PropertyBindingType.Class:
return literalArr([literal(2 /* TypeElementClass */), literal(inputAst.name), NULL_EXPR]);
case PropertyBindingType.Style:
return literalArr([
literal(4 /* TypeElementStyle */), literal(inputAst.name), literal(inputAst.unit)
]);
}
}
/**
* @param {?} elementAst
* @return {?}
*/
function fixedAttrsDef(elementAst) {
var /** @type {?} */ mapResult = Object.create(null);
elementAst.attrs.forEach(function (attrAst) { mapResult[attrAst.name] = attrAst.value; });
elementAst.directives.forEach(function (dirAst) {
Object.keys(dirAst.directive.hostAttributes).forEach(function (name) {
var /** @type {?} */ value = dirAst.directive.hostAttributes[name];
var /** @type {?} */ prevValue = mapResult[name];
mapResult[name] = prevValue != null ? mergeAttributeValue(name, prevValue, value) : value;
});
});
// Note: We need to sort to get a defined output order
// for tests and for caching generated artifacts...
return literalArr(Object.keys(mapResult).sort().map(function (attrName) { return literalArr([literal(attrName), literal(mapResult[attrName])]); }));
}
/**
* @param {?} attrName
* @param {?} attrValue1
* @param {?} attrValue2
* @return {?}
*/
function mergeAttributeValue(attrName, attrValue1, attrValue2) {
if (attrName == CLASS_ATTR$1 || attrName == STYLE_ATTR) {
return attrValue1 + " " + attrValue2;
}
else {
return attrValue2;
}
}
/**
* @param {?} nodeIndex
* @param {?} exprs
* @return {?}
*/
function callCheckStmt(nodeIndex, exprs) {
if (exprs.length > 10) {
return CHECK_VAR.callFn([VIEW_VAR, literal(nodeIndex), literal(1 /* Dynamic */), literalArr(exprs)]);
}
else {
return CHECK_VAR.callFn([VIEW_VAR, literal(nodeIndex), literal(0 /* Inline */)].concat(exprs));
}
}
/**
* @param {?} nodeIndex
* @param {?} bindingIdx
* @param {?} expr
* @return {?}
*/
function callUnwrapValue(nodeIndex, bindingIdx, expr) {
return importExpr(Identifiers.unwrapValue).callFn([
VIEW_VAR, literal(nodeIndex), literal(bindingIdx), expr
]);
}
/**
* @param {?} nodes
* @param {?=} result
* @return {?}
*/
function findStaticQueryIds(nodes, result) {
if (result === void 0) { result = new Map(); }
nodes.forEach(function (node) {
var /** @type {?} */ staticQueryIds = new Set();
var /** @type {?} */ dynamicQueryIds = new Set();
var /** @type {?} */ queryMatches = /** @type {?} */ ((undefined));
if (node instanceof ElementAst) {
findStaticQueryIds(node.children, result);
node.children.forEach(function (child) {
var /** @type {?} */ childData = /** @type {?} */ ((result.get(child)));
childData.staticQueryIds.forEach(function (queryId) { return staticQueryIds.add(queryId); });
childData.dynamicQueryIds.forEach(function (queryId) { return dynamicQueryIds.add(queryId); });
});
queryMatches = node.queryMatches;
}
else if (node instanceof EmbeddedTemplateAst) {
findStaticQueryIds(node.children, result);
node.children.forEach(function (child) {
var /** @type {?} */ childData = /** @type {?} */ ((result.get(child)));
childData.staticQueryIds.forEach(function (queryId) { return dynamicQueryIds.add(queryId); });
childData.dynamicQueryIds.forEach(function (queryId) { return dynamicQueryIds.add(queryId); });
});
queryMatches = node.queryMatches;
}
if (queryMatches) {
queryMatches.forEach(function (match) { return staticQueryIds.add(match.queryId); });
}
dynamicQueryIds.forEach(function (queryId) { return staticQueryIds.delete(queryId); });
result.set(node, { staticQueryIds: staticQueryIds, dynamicQueryIds: dynamicQueryIds });
});
return result;
}
/**
* @param {?} nodeStaticQueryIds
* @return {?}
*/
function staticViewQueryIds(nodeStaticQueryIds) {
var /** @type {?} */ staticQueryIds = new Set();
var /** @type {?} */ dynamicQueryIds = new Set();
Array.from(nodeStaticQueryIds.values()).forEach(function (entry) {
entry.staticQueryIds.forEach(function (queryId) { return staticQueryIds.add(queryId); });
entry.dynamicQueryIds.forEach(function (queryId) { return dynamicQueryIds.add(queryId); });
});
dynamicQueryIds.forEach(function (queryId) { return staticQueryIds.delete(queryId); });
return { staticQueryIds: staticQueryIds, dynamicQueryIds: dynamicQueryIds };
}
/**
* @param {?} eventAst
* @param {?} dirAst
* @return {?}
*/
function elementEventNameAndTarget(eventAst, dirAst) {
if (eventAst.isAnimation) {
return {
name: "@" + eventAst.name + "." + eventAst.phase,
target: dirAst && dirAst.directive.isComponent ? 'component' : null
};
}
else {
return eventAst;
}
}
/**
* @param {?} queryIds
* @param {?} queryId
* @param {?} isFirst
* @return {?}
*/
function calcStaticDynamicQueryFlags(queryIds, queryId, isFirst) {
var /** @type {?} */ flags = 0;
// Note: We only make queries static that query for a single item.
// This is because of backwards compatibility with the old view compiler...
if (isFirst && (queryIds.staticQueryIds.has(queryId) || !queryIds.dynamicQueryIds.has(queryId))) {
flags |= 268435456 /* StaticQuery */;
}
else {
flags |= 536870912 /* DynamicQuery */;
}
return flags;
}
/**
* @param {?} target
* @param {?} name
* @return {?}
*/
function elementEventFullName(target, name) {
return target ? target + ":" + name : name;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* A container for message extracted from the templates.
*/
var MessageBundle = (function () {
function MessageBundle(_htmlParser, _implicitTags, _implicitAttrs, _locale) {
if (_locale === void 0) { _locale = null; }
this._htmlParser = _htmlParser;
this._implicitTags = _implicitTags;
this._implicitAttrs = _implicitAttrs;
this._locale = _locale;
this._messages = [];
}
/**
* @param {?} html
* @param {?} url
* @param {?} interpolationConfig
* @return {?}
*/
MessageBundle.prototype.updateFromTemplate = /**
* @param {?} html
* @param {?} url
* @param {?} interpolationConfig
* @return {?}
*/
function (html, url, interpolationConfig) {
var /** @type {?} */ htmlParserResult = this._htmlParser.parse(html, url, true, interpolationConfig);
if (htmlParserResult.errors.length) {
return htmlParserResult.errors;
}
var /** @type {?} */ i18nParserResult = extractMessages(htmlParserResult.rootNodes, interpolationConfig, this._implicitTags, this._implicitAttrs);
if (i18nParserResult.errors.length) {
return i18nParserResult.errors;
}
(_a = this._messages).push.apply(_a, i18nParserResult.messages);
return [];
var _a;
};
// Return the message in the internal format
// The public (serialized) format might be different, see the `write` method.
/**
* @return {?}
*/
MessageBundle.prototype.getMessages = /**
* @return {?}
*/
function () { return this._messages; };
/**
* @param {?} serializer
* @param {?=} filterSources
* @return {?}
*/
MessageBundle.prototype.write = /**
* @param {?} serializer
* @param {?=} filterSources
* @return {?}
*/
function (serializer, filterSources) {
var /** @type {?} */ messages = {};
var /** @type {?} */ mapperVisitor = new MapPlaceholderNames();
// Deduplicate messages based on their ID
this._messages.forEach(function (message) {
var /** @type {?} */ id = serializer.digest(message);
if (!messages.hasOwnProperty(id)) {
messages[id] = message;
}
else {
(_a = messages[id].sources).push.apply(_a, message.sources);
}
var _a;
});
// Transform placeholder names using the serializer mapping
var /** @type {?} */ msgList = Object.keys(messages).map(function (id) {
var /** @type {?} */ mapper = serializer.createNameMapper(messages[id]);
var /** @type {?} */ src = messages[id];
var /** @type {?} */ nodes = mapper ? mapperVisitor.convert(src.nodes, mapper) : src.nodes;
var /** @type {?} */ transformedMessage = new Message(nodes, {}, {}, src.meaning, src.description, id);
transformedMessage.sources = src.sources;
if (filterSources) {
transformedMessage.sources.forEach(function (source) { return source.filePath = filterSources(source.filePath); });
}
return transformedMessage;
});
return serializer.write(msgList, this._locale);
};
return MessageBundle;
}());
var MapPlaceholderNames = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(MapPlaceholderNames, _super);
function MapPlaceholderNames() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @param {?} nodes
* @param {?} mapper
* @return {?}
*/
MapPlaceholderNames.prototype.convert = /**
* @param {?} nodes
* @param {?} mapper
* @return {?}
*/
function (nodes, mapper) {
var _this = this;
return mapper ? nodes.map(function (n) { return n.visit(_this, mapper); }) : nodes;
};
/**
* @param {?} ph
* @param {?} mapper
* @return {?}
*/
MapPlaceholderNames.prototype.visitTagPlaceholder = /**
* @param {?} ph
* @param {?} mapper
* @return {?}
*/
function (ph, mapper) {
var _this = this;
var /** @type {?} */ startName = /** @type {?} */ ((mapper.toPublicName(ph.startName)));
var /** @type {?} */ closeName = ph.closeName ? /** @type {?} */ ((mapper.toPublicName(ph.closeName))) : ph.closeName;
var /** @type {?} */ children = ph.children.map(function (n) { return n.visit(_this, mapper); });
return new TagPlaceholder(ph.tag, ph.attrs, startName, closeName, children, ph.isVoid, ph.sourceSpan);
};
/**
* @param {?} ph
* @param {?} mapper
* @return {?}
*/
MapPlaceholderNames.prototype.visitPlaceholder = /**
* @param {?} ph
* @param {?} mapper
* @return {?}
*/
function (ph, mapper) {
return new Placeholder(ph.value, /** @type {?} */ ((mapper.toPublicName(ph.name))), ph.sourceSpan);
};
/**
* @param {?} ph
* @param {?} mapper
* @return {?}
*/
MapPlaceholderNames.prototype.visitIcuPlaceholder = /**
* @param {?} ph
* @param {?} mapper
* @return {?}
*/
function (ph, mapper) {
return new IcuPlaceholder(ph.value, /** @type {?} */ ((mapper.toPublicName(ph.name))), ph.sourceSpan);
};
return MapPlaceholderNames;
}(CloneVisitor));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var GeneratedFile = (function () {
function GeneratedFile(srcFileUrl, genFileUrl, sourceOrStmts) {
this.srcFileUrl = srcFileUrl;
this.genFileUrl = genFileUrl;
if (typeof sourceOrStmts === 'string') {
this.source = sourceOrStmts;
this.stmts = null;
}
else {
this.source = null;
this.stmts = sourceOrStmts;
}
}
/**
* @param {?} other
* @return {?}
*/
GeneratedFile.prototype.isEquivalent = /**
* @param {?} other
* @return {?}
*/
function (other) {
if (this.genFileUrl !== other.genFileUrl) {
return false;
}
if (this.source) {
return this.source === other.source;
}
if (other.stmts == null) {
return false;
}
// Note: the constructor guarantees that if this.source is not filled,
// then this.stmts is.
return areAllEquivalent(/** @type {?} */ ((this.stmts)), /** @type {?} */ ((other.stmts)));
};
return GeneratedFile;
}());
/**
* @param {?} file
* @param {?=} preamble
* @return {?}
*/
function toTypeScript(file, preamble) {
if (preamble === void 0) { preamble = ''; }
if (!file.stmts) {
throw new Error("Illegal state: No stmts present on GeneratedFile " + file.genFileUrl);
}
return new TypeScriptEmitter().emitStatements(file.genFileUrl, file.stmts, preamble);
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @record
*/
/**
* @param {?} moduleMeta
* @param {?} reflector
* @return {?}
*/
function listLazyRoutes(moduleMeta, reflector) {
var /** @type {?} */ allLazyRoutes = [];
for (var _i = 0, _a = moduleMeta.transitiveModule.providers; _i < _a.length; _i++) {
var _b = _a[_i], provider = _b.provider, module = _b.module;
if (tokenReference(provider.token) === reflector.ROUTES) {
var /** @type {?} */ loadChildren = _collectLoadChildren(provider.useValue);
for (var _c = 0, loadChildren_1 = loadChildren; _c < loadChildren_1.length; _c++) {
var route = loadChildren_1[_c];
allLazyRoutes.push(parseLazyRoute(route, reflector, module.reference));
}
}
}
return allLazyRoutes;
}
/**
* @param {?} routes
* @param {?=} target
* @return {?}
*/
function _collectLoadChildren(routes, target) {
if (target === void 0) { target = []; }
if (typeof routes === 'string') {
target.push(routes);
}
else if (Array.isArray(routes)) {
for (var _i = 0, routes_1 = routes; _i < routes_1.length; _i++) {
var route = routes_1[_i];
_collectLoadChildren(route, target);
}
}
else if (routes.loadChildren) {
_collectLoadChildren(routes.loadChildren, target);
}
else if (routes.children) {
_collectLoadChildren(routes.children, target);
}
return target;
}
/**
* @param {?} route
* @param {?} reflector
* @param {?=} module
* @return {?}
*/
function parseLazyRoute(route, reflector, module) {
var _a = route.split('#'), routePath = _a[0], routeName = _a[1];
var /** @type {?} */ referencedModule = reflector.resolveExternalReference({
moduleName: routePath,
name: routeName,
}, module ? module.filePath : undefined);
return { route: route, module: module || referencedModule, referencedModule: referencedModule };
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @param {?} srcFileName
* @param {?} forJitCtx
* @param {?} summaryResolver
* @param {?} symbolResolver
* @param {?} symbols
* @param {?} types
* @return {?}
*/
function serializeSummaries(srcFileName, forJitCtx, summaryResolver, symbolResolver, symbols, types) {
var /** @type {?} */ toJsonSerializer = new ToJsonSerializer(symbolResolver, summaryResolver, srcFileName);
// for symbols, we use everything except for the class metadata itself
// (we keep the statics though), as the class metadata is contained in the
// CompileTypeSummary.
symbols.forEach(function (resolvedSymbol) {
return toJsonSerializer.addSummary({ symbol: resolvedSymbol.symbol, metadata: resolvedSymbol.metadata });
});
// Add type summaries.
types.forEach(function (_a) {
var summary = _a.summary, metadata = _a.metadata;
toJsonSerializer.addSummary({ symbol: summary.type.reference, metadata: undefined, type: summary });
});
var _a = toJsonSerializer.serialize(), json = _a.json, exportAs = _a.exportAs;
if (forJitCtx) {
var /** @type {?} */ forJitSerializer_1 = new ForJitSerializer(forJitCtx, symbolResolver, summaryResolver);
types.forEach(function (_a) {
var summary = _a.summary, metadata = _a.metadata;
forJitSerializer_1.addSourceType(summary, metadata);
});
toJsonSerializer.unprocessedSymbolSummariesBySymbol.forEach(function (summary) {
if (summaryResolver.isLibraryFile(summary.symbol.filePath) && summary.type) {
forJitSerializer_1.addLibType(summary.type);
}
});
forJitSerializer_1.serialize(exportAs);
}
return { json: json, exportAs: exportAs };
}
/**
* @param {?} symbolCache
* @param {?} summaryResolver
* @param {?} libraryFileName
* @param {?} json
* @return {?}
*/
function deserializeSummaries(symbolCache, summaryResolver, libraryFileName, json) {
var /** @type {?} */ deserializer = new FromJsonDeserializer(symbolCache, summaryResolver);
return deserializer.deserialize(libraryFileName, json);
}
/**
* @param {?} outputCtx
* @param {?} reference
* @return {?}
*/
function createForJitStub(outputCtx, reference) {
return createSummaryForJitFunction(outputCtx, reference, NULL_EXPR);
}
/**
* @param {?} outputCtx
* @param {?} reference
* @param {?} value
* @return {?}
*/
function createSummaryForJitFunction(outputCtx, reference, value) {
var /** @type {?} */ fnName = summaryForJitName(reference.name);
outputCtx.statements.push(fn([], [new ReturnStatement(value)], new ArrayType(DYNAMIC_TYPE)).toDeclStmt(fnName, [
StmtModifier.Final, StmtModifier.Exported
]));
}
var ToJsonSerializer = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ToJsonSerializer, _super);
function ToJsonSerializer(symbolResolver, summaryResolver, srcFileName) {
var _this = _super.call(this) || this;
_this.symbolResolver = symbolResolver;
_this.summaryResolver = summaryResolver;
_this.srcFileName = srcFileName;
_this.symbols = [];
_this.indexBySymbol = new Map();
_this.reexportedBy = new Map();
_this.processedSummaryBySymbol = new Map();
_this.processedSummaries = [];
_this.unprocessedSymbolSummariesBySymbol = new Map();
_this.moduleName = symbolResolver.getKnownModuleName(srcFileName);
return _this;
}
/**
* @param {?} summary
* @return {?}
*/
ToJsonSerializer.prototype.addSummary = /**
* @param {?} summary
* @return {?}
*/
function (summary) {
var _this = this;
var /** @type {?} */ unprocessedSummary = this.unprocessedSymbolSummariesBySymbol.get(summary.symbol);
var /** @type {?} */ processedSummary = this.processedSummaryBySymbol.get(summary.symbol);
if (!unprocessedSummary) {
unprocessedSummary = { symbol: summary.symbol, metadata: undefined };
this.unprocessedSymbolSummariesBySymbol.set(summary.symbol, unprocessedSummary);
processedSummary = { symbol: this.processValue(summary.symbol, 0 /* None */) };
this.processedSummaries.push(processedSummary);
this.processedSummaryBySymbol.set(summary.symbol, processedSummary);
}
if (!unprocessedSummary.metadata && summary.metadata) {
var /** @type {?} */ metadata_1 = summary.metadata || {};
if (metadata_1.__symbolic === 'class') {
// For classes, we keep everything except their class decorators.
// We need to keep e.g. the ctor args, method names, method decorators
// so that the class can be extended in another compilation unit.
// We don't keep the class decorators as
// 1) they refer to data
// that should not cause a rebuild of downstream compilation units
// (e.g. inline templates of @Component, or @NgModule.declarations)
// 2) their data is already captured in TypeSummaries, e.g. DirectiveSummary.
var /** @type {?} */ clone_1 = {};
Object.keys(metadata_1).forEach(function (propName) {
if (propName !== 'decorators') {
clone_1[propName] = metadata_1[propName];
}
});
metadata_1 = clone_1;
}
else if (isCall(metadata_1)) {
if (!isFunctionCall(metadata_1) && !isMethodCallOnVariable(metadata_1)) {
// Don't store complex calls as we won't be able to simplify them anyways later on.
// Don't store complex calls as we won't be able to simplify them anyways later on.
metadata_1 = {
__symbolic: 'error',
message: 'Complex function calls are not supported.',
};
}
}
// Note: We need to keep storing ctor calls for e.g.
// `export const x = new InjectionToken(...)`
unprocessedSummary.metadata = metadata_1;
processedSummary.metadata = this.processValue(metadata_1, 1 /* ResolveValue */);
if (metadata_1 instanceof StaticSymbol &&
this.summaryResolver.isLibraryFile(metadata_1.filePath)) {
var /** @type {?} */ declarationSymbol = this.symbols[/** @type {?} */ ((this.indexBySymbol.get(metadata_1)))];
if (!isLoweredSymbol(declarationSymbol.name)) {
// Note: symbols that were introduced during codegen in the user file can have a reexport
// if a user used `export *`. However, we can't rely on this as tsickle will change
// `export *` into named exports, using only the information from the typechecker.
// As we introduce the new symbols after typecheck, Tsickle does not know about them,
// and omits them when expanding `export *`.
// So we have to keep reexporting these symbols manually via .ngfactory files.
this.reexportedBy.set(declarationSymbol, summary.symbol);
}
}
}
if (!unprocessedSummary.type && summary.type) {
unprocessedSummary.type = summary.type;
// Note: We don't add the summaries of all referenced symbols as for the ResolvedSymbols,
// as the type summaries already contain the transitive data that they require
// (in a minimal way).
processedSummary.type = this.processValue(summary.type, 0 /* None */);
// except for reexported directives / pipes, so we need to store
// their summaries explicitly.
if (summary.type.summaryKind === CompileSummaryKind.NgModule) {
var /** @type {?} */ ngModuleSummary = /** @type {?} */ (summary.type);
ngModuleSummary.exportedDirectives.concat(ngModuleSummary.exportedPipes).forEach(function (id) {
var /** @type {?} */ symbol = id.reference;
if (_this.summaryResolver.isLibraryFile(symbol.filePath) &&
!_this.unprocessedSymbolSummariesBySymbol.has(symbol)) {
var /** @type {?} */ summary_1 = _this.summaryResolver.resolveSummary(symbol);
if (summary_1) {
_this.addSummary(summary_1);
}
}
});
}
}
};
/**
* @return {?}
*/
ToJsonSerializer.prototype.serialize = /**
* @return {?}
*/
function () {
var _this = this;
var /** @type {?} */ exportAs = [];
var /** @type {?} */ json = JSON.stringify({
moduleName: this.moduleName,
summaries: this.processedSummaries,
symbols: this.symbols.map(function (symbol, index) {
symbol.assertNoMembers();
var /** @type {?} */ importAs = /** @type {?} */ ((undefined));
if (_this.summaryResolver.isLibraryFile(symbol.filePath)) {
var /** @type {?} */ reexportSymbol = _this.reexportedBy.get(symbol);
if (reexportSymbol) {
importAs = /** @type {?} */ ((_this.indexBySymbol.get(reexportSymbol)));
}
else {
var /** @type {?} */ summary = _this.unprocessedSymbolSummariesBySymbol.get(symbol);
if (!summary || !summary.metadata || summary.metadata.__symbolic !== 'interface') {
importAs = symbol.name + "_" + index;
exportAs.push({ symbol: symbol, exportAs: importAs });
}
}
}
return {
__symbol: index,
name: symbol.name,
filePath: _this.summaryResolver.toSummaryFileName(symbol.filePath, _this.srcFileName),
importAs: importAs
};
})
});
return { json: json, exportAs: exportAs };
};
/**
* @param {?} value
* @param {?} flags
* @return {?}
*/
ToJsonSerializer.prototype.processValue = /**
* @param {?} value
* @param {?} flags
* @return {?}
*/
function (value, flags) {
return visitValue(value, this, flags);
};
/**
* @param {?} value
* @param {?} context
* @return {?}
*/
ToJsonSerializer.prototype.visitOther = /**
* @param {?} value
* @param {?} context
* @return {?}
*/
function (value, context) {
if (value instanceof StaticSymbol) {
var /** @type {?} */ baseSymbol = this.symbolResolver.getStaticSymbol(value.filePath, value.name);
var /** @type {?} */ index = this.visitStaticSymbol(baseSymbol, context);
return { __symbol: index, members: value.members };
}
};
/**
* Returns null if the options.resolveValue is true, and the summary for the symbol
* resolved to a type or could not be resolved.
* @param {?} baseSymbol
* @param {?} flags
* @return {?}
*/
ToJsonSerializer.prototype.visitStaticSymbol = /**
* Returns null if the options.resolveValue is true, and the summary for the symbol
* resolved to a type or could not be resolved.
* @param {?} baseSymbol
* @param {?} flags
* @return {?}
*/
function (baseSymbol, flags) {
var /** @type {?} */ index = this.indexBySymbol.get(baseSymbol);
var /** @type {?} */ summary = null;
if (flags & 1 /* ResolveValue */ &&
this.summaryResolver.isLibraryFile(baseSymbol.filePath)) {
if (this.unprocessedSymbolSummariesBySymbol.has(baseSymbol)) {
// the summary for this symbol was already added
// -> nothing to do.
return /** @type {?} */ ((index));
}
summary = this.loadSummary(baseSymbol);
if (summary && summary.metadata instanceof StaticSymbol) {
// The summary is a reexport
index = this.visitStaticSymbol(summary.metadata, flags);
// reset the summary as it is just a reexport, so we don't want to store it.
summary = null;
}
}
else if (index != null) {
// Note: == on purpose to compare with undefined!
// No summary and the symbol is already added -> nothing to do.
return index;
}
// Note: == on purpose to compare with undefined!
if (index == null) {
index = this.symbols.length;
this.symbols.push(baseSymbol);
}
this.indexBySymbol.set(baseSymbol, index);
if (summary) {
this.addSummary(summary);
}
return index;
};
/**
* @param {?} symbol
* @return {?}
*/
ToJsonSerializer.prototype.loadSummary = /**
* @param {?} symbol
* @return {?}
*/
function (symbol) {
var /** @type {?} */ summary = this.summaryResolver.resolveSummary(symbol);
if (!summary) {
// some symbols might originate from a plain typescript library
// that just exported .d.ts and .metadata.json files, i.e. where no summary
// files were created.
var /** @type {?} */ resolvedSymbol = this.symbolResolver.resolveSymbol(symbol);
if (resolvedSymbol) {
summary = { symbol: resolvedSymbol.symbol, metadata: resolvedSymbol.metadata };
}
}
return summary;
};
return ToJsonSerializer;
}(ValueTransformer));
var ForJitSerializer = (function () {
function ForJitSerializer(outputCtx, symbolResolver, summaryResolver) {
this.outputCtx = outputCtx;
this.symbolResolver = symbolResolver;
this.summaryResolver = summaryResolver;
this.data = [];
}
/**
* @param {?} summary
* @param {?} metadata
* @return {?}
*/
ForJitSerializer.prototype.addSourceType = /**
* @param {?} summary
* @param {?} metadata
* @return {?}
*/
function (summary, metadata) {
this.data.push({ summary: summary, metadata: metadata, isLibrary: false });
};
/**
* @param {?} summary
* @return {?}
*/
ForJitSerializer.prototype.addLibType = /**
* @param {?} summary
* @return {?}
*/
function (summary) {
this.data.push({ summary: summary, metadata: null, isLibrary: true });
};
/**
* @param {?} exportAsArr
* @return {?}
*/
ForJitSerializer.prototype.serialize = /**
* @param {?} exportAsArr
* @return {?}
*/
function (exportAsArr) {
var _this = this;
var /** @type {?} */ exportAsBySymbol = new Map();
for (var _i = 0, exportAsArr_1 = exportAsArr; _i < exportAsArr_1.length; _i++) {
var _a = exportAsArr_1[_i], symbol = _a.symbol, exportAs = _a.exportAs;
exportAsBySymbol.set(symbol, exportAs);
}
var /** @type {?} */ ngModuleSymbols = new Set();
for (var _b = 0, _c = this.data; _b < _c.length; _b++) {
var _d = _c[_b], summary = _d.summary, metadata = _d.metadata, isLibrary = _d.isLibrary;
if (summary.summaryKind === CompileSummaryKind.NgModule) {
// collect the symbols that refer to NgModule classes.
// Note: we can't just rely on `summary.type.summaryKind` to determine this as
// we don't add the summaries of all referenced symbols when we serialize type summaries.
// See serializeSummaries for details.
ngModuleSymbols.add(summary.type.reference);
var /** @type {?} */ modSummary = /** @type {?} */ (summary);
for (var _e = 0, _f = modSummary.modules; _e < _f.length; _e++) {
var mod = _f[_e];
ngModuleSymbols.add(mod.reference);
}
}
if (!isLibrary) {
var /** @type {?} */ fnName = summaryForJitName(summary.type.reference.name);
createSummaryForJitFunction(this.outputCtx, summary.type.reference, this.serializeSummaryWithDeps(summary, /** @type {?} */ ((metadata))));
}
}
ngModuleSymbols.forEach(function (ngModuleSymbol) {
if (_this.summaryResolver.isLibraryFile(ngModuleSymbol.filePath)) {
var /** @type {?} */ exportAs = exportAsBySymbol.get(ngModuleSymbol) || ngModuleSymbol.name;
var /** @type {?} */ jitExportAsName = summaryForJitName(exportAs);
_this.outputCtx.statements.push(variable(jitExportAsName)
.set(_this.serializeSummaryRef(ngModuleSymbol))
.toDeclStmt(null, [StmtModifier.Exported]));
}
});
};
/**
* @param {?} summary
* @param {?} metadata
* @return {?}
*/
ForJitSerializer.prototype.serializeSummaryWithDeps = /**
* @param {?} summary
* @param {?} metadata
* @return {?}
*/
function (summary, metadata) {
var _this = this;
var /** @type {?} */ expressions = [this.serializeSummary(summary)];
var /** @type {?} */ providers = [];
if (metadata instanceof CompileNgModuleMetadata) {
expressions.push.apply(expressions,
// For directives / pipes, we only add the declared ones,
// and rely on transitively importing NgModules to get the transitive
// summaries.
metadata.declaredDirectives.concat(metadata.declaredPipes)
.map(function (type) { return type.reference; })
.concat(metadata.transitiveModule.modules.map(function (type) { return type.reference; })
.filter(function (ref) { return ref !== metadata.type.reference; }))
.map(function (ref) { return _this.serializeSummaryRef(ref); }));
// Note: We don't use `NgModuleSummary.providers`, as that one is transitive,
// and we already have transitive modules.
providers = metadata.providers;
}
else if (summary.summaryKind === CompileSummaryKind.Directive) {
var /** @type {?} */ dirSummary = /** @type {?} */ (summary);
providers = dirSummary.providers.concat(dirSummary.viewProviders);
}
// Note: We can't just refer to the `ngsummary.ts` files for `useClass` providers (as we do for
// declaredDirectives / declaredPipes), as we allow
// providers without ctor arguments to skip the `@Injectable` decorator,
// i.e. we didn't generate .ngsummary.ts files for these.
expressions.push.apply(expressions, providers.filter(function (provider) { return !!provider.useClass; }).map(function (provider) {
return _this.serializeSummary(/** @type {?} */ ({
summaryKind: CompileSummaryKind.Injectable, type: provider.useClass
}));
}));
return literalArr(expressions);
};
/**
* @param {?} typeSymbol
* @return {?}
*/
ForJitSerializer.prototype.serializeSummaryRef = /**
* @param {?} typeSymbol
* @return {?}
*/
function (typeSymbol) {
var /** @type {?} */ jitImportedSymbol = this.symbolResolver.getStaticSymbol(summaryForJitFileName(typeSymbol.filePath), summaryForJitName(typeSymbol.name));
return this.outputCtx.importExpr(jitImportedSymbol);
};
/**
* @param {?} data
* @return {?}
*/
ForJitSerializer.prototype.serializeSummary = /**
* @param {?} data
* @return {?}
*/
function (data) {
var /** @type {?} */ outputCtx = this.outputCtx;
var Transformer = (function () {
function Transformer() {
}
/**
* @param {?} arr
* @param {?} context
* @return {?}
*/
Transformer.prototype.visitArray = /**
* @param {?} arr
* @param {?} context
* @return {?}
*/
function (arr, context) {
var _this = this;
return literalArr(arr.map(function (entry) { return visitValue(entry, _this, context); }));
};
/**
* @param {?} map
* @param {?} context
* @return {?}
*/
Transformer.prototype.visitStringMap = /**
* @param {?} map
* @param {?} context
* @return {?}
*/
function (map, context) {
var _this = this;
return new LiteralMapExpr(Object.keys(map).map(function (key) { return new LiteralMapEntry(key, visitValue(map[key], _this, context), false); }));
};
/**
* @param {?} value
* @param {?} context
* @return {?}
*/
Transformer.prototype.visitPrimitive = /**
* @param {?} value
* @param {?} context
* @return {?}
*/
function (value, context) { return literal(value); };
/**
* @param {?} value
* @param {?} context
* @return {?}
*/
Transformer.prototype.visitOther = /**
* @param {?} value
* @param {?} context
* @return {?}
*/
function (value, context) {
if (value instanceof StaticSymbol) {
return outputCtx.importExpr(value);
}
else {
throw new Error("Illegal State: Encountered value " + value);
}
};
return Transformer;
}());
return visitValue(data, new Transformer(), null);
};
return ForJitSerializer;
}());
var FromJsonDeserializer = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(FromJsonDeserializer, _super);
function FromJsonDeserializer(symbolCache, summaryResolver) {
var _this = _super.call(this) || this;
_this.symbolCache = symbolCache;
_this.summaryResolver = summaryResolver;
return _this;
}
/**
* @param {?} libraryFileName
* @param {?} json
* @return {?}
*/
FromJsonDeserializer.prototype.deserialize = /**
* @param {?} libraryFileName
* @param {?} json
* @return {?}
*/
function (libraryFileName, json) {
var _this = this;
var /** @type {?} */ data = JSON.parse(json);
var /** @type {?} */ allImportAs = [];
this.symbols = data.symbols.map(function (serializedSymbol) {
return _this.symbolCache.get(_this.summaryResolver.fromSummaryFileName(serializedSymbol.filePath, libraryFileName), serializedSymbol.name);
});
data.symbols.forEach(function (serializedSymbol, index) {
var /** @type {?} */ symbol = _this.symbols[index];
var /** @type {?} */ importAs = serializedSymbol.importAs;
if (typeof importAs === 'number') {
allImportAs.push({ symbol: symbol, importAs: _this.symbols[importAs] });
}
else if (typeof importAs === 'string') {
allImportAs.push({ symbol: symbol, importAs: _this.symbolCache.get(ngfactoryFilePath(libraryFileName), importAs) });
}
});
var /** @type {?} */ summaries = /** @type {?} */ (visitValue(data.summaries, this, null));
return { moduleName: data.moduleName, summaries: summaries, importAs: allImportAs };
};
/**
* @param {?} map
* @param {?} context
* @return {?}
*/
FromJsonDeserializer.prototype.visitStringMap = /**
* @param {?} map
* @param {?} context
* @return {?}
*/
function (map, context) {
if ('__symbol' in map) {
var /** @type {?} */ baseSymbol = this.symbols[map['__symbol']];
var /** @type {?} */ members = map['members'];
return members.length ? this.symbolCache.get(baseSymbol.filePath, baseSymbol.name, members) :
baseSymbol;
}
else {
return _super.prototype.visitStringMap.call(this, map, context);
}
};
return FromJsonDeserializer;
}(ValueTransformer));
/**
* @param {?} metadata
* @return {?}
*/
function isCall(metadata) {
return metadata && metadata.__symbolic === 'call';
}
/**
* @param {?} metadata
* @return {?}
*/
function isFunctionCall(metadata) {
return isCall(metadata) && metadata.expression instanceof StaticSymbol;
}
/**
* @param {?} metadata
* @return {?}
*/
function isMethodCallOnVariable(metadata) {
return isCall(metadata) && metadata.expression && metadata.expression.__symbolic === 'select' &&
metadata.expression.expression instanceof StaticSymbol;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/** @enum {number} */
var StubEmitFlags = {
Basic: 1,
TypeCheck: 2,
All: 3,
};
StubEmitFlags[StubEmitFlags.Basic] = "Basic";
StubEmitFlags[StubEmitFlags.TypeCheck] = "TypeCheck";
StubEmitFlags[StubEmitFlags.All] = "All";
var AotCompiler = (function () {
function AotCompiler(_config, _options, _host, _reflector, _metadataResolver, _templateParser, _styleCompiler, _viewCompiler, _typeCheckCompiler, _ngModuleCompiler, _outputEmitter, _summaryResolver, _symbolResolver) {
this._config = _config;
this._options = _options;
this._host = _host;
this._reflector = _reflector;
this._metadataResolver = _metadataResolver;
this._templateParser = _templateParser;
this._styleCompiler = _styleCompiler;
this._viewCompiler = _viewCompiler;
this._typeCheckCompiler = _typeCheckCompiler;
this._ngModuleCompiler = _ngModuleCompiler;
this._outputEmitter = _outputEmitter;
this._summaryResolver = _summaryResolver;
this._symbolResolver = _symbolResolver;
this._templateAstCache = new Map();
this._analyzedFiles = new Map();
}
/**
* @return {?}
*/
AotCompiler.prototype.clearCache = /**
* @return {?}
*/
function () { this._metadataResolver.clearCache(); };
/**
* @param {?} rootFiles
* @return {?}
*/
AotCompiler.prototype.analyzeModulesSync = /**
* @param {?} rootFiles
* @return {?}
*/
function (rootFiles) {
var _this = this;
var /** @type {?} */ analyzeResult = analyzeAndValidateNgModules(rootFiles, this._host, this._symbolResolver, this._metadataResolver);
analyzeResult.ngModules.forEach(function (ngModule) {
return _this._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, true);
});
return analyzeResult;
};
/**
* @param {?} rootFiles
* @return {?}
*/
AotCompiler.prototype.analyzeModulesAsync = /**
* @param {?} rootFiles
* @return {?}
*/
function (rootFiles) {
var _this = this;
var /** @type {?} */ analyzeResult = analyzeAndValidateNgModules(rootFiles, this._host, this._symbolResolver, this._metadataResolver);
return Promise
.all(analyzeResult.ngModules.map(function (ngModule) {
return _this._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, false);
}))
.then(function () { return analyzeResult; });
};
/**
* @param {?} fileName
* @return {?}
*/
AotCompiler.prototype._analyzeFile = /**
* @param {?} fileName
* @return {?}
*/
function (fileName) {
var /** @type {?} */ analyzedFile = this._analyzedFiles.get(fileName);
if (!analyzedFile) {
analyzedFile =
analyzeFile(this._host, this._symbolResolver, this._metadataResolver, fileName);
this._analyzedFiles.set(fileName, analyzedFile);
}
return analyzedFile;
};
/**
* @param {?} fileName
* @return {?}
*/
AotCompiler.prototype.findGeneratedFileNames = /**
* @param {?} fileName
* @return {?}
*/
function (fileName) {
var _this = this;
var /** @type {?} */ genFileNames = [];
var /** @type {?} */ file = this._analyzeFile(fileName);
// Make sure we create a .ngfactory if we have a injectable/directive/pipe/NgModule
// or a reference to a non source file.
// Note: This is overestimating the required .ngfactory files as the real calculation is harder.
// Only do this for StubEmitFlags.Basic, as adding a type check block
// does not change this file (as we generate type check blocks based on NgModules).
if (this._options.allowEmptyCodegenFiles || file.directives.length || file.pipes.length ||
file.injectables.length || file.ngModules.length || file.exportsNonSourceFiles) {
genFileNames.push(ngfactoryFilePath(file.fileName, true));
if (this._options.enableSummariesForJit) {
genFileNames.push(summaryForJitFileName(file.fileName, true));
}
}
var /** @type {?} */ fileSuffix = splitTypescriptSuffix(file.fileName, true)[1];
file.directives.forEach(function (dirSymbol) {
var /** @type {?} */ compMeta = /** @type {?} */ ((_this._metadataResolver.getNonNormalizedDirectiveMetadata(dirSymbol))).metadata;
if (!compMeta.isComponent) {
return;
} /** @type {?} */
((
// Note: compMeta is a component and therefore template is non null.
compMeta.template)).styleUrls.forEach(function (styleUrl) {
var /** @type {?} */ normalizedUrl = _this._host.resourceNameToFileName(styleUrl, file.fileName);
if (!normalizedUrl) {
throw syntaxError("Couldn't resolve resource " + styleUrl + " relative to " + file.fileName);
}
var /** @type {?} */ needsShim = (/** @type {?} */ ((compMeta.template)).encapsulation || _this._config.defaultEncapsulation) === ViewEncapsulation.Emulated;
genFileNames.push(_stylesModuleUrl(normalizedUrl, needsShim, fileSuffix));
if (_this._options.allowEmptyCodegenFiles) {
genFileNames.push(_stylesModuleUrl(normalizedUrl, !needsShim, fileSuffix));
}
});
});
return genFileNames;
};
/**
* @param {?} genFileName
* @param {?=} originalFileName
* @return {?}
*/
AotCompiler.prototype.emitBasicStub = /**
* @param {?} genFileName
* @param {?=} originalFileName
* @return {?}
*/
function (genFileName, originalFileName) {
var /** @type {?} */ outputCtx = this._createOutputContext(genFileName);
if (genFileName.endsWith('.ngfactory.ts')) {
if (!originalFileName) {
throw new Error("Assertion error: require the original file for .ngfactory.ts stubs. File: " + genFileName);
}
var /** @type {?} */ originalFile = this._analyzeFile(originalFileName);
this._createNgFactoryStub(outputCtx, originalFile, StubEmitFlags.Basic);
}
else if (genFileName.endsWith('.ngsummary.ts')) {
if (this._options.enableSummariesForJit) {
if (!originalFileName) {
throw new Error("Assertion error: require the original file for .ngsummary.ts stubs. File: " + genFileName);
}
var /** @type {?} */ originalFile = this._analyzeFile(originalFileName);
_createEmptyStub(outputCtx);
originalFile.ngModules.forEach(function (ngModule) {
// create exports that user code can reference
createForJitStub(outputCtx, ngModule.type.reference);
});
}
}
else if (genFileName.endsWith('.ngstyle.ts')) {
_createEmptyStub(outputCtx);
}
// Note: for the stubs, we don't need a property srcFileUrl,
// as lateron in emitAllImpls we will create the proper GeneratedFiles with the
// correct srcFileUrl.
// This is good as e.g. for .ngstyle.ts files we can't derive
// the url of components based on the genFileUrl.
return this._codegenSourceModule('unknown', outputCtx);
};
/**
* @param {?} genFileName
* @param {?} originalFileName
* @return {?}
*/
AotCompiler.prototype.emitTypeCheckStub = /**
* @param {?} genFileName
* @param {?} originalFileName
* @return {?}
*/
function (genFileName, originalFileName) {
var /** @type {?} */ originalFile = this._analyzeFile(originalFileName);
var /** @type {?} */ outputCtx = this._createOutputContext(genFileName);
if (genFileName.endsWith('.ngfactory.ts')) {
this._createNgFactoryStub(outputCtx, originalFile, StubEmitFlags.TypeCheck);
}
return outputCtx.statements.length > 0 ?
this._codegenSourceModule(originalFile.fileName, outputCtx) :
null;
};
/**
* @param {?} fileNames
* @return {?}
*/
AotCompiler.prototype.loadFilesAsync = /**
* @param {?} fileNames
* @return {?}
*/
function (fileNames) {
var _this = this;
var /** @type {?} */ files = fileNames.map(function (fileName) { return _this._analyzeFile(fileName); });
var /** @type {?} */ loadingPromises = [];
files.forEach(function (file) {
return file.ngModules.forEach(function (ngModule) {
return loadingPromises.push(_this._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, false));
});
});
return Promise.all(loadingPromises).then(function (_) { return mergeAndValidateNgFiles(files); });
};
/**
* @param {?} fileNames
* @return {?}
*/
AotCompiler.prototype.loadFilesSync = /**
* @param {?} fileNames
* @return {?}
*/
function (fileNames) {
var _this = this;
var /** @type {?} */ files = fileNames.map(function (fileName) { return _this._analyzeFile(fileName); });
files.forEach(function (file) {
return file.ngModules.forEach(function (ngModule) {
return _this._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, true);
});
});
return mergeAndValidateNgFiles(files);
};
/**
* @param {?} outputCtx
* @param {?} file
* @param {?} emitFlags
* @return {?}
*/
AotCompiler.prototype._createNgFactoryStub = /**
* @param {?} outputCtx
* @param {?} file
* @param {?} emitFlags
* @return {?}
*/
function (outputCtx, file, emitFlags) {
var _this = this;
var /** @type {?} */ componentId = 0;
file.ngModules.forEach(function (ngModuleMeta, ngModuleIndex) {
// Note: the code below needs to executed for StubEmitFlags.Basic and StubEmitFlags.TypeCheck,
// so we don't change the .ngfactory file too much when adding the typecheck block.
// create exports that user code can reference
// Note: the code below needs to executed for StubEmitFlags.Basic and StubEmitFlags.TypeCheck,
// so we don't change the .ngfactory file too much when adding the typecheck block.
// create exports that user code can reference
_this._ngModuleCompiler.createStub(outputCtx, ngModuleMeta.type.reference);
// add references to the symbols from the metadata.
// These can be used by the type check block for components,
// and they also cause TypeScript to include these files into the program too,
// which will make them part of the analyzedFiles.
var /** @type {?} */ externalReferences = ngModuleMeta.transitiveModule.directives.map(function (d) { return d.reference; }).concat(ngModuleMeta.transitiveModule.pipes.map(function (d) { return d.reference; }), ngModuleMeta.importedModules.map(function (m) { return m.type.reference; }), ngModuleMeta.exportedModules.map(function (m) { return m.type.reference; }), _this._externalIdentifierReferences([Identifiers.TemplateRef, Identifiers.ElementRef]));
var /** @type {?} */ externalReferenceVars = new Map();
externalReferences.forEach(function (ref, typeIndex) {
if (_this._host.isSourceFile(ref.filePath)) {
externalReferenceVars.set(ref, "_decl" + ngModuleIndex + "_" + typeIndex);
}
});
externalReferenceVars.forEach(function (varName, reference) {
outputCtx.statements.push(variable(varName)
.set(NULL_EXPR.cast(DYNAMIC_TYPE))
.toDeclStmt(expressionType(outputCtx.importExpr(reference))));
});
if (emitFlags & StubEmitFlags.TypeCheck) {
// add the typecheck block for all components of the NgModule
ngModuleMeta.declaredDirectives.forEach(function (dirId) {
var /** @type {?} */ compMeta = _this._metadataResolver.getDirectiveMetadata(dirId.reference);
if (!compMeta.isComponent) {
return;
}
componentId++;
_this._createTypeCheckBlock(outputCtx, compMeta.type.reference.name + "_Host_" + componentId, ngModuleMeta, _this._metadataResolver.getHostComponentMetadata(compMeta), [compMeta.type], externalReferenceVars);
_this._createTypeCheckBlock(outputCtx, compMeta.type.reference.name + "_" + componentId, ngModuleMeta, compMeta, ngModuleMeta.transitiveModule.directives, externalReferenceVars);
});
}
});
if (outputCtx.statements.length === 0) {
_createEmptyStub(outputCtx);
}
};
/**
* @param {?} references
* @return {?}
*/
AotCompiler.prototype._externalIdentifierReferences = /**
* @param {?} references
* @return {?}
*/
function (references) {
var /** @type {?} */ result = [];
for (var _i = 0, references_1 = references; _i < references_1.length; _i++) {
var reference = references_1[_i];
var /** @type {?} */ token = createTokenForExternalReference(this._reflector, reference);
if (token.identifier) {
result.push(token.identifier.reference);
}
}
return result;
};
/**
* @param {?} ctx
* @param {?} componentId
* @param {?} moduleMeta
* @param {?} compMeta
* @param {?} directives
* @param {?} externalReferenceVars
* @return {?}
*/
AotCompiler.prototype._createTypeCheckBlock = /**
* @param {?} ctx
* @param {?} componentId
* @param {?} moduleMeta
* @param {?} compMeta
* @param {?} directives
* @param {?} externalReferenceVars
* @return {?}
*/
function (ctx, componentId, moduleMeta, compMeta, directives, externalReferenceVars) {
var _a = this._parseTemplate(compMeta, moduleMeta, directives), parsedTemplate = _a.template, usedPipes = _a.pipes;
(_b = ctx.statements).push.apply(_b, this._typeCheckCompiler.compileComponent(componentId, compMeta, parsedTemplate, usedPipes, externalReferenceVars));
var _b;
};
/**
* @param {?} analyzeResult
* @param {?} locale
* @return {?}
*/
AotCompiler.prototype.emitMessageBundle = /**
* @param {?} analyzeResult
* @param {?} locale
* @return {?}
*/
function (analyzeResult, locale) {
var _this = this;
var /** @type {?} */ errors = [];
var /** @type {?} */ htmlParser = new HtmlParser();
// TODO(vicb): implicit tags & attributes
var /** @type {?} */ messageBundle = new MessageBundle(htmlParser, [], {}, locale);
analyzeResult.files.forEach(function (file) {
var /** @type {?} */ compMetas = [];
file.directives.forEach(function (directiveType) {
var /** @type {?} */ dirMeta = _this._metadataResolver.getDirectiveMetadata(directiveType);
if (dirMeta && dirMeta.isComponent) {
compMetas.push(dirMeta);
}
});
compMetas.forEach(function (compMeta) {
var /** @type {?} */ html = /** @type {?} */ ((/** @type {?} */ ((compMeta.template)).template));
var /** @type {?} */ interpolationConfig = InterpolationConfig.fromArray(/** @type {?} */ ((compMeta.template)).interpolation);
errors.push.apply(errors, /** @type {?} */ ((messageBundle.updateFromTemplate(html, file.fileName, interpolationConfig))));
});
});
if (errors.length) {
throw new Error(errors.map(function (e) { return e.toString(); }).join('\n'));
}
return messageBundle;
};
/**
* @param {?} analyzeResult
* @return {?}
*/
AotCompiler.prototype.emitAllImpls = /**
* @param {?} analyzeResult
* @return {?}
*/
function (analyzeResult) {
var _this = this;
var ngModuleByPipeOrDirective = analyzeResult.ngModuleByPipeOrDirective, files = analyzeResult.files;
var /** @type {?} */ sourceModules = files.map(function (file) {
return _this._compileImplFile(file.fileName, ngModuleByPipeOrDirective, file.directives, file.pipes, file.ngModules, file.injectables);
});
return flatten(sourceModules);
};
/**
* @param {?} srcFileUrl
* @param {?} ngModuleByPipeOrDirective
* @param {?} directives
* @param {?} pipes
* @param {?} ngModules
* @param {?} injectables
* @return {?}
*/
AotCompiler.prototype._compileImplFile = /**
* @param {?} srcFileUrl
* @param {?} ngModuleByPipeOrDirective
* @param {?} directives
* @param {?} pipes
* @param {?} ngModules
* @param {?} injectables
* @return {?}
*/
function (srcFileUrl, ngModuleByPipeOrDirective, directives, pipes, ngModules, injectables) {
var _this = this;
var /** @type {?} */ fileSuffix = splitTypescriptSuffix(srcFileUrl, true)[1];
var /** @type {?} */ generatedFiles = [];
var /** @type {?} */ outputCtx = this._createOutputContext(ngfactoryFilePath(srcFileUrl, true));
generatedFiles.push.apply(generatedFiles, this._createSummary(srcFileUrl, directives, pipes, ngModules, injectables, outputCtx));
// compile all ng modules
ngModules.forEach(function (ngModuleMeta) { return _this._compileModule(outputCtx, ngModuleMeta); });
// compile components
directives.forEach(function (dirType) {
var /** @type {?} */ compMeta = _this._metadataResolver.getDirectiveMetadata(/** @type {?} */ (dirType));
if (!compMeta.isComponent) {
return;
}
var /** @type {?} */ ngModule = ngModuleByPipeOrDirective.get(dirType);
if (!ngModule) {
throw new Error("Internal Error: cannot determine the module for component " + identifierName(compMeta.type) + "!");
}
// compile styles
var /** @type {?} */ componentStylesheet = _this._styleCompiler.compileComponent(outputCtx, compMeta); /** @type {?} */
((
// Note: compMeta is a component and therefore template is non null.
compMeta.template)).externalStylesheets.forEach(function (stylesheetMeta) {
// Note: fill non shim and shim style files as they might
// be shared by component with and without ViewEncapsulation.
var /** @type {?} */ shim = _this._styleCompiler.needsStyleShim(compMeta);
generatedFiles.push(_this._codegenStyles(srcFileUrl, compMeta, stylesheetMeta, shim, fileSuffix));
if (_this._options.allowEmptyCodegenFiles) {
generatedFiles.push(_this._codegenStyles(srcFileUrl, compMeta, stylesheetMeta, !shim, fileSuffix));
}
});
// compile components
var /** @type {?} */ compViewVars = _this._compileComponent(outputCtx, compMeta, ngModule, ngModule.transitiveModule.directives, componentStylesheet, fileSuffix);
_this._compileComponentFactory(outputCtx, compMeta, ngModule, fileSuffix);
});
if (outputCtx.statements.length > 0 || this._options.allowEmptyCodegenFiles) {
var /** @type {?} */ srcModule = this._codegenSourceModule(srcFileUrl, outputCtx);
generatedFiles.unshift(srcModule);
}
return generatedFiles;
};
/**
* @param {?} srcFileName
* @param {?} directives
* @param {?} pipes
* @param {?} ngModules
* @param {?} injectables
* @param {?} ngFactoryCtx
* @return {?}
*/
AotCompiler.prototype._createSummary = /**
* @param {?} srcFileName
* @param {?} directives
* @param {?} pipes
* @param {?} ngModules
* @param {?} injectables
* @param {?} ngFactoryCtx
* @return {?}
*/
function (srcFileName, directives, pipes, ngModules, injectables, ngFactoryCtx) {
var _this = this;
var /** @type {?} */ symbolSummaries = this._symbolResolver.getSymbolsOf(srcFileName)
.map(function (symbol) { return _this._symbolResolver.resolveSymbol(symbol); });
var /** @type {?} */ typeData = ngModules.map(function (meta) {
return ({
summary: /** @type {?} */ ((_this._metadataResolver.getNgModuleSummary(meta.type.reference))),
metadata: /** @type {?} */ ((_this._metadataResolver.getNgModuleMetadata(meta.type.reference)))
});
}).concat(directives.map(function (ref) {
return ({
summary: /** @type {?} */ ((_this._metadataResolver.getDirectiveSummary(ref))),
metadata: /** @type {?} */ ((_this._metadataResolver.getDirectiveMetadata(ref)))
});
}), pipes.map(function (ref) {
return ({
summary: /** @type {?} */ ((_this._metadataResolver.getPipeSummary(ref))),
metadata: /** @type {?} */ ((_this._metadataResolver.getPipeMetadata(ref)))
});
}), injectables.map(function (ref) {
return ({
summary: /** @type {?} */ ((_this._metadataResolver.getInjectableSummary(ref))),
metadata: /** @type {?} */ ((_this._metadataResolver.getInjectableSummary(ref))).type
});
}));
var /** @type {?} */ forJitOutputCtx = this._options.enableSummariesForJit ?
this._createOutputContext(summaryForJitFileName(srcFileName, true)) :
null;
var _a = serializeSummaries(srcFileName, forJitOutputCtx, this._summaryResolver, this._symbolResolver, symbolSummaries, typeData), json = _a.json, exportAs = _a.exportAs;
exportAs.forEach(function (entry) {
ngFactoryCtx.statements.push(variable(entry.exportAs).set(ngFactoryCtx.importExpr(entry.symbol)).toDeclStmt(null, [
StmtModifier.Exported
]));
});
var /** @type {?} */ summaryJson = new GeneratedFile(srcFileName, summaryFileName(srcFileName), json);
var /** @type {?} */ result = [summaryJson];
if (forJitOutputCtx) {
result.push(this._codegenSourceModule(srcFileName, forJitOutputCtx));
}
return result;
};
/**
* @param {?} outputCtx
* @param {?} ngModule
* @return {?}
*/
AotCompiler.prototype._compileModule = /**
* @param {?} outputCtx
* @param {?} ngModule
* @return {?}
*/
function (outputCtx, ngModule) {
var /** @type {?} */ providers = [];
if (this._options.locale) {
var /** @type {?} */ normalizedLocale = this._options.locale.replace(/_/g, '-');
providers.push({
token: createTokenForExternalReference(this._reflector, Identifiers.LOCALE_ID),
useValue: normalizedLocale,
});
}
if (this._options.i18nFormat) {
providers.push({
token: createTokenForExternalReference(this._reflector, Identifiers.TRANSLATIONS_FORMAT),
useValue: this._options.i18nFormat
});
}
this._ngModuleCompiler.compile(outputCtx, ngModule, providers);
};
/**
* @param {?} outputCtx
* @param {?} compMeta
* @param {?} ngModule
* @param {?} fileSuffix
* @return {?}
*/
AotCompiler.prototype._compileComponentFactory = /**
* @param {?} outputCtx
* @param {?} compMeta
* @param {?} ngModule
* @param {?} fileSuffix
* @return {?}
*/
function (outputCtx, compMeta, ngModule, fileSuffix) {
var /** @type {?} */ hostMeta = this._metadataResolver.getHostComponentMetadata(compMeta);
var /** @type {?} */ hostViewFactoryVar = this._compileComponent(outputCtx, hostMeta, ngModule, [compMeta.type], null, fileSuffix)
.viewClassVar;
var /** @type {?} */ compFactoryVar = componentFactoryName(compMeta.type.reference);
var /** @type {?} */ inputsExprs = [];
for (var /** @type {?} */ propName in compMeta.inputs) {
var /** @type {?} */ templateName = compMeta.inputs[propName];
// Don't quote so that the key gets minified...
inputsExprs.push(new LiteralMapEntry(propName, literal(templateName), false));
}
var /** @type {?} */ outputsExprs = [];
for (var /** @type {?} */ propName in compMeta.outputs) {
var /** @type {?} */ templateName = compMeta.outputs[propName];
// Don't quote so that the key gets minified...
outputsExprs.push(new LiteralMapEntry(propName, literal(templateName), false));
}
outputCtx.statements.push(variable(compFactoryVar)
.set(importExpr(Identifiers.createComponentFactory).callFn([
literal(compMeta.selector), outputCtx.importExpr(compMeta.type.reference),
variable(hostViewFactoryVar), new LiteralMapExpr(inputsExprs),
new LiteralMapExpr(outputsExprs),
literalArr(/** @type {?} */ ((compMeta.template)).ngContentSelectors.map(function (selector) { return literal(selector); }))
]))
.toDeclStmt(importType(Identifiers.ComponentFactory, [/** @type {?} */ ((expressionType(outputCtx.importExpr(compMeta.type.reference))))], [TypeModifier.Const]), [StmtModifier.Final, StmtModifier.Exported]));
};
/**
* @param {?} outputCtx
* @param {?} compMeta
* @param {?} ngModule
* @param {?} directiveIdentifiers
* @param {?} componentStyles
* @param {?} fileSuffix
* @return {?}
*/
AotCompiler.prototype._compileComponent = /**
* @param {?} outputCtx
* @param {?} compMeta
* @param {?} ngModule
* @param {?} directiveIdentifiers
* @param {?} componentStyles
* @param {?} fileSuffix
* @return {?}
*/
function (outputCtx, compMeta, ngModule, directiveIdentifiers, componentStyles, fileSuffix) {
var _a = this._parseTemplate(compMeta, ngModule, directiveIdentifiers), parsedTemplate = _a.template, usedPipes = _a.pipes;
var /** @type {?} */ stylesExpr = componentStyles ? variable(componentStyles.stylesVar) : literalArr([]);
var /** @type {?} */ viewResult = this._viewCompiler.compileComponent(outputCtx, compMeta, parsedTemplate, stylesExpr, usedPipes);
if (componentStyles) {
_resolveStyleStatements(this._symbolResolver, componentStyles, this._styleCompiler.needsStyleShim(compMeta), fileSuffix);
}
return viewResult;
};
/**
* @param {?} compMeta
* @param {?} ngModule
* @param {?} directiveIdentifiers
* @return {?}
*/
AotCompiler.prototype._parseTemplate = /**
* @param {?} compMeta
* @param {?} ngModule
* @param {?} directiveIdentifiers
* @return {?}
*/
function (compMeta, ngModule, directiveIdentifiers) {
var _this = this;
if (this._templateAstCache.has(compMeta.type.reference)) {
return /** @type {?} */ ((this._templateAstCache.get(compMeta.type.reference)));
}
var /** @type {?} */ preserveWhitespaces = /** @type {?} */ ((/** @type {?} */ ((compMeta)).template)).preserveWhitespaces;
var /** @type {?} */ directives = directiveIdentifiers.map(function (dir) { return _this._metadataResolver.getDirectiveSummary(dir.reference); });
var /** @type {?} */ pipes = ngModule.transitiveModule.pipes.map(function (pipe) { return _this._metadataResolver.getPipeSummary(pipe.reference); });
var /** @type {?} */ result = this._templateParser.parse(compMeta, /** @type {?} */ ((/** @type {?} */ ((compMeta.template)).htmlAst)), directives, pipes, ngModule.schemas, templateSourceUrl(ngModule.type, compMeta, /** @type {?} */ ((compMeta.template))), preserveWhitespaces);
this._templateAstCache.set(compMeta.type.reference, result);
return result;
};
/**
* @param {?} genFilePath
* @return {?}
*/
AotCompiler.prototype._createOutputContext = /**
* @param {?} genFilePath
* @return {?}
*/
function (genFilePath) {
var _this = this;
var /** @type {?} */ importExpr$$1 = function (symbol, typeParams) {
if (typeParams === void 0) { typeParams = null; }
if (!(symbol instanceof StaticSymbol)) {
throw new Error("Internal error: unknown identifier " + JSON.stringify(symbol));
}
var /** @type {?} */ arity = _this._symbolResolver.getTypeArity(symbol) || 0;
var _a = _this._symbolResolver.getImportAs(symbol) || symbol, filePath = _a.filePath, name = _a.name, members = _a.members;
var /** @type {?} */ importModule = _this._fileNameToModuleName(filePath, genFilePath);
// It should be good enough to compare filePath to genFilePath and if they are equal
// there is a self reference. However, ngfactory files generate to .ts but their
// symbols have .d.ts so a simple compare is insufficient. They should be canonical
// and is tracked by #17705.
var /** @type {?} */ selfReference = _this._fileNameToModuleName(genFilePath, genFilePath);
var /** @type {?} */ moduleName = importModule === selfReference ? null : importModule;
// If we are in a type expression that refers to a generic type then supply
// the required type parameters. If there were not enough type parameters
// supplied, supply any as the type. Outside a type expression the reference
// should not supply type parameters and be treated as a simple value reference
// to the constructor function itself.
var /** @type {?} */ suppliedTypeParams = typeParams || [];
var /** @type {?} */ missingTypeParamsCount = arity - suppliedTypeParams.length;
var /** @type {?} */ allTypeParams = suppliedTypeParams.concat(new Array(missingTypeParamsCount).fill(DYNAMIC_TYPE));
return members.reduce(function (expr, memberName) { return expr.prop(memberName); }, /** @type {?} */ (importExpr(new ExternalReference(moduleName, name, null), allTypeParams)));
};
return { statements: [], genFilePath: genFilePath, importExpr: importExpr$$1 };
};
/**
* @param {?} importedFilePath
* @param {?} containingFilePath
* @return {?}
*/
AotCompiler.prototype._fileNameToModuleName = /**
* @param {?} importedFilePath
* @param {?} containingFilePath
* @return {?}
*/
function (importedFilePath, containingFilePath) {
return this._summaryResolver.getKnownModuleName(importedFilePath) ||
this._symbolResolver.getKnownModuleName(importedFilePath) ||
this._host.fileNameToModuleName(importedFilePath, containingFilePath);
};
/**
* @param {?} srcFileUrl
* @param {?} compMeta
* @param {?} stylesheetMetadata
* @param {?} isShimmed
* @param {?} fileSuffix
* @return {?}
*/
AotCompiler.prototype._codegenStyles = /**
* @param {?} srcFileUrl
* @param {?} compMeta
* @param {?} stylesheetMetadata
* @param {?} isShimmed
* @param {?} fileSuffix
* @return {?}
*/
function (srcFileUrl, compMeta, stylesheetMetadata, isShimmed, fileSuffix) {
var /** @type {?} */ outputCtx = this._createOutputContext(_stylesModuleUrl(/** @type {?} */ ((stylesheetMetadata.moduleUrl)), isShimmed, fileSuffix));
var /** @type {?} */ compiledStylesheet = this._styleCompiler.compileStyles(outputCtx, compMeta, stylesheetMetadata, isShimmed);
_resolveStyleStatements(this._symbolResolver, compiledStylesheet, isShimmed, fileSuffix);
return this._codegenSourceModule(srcFileUrl, outputCtx);
};
/**
* @param {?} srcFileUrl
* @param {?} ctx
* @return {?}
*/
AotCompiler.prototype._codegenSourceModule = /**
* @param {?} srcFileUrl
* @param {?} ctx
* @return {?}
*/
function (srcFileUrl, ctx) {
return new GeneratedFile(srcFileUrl, ctx.genFilePath, ctx.statements);
};
/**
* @param {?=} entryRoute
* @param {?=} analyzedModules
* @return {?}
*/
AotCompiler.prototype.listLazyRoutes = /**
* @param {?=} entryRoute
* @param {?=} analyzedModules
* @return {?}
*/
function (entryRoute, analyzedModules) {
var /** @type {?} */ self = this;
if (entryRoute) {
var /** @type {?} */ symbol = parseLazyRoute(entryRoute, this._reflector).referencedModule;
return visitLazyRoute(symbol);
}
else if (analyzedModules) {
var /** @type {?} */ allLazyRoutes = [];
for (var _i = 0, _a = analyzedModules.ngModules; _i < _a.length; _i++) {
var ngModule = _a[_i];
var /** @type {?} */ lazyRoutes = listLazyRoutes(ngModule, this._reflector);
for (var _b = 0, lazyRoutes_1 = lazyRoutes; _b < lazyRoutes_1.length; _b++) {
var lazyRoute = lazyRoutes_1[_b];
allLazyRoutes.push(lazyRoute);
}
}
return allLazyRoutes;
}
else {
throw new Error("Either route or analyzedModules has to be specified!");
}
/**
* @param {?} symbol
* @param {?=} seenRoutes
* @param {?=} allLazyRoutes
* @return {?}
*/
function visitLazyRoute(symbol, seenRoutes, allLazyRoutes) {
if (seenRoutes === void 0) { seenRoutes = new Set(); }
if (allLazyRoutes === void 0) { allLazyRoutes = []; }
// Support pointing to default exports, but stop recursing there,
// as the StaticReflector does not yet support default exports.
if (seenRoutes.has(symbol) || !symbol.name) {
return allLazyRoutes;
}
seenRoutes.add(symbol);
var /** @type {?} */ lazyRoutes = listLazyRoutes(/** @type {?} */ ((self._metadataResolver.getNgModuleMetadata(symbol, true))), self._reflector);
for (var _i = 0, lazyRoutes_2 = lazyRoutes; _i < lazyRoutes_2.length; _i++) {
var lazyRoute = lazyRoutes_2[_i];
allLazyRoutes.push(lazyRoute);
visitLazyRoute(lazyRoute.referencedModule, seenRoutes, allLazyRoutes);
}
return allLazyRoutes;
}
};
return AotCompiler;
}());
/**
* @param {?} outputCtx
* @return {?}
*/
function _createEmptyStub(outputCtx) {
// Note: We need to produce at least one import statement so that
// TypeScript knows that the file is an es6 module. Otherwise our generated
// exports / imports won't be emitted properly by TypeScript.
outputCtx.statements.push(importExpr(Identifiers.ComponentFactory).toStmt());
}
/**
* @param {?} symbolResolver
* @param {?} compileResult
* @param {?} needsShim
* @param {?} fileSuffix
* @return {?}
*/
function _resolveStyleStatements(symbolResolver, compileResult, needsShim, fileSuffix) {
compileResult.dependencies.forEach(function (dep) {
dep.setValue(symbolResolver.getStaticSymbol(_stylesModuleUrl(dep.moduleUrl, needsShim, fileSuffix), dep.name));
});
}
/**
* @param {?} stylesheetUrl
* @param {?} shim
* @param {?} suffix
* @return {?}
*/
function _stylesModuleUrl(stylesheetUrl, shim, suffix) {
return "" + stylesheetUrl + (shim ? '.shim' : '') + ".ngstyle" + suffix;
}
/**
* @record
*/
/**
* @record
*/
/**
* @record
*/
/**
* @param {?} fileNames
* @param {?} host
* @param {?} staticSymbolResolver
* @param {?} metadataResolver
* @return {?}
*/
function analyzeNgModules(fileNames, host, staticSymbolResolver, metadataResolver) {
var /** @type {?} */ files = _analyzeFilesIncludingNonProgramFiles(fileNames, host, staticSymbolResolver, metadataResolver);
return mergeAnalyzedFiles(files);
}
/**
* @param {?} fileNames
* @param {?} host
* @param {?} staticSymbolResolver
* @param {?} metadataResolver
* @return {?}
*/
function analyzeAndValidateNgModules(fileNames, host, staticSymbolResolver, metadataResolver) {
return validateAnalyzedModules(analyzeNgModules(fileNames, host, staticSymbolResolver, metadataResolver));
}
/**
* @param {?} analyzedModules
* @return {?}
*/
function validateAnalyzedModules(analyzedModules) {
if (analyzedModules.symbolsMissingModule && analyzedModules.symbolsMissingModule.length) {
var /** @type {?} */ messages = analyzedModules.symbolsMissingModule.map(function (s) {
return "Cannot determine the module for class " + s.name + " in " + s.filePath + "! Add " + s.name + " to the NgModule to fix it.";
});
throw syntaxError(messages.join('\n'));
}
return analyzedModules;
}
/**
* @param {?} fileNames
* @param {?} host
* @param {?} staticSymbolResolver
* @param {?} metadataResolver
* @return {?}
*/
function _analyzeFilesIncludingNonProgramFiles(fileNames, host, staticSymbolResolver, metadataResolver) {
var /** @type {?} */ seenFiles = new Set();
var /** @type {?} */ files = [];
var /** @type {?} */ visitFile = function (fileName) {
if (seenFiles.has(fileName) || !host.isSourceFile(fileName)) {
return false;
}
seenFiles.add(fileName);
var /** @type {?} */ analyzedFile = analyzeFile(host, staticSymbolResolver, metadataResolver, fileName);
files.push(analyzedFile);
analyzedFile.ngModules.forEach(function (ngModule) {
ngModule.transitiveModule.modules.forEach(function (modMeta) { return visitFile(modMeta.reference.filePath); });
});
};
fileNames.forEach(function (fileName) { return visitFile(fileName); });
return files;
}
/**
* @param {?} host
* @param {?} staticSymbolResolver
* @param {?} metadataResolver
* @param {?} fileName
* @return {?}
*/
function analyzeFile(host, staticSymbolResolver, metadataResolver, fileName) {
var /** @type {?} */ directives = [];
var /** @type {?} */ pipes = [];
var /** @type {?} */ injectables = [];
var /** @type {?} */ ngModules = [];
var /** @type {?} */ hasDecorators = staticSymbolResolver.hasDecorators(fileName);
var /** @type {?} */ exportsNonSourceFiles = false;
// Don't analyze .d.ts files that have no decorators as a shortcut
// to speed up the analysis. This prevents us from
// resolving the references in these files.
// Note: exportsNonSourceFiles is only needed when compiling with summaries,
// which is not the case when .d.ts files are treated as input files.
if (!fileName.endsWith('.d.ts') || hasDecorators) {
staticSymbolResolver.getSymbolsOf(fileName).forEach(function (symbol) {
var /** @type {?} */ resolvedSymbol = staticSymbolResolver.resolveSymbol(symbol);
var /** @type {?} */ symbolMeta = resolvedSymbol.metadata;
if (!symbolMeta || symbolMeta.__symbolic === 'error') {
return;
}
var /** @type {?} */ isNgSymbol = false;
if (symbolMeta.__symbolic === 'class') {
if (metadataResolver.isDirective(symbol)) {
isNgSymbol = true;
directives.push(symbol);
}
else if (metadataResolver.isPipe(symbol)) {
isNgSymbol = true;
pipes.push(symbol);
}
else if (metadataResolver.isNgModule(symbol)) {
var /** @type {?} */ ngModule = metadataResolver.getNgModuleMetadata(symbol, false);
if (ngModule) {
isNgSymbol = true;
ngModules.push(ngModule);
}
}
else if (metadataResolver.isInjectable(symbol)) {
isNgSymbol = true;
injectables.push(symbol);
}
}
if (!isNgSymbol) {
exportsNonSourceFiles =
exportsNonSourceFiles || isValueExportingNonSourceFile(host, symbolMeta);
}
});
}
return {
fileName: fileName, directives: directives, pipes: pipes, ngModules: ngModules, injectables: injectables, exportsNonSourceFiles: exportsNonSourceFiles,
};
}
/**
* @param {?} host
* @param {?} metadata
* @return {?}
*/
function isValueExportingNonSourceFile(host, metadata) {
var /** @type {?} */ exportsNonSourceFiles = false;
var Visitor = (function () {
function Visitor() {
}
/**
* @param {?} arr
* @param {?} context
* @return {?}
*/
Visitor.prototype.visitArray = /**
* @param {?} arr
* @param {?} context
* @return {?}
*/
function (arr, context) {
var _this = this;
arr.forEach(function (v) { return visitValue(v, _this, context); });
};
/**
* @param {?} map
* @param {?} context
* @return {?}
*/
Visitor.prototype.visitStringMap = /**
* @param {?} map
* @param {?} context
* @return {?}
*/
function (map, context) {
var _this = this;
Object.keys(map).forEach(function (key) { return visitValue(map[key], _this, context); });
};
/**
* @param {?} value
* @param {?} context
* @return {?}
*/
Visitor.prototype.visitPrimitive = /**
* @param {?} value
* @param {?} context
* @return {?}
*/
function (value, context) { };
/**
* @param {?} value
* @param {?} context
* @return {?}
*/
Visitor.prototype.visitOther = /**
* @param {?} value
* @param {?} context
* @return {?}
*/
function (value, context) {
if (value instanceof StaticSymbol && !host.isSourceFile(value.filePath)) {
exportsNonSourceFiles = true;
}
};
return Visitor;
}());
visitValue(metadata, new Visitor(), null);
return exportsNonSourceFiles;
}
/**
* @param {?} analyzedFiles
* @return {?}
*/
function mergeAnalyzedFiles(analyzedFiles) {
var /** @type {?} */ allNgModules = [];
var /** @type {?} */ ngModuleByPipeOrDirective = new Map();
var /** @type {?} */ allPipesAndDirectives = new Set();
analyzedFiles.forEach(function (af) {
af.ngModules.forEach(function (ngModule) {
allNgModules.push(ngModule);
ngModule.declaredDirectives.forEach(function (d) { return ngModuleByPipeOrDirective.set(d.reference, ngModule); });
ngModule.declaredPipes.forEach(function (p) { return ngModuleByPipeOrDirective.set(p.reference, ngModule); });
});
af.directives.forEach(function (d) { return allPipesAndDirectives.add(d); });
af.pipes.forEach(function (p) { return allPipesAndDirectives.add(p); });
});
var /** @type {?} */ symbolsMissingModule = [];
allPipesAndDirectives.forEach(function (ref) {
if (!ngModuleByPipeOrDirective.has(ref)) {
symbolsMissingModule.push(ref);
}
});
return {
ngModules: allNgModules,
ngModuleByPipeOrDirective: ngModuleByPipeOrDirective,
symbolsMissingModule: symbolsMissingModule,
files: analyzedFiles
};
}
/**
* @param {?} files
* @return {?}
*/
function mergeAndValidateNgFiles(files) {
return validateAnalyzedModules(mergeAnalyzedFiles(files));
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
var ANGULAR_CORE = '@angular/core';
var ANGULAR_ROUTER = '@angular/router';
var HIDDEN_KEY = /^\$.*\$$/;
var IGNORE = {
__symbolic: 'ignore'
};
var USE_VALUE = 'useValue';
var PROVIDE = 'provide';
var REFERENCE_SET = new Set([USE_VALUE, 'useFactory', 'data']);
/**
* @param {?} value
* @return {?}
*/
function shouldIgnore(value) {
return value && value.__symbolic == 'ignore';
}
/**
* A static reflector implements enough of the Reflector API that is necessary to compile
* templates statically.
*/
var StaticReflector = (function () {
function StaticReflector(summaryResolver, symbolResolver, knownMetadataClasses, knownMetadataFunctions, errorRecorder) {
if (knownMetadataClasses === void 0) { knownMetadataClasses = []; }
if (knownMetadataFunctions === void 0) { knownMetadataFunctions = []; }
var _this = this;
this.summaryResolver = summaryResolver;
this.symbolResolver = symbolResolver;
this.errorRecorder = errorRecorder;
this.annotationCache = new Map();
this.propertyCache = new Map();
this.parameterCache = new Map();
this.methodCache = new Map();
this.conversionMap = new Map();
this.annotationForParentClassWithSummaryKind = new Map();
this.initializeConversionMap();
knownMetadataClasses.forEach(function (kc) {
return _this._registerDecoratorOrConstructor(_this.getStaticSymbol(kc.filePath, kc.name), kc.ctor);
});
knownMetadataFunctions.forEach(function (kf) { return _this._registerFunction(_this.getStaticSymbol(kf.filePath, kf.name), kf.fn); });
this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.Directive, [createDirective, createComponent]);
this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.Pipe, [createPipe]);
this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.NgModule, [createNgModule]);
this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.Injectable, [createInjectable, createPipe, createDirective, createComponent, createNgModule]);
}
/**
* @param {?} typeOrFunc
* @return {?}
*/
StaticReflector.prototype.componentModuleUrl = /**
* @param {?} typeOrFunc
* @return {?}
*/
function (typeOrFunc) {
var /** @type {?} */ staticSymbol = this.findSymbolDeclaration(typeOrFunc);
return this.symbolResolver.getResourcePath(staticSymbol);
};
/**
* @param {?} ref
* @param {?=} containingFile
* @return {?}
*/
StaticReflector.prototype.resolveExternalReference = /**
* @param {?} ref
* @param {?=} containingFile
* @return {?}
*/
function (ref, containingFile) {
var /** @type {?} */ refSymbol = this.symbolResolver.getSymbolByModule(/** @type {?} */ ((ref.moduleName)), /** @type {?} */ ((ref.name)), containingFile);
var /** @type {?} */ declarationSymbol = this.findSymbolDeclaration(refSymbol);
if (!containingFile) {
this.symbolResolver.recordModuleNameForFileName(refSymbol.filePath, /** @type {?} */ ((ref.moduleName)));
this.symbolResolver.recordImportAs(declarationSymbol, refSymbol);
}
return declarationSymbol;
};
/**
* @param {?} moduleUrl
* @param {?} name
* @param {?=} containingFile
* @return {?}
*/
StaticReflector.prototype.findDeclaration = /**
* @param {?} moduleUrl
* @param {?} name
* @param {?=} containingFile
* @return {?}
*/
function (moduleUrl, name, containingFile) {
return this.findSymbolDeclaration(this.symbolResolver.getSymbolByModule(moduleUrl, name, containingFile));
};
/**
* @param {?} moduleUrl
* @param {?} name
* @return {?}
*/
StaticReflector.prototype.tryFindDeclaration = /**
* @param {?} moduleUrl
* @param {?} name
* @return {?}
*/
function (moduleUrl, name) {
var _this = this;
return this.symbolResolver.ignoreErrorsFor(function () { return _this.findDeclaration(moduleUrl, name); });
};
/**
* @param {?} symbol
* @return {?}
*/
StaticReflector.prototype.findSymbolDeclaration = /**
* @param {?} symbol
* @return {?}
*/
function (symbol) {
var /** @type {?} */ resolvedSymbol = this.symbolResolver.resolveSymbol(symbol);
if (resolvedSymbol && resolvedSymbol.metadata instanceof StaticSymbol) {
return this.findSymbolDeclaration(resolvedSymbol.metadata);
}
else {
return symbol;
}
};
/**
* @param {?} type
* @return {?}
*/
StaticReflector.prototype.annotations = /**
* @param {?} type
* @return {?}
*/
function (type) {
var /** @type {?} */ annotations = this.annotationCache.get(type);
if (!annotations) {
annotations = [];
var /** @type {?} */ classMetadata = this.getTypeMetadata(type);
var /** @type {?} */ parentType = this.findParentType(type, classMetadata);
if (parentType) {
var /** @type {?} */ parentAnnotations = this.annotations(parentType);
annotations.push.apply(annotations, parentAnnotations);
}
var /** @type {?} */ ownAnnotations_1 = [];
if (classMetadata['decorators']) {
ownAnnotations_1 = this.simplify(type, classMetadata['decorators']);
annotations.push.apply(annotations, ownAnnotations_1);
}
if (parentType && !this.summaryResolver.isLibraryFile(type.filePath) &&
this.summaryResolver.isLibraryFile(parentType.filePath)) {
var /** @type {?} */ summary = this.summaryResolver.resolveSummary(parentType);
if (summary && summary.type) {
var /** @type {?} */ requiredAnnotationTypes = /** @type {?} */ ((this.annotationForParentClassWithSummaryKind.get(/** @type {?} */ ((summary.type.summaryKind)))));
var /** @type {?} */ typeHasRequiredAnnotation = requiredAnnotationTypes.some(function (requiredType) { return ownAnnotations_1.some(function (ann) { return requiredType.isTypeOf(ann); }); });
if (!typeHasRequiredAnnotation) {
this.reportError(syntaxError("Class " + type.name + " in " + type.filePath + " extends from a " + CompileSummaryKind[(/** @type {?} */ ((summary.type.summaryKind)))] + " in another compilation unit without duplicating the decorator. " +
("Please add a " + requiredAnnotationTypes.map(function (type) { return type.ngMetadataName; }).join(' or ') + " decorator to the class.")), type);
}
}
}
this.annotationCache.set(type, annotations.filter(function (ann) { return !!ann; }));
}
return annotations;
};
/**
* @param {?} type
* @return {?}
*/
StaticReflector.prototype.propMetadata = /**
* @param {?} type
* @return {?}
*/
function (type) {
var _this = this;
var /** @type {?} */ propMetadata = this.propertyCache.get(type);
if (!propMetadata) {
var /** @type {?} */ classMetadata = this.getTypeMetadata(type);
propMetadata = {};
var /** @type {?} */ parentType = this.findParentType(type, classMetadata);
if (parentType) {
var /** @type {?} */ parentPropMetadata_1 = this.propMetadata(parentType);
Object.keys(parentPropMetadata_1).forEach(function (parentProp) {
/** @type {?} */ ((propMetadata))[parentProp] = parentPropMetadata_1[parentProp];
});
}
var /** @type {?} */ members_1 = classMetadata['members'] || {};
Object.keys(members_1).forEach(function (propName) {
var /** @type {?} */ propData = members_1[propName];
var /** @type {?} */ prop = (/** @type {?} */ (propData))
.find(function (a) { return a['__symbolic'] == 'property' || a['__symbolic'] == 'method'; });
var /** @type {?} */ decorators = [];
if (/** @type {?} */ ((propMetadata))[propName]) {
decorators.push.apply(decorators, /** @type {?} */ ((propMetadata))[propName]);
} /** @type {?} */
((propMetadata))[propName] = decorators;
if (prop && prop['decorators']) {
decorators.push.apply(decorators, _this.simplify(type, prop['decorators']));
}
});
this.propertyCache.set(type, propMetadata);
}
return propMetadata;
};
/**
* @param {?} type
* @return {?}
*/
StaticReflector.prototype.parameters = /**
* @param {?} type
* @return {?}
*/
function (type) {
var _this = this;
if (!(type instanceof StaticSymbol)) {
this.reportError(new Error("parameters received " + JSON.stringify(type) + " which is not a StaticSymbol"), type);
return [];
}
try {
var /** @type {?} */ parameters_1 = this.parameterCache.get(type);
if (!parameters_1) {
var /** @type {?} */ classMetadata = this.getTypeMetadata(type);
var /** @type {?} */ parentType = this.findParentType(type, classMetadata);
var /** @type {?} */ members = classMetadata ? classMetadata['members'] : null;
var /** @type {?} */ ctorData = members ? members['__ctor__'] : null;
if (ctorData) {
var /** @type {?} */ ctor = (/** @type {?} */ (ctorData)).find(function (a) { return a['__symbolic'] == 'constructor'; });
var /** @type {?} */ rawParameterTypes = /** @type {?} */ (ctor['parameters']) || [];
var /** @type {?} */ parameterDecorators_1 = /** @type {?} */ (this.simplify(type, ctor['parameterDecorators'] || []));
parameters_1 = [];
rawParameterTypes.forEach(function (rawParamType, index) {
var /** @type {?} */ nestedResult = [];
var /** @type {?} */ paramType = _this.trySimplify(type, rawParamType);
if (paramType)
nestedResult.push(paramType);
var /** @type {?} */ decorators = parameterDecorators_1 ? parameterDecorators_1[index] : null;
if (decorators) {
nestedResult.push.apply(nestedResult, decorators);
} /** @type {?} */
((parameters_1)).push(nestedResult);
});
}
else if (parentType) {
parameters_1 = this.parameters(parentType);
}
if (!parameters_1) {
parameters_1 = [];
}
this.parameterCache.set(type, parameters_1);
}
return parameters_1;
}
catch (/** @type {?} */ e) {
console.error("Failed on type " + JSON.stringify(type) + " with error " + e);
throw e;
}
};
/**
* @param {?} type
* @return {?}
*/
StaticReflector.prototype._methodNames = /**
* @param {?} type
* @return {?}
*/
function (type) {
var /** @type {?} */ methodNames = this.methodCache.get(type);
if (!methodNames) {
var /** @type {?} */ classMetadata = this.getTypeMetadata(type);
methodNames = {};
var /** @type {?} */ parentType = this.findParentType(type, classMetadata);
if (parentType) {
var /** @type {?} */ parentMethodNames_1 = this._methodNames(parentType);
Object.keys(parentMethodNames_1).forEach(function (parentProp) {
/** @type {?} */ ((methodNames))[parentProp] = parentMethodNames_1[parentProp];
});
}
var /** @type {?} */ members_2 = classMetadata['members'] || {};
Object.keys(members_2).forEach(function (propName) {
var /** @type {?} */ propData = members_2[propName];
var /** @type {?} */ isMethod = (/** @type {?} */ (propData)).some(function (a) { return a['__symbolic'] == 'method'; }); /** @type {?} */
((methodNames))[propName] = /** @type {?} */ ((methodNames))[propName] || isMethod;
});
this.methodCache.set(type, methodNames);
}
return methodNames;
};
/**
* @param {?} type
* @param {?} classMetadata
* @return {?}
*/
StaticReflector.prototype.findParentType = /**
* @param {?} type
* @param {?} classMetadata
* @return {?}
*/
function (type, classMetadata) {
var /** @type {?} */ parentType = this.trySimplify(type, classMetadata['extends']);
if (parentType instanceof StaticSymbol) {
return parentType;
}
};
/**
* @param {?} type
* @param {?} lcProperty
* @return {?}
*/
StaticReflector.prototype.hasLifecycleHook = /**
* @param {?} type
* @param {?} lcProperty
* @return {?}
*/
function (type, lcProperty) {
if (!(type instanceof StaticSymbol)) {
this.reportError(new Error("hasLifecycleHook received " + JSON.stringify(type) + " which is not a StaticSymbol"), type);
}
try {
return !!this._methodNames(type)[lcProperty];
}
catch (/** @type {?} */ e) {
console.error("Failed on type " + JSON.stringify(type) + " with error " + e);
throw e;
}
};
/**
* @param {?} type
* @param {?} ctor
* @return {?}
*/
StaticReflector.prototype._registerDecoratorOrConstructor = /**
* @param {?} type
* @param {?} ctor
* @return {?}
*/
function (type, ctor) {
this.conversionMap.set(type, function (context, args) { return new (ctor.bind.apply(ctor, [void 0].concat(args)))(); });
};
/**
* @param {?} type
* @param {?} fn
* @return {?}
*/
StaticReflector.prototype._registerFunction = /**
* @param {?} type
* @param {?} fn
* @return {?}
*/
function (type, fn) {
this.conversionMap.set(type, function (context, args) { return fn.apply(undefined, args); });
};
/**
* @return {?}
*/
StaticReflector.prototype.initializeConversionMap = /**
* @return {?}
*/
function () {
this.injectionToken = this.findDeclaration(ANGULAR_CORE, 'InjectionToken');
this.opaqueToken = this.findDeclaration(ANGULAR_CORE, 'OpaqueToken');
this.ROUTES = this.tryFindDeclaration(ANGULAR_ROUTER, 'ROUTES');
this.ANALYZE_FOR_ENTRY_COMPONENTS =
this.findDeclaration(ANGULAR_CORE, 'ANALYZE_FOR_ENTRY_COMPONENTS');
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Host'), createHost);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Injectable'), createInjectable);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Self'), createSelf);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'SkipSelf'), createSkipSelf);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Inject'), createInject);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Optional'), createOptional);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Attribute'), createAttribute);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'ContentChild'), createContentChild);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'ContentChildren'), createContentChildren);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'ViewChild'), createViewChild);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'ViewChildren'), createViewChildren);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Input'), createInput);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Output'), createOutput);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Pipe'), createPipe);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'HostBinding'), createHostBinding);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'HostListener'), createHostListener);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Directive'), createDirective);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Component'), createComponent);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'NgModule'), createNgModule);
// Note: Some metadata classes can be used directly with Provider.deps.
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Host'), createHost);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Self'), createSelf);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'SkipSelf'), createSkipSelf);
this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Optional'), createOptional);
};
/**
* getStaticSymbol produces a Type whose metadata is known but whose implementation is not loaded.
* All types passed to the StaticResolver should be pseudo-types returned by this method.
*
* @param declarationFile the absolute path of the file where the symbol is declared
* @param name the name of the type.
*/
/**
* getStaticSymbol produces a Type whose metadata is known but whose implementation is not loaded.
* All types passed to the StaticResolver should be pseudo-types returned by this method.
*
* @param {?} declarationFile the absolute path of the file where the symbol is declared
* @param {?} name the name of the type.
* @param {?=} members
* @return {?}
*/
StaticReflector.prototype.getStaticSymbol = /**
* getStaticSymbol produces a Type whose metadata is known but whose implementation is not loaded.
* All types passed to the StaticResolver should be pseudo-types returned by this method.
*
* @param {?} declarationFile the absolute path of the file where the symbol is declared
* @param {?} name the name of the type.
* @param {?=} members
* @return {?}
*/
function (declarationFile, name, members) {
return this.symbolResolver.getStaticSymbol(declarationFile, name, members);
};
/**
* @param {?} error
* @param {?} context
* @param {?=} path
* @return {?}
*/
StaticReflector.prototype.reportError = /**
* @param {?} error
* @param {?} context
* @param {?=} path
* @return {?}
*/
function (error, context, path) {
if (this.errorRecorder) {
this.errorRecorder(error, (context && context.filePath) || path);
}
else {
throw error;
}
};
/**
* Simplify but discard any errors
* @param {?} context
* @param {?} value
* @return {?}
*/
StaticReflector.prototype.trySimplify = /**
* Simplify but discard any errors
* @param {?} context
* @param {?} value
* @return {?}
*/
function (context, value) {
var /** @type {?} */ originalRecorder = this.errorRecorder;
this.errorRecorder = function (error, fileName) { };
var /** @type {?} */ result = this.simplify(context, value);
this.errorRecorder = originalRecorder;
return result;
};
/**
* \@internal
* @param {?} context
* @param {?} value
* @return {?}
*/
StaticReflector.prototype.simplify = /**
* \@internal
* @param {?} context
* @param {?} value
* @return {?}
*/
function (context, value) {
var _this = this;
var /** @type {?} */ self = this;
var /** @type {?} */ scope = BindingScope.empty;
var /** @type {?} */ calling = new Map();
/**
* @param {?} context
* @param {?} value
* @param {?} depth
* @param {?} references
* @return {?}
*/
function simplifyInContext(context, value, depth, references) {
/**
* @param {?} staticSymbol
* @return {?}
*/
function resolveReferenceValue(staticSymbol) {
var /** @type {?} */ resolvedSymbol = self.symbolResolver.resolveSymbol(staticSymbol);
return resolvedSymbol ? resolvedSymbol.metadata : null;
}
/**
* @param {?} functionSymbol
* @param {?} targetFunction
* @param {?} args
* @return {?}
*/
function simplifyCall(functionSymbol, targetFunction, args) {
if (targetFunction && targetFunction['__symbolic'] == 'function') {
if (calling.get(functionSymbol)) {
throw new Error('Recursion not supported');
}
try {
var /** @type {?} */ value_1 = targetFunction['value'];
if (value_1 && (depth != 0 || value_1.__symbolic != 'error')) {
var /** @type {?} */ parameters = targetFunction['parameters'];
var /** @type {?} */ defaults = targetFunction.defaults;
args = args.map(function (arg) { return simplifyInContext(context, arg, depth + 1, references); })
.map(function (arg) { return shouldIgnore(arg) ? undefined : arg; });
if (defaults && defaults.length > args.length) {
args.push.apply(args, defaults.slice(args.length).map(function (value) { return simplify(value); }));
}
calling.set(functionSymbol, true);
var /** @type {?} */ functionScope = BindingScope.build();
for (var /** @type {?} */ i = 0; i < parameters.length; i++) {
functionScope.define(parameters[i], args[i]);
}
var /** @type {?} */ oldScope = scope;
var /** @type {?} */ result_1;
try {
scope = functionScope.done();
result_1 = simplifyInContext(functionSymbol, value_1, depth + 1, references);
}
finally {
scope = oldScope;
}
return result_1;
}
}
finally {
calling.delete(functionSymbol);
}
}
if (depth === 0) {
// If depth is 0 we are evaluating the top level expression that is describing element
// decorator. In this case, it is a decorator we don't understand, such as a custom
// non-angular decorator, and we should just ignore it.
return IGNORE;
}
return simplify({ __symbolic: 'error', message: 'Function call not supported', context: functionSymbol });
}
/**
* @param {?} expression
* @return {?}
*/
function simplify(expression) {
if (isPrimitive(expression)) {
return expression;
}
if (expression instanceof Array) {
var /** @type {?} */ result_2 = [];
for (var _i = 0, _a = (/** @type {?} */ (expression)); _i < _a.length; _i++) {
var item = _a[_i];
// Check for a spread expression
if (item && item.__symbolic === 'spread') {
// We call with references as 0 because we require the actual value and cannot
// tolerate a reference here.
var /** @type {?} */ spreadArray = simplifyInContext(context, item.expression, depth, 0);
if (Array.isArray(spreadArray)) {
for (var _b = 0, spreadArray_1 = spreadArray; _b < spreadArray_1.length; _b++) {
var spreadItem = spreadArray_1[_b];
result_2.push(spreadItem);
}
continue;
}
}
var /** @type {?} */ value_2 = simplify(item);
if (shouldIgnore(value_2)) {
continue;
}
result_2.push(value_2);
}
return result_2;
}
if (expression instanceof StaticSymbol) {
// Stop simplification at builtin symbols or if we are in a reference context and
// the symbol doesn't have members.
if (expression === self.injectionToken || self.conversionMap.has(expression) ||
(references > 0 && !expression.members.length)) {
return expression;
}
else {
var /** @type {?} */ staticSymbol = expression;
var /** @type {?} */ declarationValue = resolveReferenceValue(staticSymbol);
if (declarationValue != null) {
return simplifyInContext(staticSymbol, declarationValue, depth + 1, references);
}
else {
return staticSymbol;
}
}
}
if (expression) {
if (expression['__symbolic']) {
var /** @type {?} */ staticSymbol = void 0;
switch (expression['__symbolic']) {
case 'binop':
var /** @type {?} */ left = simplify(expression['left']);
if (shouldIgnore(left))
return left;
var /** @type {?} */ right = simplify(expression['right']);
if (shouldIgnore(right))
return right;
switch (expression['operator']) {
case '&&':
return left && right;
case '||':
return left || right;
case '|':
return left | right;
case '^':
return left ^ right;
case '&':
return left & right;
case '==':
return left == right;
case '!=':
return left != right;
case '===':
return left === right;
case '!==':
return left !== right;
case '<':
return left < right;
case '>':
return left > right;
case '<=':
return left <= right;
case '>=':
return left >= right;
case '<<':
return left << right;
case '>>':
return left >> right;
case '+':
return left + right;
case '-':
return left - right;
case '*':
return left * right;
case '/':
return left / right;
case '%':
return left % right;
}
return null;
case 'if':
var /** @type {?} */ condition = simplify(expression['condition']);
return condition ? simplify(expression['thenExpression']) :
simplify(expression['elseExpression']);
case 'pre':
var /** @type {?} */ operand = simplify(expression['operand']);
if (shouldIgnore(operand))
return operand;
switch (expression['operator']) {
case '+':
return operand;
case '-':
return -operand;
case '!':
return !operand;
case '~':
return ~operand;
}
return null;
case 'index':
var /** @type {?} */ indexTarget = simplifyInContext(context, expression['expression'], depth, 0);
var /** @type {?} */ index = simplifyInContext(context, expression['index'], depth, 0);
if (indexTarget && isPrimitive(index))
return indexTarget[index];
return null;
case 'select':
var /** @type {?} */ member = expression['member'];
var /** @type {?} */ selectContext = context;
var /** @type {?} */ selectTarget = simplify(expression['expression']);
if (selectTarget instanceof StaticSymbol) {
var /** @type {?} */ members = selectTarget.members.concat(member);
selectContext =
self.getStaticSymbol(selectTarget.filePath, selectTarget.name, members);
var /** @type {?} */ declarationValue = resolveReferenceValue(selectContext);
if (declarationValue != null) {
return simplifyInContext(selectContext, declarationValue, depth + 1, references);
}
else {
return selectContext;
}
}
if (selectTarget && isPrimitive(member))
return simplifyInContext(selectContext, selectTarget[member], depth + 1, references);
return null;
case 'reference':
// Note: This only has to deal with variable references,
// as symbol references have been converted into StaticSymbols already
// in the StaticSymbolResolver!
var /** @type {?} */ name_1 = expression['name'];
var /** @type {?} */ localValue = scope.resolve(name_1);
if (localValue != BindingScope.missing) {
return localValue;
}
break;
case 'class':
return context;
case 'function':
return context;
case 'new':
case 'call':
// Determine if the function is a built-in conversion
staticSymbol = simplifyInContext(context, expression['expression'], depth + 1, /* references */ 0);
if (staticSymbol instanceof StaticSymbol) {
if (staticSymbol === self.injectionToken || staticSymbol === self.opaqueToken) {
// if somebody calls new InjectionToken, don't create an InjectionToken,
// but rather return the symbol to which the InjectionToken is assigned to.
// OpaqueToken is supported too as it is required by the language service to
// support v4 and prior versions of Angular.
return context;
}
var /** @type {?} */ argExpressions = expression['arguments'] || [];
var /** @type {?} */ converter = self.conversionMap.get(staticSymbol);
if (converter) {
var /** @type {?} */ args = argExpressions
.map(function (arg) { return simplifyInContext(context, arg, depth + 1, references); })
.map(function (arg) { return shouldIgnore(arg) ? undefined : arg; });
return converter(context, args);
}
else {
// Determine if the function is one we can simplify.
var /** @type {?} */ targetFunction = resolveReferenceValue(staticSymbol);
return simplifyCall(staticSymbol, targetFunction, argExpressions);
}
}
return IGNORE;
case 'error':
var /** @type {?} */ message = produceErrorMessage(expression);
if (expression['line']) {
message =
message + " (position " + (expression['line'] + 1) + ":" + (expression['character'] + 1) + " in the original .ts file)";
self.reportError(positionalError(message, context.filePath, expression['line'], expression['character']), context);
}
else {
self.reportError(new Error(message), context);
}
return IGNORE;
case 'ignore':
return expression;
}
return null;
}
return mapStringMap(expression, function (value, name) {
if (REFERENCE_SET.has(name)) {
if (name === USE_VALUE && PROVIDE in expression) {
// If this is a provider expression, check for special tokens that need the value
// during analysis.
var /** @type {?} */ provide = simplify(expression.provide);
if (provide === self.ROUTES || provide == self.ANALYZE_FOR_ENTRY_COMPONENTS) {
return simplify(value);
}
}
return simplifyInContext(context, value, depth, references + 1);
}
return simplify(value);
});
}
return IGNORE;
}
try {
return simplify(value);
}
catch (/** @type {?} */ e) {
var /** @type {?} */ members = context.members.length ? "." + context.members.join('.') : '';
var /** @type {?} */ message = e.message + ", resolving symbol " + context.name + members + " in " + context.filePath;
if (e.fileName) {
throw positionalError(message, e.fileName, e.line, e.column);
}
throw syntaxError(message);
}
}
var /** @type {?} */ recordedSimplifyInContext = function (context, value) {
try {
return simplifyInContext(context, value, 0, 0);
}
catch (/** @type {?} */ e) {
_this.reportError(e, context);
}
};
var /** @type {?} */ result = this.errorRecorder ? recordedSimplifyInContext(context, value) :
simplifyInContext(context, value, 0, 0);
if (shouldIgnore(result)) {
return undefined;
}
return result;
};
/**
* @param {?} type
* @return {?}
*/
StaticReflector.prototype.getTypeMetadata = /**
* @param {?} type
* @return {?}
*/
function (type) {
var /** @type {?} */ resolvedSymbol = this.symbolResolver.resolveSymbol(type);
return resolvedSymbol && resolvedSymbol.metadata ? resolvedSymbol.metadata :
{ __symbolic: 'class' };
};
return StaticReflector;
}());
/**
* @param {?} error
* @return {?}
*/
function expandedMessage(error) {
switch (error.message) {
case 'Reference to non-exported class':
if (error.context && error.context.className) {
return "Reference to a non-exported class " + error.context.className + ". Consider exporting the class";
}
break;
case 'Variable not initialized':
return 'Only initialized variables and constants can be referenced because the value of this variable is needed by the template compiler';
case 'Destructuring not supported':
return 'Referencing an exported destructured variable or constant is not supported by the template compiler. Consider simplifying this to avoid destructuring';
case 'Could not resolve type':
if (error.context && error.context.typeName) {
return "Could not resolve type " + error.context.typeName;
}
break;
case 'Function call not supported':
var /** @type {?} */ prefix = error.context && error.context.name ? "Calling function '" + error.context.name + "', f" : 'F';
return prefix +
'unction calls are not supported. Consider replacing the function or lambda with a reference to an exported function';
case 'Reference to a local symbol':
if (error.context && error.context.name) {
return "Reference to a local (non-exported) symbol '" + error.context.name + "'. Consider exporting the symbol";
}
break;
}
return error.message;
}
/**
* @param {?} error
* @return {?}
*/
function produceErrorMessage(error) {
return "Error encountered resolving symbol values statically. " + expandedMessage(error);
}
/**
* @param {?} input
* @param {?} transform
* @return {?}
*/
function mapStringMap(input, transform) {
if (!input)
return {};
var /** @type {?} */ result = {};
Object.keys(input).forEach(function (key) {
var /** @type {?} */ value = transform(input[key], key);
if (!shouldIgnore(value)) {
if (HIDDEN_KEY.test(key)) {
Object.defineProperty(result, key, { enumerable: false, configurable: true, value: value });
}
else {
result[key] = value;
}
}
});
return result;
}
/**
* @param {?} o
* @return {?}
*/
function isPrimitive(o) {
return o === null || (typeof o !== 'function' && typeof o !== 'object');
}
/**
* @abstract
*/
var BindingScope = (function () {
function BindingScope() {
}
/**
* @return {?}
*/
BindingScope.build = /**
* @return {?}
*/
function () {
var /** @type {?} */ current = new Map();
return {
define: function (name, value) {
current.set(name, value);
return this;
},
done: function () {
return current.size > 0 ? new PopulatedScope(current) : BindingScope.empty;
}
};
};
BindingScope.missing = {};
BindingScope.empty = { resolve: function (name) { return BindingScope.missing; } };
return BindingScope;
}());
var PopulatedScope = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(PopulatedScope, _super);
function PopulatedScope(bindings) {
var _this = _super.call(this) || this;
_this.bindings = bindings;
return _this;
}
/**
* @param {?} name
* @return {?}
*/
PopulatedScope.prototype.resolve = /**
* @param {?} name
* @return {?}
*/
function (name) {
return this.bindings.has(name) ? this.bindings.get(name) : BindingScope.missing;
};
return PopulatedScope;
}(BindingScope));
/**
* @param {?} message
* @param {?} fileName
* @param {?} line
* @param {?} column
* @return {?}
*/
function positionalError(message, fileName, line, column) {
var /** @type {?} */ result = syntaxError(message);
(/** @type {?} */ (result)).fileName = fileName;
(/** @type {?} */ (result)).line = line;
(/** @type {?} */ (result)).column = column;
return result;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
var ResolvedStaticSymbol = (function () {
function ResolvedStaticSymbol(symbol, metadata) {
this.symbol = symbol;
this.metadata = metadata;
}
return ResolvedStaticSymbol;
}());
/**
* The host of the SymbolResolverHost disconnects the implementation from TypeScript / other
* language
* services and from underlying file systems.
* @record
*/
var SUPPORTED_SCHEMA_VERSION = 4;
/**
* This class is responsible for loading metadata per symbol,
* and normalizing references between symbols.
*
* Internally, it only uses symbols without members,
* and deduces the values for symbols with members based
* on these symbols.
*/
var StaticSymbolResolver = (function () {
function StaticSymbolResolver(host, staticSymbolCache, summaryResolver, errorRecorder) {
this.host = host;
this.staticSymbolCache = staticSymbolCache;
this.summaryResolver = summaryResolver;
this.errorRecorder = errorRecorder;
this.metadataCache = new Map();
this.resolvedSymbols = new Map();
this.resolvedFilePaths = new Set();
this.importAs = new Map();
this.symbolResourcePaths = new Map();
this.symbolFromFile = new Map();
this.knownFileNameToModuleNames = new Map();
}
/**
* @param {?} staticSymbol
* @return {?}
*/
StaticSymbolResolver.prototype.resolveSymbol = /**
* @param {?} staticSymbol
* @return {?}
*/
function (staticSymbol) {
if (staticSymbol.members.length > 0) {
return /** @type {?} */ ((this._resolveSymbolMembers(staticSymbol)));
}
// Note: always ask for a summary first,
// as we might have read shallow metadata via a .d.ts file
// for the symbol.
var /** @type {?} */ resultFromSummary = /** @type {?} */ ((this._resolveSymbolFromSummary(staticSymbol)));
if (resultFromSummary) {
return resultFromSummary;
}
var /** @type {?} */ resultFromCache = this.resolvedSymbols.get(staticSymbol);
if (resultFromCache) {
return resultFromCache;
}
// Note: Some users use libraries that were not compiled with ngc, i.e. they don't
// have summaries, only .d.ts files. So we always need to check both, the summary
// and metadata.
this._createSymbolsOf(staticSymbol.filePath);
return /** @type {?} */ ((this.resolvedSymbols.get(staticSymbol)));
};
/**
* getImportAs produces a symbol that can be used to import the given symbol.
* The import might be different than the symbol if the symbol is exported from
* a library with a summary; in which case we want to import the symbol from the
* ngfactory re-export instead of directly to avoid introducing a direct dependency
* on an otherwise indirect dependency.
*
* @param staticSymbol the symbol for which to generate a import symbol
*/
/**
* getImportAs produces a symbol that can be used to import the given symbol.
* The import might be different than the symbol if the symbol is exported from
* a library with a summary; in which case we want to import the symbol from the
* ngfactory re-export instead of directly to avoid introducing a direct dependency
* on an otherwise indirect dependency.
*
* @param {?} staticSymbol the symbol for which to generate a import symbol
* @return {?}
*/
StaticSymbolResolver.prototype.getImportAs = /**
* getImportAs produces a symbol that can be used to import the given symbol.
* The import might be different than the symbol if the symbol is exported from
* a library with a summary; in which case we want to import the symbol from the
* ngfactory re-export instead of directly to avoid introducing a direct dependency
* on an otherwise indirect dependency.
*
* @param {?} staticSymbol the symbol for which to generate a import symbol
* @return {?}
*/
function (staticSymbol) {
if (staticSymbol.members.length) {
var /** @type {?} */ baseSymbol = this.getStaticSymbol(staticSymbol.filePath, staticSymbol.name);
var /** @type {?} */ baseImportAs = this.getImportAs(baseSymbol);
return baseImportAs ?
this.getStaticSymbol(baseImportAs.filePath, baseImportAs.name, staticSymbol.members) :
null;
}
var /** @type {?} */ summarizedFileName = stripSummaryForJitFileSuffix(staticSymbol.filePath);
if (summarizedFileName !== staticSymbol.filePath) {
var /** @type {?} */ summarizedName = stripSummaryForJitNameSuffix(staticSymbol.name);
var /** @type {?} */ baseSymbol = this.getStaticSymbol(summarizedFileName, summarizedName, staticSymbol.members);
var /** @type {?} */ baseImportAs = this.getImportAs(baseSymbol);
return baseImportAs ?
this.getStaticSymbol(summaryForJitFileName(baseImportAs.filePath), summaryForJitName(baseImportAs.name), baseSymbol.members) :
null;
}
var /** @type {?} */ result = this.summaryResolver.getImportAs(staticSymbol);
if (!result) {
result = /** @type {?} */ ((this.importAs.get(staticSymbol)));
}
return result;
};
/**
* getResourcePath produces the path to the original location of the symbol and should
* be used to determine the relative location of resource references recorded in
* symbol metadata.
*/
/**
* getResourcePath produces the path to the original location of the symbol and should
* be used to determine the relative location of resource references recorded in
* symbol metadata.
* @param {?} staticSymbol
* @return {?}
*/
StaticSymbolResolver.prototype.getResourcePath = /**
* getResourcePath produces the path to the original location of the symbol and should
* be used to determine the relative location of resource references recorded in
* symbol metadata.
* @param {?} staticSymbol
* @return {?}
*/
function (staticSymbol) {
return this.symbolResourcePaths.get(staticSymbol) || staticSymbol.filePath;
};
/**
* getTypeArity returns the number of generic type parameters the given symbol
* has. If the symbol is not a type the result is null.
*/
/**
* getTypeArity returns the number of generic type parameters the given symbol
* has. If the symbol is not a type the result is null.
* @param {?} staticSymbol
* @return {?}
*/
StaticSymbolResolver.prototype.getTypeArity = /**
* getTypeArity returns the number of generic type parameters the given symbol
* has. If the symbol is not a type the result is null.
* @param {?} staticSymbol
* @return {?}
*/
function (staticSymbol) {
// If the file is a factory/ngsummary file, don't resolve the symbol as doing so would
// cause the metadata for an factory/ngsummary file to be loaded which doesn't exist.
// All references to generated classes must include the correct arity whenever
// generating code.
if (isGeneratedFile(staticSymbol.filePath)) {
return null;
}
var /** @type {?} */ resolvedSymbol = this.resolveSymbol(staticSymbol);
while (resolvedSymbol && resolvedSymbol.metadata instanceof StaticSymbol) {
resolvedSymbol = this.resolveSymbol(resolvedSymbol.metadata);
}
return (resolvedSymbol && resolvedSymbol.metadata && resolvedSymbol.metadata.arity) || null;
};
/**
* @param {?} filePath
* @return {?}
*/
StaticSymbolResolver.prototype.getKnownModuleName = /**
* @param {?} filePath
* @return {?}
*/
function (filePath) {
return this.knownFileNameToModuleNames.get(filePath) || null;
};
/**
* @param {?} sourceSymbol
* @param {?} targetSymbol
* @return {?}
*/
StaticSymbolResolver.prototype.recordImportAs = /**
* @param {?} sourceSymbol
* @param {?} targetSymbol
* @return {?}
*/
function (sourceSymbol, targetSymbol) {
sourceSymbol.assertNoMembers();
targetSymbol.assertNoMembers();
this.importAs.set(sourceSymbol, targetSymbol);
};
/**
* @param {?} fileName
* @param {?} moduleName
* @return {?}
*/
StaticSymbolResolver.prototype.recordModuleNameForFileName = /**
* @param {?} fileName
* @param {?} moduleName
* @return {?}
*/
function (fileName, moduleName) {
this.knownFileNameToModuleNames.set(fileName, moduleName);
};
/**
* Invalidate all information derived from the given file.
*
* @param fileName the file to invalidate
*/
/**
* Invalidate all information derived from the given file.
*
* @param {?} fileName the file to invalidate
* @return {?}
*/
StaticSymbolResolver.prototype.invalidateFile = /**
* Invalidate all information derived from the given file.
*
* @param {?} fileName the file to invalidate
* @return {?}
*/
function (fileName) {
this.metadataCache.delete(fileName);
this.resolvedFilePaths.delete(fileName);
var /** @type {?} */ symbols = this.symbolFromFile.get(fileName);
if (symbols) {
this.symbolFromFile.delete(fileName);
for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {
var symbol = symbols_1[_i];
this.resolvedSymbols.delete(symbol);
this.importAs.delete(symbol);
this.symbolResourcePaths.delete(symbol);
}
}
};
/* @internal */
/**
* @template T
* @param {?} cb
* @return {?}
*/
StaticSymbolResolver.prototype.ignoreErrorsFor = /**
* @template T
* @param {?} cb
* @return {?}
*/
function (cb) {
var /** @type {?} */ recorder = this.errorRecorder;
this.errorRecorder = function () { };
try {
return cb();
}
finally {
this.errorRecorder = recorder;
}
};
/**
* @param {?} staticSymbol
* @return {?}
*/
StaticSymbolResolver.prototype._resolveSymbolMembers = /**
* @param {?} staticSymbol
* @return {?}
*/
function (staticSymbol) {
var /** @type {?} */ members = staticSymbol.members;
var /** @type {?} */ baseResolvedSymbol = this.resolveSymbol(this.getStaticSymbol(staticSymbol.filePath, staticSymbol.name));
if (!baseResolvedSymbol) {
return null;
}
var /** @type {?} */ baseMetadata = baseResolvedSymbol.metadata;
if (baseMetadata instanceof StaticSymbol) {
return new ResolvedStaticSymbol(staticSymbol, this.getStaticSymbol(baseMetadata.filePath, baseMetadata.name, members));
}
else if (baseMetadata && baseMetadata.__symbolic === 'class') {
if (baseMetadata.statics && members.length === 1) {
return new ResolvedStaticSymbol(staticSymbol, baseMetadata.statics[members[0]]);
}
}
else {
var /** @type {?} */ value = baseMetadata;
for (var /** @type {?} */ i = 0; i < members.length && value; i++) {
value = value[members[i]];
}
return new ResolvedStaticSymbol(staticSymbol, value);
}
return null;
};
/**
* @param {?} staticSymbol
* @return {?}
*/
StaticSymbolResolver.prototype._resolveSymbolFromSummary = /**
* @param {?} staticSymbol
* @return {?}
*/
function (staticSymbol) {
var /** @type {?} */ summary = this.summaryResolver.resolveSummary(staticSymbol);
return summary ? new ResolvedStaticSymbol(staticSymbol, summary.metadata) : null;
};
/**
* getStaticSymbol produces a Type whose metadata is known but whose implementation is not loaded.
* All types passed to the StaticResolver should be pseudo-types returned by this method.
*
* @param declarationFile the absolute path of the file where the symbol is declared
* @param name the name of the type.
* @param members a symbol for a static member of the named type
*/
/**
* getStaticSymbol produces a Type whose metadata is known but whose implementation is not loaded.
* All types passed to the StaticResolver should be pseudo-types returned by this method.
*
* @param {?} declarationFile the absolute path of the file where the symbol is declared
* @param {?} name the name of the type.
* @param {?=} members a symbol for a static member of the named type
* @return {?}
*/
StaticSymbolResolver.prototype.getStaticSymbol = /**
* getStaticSymbol produces a Type whose metadata is known but whose implementation is not loaded.
* All types passed to the StaticResolver should be pseudo-types returned by this method.
*
* @param {?} declarationFile the absolute path of the file where the symbol is declared
* @param {?} name the name of the type.
* @param {?=} members a symbol for a static member of the named type
* @return {?}
*/
function (declarationFile, name, members) {
return this.staticSymbolCache.get(declarationFile, name, members);
};
/**
* hasDecorators checks a file's metadata for the presense of decorators without evalutating the
* metadata.
*
* @param filePath the absolute path to examine for decorators.
* @returns true if any class in the file has a decorator.
*/
/**
* hasDecorators checks a file's metadata for the presense of decorators without evalutating the
* metadata.
*
* @param {?} filePath the absolute path to examine for decorators.
* @return {?} true if any class in the file has a decorator.
*/
StaticSymbolResolver.prototype.hasDecorators = /**
* hasDecorators checks a file's metadata for the presense of decorators without evalutating the
* metadata.
*
* @param {?} filePath the absolute path to examine for decorators.
* @return {?} true if any class in the file has a decorator.
*/
function (filePath) {
var /** @type {?} */ metadata = this.getModuleMetadata(filePath);
if (metadata['metadata']) {
return Object.keys(metadata['metadata']).some(function (metadataKey) {
var /** @type {?} */ entry = metadata['metadata'][metadataKey];
return entry && entry.__symbolic === 'class' && entry.decorators;
});
}
return false;
};
/**
* @param {?} filePath
* @return {?}
*/
StaticSymbolResolver.prototype.getSymbolsOf = /**
* @param {?} filePath
* @return {?}
*/
function (filePath) {
var /** @type {?} */ summarySymbols = this.summaryResolver.getSymbolsOf(filePath);
if (summarySymbols) {
return summarySymbols;
}
// Note: Some users use libraries that were not compiled with ngc, i.e. they don't
// have summaries, only .d.ts files, but `summaryResolver.isLibraryFile` returns true.
this._createSymbolsOf(filePath);
var /** @type {?} */ metadataSymbols = [];
this.resolvedSymbols.forEach(function (resolvedSymbol) {
if (resolvedSymbol.symbol.filePath === filePath) {
metadataSymbols.push(resolvedSymbol.symbol);
}
});
return metadataSymbols;
};
/**
* @param {?} filePath
* @return {?}
*/
StaticSymbolResolver.prototype._createSymbolsOf = /**
* @param {?} filePath
* @return {?}
*/
function (filePath) {
var _this = this;
if (this.resolvedFilePaths.has(filePath)) {
return;
}
this.resolvedFilePaths.add(filePath);
var /** @type {?} */ resolvedSymbols = [];
var /** @type {?} */ metadata = this.getModuleMetadata(filePath);
if (metadata['importAs']) {
// Index bundle indices should use the importAs module name defined
// in the bundle.
this.knownFileNameToModuleNames.set(filePath, metadata['importAs']);
}
// handle the symbols in one of the re-export location
if (metadata['exports']) {
var _loop_1 = function (moduleExport) {
// handle the symbols in the list of explicitly re-exported symbols.
if (moduleExport.export) {
moduleExport.export.forEach(function (exportSymbol) {
var /** @type {?} */ symbolName;
if (typeof exportSymbol === 'string') {
symbolName = exportSymbol;
}
else {
symbolName = exportSymbol.as;
}
symbolName = unescapeIdentifier(symbolName);
var /** @type {?} */ symName = symbolName;
if (typeof exportSymbol !== 'string') {
symName = unescapeIdentifier(exportSymbol.name);
}
var /** @type {?} */ resolvedModule = _this.resolveModule(moduleExport.from, filePath);
if (resolvedModule) {
var /** @type {?} */ targetSymbol = _this.getStaticSymbol(resolvedModule, symName);
var /** @type {?} */ sourceSymbol = _this.getStaticSymbol(filePath, symbolName);
resolvedSymbols.push(_this.createExport(sourceSymbol, targetSymbol));
}
});
}
else {
// handle the symbols via export * directives.
var /** @type {?} */ resolvedModule = this_1.resolveModule(moduleExport.from, filePath);
if (resolvedModule) {
var /** @type {?} */ nestedExports = this_1.getSymbolsOf(resolvedModule);
nestedExports.forEach(function (targetSymbol) {
var /** @type {?} */ sourceSymbol = _this.getStaticSymbol(filePath, targetSymbol.name);
resolvedSymbols.push(_this.createExport(sourceSymbol, targetSymbol));
});
}
}
};
var this_1 = this;
for (var _i = 0, _a = metadata['exports']; _i < _a.length; _i++) {
var moduleExport = _a[_i];
_loop_1(moduleExport);
}
}
// handle the actual metadata. Has to be after the exports
// as there migth be collisions in the names, and we want the symbols
// of the current module to win ofter reexports.
if (metadata['metadata']) {
// handle direct declarations of the symbol
var /** @type {?} */ topLevelSymbolNames_1 = new Set(Object.keys(metadata['metadata']).map(unescapeIdentifier));
var /** @type {?} */ origins_1 = metadata['origins'] || {};
Object.keys(metadata['metadata']).forEach(function (metadataKey) {
var /** @type {?} */ symbolMeta = metadata['metadata'][metadataKey];
var /** @type {?} */ name = unescapeIdentifier(metadataKey);
var /** @type {?} */ symbol = _this.getStaticSymbol(filePath, name);
var /** @type {?} */ origin = origins_1.hasOwnProperty(metadataKey) && origins_1[metadataKey];
if (origin) {
// If the symbol is from a bundled index, use the declaration location of the
// symbol so relative references (such as './my.html') will be calculated
// correctly.
var /** @type {?} */ originFilePath = _this.resolveModule(origin, filePath);
if (!originFilePath) {
_this.reportError(new Error("Couldn't resolve original symbol for " + origin + " from " + filePath));
}
else {
_this.symbolResourcePaths.set(symbol, originFilePath);
}
}
resolvedSymbols.push(_this.createResolvedSymbol(symbol, filePath, topLevelSymbolNames_1, symbolMeta));
});
}
resolvedSymbols.forEach(function (resolvedSymbol) { return _this.resolvedSymbols.set(resolvedSymbol.symbol, resolvedSymbol); });
this.symbolFromFile.set(filePath, resolvedSymbols.map(function (resolvedSymbol) { return resolvedSymbol.symbol; }));
};
/**
* @param {?} sourceSymbol
* @param {?} topLevelPath
* @param {?} topLevelSymbolNames
* @param {?} metadata
* @return {?}
*/
StaticSymbolResolver.prototype.createResolvedSymbol = /**
* @param {?} sourceSymbol
* @param {?} topLevelPath
* @param {?} topLevelSymbolNames
* @param {?} metadata
* @return {?}
*/
function (sourceSymbol, topLevelPath, topLevelSymbolNames, metadata) {
// For classes that don't have Angular summaries / metadata,
// we only keep their arity, but nothing else
// (e.g. their constructor parameters).
// We do this to prevent introducing deep imports
// as we didn't generate .ngfactory.ts files with proper reexports.
if (this.summaryResolver.isLibraryFile(sourceSymbol.filePath) && metadata &&
metadata['__symbolic'] === 'class') {
var /** @type {?} */ transformedMeta_1 = { __symbolic: 'class', arity: metadata.arity };
return new ResolvedStaticSymbol(sourceSymbol, transformedMeta_1);
}
var /** @type {?} */ self = this;
var ReferenceTransformer = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(ReferenceTransformer, _super);
function ReferenceTransformer() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @param {?} map
* @param {?} functionParams
* @return {?}
*/
ReferenceTransformer.prototype.visitStringMap = /**
* @param {?} map
* @param {?} functionParams
* @return {?}
*/
function (map, functionParams) {
var /** @type {?} */ symbolic = map['__symbolic'];
if (symbolic === 'function') {
var /** @type {?} */ oldLen = functionParams.length;
functionParams.push.apply(functionParams, (map['parameters'] || []));
var /** @type {?} */ result = _super.prototype.visitStringMap.call(this, map, functionParams);
functionParams.length = oldLen;
return result;
}
else if (symbolic === 'reference') {
var /** @type {?} */ module = map['module'];
var /** @type {?} */ name_1 = map['name'] ? unescapeIdentifier(map['name']) : map['name'];
if (!name_1) {
return null;
}
var /** @type {?} */ filePath = void 0;
if (module) {
filePath = /** @type {?} */ ((self.resolveModule(module, sourceSymbol.filePath)));
if (!filePath) {
return {
__symbolic: 'error',
message: "Could not resolve " + module + " relative to " + sourceSymbol.filePath + "."
};
}
return self.getStaticSymbol(filePath, name_1);
}
else if (functionParams.indexOf(name_1) >= 0) {
// reference to a function parameter
return { __symbolic: 'reference', name: name_1 };
}
else {
if (topLevelSymbolNames.has(name_1)) {
return self.getStaticSymbol(topLevelPath, name_1);
}
// ambient value
null;
}
}
else {
return _super.prototype.visitStringMap.call(this, map, functionParams);
}
};
return ReferenceTransformer;
}(ValueTransformer));
var /** @type {?} */ transformedMeta = visitValue(metadata, new ReferenceTransformer(), []);
if (transformedMeta instanceof StaticSymbol) {
return this.createExport(sourceSymbol, transformedMeta);
}
return new ResolvedStaticSymbol(sourceSymbol, transformedMeta);
};
/**
* @param {?} sourceSymbol
* @param {?} targetSymbol
* @return {?}
*/
StaticSymbolResolver.prototype.createExport = /**
* @param {?} sourceSymbol
* @param {?} targetSymbol
* @return {?}
*/
function (sourceSymbol, targetSymbol) {
sourceSymbol.assertNoMembers();
targetSymbol.assertNoMembers();
if (this.summaryResolver.isLibraryFile(sourceSymbol.filePath) &&
this.summaryResolver.isLibraryFile(targetSymbol.filePath)) {
// This case is for an ng library importing symbols from a plain ts library
// transitively.
// Note: We rely on the fact that we discover symbols in the direction
// from source files to library files
this.importAs.set(targetSymbol, this.getImportAs(sourceSymbol) || sourceSymbol);
}
return new ResolvedStaticSymbol(sourceSymbol, targetSymbol);
};
/**
* @param {?} error
* @param {?=} context
* @param {?=} path
* @return {?}
*/
StaticSymbolResolver.prototype.reportError = /**
* @param {?} error
* @param {?=} context
* @param {?=} path
* @return {?}
*/
function (error, context, path) {
if (this.errorRecorder) {
this.errorRecorder(error, (context && context.filePath) || path);
}
else {
throw error;
}
};
/**
* @param {?} module an absolute path to a module file.
* @return {?}
*/
StaticSymbolResolver.prototype.getModuleMetadata = /**
* @param {?} module an absolute path to a module file.
* @return {?}
*/
function (module) {
var /** @type {?} */ moduleMetadata = this.metadataCache.get(module);
if (!moduleMetadata) {
var /** @type {?} */ moduleMetadatas = this.host.getMetadataFor(module);
if (moduleMetadatas) {
var /** @type {?} */ maxVersion_1 = -1;
moduleMetadatas.forEach(function (md) {
if (md['version'] > maxVersion_1) {
maxVersion_1 = md['version'];
moduleMetadata = md;
}
});
}
if (!moduleMetadata) {
moduleMetadata =
{ __symbolic: 'module', version: SUPPORTED_SCHEMA_VERSION, module: module, metadata: {} };
}
if (moduleMetadata['version'] != SUPPORTED_SCHEMA_VERSION) {
var /** @type {?} */ errorMessage = moduleMetadata['version'] == 2 ?
"Unsupported metadata version " + moduleMetadata['version'] + " for module " + module + ". This module should be compiled with a newer version of ngc" :
"Metadata version mismatch for module " + module + ", found version " + moduleMetadata['version'] + ", expected " + SUPPORTED_SCHEMA_VERSION;
this.reportError(new Error(errorMessage));
}
this.metadataCache.set(module, moduleMetadata);
}
return moduleMetadata;
};
/**
* @param {?} module
* @param {?} symbolName
* @param {?=} containingFile
* @return {?}
*/
StaticSymbolResolver.prototype.getSymbolByModule = /**
* @param {?} module
* @param {?} symbolName
* @param {?=} containingFile
* @return {?}
*/
function (module, symbolName, containingFile) {
var /** @type {?} */ filePath = this.resolveModule(module, containingFile);
if (!filePath) {
this.reportError(new Error("Could not resolve module " + module + (containingFile ? ' relative to ' +
containingFile : '')));
return this.getStaticSymbol("ERROR:" + module, symbolName);
}
return this.getStaticSymbol(filePath, symbolName);
};
/**
* @param {?} module
* @param {?=} containingFile
* @return {?}
*/
StaticSymbolResolver.prototype.resolveModule = /**
* @param {?} module
* @param {?=} containingFile
* @return {?}
*/
function (module, containingFile) {
try {
return this.host.moduleNameToFileName(module, containingFile);
}
catch (/** @type {?} */ e) {
console.error("Could not resolve module '" + module + "' relative to file " + containingFile);
this.reportError(e, undefined, containingFile);
}
return null;
};
return StaticSymbolResolver;
}());
/**
* @param {?} identifier
* @return {?}
*/
function unescapeIdentifier(identifier) {
return identifier.startsWith('___') ? identifier.substr(1) : identifier;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @record
*/
var AotSummaryResolver = (function () {
function AotSummaryResolver(host, staticSymbolCache) {
this.host = host;
this.staticSymbolCache = staticSymbolCache;
this.summaryCache = new Map();
this.loadedFilePaths = new Map();
this.importAs = new Map();
this.knownFileNameToModuleNames = new Map();
}
/**
* @param {?} filePath
* @return {?}
*/
AotSummaryResolver.prototype.isLibraryFile = /**
* @param {?} filePath
* @return {?}
*/
function (filePath) {
// Note: We need to strip the .ngfactory. file path,
// so this method also works for generated files
// (for which host.isSourceFile will always return false).
return !this.host.isSourceFile(stripGeneratedFileSuffix(filePath));
};
/**
* @param {?} filePath
* @param {?} referringSrcFileName
* @return {?}
*/
AotSummaryResolver.prototype.toSummaryFileName = /**
* @param {?} filePath
* @param {?} referringSrcFileName
* @return {?}
*/
function (filePath, referringSrcFileName) {
return this.host.toSummaryFileName(filePath, referringSrcFileName);
};
/**
* @param {?} fileName
* @param {?} referringLibFileName
* @return {?}
*/
AotSummaryResolver.prototype.fromSummaryFileName = /**
* @param {?} fileName
* @param {?} referringLibFileName
* @return {?}
*/
function (fileName, referringLibFileName) {
return this.host.fromSummaryFileName(fileName, referringLibFileName);
};
/**
* @param {?} staticSymbol
* @return {?}
*/
AotSummaryResolver.prototype.resolveSummary = /**
* @param {?} staticSymbol
* @return {?}
*/
function (staticSymbol) {
staticSymbol.assertNoMembers();
var /** @type {?} */ summary = this.summaryCache.get(staticSymbol);
if (!summary) {
this._loadSummaryFile(staticSymbol.filePath);
summary = /** @type {?} */ ((this.summaryCache.get(staticSymbol)));
}
return summary || null;
};
/**
* @param {?} filePath
* @return {?}
*/
AotSummaryResolver.prototype.getSymbolsOf = /**
* @param {?} filePath
* @return {?}
*/
function (filePath) {
if (this._loadSummaryFile(filePath)) {
return Array.from(this.summaryCache.keys()).filter(function (symbol) { return symbol.filePath === filePath; });
}
return null;
};
/**
* @param {?} staticSymbol
* @return {?}
*/
AotSummaryResolver.prototype.getImportAs = /**
* @param {?} staticSymbol
* @return {?}
*/
function (staticSymbol) {
staticSymbol.assertNoMembers();
return /** @type {?} */ ((this.importAs.get(staticSymbol)));
};
/**
* Converts a file path to a module name that can be used as an `import`.
*/
/**
* Converts a file path to a module name that can be used as an `import`.
* @param {?} importedFilePath
* @return {?}
*/
AotSummaryResolver.prototype.getKnownModuleName = /**
* Converts a file path to a module name that can be used as an `import`.
* @param {?} importedFilePath
* @return {?}
*/
function (importedFilePath) {
return this.knownFileNameToModuleNames.get(importedFilePath) || null;
};
/**
* @param {?} summary
* @return {?}
*/
AotSummaryResolver.prototype.addSummary = /**
* @param {?} summary
* @return {?}
*/
function (summary) { this.summaryCache.set(summary.symbol, summary); };
/**
* @param {?} filePath
* @return {?}
*/
AotSummaryResolver.prototype._loadSummaryFile = /**
* @param {?} filePath
* @return {?}
*/
function (filePath) {
var _this = this;
var /** @type {?} */ hasSummary = this.loadedFilePaths.get(filePath);
if (hasSummary != null) {
return hasSummary;
}
var /** @type {?} */ json = null;
if (this.isLibraryFile(filePath)) {
var /** @type {?} */ summaryFilePath = summaryFileName(filePath);
try {
json = this.host.loadSummary(summaryFilePath);
}
catch (/** @type {?} */ e) {
console.error("Error loading summary file " + summaryFilePath);
throw e;
}
}
hasSummary = json != null;
this.loadedFilePaths.set(filePath, hasSummary);
if (json) {
var _a = deserializeSummaries(this.staticSymbolCache, this, filePath, json), moduleName = _a.moduleName, summaries = _a.summaries, importAs = _a.importAs;
summaries.forEach(function (summary) { return _this.summaryCache.set(summary.symbol, summary); });
if (moduleName) {
this.knownFileNameToModuleNames.set(filePath, moduleName);
}
importAs.forEach(function (importAs) { _this.importAs.set(importAs.symbol, importAs.importAs); });
}
return hasSummary;
};
return AotSummaryResolver;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @param {?} host
* @return {?}
*/
function createAotUrlResolver(host) {
return {
resolve: function (basePath, url) {
var /** @type {?} */ filePath = host.resourceNameToFileName(url, basePath);
if (!filePath) {
throw syntaxError("Couldn't resolve resource " + url + " from " + basePath);
}
return filePath;
}
};
}
/**
* Creates a new AotCompiler based on options and a host.
* @param {?} compilerHost
* @param {?} options
* @param {?=} errorCollector
* @return {?}
*/
function createAotCompiler(compilerHost, options, errorCollector) {
var /** @type {?} */ translations = options.translations || '';
var /** @type {?} */ urlResolver = createAotUrlResolver(compilerHost);
var /** @type {?} */ symbolCache = new StaticSymbolCache();
var /** @type {?} */ summaryResolver = new AotSummaryResolver(compilerHost, symbolCache);
var /** @type {?} */ symbolResolver = new StaticSymbolResolver(compilerHost, symbolCache, summaryResolver);
var /** @type {?} */ staticReflector = new StaticReflector(summaryResolver, symbolResolver, [], [], errorCollector);
var /** @type {?} */ htmlParser = new I18NHtmlParser(new HtmlParser(), translations, options.i18nFormat, options.missingTranslation, console);
var /** @type {?} */ config = new CompilerConfig({
defaultEncapsulation: ViewEncapsulation.Emulated,
useJit: false,
enableLegacyTemplate: options.enableLegacyTemplate === true,
missingTranslation: options.missingTranslation,
preserveWhitespaces: options.preserveWhitespaces,
strictInjectionParameters: options.strictInjectionParameters,
});
var /** @type {?} */ normalizer = new DirectiveNormalizer({ get: function (url) { return compilerHost.loadResource(url); } }, urlResolver, htmlParser, config);
var /** @type {?} */ expressionParser = new Parser(new Lexer());
var /** @type {?} */ elementSchemaRegistry = new DomElementSchemaRegistry();
var /** @type {?} */ tmplParser = new TemplateParser(config, staticReflector, expressionParser, elementSchemaRegistry, htmlParser, console, []);
var /** @type {?} */ resolver = new CompileMetadataResolver(config, htmlParser, new NgModuleResolver(staticReflector), new DirectiveResolver(staticReflector), new PipeResolver(staticReflector), summaryResolver, elementSchemaRegistry, normalizer, console, symbolCache, staticReflector, errorCollector);
// TODO(vicb): do not pass options.i18nFormat here
var /** @type {?} */ viewCompiler = new ViewCompiler(staticReflector);
var /** @type {?} */ typeCheckCompiler = new TypeCheckCompiler(options, staticReflector);
var /** @type {?} */ compiler = new AotCompiler(config, options, compilerHost, staticReflector, resolver, tmplParser, new StyleCompiler(urlResolver), viewCompiler, typeCheckCompiler, new NgModuleCompiler(staticReflector), new TypeScriptEmitter(), summaryResolver, symbolResolver);
return { compiler: compiler, reflector: staticReflector };
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @record
*/
/**
* @abstract
*/
var SummaryResolver = (function () {
function SummaryResolver() {
}
return SummaryResolver;
}());
var JitSummaryResolver = (function () {
function JitSummaryResolver() {
this._summaries = new Map();
}
/**
* @return {?}
*/
JitSummaryResolver.prototype.isLibraryFile = /**
* @return {?}
*/
function () { return false; };
/**
* @param {?} fileName
* @return {?}
*/
JitSummaryResolver.prototype.toSummaryFileName = /**
* @param {?} fileName
* @return {?}
*/
function (fileName) { return fileName; };
/**
* @param {?} fileName
* @return {?}
*/
JitSummaryResolver.prototype.fromSummaryFileName = /**
* @param {?} fileName
* @return {?}
*/
function (fileName) { return fileName; };
/**
* @param {?} reference
* @return {?}
*/
JitSummaryResolver.prototype.resolveSummary = /**
* @param {?} reference
* @return {?}
*/
function (reference) {
return this._summaries.get(reference) || null;
};
/**
* @return {?}
*/
JitSummaryResolver.prototype.getSymbolsOf = /**
* @return {?}
*/
function () { return []; };
/**
* @param {?} reference
* @return {?}
*/
JitSummaryResolver.prototype.getImportAs = /**
* @param {?} reference
* @return {?}
*/
function (reference) { return reference; };
/**
* @param {?} fileName
* @return {?}
*/
JitSummaryResolver.prototype.getKnownModuleName = /**
* @param {?} fileName
* @return {?}
*/
function (fileName) { return null; };
/**
* @param {?} summary
* @return {?}
*/
JitSummaryResolver.prototype.addSummary = /**
* @param {?} summary
* @return {?}
*/
function (summary) { this._summaries.set(summary.symbol, summary); };
return JitSummaryResolver;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @param {?} statements
* @param {?} reflector
* @return {?}
*/
function interpretStatements(statements, reflector) {
var /** @type {?} */ ctx = new _ExecutionContext(null, null, null, new Map());
var /** @type {?} */ visitor = new StatementInterpreter(reflector);
visitor.visitAllStatements(statements, ctx);
var /** @type {?} */ result = {};
ctx.exports.forEach(function (exportName) { result[exportName] = ctx.vars.get(exportName); });
return result;
}
/**
* @param {?} varNames
* @param {?} varValues
* @param {?} statements
* @param {?} ctx
* @param {?} visitor
* @return {?}
*/
function _executeFunctionStatements(varNames, varValues, statements, ctx, visitor) {
var /** @type {?} */ childCtx = ctx.createChildWihtLocalVars();
for (var /** @type {?} */ i = 0; i < varNames.length; i++) {
childCtx.vars.set(varNames[i], varValues[i]);
}
var /** @type {?} */ result = visitor.visitAllStatements(statements, childCtx);
return result ? result.value : null;
}
var _ExecutionContext = (function () {
function _ExecutionContext(parent, instance, className, vars) {
this.parent = parent;
this.instance = instance;
this.className = className;
this.vars = vars;
this.exports = [];
}
/**
* @return {?}
*/
_ExecutionContext.prototype.createChildWihtLocalVars = /**
* @return {?}
*/
function () {
return new _ExecutionContext(this, this.instance, this.className, new Map());
};
return _ExecutionContext;
}());
var ReturnValue = (function () {
function ReturnValue(value) {
this.value = value;
}
return ReturnValue;
}());
/**
* @param {?} _classStmt
* @param {?} _ctx
* @param {?} _visitor
* @return {?}
*/
function createDynamicClass(_classStmt, _ctx, _visitor) {
var /** @type {?} */ propertyDescriptors = {};
_classStmt.getters.forEach(function (getter) {
// Note: use `function` instead of arrow function to capture `this`
propertyDescriptors[getter.name] = {
configurable: false,
get: function () {
var /** @type {?} */ instanceCtx = new _ExecutionContext(_ctx, this, _classStmt.name, _ctx.vars);
return _executeFunctionStatements([], [], getter.body, instanceCtx, _visitor);
}
};
});
_classStmt.methods.forEach(function (method) {
var /** @type {?} */ paramNames = method.params.map(function (param) { return param.name; });
// Note: use `function` instead of arrow function to capture `this`
propertyDescriptors[/** @type {?} */ ((method.name))] = {
writable: false,
configurable: false,
value: function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var /** @type {?} */ instanceCtx = new _ExecutionContext(_ctx, this, _classStmt.name, _ctx.vars);
return _executeFunctionStatements(paramNames, args, method.body, instanceCtx, _visitor);
}
};
});
var /** @type {?} */ ctorParamNames = _classStmt.constructorMethod.params.map(function (param) { return param.name; });
// Note: use `function` instead of arrow function to capture `this`
var /** @type {?} */ ctor = function () {
var _this = this;
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var /** @type {?} */ instanceCtx = new _ExecutionContext(_ctx, this, _classStmt.name, _ctx.vars);
_classStmt.fields.forEach(function (field) { _this[field.name] = undefined; });
_executeFunctionStatements(ctorParamNames, args, _classStmt.constructorMethod.body, instanceCtx, _visitor);
};
var /** @type {?} */ superClass = _classStmt.parent ? _classStmt.parent.visitExpression(_visitor, _ctx) : Object;
ctor.prototype = Object.create(superClass.prototype, propertyDescriptors);
return ctor;
}
var StatementInterpreter = (function () {
function StatementInterpreter(reflector) {
this.reflector = reflector;
}
/**
* @param {?} ast
* @return {?}
*/
StatementInterpreter.prototype.debugAst = /**
* @param {?} ast
* @return {?}
*/
function (ast) { return debugOutputAstAsTypeScript(ast); };
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitDeclareVarStmt = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
ctx.vars.set(stmt.name, stmt.value.visitExpression(this, ctx));
if (stmt.hasModifier(StmtModifier.Exported)) {
ctx.exports.push(stmt.name);
}
return null;
};
/**
* @param {?} expr
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitWriteVarExpr = /**
* @param {?} expr
* @param {?} ctx
* @return {?}
*/
function (expr, ctx) {
var /** @type {?} */ value = expr.value.visitExpression(this, ctx);
var /** @type {?} */ currCtx = ctx;
while (currCtx != null) {
if (currCtx.vars.has(expr.name)) {
currCtx.vars.set(expr.name, value);
return value;
}
currCtx = /** @type {?} */ ((currCtx.parent));
}
throw new Error("Not declared variable " + expr.name);
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitReadVarExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
var /** @type {?} */ varName = /** @type {?} */ ((ast.name));
if (ast.builtin != null) {
switch (ast.builtin) {
case BuiltinVar.Super:
return ctx.instance.__proto__;
case BuiltinVar.This:
return ctx.instance;
case BuiltinVar.CatchError:
varName = CATCH_ERROR_VAR$2;
break;
case BuiltinVar.CatchStack:
varName = CATCH_STACK_VAR$2;
break;
default:
throw new Error("Unknown builtin variable " + ast.builtin);
}
}
var /** @type {?} */ currCtx = ctx;
while (currCtx != null) {
if (currCtx.vars.has(varName)) {
return currCtx.vars.get(varName);
}
currCtx = /** @type {?} */ ((currCtx.parent));
}
throw new Error("Not declared variable " + varName);
};
/**
* @param {?} expr
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitWriteKeyExpr = /**
* @param {?} expr
* @param {?} ctx
* @return {?}
*/
function (expr, ctx) {
var /** @type {?} */ receiver = expr.receiver.visitExpression(this, ctx);
var /** @type {?} */ index = expr.index.visitExpression(this, ctx);
var /** @type {?} */ value = expr.value.visitExpression(this, ctx);
receiver[index] = value;
return value;
};
/**
* @param {?} expr
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitWritePropExpr = /**
* @param {?} expr
* @param {?} ctx
* @return {?}
*/
function (expr, ctx) {
var /** @type {?} */ receiver = expr.receiver.visitExpression(this, ctx);
var /** @type {?} */ value = expr.value.visitExpression(this, ctx);
receiver[expr.name] = value;
return value;
};
/**
* @param {?} expr
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitInvokeMethodExpr = /**
* @param {?} expr
* @param {?} ctx
* @return {?}
*/
function (expr, ctx) {
var /** @type {?} */ receiver = expr.receiver.visitExpression(this, ctx);
var /** @type {?} */ args = this.visitAllExpressions(expr.args, ctx);
var /** @type {?} */ result;
if (expr.builtin != null) {
switch (expr.builtin) {
case BuiltinMethod.ConcatArray:
result = receiver.concat.apply(receiver, args);
break;
case BuiltinMethod.SubscribeObservable:
result = receiver.subscribe({ next: args[0] });
break;
case BuiltinMethod.Bind:
result = receiver.bind.apply(receiver, args);
break;
default:
throw new Error("Unknown builtin method " + expr.builtin);
}
}
else {
result = receiver[/** @type {?} */ ((expr.name))].apply(receiver, args);
}
return result;
};
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitInvokeFunctionExpr = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
var /** @type {?} */ args = this.visitAllExpressions(stmt.args, ctx);
var /** @type {?} */ fnExpr = stmt.fn;
if (fnExpr instanceof ReadVarExpr && fnExpr.builtin === BuiltinVar.Super) {
ctx.instance.constructor.prototype.constructor.apply(ctx.instance, args);
return null;
}
else {
var /** @type {?} */ fn$$1 = stmt.fn.visitExpression(this, ctx);
return fn$$1.apply(null, args);
}
};
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitReturnStmt = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
return new ReturnValue(stmt.value.visitExpression(this, ctx));
};
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitDeclareClassStmt = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
var /** @type {?} */ clazz = createDynamicClass(stmt, ctx, this);
ctx.vars.set(stmt.name, clazz);
if (stmt.hasModifier(StmtModifier.Exported)) {
ctx.exports.push(stmt.name);
}
return null;
};
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitExpressionStmt = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
return stmt.expr.visitExpression(this, ctx);
};
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitIfStmt = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
var /** @type {?} */ condition = stmt.condition.visitExpression(this, ctx);
if (condition) {
return this.visitAllStatements(stmt.trueCase, ctx);
}
else if (stmt.falseCase != null) {
return this.visitAllStatements(stmt.falseCase, ctx);
}
return null;
};
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitTryCatchStmt = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
try {
return this.visitAllStatements(stmt.bodyStmts, ctx);
}
catch (/** @type {?} */ e) {
var /** @type {?} */ childCtx = ctx.createChildWihtLocalVars();
childCtx.vars.set(CATCH_ERROR_VAR$2, e);
childCtx.vars.set(CATCH_STACK_VAR$2, e.stack);
return this.visitAllStatements(stmt.catchStmts, childCtx);
}
};
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitThrowStmt = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
throw stmt.error.visitExpression(this, ctx);
};
/**
* @param {?} stmt
* @param {?=} context
* @return {?}
*/
StatementInterpreter.prototype.visitCommentStmt = /**
* @param {?} stmt
* @param {?=} context
* @return {?}
*/
function (stmt, context) { return null; };
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitInstantiateExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
var /** @type {?} */ args = this.visitAllExpressions(ast.args, ctx);
var /** @type {?} */ clazz = ast.classExpr.visitExpression(this, ctx);
return new (clazz.bind.apply(clazz, [void 0].concat(args)))();
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitLiteralExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) { return ast.value; };
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitExternalExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
return this.reflector.resolveExternalReference(ast.value);
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitConditionalExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
if (ast.condition.visitExpression(this, ctx)) {
return ast.trueCase.visitExpression(this, ctx);
}
else if (ast.falseCase != null) {
return ast.falseCase.visitExpression(this, ctx);
}
return null;
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitNotExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
return !ast.condition.visitExpression(this, ctx);
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitAssertNotNullExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
return ast.condition.visitExpression(this, ctx);
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitCastExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
return ast.value.visitExpression(this, ctx);
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitFunctionExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
var /** @type {?} */ paramNames = ast.params.map(function (param) { return param.name; });
return _declareFn(paramNames, ast.statements, ctx, this);
};
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitDeclareFunctionStmt = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
var /** @type {?} */ paramNames = stmt.params.map(function (param) { return param.name; });
ctx.vars.set(stmt.name, _declareFn(paramNames, stmt.statements, ctx, this));
if (stmt.hasModifier(StmtModifier.Exported)) {
ctx.exports.push(stmt.name);
}
return null;
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitBinaryOperatorExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
var _this = this;
var /** @type {?} */ lhs = function () { return ast.lhs.visitExpression(_this, ctx); };
var /** @type {?} */ rhs = function () { return ast.rhs.visitExpression(_this, ctx); };
switch (ast.operator) {
case BinaryOperator.Equals:
return lhs() == rhs();
case BinaryOperator.Identical:
return lhs() === rhs();
case BinaryOperator.NotEquals:
return lhs() != rhs();
case BinaryOperator.NotIdentical:
return lhs() !== rhs();
case BinaryOperator.And:
return lhs() && rhs();
case BinaryOperator.Or:
return lhs() || rhs();
case BinaryOperator.Plus:
return lhs() + rhs();
case BinaryOperator.Minus:
return lhs() - rhs();
case BinaryOperator.Divide:
return lhs() / rhs();
case BinaryOperator.Multiply:
return lhs() * rhs();
case BinaryOperator.Modulo:
return lhs() % rhs();
case BinaryOperator.Lower:
return lhs() < rhs();
case BinaryOperator.LowerEquals:
return lhs() <= rhs();
case BinaryOperator.Bigger:
return lhs() > rhs();
case BinaryOperator.BiggerEquals:
return lhs() >= rhs();
default:
throw new Error("Unknown operator " + ast.operator);
}
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitReadPropExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
var /** @type {?} */ result;
var /** @type {?} */ receiver = ast.receiver.visitExpression(this, ctx);
result = receiver[ast.name];
return result;
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitReadKeyExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
var /** @type {?} */ receiver = ast.receiver.visitExpression(this, ctx);
var /** @type {?} */ prop = ast.index.visitExpression(this, ctx);
return receiver[prop];
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitLiteralArrayExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
return this.visitAllExpressions(ast.entries, ctx);
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitLiteralMapExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
var _this = this;
var /** @type {?} */ result = {};
ast.entries.forEach(function (entry) { return result[entry.key] = entry.value.visitExpression(_this, ctx); });
return result;
};
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
StatementInterpreter.prototype.visitCommaExpr = /**
* @param {?} ast
* @param {?} context
* @return {?}
*/
function (ast, context) {
var /** @type {?} */ values = this.visitAllExpressions(ast.parts, context);
return values[values.length - 1];
};
/**
* @param {?} expressions
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitAllExpressions = /**
* @param {?} expressions
* @param {?} ctx
* @return {?}
*/
function (expressions, ctx) {
var _this = this;
return expressions.map(function (expr) { return expr.visitExpression(_this, ctx); });
};
/**
* @param {?} statements
* @param {?} ctx
* @return {?}
*/
StatementInterpreter.prototype.visitAllStatements = /**
* @param {?} statements
* @param {?} ctx
* @return {?}
*/
function (statements, ctx) {
for (var /** @type {?} */ i = 0; i < statements.length; i++) {
var /** @type {?} */ stmt = statements[i];
var /** @type {?} */ val = stmt.visitStatement(this, ctx);
if (val instanceof ReturnValue) {
return val;
}
}
return null;
};
return StatementInterpreter;
}());
/**
* @param {?} varNames
* @param {?} statements
* @param {?} ctx
* @param {?} visitor
* @return {?}
*/
function _declareFn(varNames, statements, ctx, visitor) {
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return _executeFunctionStatements(varNames, args, statements, ctx, visitor);
};
}
var CATCH_ERROR_VAR$2 = 'error';
var CATCH_STACK_VAR$2 = 'stack';
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @abstract
*/
var AbstractJsEmitterVisitor = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(AbstractJsEmitterVisitor, _super);
function AbstractJsEmitterVisitor() {
return _super.call(this, false) || this;
}
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
AbstractJsEmitterVisitor.prototype.visitDeclareClassStmt = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
var _this = this;
ctx.pushClass(stmt);
this._visitClassConstructor(stmt, ctx);
if (stmt.parent != null) {
ctx.print(stmt, stmt.name + ".prototype = Object.create(");
stmt.parent.visitExpression(this, ctx);
ctx.println(stmt, ".prototype);");
}
stmt.getters.forEach(function (getter) { return _this._visitClassGetter(stmt, getter, ctx); });
stmt.methods.forEach(function (method) { return _this._visitClassMethod(stmt, method, ctx); });
ctx.popClass();
return null;
};
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
AbstractJsEmitterVisitor.prototype._visitClassConstructor = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
ctx.print(stmt, "function " + stmt.name + "(");
if (stmt.constructorMethod != null) {
this._visitParams(stmt.constructorMethod.params, ctx);
}
ctx.println(stmt, ") {");
ctx.incIndent();
if (stmt.constructorMethod != null) {
if (stmt.constructorMethod.body.length > 0) {
ctx.println(stmt, "var self = this;");
this.visitAllStatements(stmt.constructorMethod.body, ctx);
}
}
ctx.decIndent();
ctx.println(stmt, "}");
};
/**
* @param {?} stmt
* @param {?} getter
* @param {?} ctx
* @return {?}
*/
AbstractJsEmitterVisitor.prototype._visitClassGetter = /**
* @param {?} stmt
* @param {?} getter
* @param {?} ctx
* @return {?}
*/
function (stmt, getter, ctx) {
ctx.println(stmt, "Object.defineProperty(" + stmt.name + ".prototype, '" + getter.name + "', { get: function() {");
ctx.incIndent();
if (getter.body.length > 0) {
ctx.println(stmt, "var self = this;");
this.visitAllStatements(getter.body, ctx);
}
ctx.decIndent();
ctx.println(stmt, "}});");
};
/**
* @param {?} stmt
* @param {?} method
* @param {?} ctx
* @return {?}
*/
AbstractJsEmitterVisitor.prototype._visitClassMethod = /**
* @param {?} stmt
* @param {?} method
* @param {?} ctx
* @return {?}
*/
function (stmt, method, ctx) {
ctx.print(stmt, stmt.name + ".prototype." + method.name + " = function(");
this._visitParams(method.params, ctx);
ctx.println(stmt, ") {");
ctx.incIndent();
if (method.body.length > 0) {
ctx.println(stmt, "var self = this;");
this.visitAllStatements(method.body, ctx);
}
ctx.decIndent();
ctx.println(stmt, "};");
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
AbstractJsEmitterVisitor.prototype.visitReadVarExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
if (ast.builtin === BuiltinVar.This) {
ctx.print(ast, 'self');
}
else if (ast.builtin === BuiltinVar.Super) {
throw new Error("'super' needs to be handled at a parent ast node, not at the variable level!");
}
else {
_super.prototype.visitReadVarExpr.call(this, ast, ctx);
}
return null;
};
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
AbstractJsEmitterVisitor.prototype.visitDeclareVarStmt = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
ctx.print(stmt, "var " + stmt.name + " = ");
stmt.value.visitExpression(this, ctx);
ctx.println(stmt, ";");
return null;
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
AbstractJsEmitterVisitor.prototype.visitCastExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
ast.value.visitExpression(this, ctx);
return null;
};
/**
* @param {?} expr
* @param {?} ctx
* @return {?}
*/
AbstractJsEmitterVisitor.prototype.visitInvokeFunctionExpr = /**
* @param {?} expr
* @param {?} ctx
* @return {?}
*/
function (expr, ctx) {
var /** @type {?} */ fnExpr = expr.fn;
if (fnExpr instanceof ReadVarExpr && fnExpr.builtin === BuiltinVar.Super) {
/** @type {?} */ ((/** @type {?} */ ((ctx.currentClass)).parent)).visitExpression(this, ctx);
ctx.print(expr, ".call(this");
if (expr.args.length > 0) {
ctx.print(expr, ", ");
this.visitAllExpressions(expr.args, ctx, ',');
}
ctx.print(expr, ")");
}
else {
_super.prototype.visitInvokeFunctionExpr.call(this, expr, ctx);
}
return null;
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
AbstractJsEmitterVisitor.prototype.visitFunctionExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
ctx.print(ast, "function(");
this._visitParams(ast.params, ctx);
ctx.println(ast, ") {");
ctx.incIndent();
this.visitAllStatements(ast.statements, ctx);
ctx.decIndent();
ctx.print(ast, "}");
return null;
};
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
AbstractJsEmitterVisitor.prototype.visitDeclareFunctionStmt = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
ctx.print(stmt, "function " + stmt.name + "(");
this._visitParams(stmt.params, ctx);
ctx.println(stmt, ") {");
ctx.incIndent();
this.visitAllStatements(stmt.statements, ctx);
ctx.decIndent();
ctx.println(stmt, "}");
return null;
};
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
AbstractJsEmitterVisitor.prototype.visitTryCatchStmt = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
ctx.println(stmt, "try {");
ctx.incIndent();
this.visitAllStatements(stmt.bodyStmts, ctx);
ctx.decIndent();
ctx.println(stmt, "} catch (" + CATCH_ERROR_VAR$1.name + ") {");
ctx.incIndent();
var /** @type {?} */ catchStmts = [/** @type {?} */ (CATCH_STACK_VAR$1.set(CATCH_ERROR_VAR$1.prop('stack')).toDeclStmt(null, [
StmtModifier.Final
]))].concat(stmt.catchStmts);
this.visitAllStatements(catchStmts, ctx);
ctx.decIndent();
ctx.println(stmt, "}");
return null;
};
/**
* @param {?} params
* @param {?} ctx
* @return {?}
*/
AbstractJsEmitterVisitor.prototype._visitParams = /**
* @param {?} params
* @param {?} ctx
* @return {?}
*/
function (params, ctx) {
this.visitAllObjects(function (param) { return ctx.print(null, param.name); }, params, ctx, ',');
};
/**
* @param {?} method
* @return {?}
*/
AbstractJsEmitterVisitor.prototype.getBuiltinMethodName = /**
* @param {?} method
* @return {?}
*/
function (method) {
var /** @type {?} */ name;
switch (method) {
case BuiltinMethod.ConcatArray:
name = 'concat';
break;
case BuiltinMethod.SubscribeObservable:
name = 'subscribe';
break;
case BuiltinMethod.Bind:
name = 'bind';
break;
default:
throw new Error("Unknown builtin method: " + method);
}
return name;
};
return AbstractJsEmitterVisitor;
}(AbstractEmitterVisitor));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @param {?} sourceUrl
* @param {?} ctx
* @param {?} vars
* @param {?} createSourceMap
* @return {?}
*/
function evalExpression(sourceUrl, ctx, vars, createSourceMap) {
var /** @type {?} */ fnBody = ctx.toSource() + "\n//# sourceURL=" + sourceUrl;
var /** @type {?} */ fnArgNames = [];
var /** @type {?} */ fnArgValues = [];
for (var /** @type {?} */ argName in vars) {
fnArgNames.push(argName);
fnArgValues.push(vars[argName]);
}
if (createSourceMap) {
// using `new Function(...)` generates a header, 1 line of no arguments, 2 lines otherwise
// E.g. ```
// function anonymous(a,b,c
// /**/) { ... }```
// We don't want to hard code this fact, so we auto detect it via an empty function first.
var /** @type {?} */ emptyFn = new (Function.bind.apply(Function, [void 0].concat(fnArgNames.concat('return null;'))))().toString();
var /** @type {?} */ headerLines = emptyFn.slice(0, emptyFn.indexOf('return null;')).split('\n').length - 1;
fnBody += "\n" + ctx.toSourceMapGenerator(sourceUrl, headerLines).toJsComment();
}
return new (Function.bind.apply(Function, [void 0].concat(fnArgNames.concat(fnBody))))().apply(void 0, fnArgValues);
}
/**
* @param {?} sourceUrl
* @param {?} statements
* @param {?} reflector
* @param {?} createSourceMaps
* @return {?}
*/
function jitStatements(sourceUrl, statements, reflector, createSourceMaps) {
var /** @type {?} */ converter = new JitEmitterVisitor(reflector);
var /** @type {?} */ ctx = EmitterVisitorContext.createRoot();
converter.visitAllStatements(statements, ctx);
converter.createReturnStmt(ctx);
return evalExpression(sourceUrl, ctx, converter.getArgs(), createSourceMaps);
}
var JitEmitterVisitor = (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_0_tslib__["b" /* __extends */])(JitEmitterVisitor, _super);
function JitEmitterVisitor(reflector) {
var _this = _super.call(this) || this;
_this.reflector = reflector;
_this._evalArgNames = [];
_this._evalArgValues = [];
_this._evalExportedVars = [];
return _this;
}
/**
* @param {?} ctx
* @return {?}
*/
JitEmitterVisitor.prototype.createReturnStmt = /**
* @param {?} ctx
* @return {?}
*/
function (ctx) {
var /** @type {?} */ stmt = new ReturnStatement(new LiteralMapExpr(this._evalExportedVars.map(function (resultVar) { return new LiteralMapEntry(resultVar, variable(resultVar), false); })));
stmt.visitStatement(this, ctx);
};
/**
* @return {?}
*/
JitEmitterVisitor.prototype.getArgs = /**
* @return {?}
*/
function () {
var /** @type {?} */ result = {};
for (var /** @type {?} */ i = 0; i < this._evalArgNames.length; i++) {
result[this._evalArgNames[i]] = this._evalArgValues[i];
}
return result;
};
/**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
JitEmitterVisitor.prototype.visitExternalExpr = /**
* @param {?} ast
* @param {?} ctx
* @return {?}
*/
function (ast, ctx) {
var /** @type {?} */ value = this.reflector.resolveExternalReference(ast.value);
var /** @type {?} */ id = this._evalArgValues.indexOf(value);
if (id === -1) {
id = this._evalArgValues.length;
this._evalArgValues.push(value);
var /** @type {?} */ name_1 = identifierName({ reference: value }) || 'val';
this._evalArgNames.push("jit_" + name_1 + "_" + id);
}
ctx.print(ast, this._evalArgNames[id]);
return null;
};
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
JitEmitterVisitor.prototype.visitDeclareVarStmt = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
if (stmt.hasModifier(StmtModifier.Exported)) {
this._evalExportedVars.push(stmt.name);
}
return _super.prototype.visitDeclareVarStmt.call(this, stmt, ctx);
};
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
JitEmitterVisitor.prototype.visitDeclareFunctionStmt = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
if (stmt.hasModifier(StmtModifier.Exported)) {
this._evalExportedVars.push(stmt.name);
}
return _super.prototype.visitDeclareFunctionStmt.call(this, stmt, ctx);
};
/**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
JitEmitterVisitor.prototype.visitDeclareClassStmt = /**
* @param {?} stmt
* @param {?} ctx
* @return {?}
*/
function (stmt, ctx) {
if (stmt.hasModifier(StmtModifier.Exported)) {
this._evalExportedVars.push(stmt.name);
}
return _super.prototype.visitDeclareClassStmt.call(this, stmt, ctx);
};
return JitEmitterVisitor;
}(AbstractJsEmitterVisitor));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @record
*/
/**
* An internal module of the Angular compiler that begins with component types,
* extracts templates, and eventually produces a compiled version of the component
* ready for linking into an application.
*
* \@security When compiling templates at runtime, you must ensure that the entire template comes
* from a trusted source. Attacker-controlled data introduced by a template could expose your
* application to XSS risks. For more detail, see the [Security Guide](http://g.co/ng/security).
*/
var JitCompiler = (function () {
function JitCompiler(_metadataResolver, _templateParser, _styleCompiler, _viewCompiler, _ngModuleCompiler, _summaryResolver, _reflector, _compilerConfig, _console, getExtraNgModuleProviders) {
this._metadataResolver = _metadataResolver;
this._templateParser = _templateParser;
this._styleCompiler = _styleCompiler;
this._viewCompiler = _viewCompiler;
this._ngModuleCompiler = _ngModuleCompiler;
this._summaryResolver = _summaryResolver;
this._reflector = _reflector;
this._compilerConfig = _compilerConfig;
this._console = _console;
this.getExtraNgModuleProviders = getExtraNgModuleProviders;
this._compiledTemplateCache = new Map();
this._compiledHostTemplateCache = new Map();
this._compiledDirectiveWrapperCache = new Map();
this._compiledNgModuleCache = new Map();
this._sharedStylesheetCount = 0;
}
/**
* @param {?} moduleType
* @return {?}
*/
JitCompiler.prototype.compileModuleSync = /**
* @param {?} moduleType
* @return {?}
*/
function (moduleType) {
return SyncAsync.assertSync(this._compileModuleAndComponents(moduleType, true));
};
/**
* @param {?} moduleType
* @return {?}
*/
JitCompiler.prototype.compileModuleAsync = /**
* @param {?} moduleType
* @return {?}
*/
function (moduleType) {
return Promise.resolve(this._compileModuleAndComponents(moduleType, false));
};
/**
* @param {?} moduleType
* @return {?}
*/
JitCompiler.prototype.compileModuleAndAllComponentsSync = /**
* @param {?} moduleType
* @return {?}
*/
function (moduleType) {
return SyncAsync.assertSync(this._compileModuleAndAllComponents(moduleType, true));
};
/**
* @param {?} moduleType
* @return {?}
*/
JitCompiler.prototype.compileModuleAndAllComponentsAsync = /**
* @param {?} moduleType
* @return {?}
*/
function (moduleType) {
return Promise.resolve(this._compileModuleAndAllComponents(moduleType, false));
};
/**
* @param {?} component
* @return {?}
*/
JitCompiler.prototype.getComponentFactory = /**
* @param {?} component
* @return {?}
*/
function (component) {
var /** @type {?} */ summary = this._metadataResolver.getDirectiveSummary(component);
return /** @type {?} */ (summary.componentFactory);
};
/**
* @param {?} summaries
* @return {?}
*/
JitCompiler.prototype.loadAotSummaries = /**
* @param {?} summaries
* @return {?}
*/
function (summaries) {
var _this = this;
this.clearCache();
flattenSummaries(summaries).forEach(function (summary) {
_this._summaryResolver.addSummary({ symbol: summary.type.reference, metadata: null, type: summary });
});
};
/**
* @param {?} ref
* @return {?}
*/
JitCompiler.prototype.hasAotSummary = /**
* @param {?} ref
* @return {?}
*/
function (ref) { return !!this._summaryResolver.resolveSummary(ref); };
/**
* @param {?} ids
* @return {?}
*/
JitCompiler.prototype._filterJitIdentifiers = /**
* @param {?} ids
* @return {?}
*/
function (ids) {
var _this = this;
return ids.map(function (mod) { return mod.reference; }).filter(function (ref) { return !_this.hasAotSummary(ref); });
};
/**
* @param {?} moduleType
* @param {?} isSync
* @return {?}
*/
JitCompiler.prototype._compileModuleAndComponents = /**
* @param {?} moduleType
* @param {?} isSync
* @return {?}
*/
function (moduleType, isSync) {
var _this = this;
return SyncAsync.then(this._loadModules(moduleType, isSync), function () {
_this._compileComponents(moduleType, null);
return _this._compileModule(moduleType);
});
};
/**
* @param {?} moduleType
* @param {?} isSync
* @return {?}
*/
JitCompiler.prototype._compileModuleAndAllComponents = /**
* @param {?} moduleType
* @param {?} isSync
* @return {?}
*/
function (moduleType, isSync) {
var _this = this;
return SyncAsync.then(this._loadModules(moduleType, isSync), function () {
var /** @type {?} */ componentFactories = [];
_this._compileComponents(moduleType, componentFactories);
return {
ngModuleFactory: _this._compileModule(moduleType),
componentFactories: componentFactories
};
});
};
/**
* @param {?} mainModule
* @param {?} isSync
* @return {?}
*/
JitCompiler.prototype._loadModules = /**
* @param {?} mainModule
* @param {?} isSync
* @return {?}
*/
function (mainModule, isSync) {
var _this = this;
var /** @type {?} */ loading = [];
var /** @type {?} */ mainNgModule = /** @type {?} */ ((this._metadataResolver.getNgModuleMetadata(mainModule)));
// Note: for runtime compilation, we want to transitively compile all modules,
// so we also need to load the declared directives / pipes for all nested modules.
this._filterJitIdentifiers(mainNgModule.transitiveModule.modules).forEach(function (nestedNgModule) {
// getNgModuleMetadata only returns null if the value passed in is not an NgModule
var /** @type {?} */ moduleMeta = /** @type {?} */ ((_this._metadataResolver.getNgModuleMetadata(nestedNgModule)));
_this._filterJitIdentifiers(moduleMeta.declaredDirectives).forEach(function (ref) {
var /** @type {?} */ promise = _this._metadataResolver.loadDirectiveMetadata(moduleMeta.type.reference, ref, isSync);
if (promise) {
loading.push(promise);
}
});
_this._filterJitIdentifiers(moduleMeta.declaredPipes)
.forEach(function (ref) { return _this._metadataResolver.getOrLoadPipeMetadata(ref); });
});
return SyncAsync.all(loading);
};
/**
* @param {?} moduleType
* @return {?}
*/
JitCompiler.prototype._compileModule = /**
* @param {?} moduleType
* @return {?}
*/
function (moduleType) {
var /** @type {?} */ ngModuleFactory = /** @type {?} */ ((this._compiledNgModuleCache.get(moduleType)));
if (!ngModuleFactory) {
var /** @type {?} */ moduleMeta = /** @type {?} */ ((this._metadataResolver.getNgModuleMetadata(moduleType)));
// Always provide a bound Compiler
var /** @type {?} */ extraProviders = this.getExtraNgModuleProviders(moduleMeta.type.reference);
var /** @type {?} */ outputCtx = createOutputContext();
var /** @type {?} */ compileResult = this._ngModuleCompiler.compile(outputCtx, moduleMeta, extraProviders);
ngModuleFactory = this._interpretOrJit(ngModuleJitUrl(moduleMeta), outputCtx.statements)[compileResult.ngModuleFactoryVar];
this._compiledNgModuleCache.set(moduleMeta.type.reference, ngModuleFactory);
}
return ngModuleFactory;
};
/**
* @internal
*/
/**
* \@internal
* @param {?} mainModule
* @param {?} allComponentFactories
* @return {?}
*/
JitCompiler.prototype._compileComponents = /**
* \@internal
* @param {?} mainModule
* @param {?} allComponentFactories
* @return {?}
*/
function (mainModule, allComponentFactories) {
var _this = this;
var /** @type {?} */ ngModule = /** @type {?} */ ((this._metadataResolver.getNgModuleMetadata(mainModule)));
var /** @type {?} */ moduleByJitDirective = new Map();
var /** @type {?} */ templates = new Set();
var /** @type {?} */ transJitModules = this._filterJitIdentifiers(ngModule.transitiveModule.modules);
transJitModules.forEach(function (localMod) {
var /** @type {?} */ localModuleMeta = /** @type {?} */ ((_this._metadataResolver.getNgModuleMetadata(localMod)));
_this._filterJitIdentifiers(localModuleMeta.declaredDirectives).forEach(function (dirRef) {
moduleByJitDirective.set(dirRef, localModuleMeta);
var /** @type {?} */ dirMeta = _this._metadataResolver.getDirectiveMetadata(dirRef);
if (dirMeta.isComponent) {
templates.add(_this._createCompiledTemplate(dirMeta, localModuleMeta));
if (allComponentFactories) {
var /** @type {?} */ template = _this._createCompiledHostTemplate(dirMeta.type.reference, localModuleMeta);
templates.add(template);
allComponentFactories.push(/** @type {?} */ (dirMeta.componentFactory));
}
}
});
});
transJitModules.forEach(function (localMod) {
var /** @type {?} */ localModuleMeta = /** @type {?} */ ((_this._metadataResolver.getNgModuleMetadata(localMod)));
_this._filterJitIdentifiers(localModuleMeta.declaredDirectives).forEach(function (dirRef) {
var /** @type {?} */ dirMeta = _this._metadataResolver.getDirectiveMetadata(dirRef);
if (dirMeta.isComponent) {
dirMeta.entryComponents.forEach(function (entryComponentType) {
var /** @type {?} */ moduleMeta = /** @type {?} */ ((moduleByJitDirective.get(entryComponentType.componentType)));
templates.add(_this._createCompiledHostTemplate(entryComponentType.componentType, moduleMeta));
});
}
});
localModuleMeta.entryComponents.forEach(function (entryComponentType) {
if (!_this.hasAotSummary(entryComponentType.componentType.reference)) {
var /** @type {?} */ moduleMeta = /** @type {?} */ ((moduleByJitDirective.get(entryComponentType.componentType)));
templates.add(_this._createCompiledHostTemplate(entryComponentType.componentType, moduleMeta));
}
});
});
templates.forEach(function (template) { return _this._compileTemplate(template); });
};
/**
* @param {?} type
* @return {?}
*/
JitCompiler.prototype.clearCacheFor = /**
* @param {?} type
* @return {?}
*/
function (type) {
this._compiledNgModuleCache.delete(type);
this._metadataResolver.clearCacheFor(type);
this._compiledHostTemplateCache.delete(type);
var /** @type {?} */ compiledTemplate = this._compiledTemplateCache.get(type);
if (compiledTemplate) {
this._compiledTemplateCache.delete(type);
}
};
/**
* @return {?}
*/
JitCompiler.prototype.clearCache = /**
* @return {?}
*/
function () {
this._metadataResolver.clearCache();
this._compiledTemplateCache.clear();
this._compiledHostTemplateCache.clear();
this._compiledNgModuleCache.clear();
};
/**
* @param {?} compType
* @param {?} ngModule
* @return {?}
*/
JitCompiler.prototype._createCompiledHostTemplate = /**
* @param {?} compType
* @param {?} ngModule
* @return {?}
*/
function (compType, ngModule) {
if (!ngModule) {
throw new Error("Component " + stringify(compType) + " is not part of any NgModule or the module has not been imported into your module.");
}
var /** @type {?} */ compiledTemplate = this._compiledHostTemplateCache.get(compType);
if (!compiledTemplate) {
var /** @type {?} */ compMeta = this._metadataResolver.getDirectiveMetadata(compType);
assertComponent(compMeta);
var /** @type {?} */ hostMeta = this._metadataResolver.getHostComponentMetadata(compMeta, (/** @type {?} */ (compMeta.componentFactory)).viewDefFactory);
compiledTemplate =
new CompiledTemplate(true, compMeta.type, hostMeta, ngModule, [compMeta.type]);
this._compiledHostTemplateCache.set(compType, compiledTemplate);
}
return compiledTemplate;
};
/**
* @param {?} compMeta
* @param {?} ngModule
* @return {?}
*/
JitCompiler.prototype._createCompiledTemplate = /**
* @param {?} compMeta
* @param {?} ngModule
* @return {?}
*/
function (compMeta, ngModule) {
var /** @type {?} */ compiledTemplate = this._compiledTemplateCache.get(compMeta.type.reference);
if (!compiledTemplate) {
assertComponent(compMeta);
compiledTemplate = new CompiledTemplate(false, compMeta.type, compMeta, ngModule, ngModule.transitiveModule.directives);
this._compiledTemplateCache.set(compMeta.type.reference, compiledTemplate);
}
return compiledTemplate;
};
/**
* @param {?} template
* @return {?}
*/
JitCompiler.prototype._compileTemplate = /**
* @param {?} template
* @return {?}
*/
function (template) {
var _this = this;
if (template.isCompiled) {
return;
}
var /** @type {?} */ compMeta = template.compMeta;
var /** @type {?} */ externalStylesheetsByModuleUrl = new Map();
var /** @type {?} */ outputContext = createOutputContext();
var /** @type {?} */ componentStylesheet = this._styleCompiler.compileComponent(outputContext, compMeta); /** @type {?} */
((compMeta.template)).externalStylesheets.forEach(function (stylesheetMeta) {
var /** @type {?} */ compiledStylesheet = _this._styleCompiler.compileStyles(createOutputContext(), compMeta, stylesheetMeta);
externalStylesheetsByModuleUrl.set(/** @type {?} */ ((stylesheetMeta.moduleUrl)), compiledStylesheet);
});
this._resolveStylesCompileResult(componentStylesheet, externalStylesheetsByModuleUrl);
var /** @type {?} */ pipes = template.ngModule.transitiveModule.pipes.map(function (pipe) { return _this._metadataResolver.getPipeSummary(pipe.reference); });
var _a = this._parseTemplate(compMeta, template.ngModule, template.directives), parsedTemplate = _a.template, usedPipes = _a.pipes;
var /** @type {?} */ compileResult = this._viewCompiler.compileComponent(outputContext, compMeta, parsedTemplate, variable(componentStylesheet.stylesVar), usedPipes);
var /** @type {?} */ evalResult = this._interpretOrJit(templateJitUrl(template.ngModule.type, template.compMeta), outputContext.statements);
var /** @type {?} */ viewClass = evalResult[compileResult.viewClassVar];
var /** @type {?} */ rendererType = evalResult[compileResult.rendererTypeVar];
template.compiled(viewClass, rendererType);
};
/**
* @param {?} compMeta
* @param {?} ngModule
* @param {?} directiveIdentifiers
* @return {?}
*/
JitCompiler.prototype._parseTemplate = /**
* @param {?} compMeta
* @param {?} ngModule
* @param {?} directiveIdentifiers
* @return {?}
*/
function (compMeta, ngModule, directiveIdentifiers) {
var _this = this;
// Note: ! is ok here as components always have a template.
var /** @type {?} */ preserveWhitespaces = /** @type {?} */ ((compMeta.template)).preserveWhitespaces;
var /** @type {?} */ directives = directiveIdentifiers.map(function (dir) { return _this._metadataResolver.getDirectiveSummary(dir.reference); });
var /** @type {?} */ pipes = ngModule.transitiveModule.pipes.map(function (pipe) { return _this._metadataResolver.getPipeSummary(pipe.reference); });
return this._templateParser.parse(compMeta, /** @type {?} */ ((/** @type {?} */ ((compMeta.template)).htmlAst)), directives, pipes, ngModule.schemas, templateSourceUrl(ngModule.type, compMeta, /** @type {?} */ ((compMeta.template))), preserveWhitespaces);
};
/**
* @param {?} result
* @param {?} externalStylesheetsByModuleUrl
* @return {?}
*/
JitCompiler.prototype._resolveStylesCompileResult = /**
* @param {?} result
* @param {?} externalStylesheetsByModuleUrl
* @return {?}
*/
function (result, externalStylesheetsByModuleUrl) {
var _this = this;
result.dependencies.forEach(function (dep, i) {
var /** @type {?} */ nestedCompileResult = /** @type {?} */ ((externalStylesheetsByModuleUrl.get(dep.moduleUrl)));
var /** @type {?} */ nestedStylesArr = _this._resolveAndEvalStylesCompileResult(nestedCompileResult, externalStylesheetsByModuleUrl);
dep.setValue(nestedStylesArr);
});
};
/**
* @param {?} result
* @param {?} externalStylesheetsByModuleUrl
* @return {?}
*/
JitCompiler.prototype._resolveAndEvalStylesCompileResult = /**
* @param {?} result
* @param {?} externalStylesheetsByModuleUrl
* @return {?}
*/
function (result, externalStylesheetsByModuleUrl) {
this._resolveStylesCompileResult(result, externalStylesheetsByModuleUrl);
return this._interpretOrJit(sharedStylesheetJitUrl(result.meta, this._sharedStylesheetCount++), result.outputCtx.statements)[result.stylesVar];
};
/**
* @param {?} sourceUrl
* @param {?} statements
* @return {?}
*/
JitCompiler.prototype._interpretOrJit = /**
* @param {?} sourceUrl
* @param {?} statements
* @return {?}
*/
function (sourceUrl, statements) {
if (!this._compilerConfig.useJit) {
return interpretStatements(statements, this._reflector);
}
else {
return jitStatements(sourceUrl, statements, this._reflector, this._compilerConfig.jitDevMode);
}
};
return JitCompiler;
}());
var CompiledTemplate = (function () {
function CompiledTemplate(isHost, compType, compMeta, ngModule, directives) {
this.isHost = isHost;
this.compType = compType;
this.compMeta = compMeta;
this.ngModule = ngModule;
this.directives = directives;
this._viewClass = /** @type {?} */ ((null));
this.isCompiled = false;
}
/**
* @param {?} viewClass
* @param {?} rendererType
* @return {?}
*/
CompiledTemplate.prototype.compiled = /**
* @param {?} viewClass
* @param {?} rendererType
* @return {?}
*/
function (viewClass, rendererType) {
this._viewClass = viewClass;
(/** @type {?} */ (this.compMeta.componentViewType)).setDelegate(viewClass);
for (var /** @type {?} */ prop in rendererType) {
(/** @type {?} */ (this.compMeta.rendererType))[prop] = rendererType[prop];
}
this.isCompiled = true;
};
return CompiledTemplate;
}());
/**
* @param {?} meta
* @return {?}
*/
function assertComponent(meta) {
if (!meta.isComponent) {
throw new Error("Could not compile '" + identifierName(meta.type) + "' because it is not a component.");
}
}
/**
* @param {?} fn
* @param {?=} out
* @param {?=} seen
* @return {?}
*/
function flattenSummaries(fn$$1, out, seen) {
if (out === void 0) { out = []; }
if (seen === void 0) { seen = new Set(); }
if (seen.has(fn$$1)) {
return out;
}
seen.add(fn$$1);
var /** @type {?} */ summaries = fn$$1();
for (var /** @type {?} */ i = 0; i < summaries.length; i++) {
var /** @type {?} */ entry = summaries[i];
if (typeof entry === 'function') {
flattenSummaries(entry, out, seen);
}
else {
out.push(entry);
}
}
return out;
}
/**
* @return {?}
*/
function createOutputContext() {
var /** @type {?} */ importExpr$$1 = function (symbol) {
return importExpr({ name: identifierName(symbol), moduleName: null, runtime: symbol });
};
return { statements: [], genFilePath: '', importExpr: importExpr$$1 };
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Provides access to reflection data about symbols that the compiler needs.
* @abstract
*/
var CompileReflector = (function () {
function CompileReflector() {
}
return CompileReflector;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* Create a {\@link UrlResolver} with no package prefix.
* @return {?}
*/
function createUrlResolverWithoutPackagePrefix() {
return new UrlResolver();
}
/**
* @return {?}
*/
function createOfflineCompileUrlResolver() {
return new UrlResolver('.');
}
/**
* @record
*/
var UrlResolver = (function () {
function UrlResolverImpl(_packagePrefix) {
if (_packagePrefix === void 0) { _packagePrefix = null; }
this._packagePrefix = _packagePrefix;
}
/**
* Resolves the `url` given the `baseUrl`:
* - when the `url` is null, the `baseUrl` is returned,
* - if `url` is relative ('path/to/here', './path/to/here'), the resolved url is a combination of
* `baseUrl` and `url`,
* - if `url` is absolute (it has a scheme: 'http://', 'https://' or start with '/'), the `url` is
* returned as is (ignoring the `baseUrl`)
*/
/**
* Resolves the `url` given the `baseUrl`:
* - when the `url` is null, the `baseUrl` is returned,
* - if `url` is relative ('path/to/here', './path/to/here'), the resolved url is a combination of
* `baseUrl` and `url`,
* - if `url` is absolute (it has a scheme: 'http://', 'https://' or start with '/'), the `url` is
* returned as is (ignoring the `baseUrl`)
* @param {?} baseUrl
* @param {?} url
* @return {?}
*/
UrlResolverImpl.prototype.resolve = /**
* Resolves the `url` given the `baseUrl`:
* - when the `url` is null, the `baseUrl` is returned,
* - if `url` is relative ('path/to/here', './path/to/here'), the resolved url is a combination of
* `baseUrl` and `url`,
* - if `url` is absolute (it has a scheme: 'http://', 'https://' or start with '/'), the `url` is
* returned as is (ignoring the `baseUrl`)
* @param {?} baseUrl
* @param {?} url
* @return {?}
*/
function (baseUrl, url) {
var /** @type {?} */ resolvedUrl = url;
if (baseUrl != null && baseUrl.length > 0) {
resolvedUrl = _resolveUrl(baseUrl, resolvedUrl);
}
var /** @type {?} */ resolvedParts = _split(resolvedUrl);
var /** @type {?} */ prefix = this._packagePrefix;
if (prefix != null && resolvedParts != null &&
resolvedParts[_ComponentIndex.Scheme] == 'package') {
var /** @type {?} */ path = resolvedParts[_ComponentIndex.Path];
prefix = prefix.replace(/\/+$/, '');
path = path.replace(/^\/+/, '');
return prefix + "/" + path;
}
return resolvedUrl;
};
return UrlResolverImpl;
}());
/**
* Extract the scheme of a URL.
* @param {?} url
* @return {?}
*/
function getUrlScheme(url) {
var /** @type {?} */ match = _split(url);
return (match && match[_ComponentIndex.Scheme]) || '';
}
/**
* Builds a URI string from already-encoded parts.
*
* No encoding is performed. Any component may be omitted as either null or
* undefined.
*
* @param {?=} opt_scheme The scheme such as 'http'.
* @param {?=} opt_userInfo The user name before the '\@'.
* @param {?=} opt_domain The domain such as 'www.google.com', already
* URI-encoded.
* @param {?=} opt_port The port number.
* @param {?=} opt_path The path, already URI-encoded. If it is not
* empty, it must begin with a slash.
* @param {?=} opt_queryData The URI-encoded query data.
* @param {?=} opt_fragment The URI-encoded fragment identifier.
* @return {?} The fully combined URI.
*/
function _buildFromEncodedParts(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) {
var /** @type {?} */ out = [];
if (opt_scheme != null) {
out.push(opt_scheme + ':');
}
if (opt_domain != null) {
out.push('//');
if (opt_userInfo != null) {
out.push(opt_userInfo + '@');
}
out.push(opt_domain);
if (opt_port != null) {
out.push(':' + opt_port);
}
}
if (opt_path != null) {
out.push(opt_path);
}
if (opt_queryData != null) {
out.push('?' + opt_queryData);
}
if (opt_fragment != null) {
out.push('#' + opt_fragment);
}
return out.join('');
}
/**
* A regular expression for breaking a URI into its component parts.
*
* {\@link http://www.gbiv.com/protocols/uri/rfc/rfc3986.html#RFC2234} says
* As the "first-match-wins" algorithm is identical to the "greedy"
* disambiguation method used by POSIX regular expressions, it is natural and
* commonplace to use a regular expression for parsing the potential five
* components of a URI reference.
*
* The following line is the regular expression for breaking-down a
* well-formed URI reference into its components.
*
* <pre>
* ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?
* 12 3 4 5 6 7 8 9
* </pre>
*
* The numbers in the second line above are only to assist readability; they
* indicate the reference points for each subexpression (i.e., each paired
* parenthesis). We refer to the value matched for subexpression <n> as $<n>.
* For example, matching the above expression to
* <pre>
* http://www.ics.uci.edu/pub/ietf/uri/#Related
* </pre>
* results in the following subexpression matches:
* <pre>
* $1 = http:
* $2 = http
* $3 = //www.ics.uci.edu
* $4 = www.ics.uci.edu
* $5 = /pub/ietf/uri/
* $6 = <undefined>
* $7 = <undefined>
* $8 = #Related
* $9 = Related
* </pre>
* where <undefined> indicates that the component is not present, as is the
* case for the query component in the above example. Therefore, we can
* determine the value of the five components as
* <pre>
* scheme = $2
* authority = $4
* path = $5
* query = $7
* fragment = $9
* </pre>
*
* The regular expression has been modified slightly to expose the
* userInfo, domain, and port separately from the authority.
* The modified version yields
* <pre>
* $1 = http scheme
* $2 = <undefined> userInfo -\
* $3 = www.ics.uci.edu domain | authority
* $4 = <undefined> port -/
* $5 = /pub/ietf/uri/ path
* $6 = <undefined> query without ?
* $7 = Related fragment without #
* </pre>
* \@internal
*/
var _splitRe = new RegExp('^' +
'(?:' +
'([^:/?#.]+)' +
':)?' +
'(?://' +
'(?:([^/?#]*)@)?' +
'([\\w\\d\\-\\u0100-\\uffff.%]*)' +
'(?::([0-9]+))?' +
')?' +
'([^?#]+)?' +
'(?:\\?([^#]*))?' +
'(?:#(.*))?' +
'$');
/** @enum {number} */
var _ComponentIndex = {
Scheme: 1,
UserInfo: 2,
Domain: 3,
Port: 4,
Path: 5,
QueryData: 6,
Fragment: 7,
};
_ComponentIndex[_ComponentIndex.Scheme] = "Scheme";
_ComponentIndex[_ComponentIndex.UserInfo] = "UserInfo";
_ComponentIndex[_ComponentIndex.Domain] = "Domain";
_ComponentIndex[_ComponentIndex.Port] = "Port";
_ComponentIndex[_ComponentIndex.Path] = "Path";
_ComponentIndex[_ComponentIndex.QueryData] = "QueryData";
_ComponentIndex[_ComponentIndex.Fragment] = "Fragment";
/**
* Splits a URI into its component parts.
*
* Each component can be accessed via the component indices; for example:
* <pre>
* goog.uri.utils.split(someStr)[goog.uri.utils.CompontentIndex.QUERY_DATA];
* </pre>
*
* @param {?} uri The URI string to examine.
* @return {?} Each component still URI-encoded.
* Each component that is present will contain the encoded value, whereas
* components that are not present will be undefined or empty, depending
* on the browser's regular expression implementation. Never null, since
* arbitrary strings may still look like path names.
*/
function _split(uri) {
return /** @type {?} */ ((uri.match(_splitRe)));
}
/**
* Removes dot segments in given path component, as described in
* RFC 3986, section 5.2.4.
*
* @param {?} path A non-empty path component.
* @return {?} Path component with removed dot segments.
*/
function _removeDotSegments(path) {
if (path == '/')
return '/';
var /** @type {?} */ leadingSlash = path[0] == '/' ? '/' : '';
var /** @type {?} */ trailingSlash = path[path.length - 1] === '/' ? '/' : '';
var /** @type {?} */ segments = path.split('/');
var /** @type {?} */ out = [];
var /** @type {?} */ up = 0;
for (var /** @type {?} */ pos = 0; pos < segments.length; pos++) {
var /** @type {?} */ segment = segments[pos];
switch (segment) {
case '':
case '.':
break;
case '..':
if (out.length > 0) {
out.pop();
}
else {
up++;
}
break;
default:
out.push(segment);
}
}
if (leadingSlash == '') {
while (up-- > 0) {
out.unshift('..');
}
if (out.length === 0)
out.push('.');
}
return leadingSlash + out.join('/') + trailingSlash;
}
/**
* Takes an array of the parts from split and canonicalizes the path part
* and then joins all the parts.
* @param {?} parts
* @return {?}
*/
function _joinAndCanonicalizePath(parts) {
var /** @type {?} */ path = parts[_ComponentIndex.Path];
path = path == null ? '' : _removeDotSegments(path);
parts[_ComponentIndex.Path] = path;
return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]);
}
/**
* Resolves a URL.
* @param {?} base The URL acting as the base URL.
* @param {?} url
* @return {?}
*/
function _resolveUrl(base, url) {
var /** @type {?} */ parts = _split(encodeURI(url));
var /** @type {?} */ baseParts = _split(base);
if (parts[_ComponentIndex.Scheme] != null) {
return _joinAndCanonicalizePath(parts);
}
else {
parts[_ComponentIndex.Scheme] = baseParts[_ComponentIndex.Scheme];
}
for (var /** @type {?} */ i = _ComponentIndex.Scheme; i <= _ComponentIndex.Port; i++) {
if (parts[i] == null) {
parts[i] = baseParts[i];
}
}
if (parts[_ComponentIndex.Path][0] == '/') {
return _joinAndCanonicalizePath(parts);
}
var /** @type {?} */ path = baseParts[_ComponentIndex.Path];
if (path == null)
path = '/';
var /** @type {?} */ index = path.lastIndexOf('/');
path = path.substring(0, index + 1) + parts[_ComponentIndex.Path];
parts[_ComponentIndex.Path] = path;
return _joinAndCanonicalizePath(parts);
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* An interface for retrieving documents by URL that the compiler uses
* to load templates.
*/
var ResourceLoader = (function () {
function ResourceLoader() {
}
/**
* @param {?} url
* @return {?}
*/
ResourceLoader.prototype.get = /**
* @param {?} url
* @return {?}
*/
function (url) { return ''; };
return ResourceLoader;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Extract i18n messages from source code
*/
/**
* The host of the Extractor disconnects the implementation from TypeScript / other language
* services and from underlying file systems.
* @record
*/
var Extractor = (function () {
function Extractor(host, staticSymbolResolver, messageBundle, metadataResolver) {
this.host = host;
this.staticSymbolResolver = staticSymbolResolver;
this.messageBundle = messageBundle;
this.metadataResolver = metadataResolver;
}
/**
* @param {?} rootFiles
* @return {?}
*/
Extractor.prototype.extract = /**
* @param {?} rootFiles
* @return {?}
*/
function (rootFiles) {
var _this = this;
var _a = analyzeAndValidateNgModules(rootFiles, this.host, this.staticSymbolResolver, this.metadataResolver), files = _a.files, ngModules = _a.ngModules;
return Promise
.all(ngModules.map(function (ngModule) {
return _this.metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, false);
}))
.then(function () {
var /** @type {?} */ errors = [];
files.forEach(function (file) {
var /** @type {?} */ compMetas = [];
file.directives.forEach(function (directiveType) {
var /** @type {?} */ dirMeta = _this.metadataResolver.getDirectiveMetadata(directiveType);
if (dirMeta && dirMeta.isComponent) {
compMetas.push(dirMeta);
}
});
compMetas.forEach(function (compMeta) {
var /** @type {?} */ html = /** @type {?} */ ((/** @type {?} */ ((compMeta.template)).template));
var /** @type {?} */ interpolationConfig = InterpolationConfig.fromArray(/** @type {?} */ ((compMeta.template)).interpolation);
errors.push.apply(errors, /** @type {?} */ ((_this.messageBundle.updateFromTemplate(html, file.fileName, interpolationConfig))));
});
});
if (errors.length) {
throw new Error(errors.map(function (e) { return e.toString(); }).join('\n'));
}
return _this.messageBundle;
});
};
/**
* @param {?} host
* @param {?} locale
* @return {?}
*/
Extractor.create = /**
* @param {?} host
* @param {?} locale
* @return {?}
*/
function (host, locale) {
var /** @type {?} */ htmlParser = new HtmlParser();
var /** @type {?} */ urlResolver = createAotUrlResolver(host);
var /** @type {?} */ symbolCache = new StaticSymbolCache();
var /** @type {?} */ summaryResolver = new AotSummaryResolver(host, symbolCache);
var /** @type {?} */ staticSymbolResolver = new StaticSymbolResolver(host, symbolCache, summaryResolver);
var /** @type {?} */ staticReflector = new StaticReflector(summaryResolver, staticSymbolResolver);
var /** @type {?} */ config = new CompilerConfig({ defaultEncapsulation: ViewEncapsulation.Emulated, useJit: false });
var /** @type {?} */ normalizer = new DirectiveNormalizer({ get: function (url) { return host.loadResource(url); } }, urlResolver, htmlParser, config);
var /** @type {?} */ elementSchemaRegistry = new DomElementSchemaRegistry();
var /** @type {?} */ resolver = new CompileMetadataResolver(config, htmlParser, new NgModuleResolver(staticReflector), new DirectiveResolver(staticReflector), new PipeResolver(staticReflector), summaryResolver, elementSchemaRegistry, normalizer, console, symbolCache, staticReflector);
// TODO(vicb): implicit tags & attributes
var /** @type {?} */ messageBundle = new MessageBundle(htmlParser, [], {}, locale);
var /** @type {?} */ extractor = new Extractor(host, staticSymbolResolver, messageBundle, resolver);
return { extractor: extractor, staticReflector: staticReflector };
};
return Extractor;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @module
* @description
* Entry point for all APIs of the compiler package.
*
* <div class="callout is-critical">
* <header>Unstable APIs</header>
* <p>
* All compiler apis are currently considered experimental and private!
* </p>
* <p>
* We expect the APIs in this package to keep on changing. Do not rely on them.
* </p>
* </div>
*/
// This file only reexports content of the `src` folder. Keep it that way.
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @module
* @description
* Entry point for all public APIs of this package.
*/
// This file only reexports content of the `src` folder. Keep it that way.
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// This file is not used to build this module. It is only used during editing
// by the TypeScript language service and during build for verification. `ngc`
// replaces this file with production index.ts when it rewrites private symbol
// names.
//# sourceMappingURL=compiler.js.map
/***/ }),
/* 357 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var Subscriber_1 = __webpack_require__(25);
var rxSubscriber_1 = __webpack_require__(72);
var Observer_1 = __webpack_require__(125);
function toSubscriber(nextOrObserver, error, complete) {
if (nextOrObserver) {
if (nextOrObserver instanceof Subscriber_1.Subscriber) {
return nextOrObserver;
}
if (nextOrObserver[rxSubscriber_1.rxSubscriber]) {
return nextOrObserver[rxSubscriber_1.rxSubscriber]();
}
}
if (!nextOrObserver && !error && !complete) {
return new Subscriber_1.Subscriber(Observer_1.empty);
}
return new Subscriber_1.Subscriber(nextOrObserver, error, complete);
}
exports.toSubscriber = toSubscriber;
//# sourceMappingURL=toSubscriber.js.map
/***/ }),
/* 358 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
/**
* An error thrown when one or more errors have occurred during the
* `unsubscribe` of a {@link Subscription}.
*/
var UnsubscriptionError = (function (_super) {
__extends(UnsubscriptionError, _super);
function UnsubscriptionError(errors) {
_super.call(this);
this.errors = errors;
var err = Error.call(this, errors ?
errors.length + " errors occurred during unsubscription:\n " + errors.map(function (err, i) { return ((i + 1) + ") " + err.toString()); }).join('\n ') : '');
this.name = err.name = 'UnsubscriptionError';
this.stack = err.stack;
this.message = err.message;
}
return UnsubscriptionError;
}(Error));
exports.UnsubscriptionError = UnsubscriptionError;
//# sourceMappingURL=UnsubscriptionError.js.map
/***/ }),
/* 359 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var noop_1 = __webpack_require__(360);
/* tslint:enable:max-line-length */
function pipe() {
var fns = [];
for (var _i = 0; _i < arguments.length; _i++) {
fns[_i - 0] = arguments[_i];
}
return pipeFromArray(fns);
}
exports.pipe = pipe;
/* @internal */
function pipeFromArray(fns) {
if (!fns) {
return noop_1.noop;
}
if (fns.length === 1) {
return fns[0];
}
return function piped(input) {
return fns.reduce(function (prev, fn) { return fn(prev); }, input);
};
}
exports.pipeFromArray = pipeFromArray;
//# sourceMappingURL=pipe.js.map
/***/ }),
/* 360 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* tslint:disable:no-empty */
function noop() { }
exports.noop = noop;
//# sourceMappingURL=noop.js.map
/***/ }),
/* 361 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var merge_1 = __webpack_require__(362);
exports.merge = merge_1.mergeStatic;
//# sourceMappingURL=merge.js.map
/***/ }),
/* 362 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var merge_1 = __webpack_require__(127);
var merge_2 = __webpack_require__(127);
exports.mergeStatic = merge_2.mergeStatic;
/* tslint:enable:max-line-length */
/**
* Creates an output Observable which concurrently emits all values from every
* given input Observable.
*
* <span class="informal">Flattens multiple Observables together by blending
* their values into one Observable.</span>
*
* <img src="./img/merge.png" width="100%">
*
* `merge` subscribes to each given input Observable (either the source or an
* Observable given as argument), and simply forwards (without doing any
* transformation) all the values from all the input Observables to the output
* Observable. The output Observable only completes once all input Observables
* have completed. Any error delivered by an input Observable will be immediately
* emitted on the output Observable.
*
* @example <caption>Merge together two Observables: 1s interval and clicks</caption>
* var clicks = Rx.Observable.fromEvent(document, 'click');
* var timer = Rx.Observable.interval(1000);
* var clicksOrTimer = clicks.merge(timer);
* clicksOrTimer.subscribe(x => console.log(x));
*
* @example <caption>Merge together 3 Observables, but only 2 run concurrently</caption>
* var timer1 = Rx.Observable.interval(1000).take(10);
* var timer2 = Rx.Observable.interval(2000).take(6);
* var timer3 = Rx.Observable.interval(500).take(10);
* var concurrent = 2; // the argument
* var merged = timer1.merge(timer2, timer3, concurrent);
* merged.subscribe(x => console.log(x));
*
* @see {@link mergeAll}
* @see {@link mergeMap}
* @see {@link mergeMapTo}
* @see {@link mergeScan}
*
* @param {ObservableInput} other An input Observable to merge with the source
* Observable. More than one input Observables may be given as argument.
* @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input
* Observables being subscribed to concurrently.
* @param {Scheduler} [scheduler=null] The IScheduler to use for managing
* concurrency of input Observables.
* @return {Observable} An Observable that emits items that are the result of
* every input Observable.
* @method merge
* @owner Observable
*/
function merge() {
var observables = [];
for (var _i = 0; _i < arguments.length; _i++) {
observables[_i - 0] = arguments[_i];
}
return merge_1.merge.apply(void 0, observables)(this);
}
exports.merge = merge;
//# sourceMappingURL=merge.js.map
/***/ }),
/* 363 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Observable_1 = __webpack_require__(9);
/**
* We need this JSDoc comment for affecting ESDoc.
* @extends {Ignored}
* @hide true
*/
var ScalarObservable = (function (_super) {
__extends(ScalarObservable, _super);
function ScalarObservable(value, scheduler) {
_super.call(this);
this.value = value;
this.scheduler = scheduler;
this._isScalar = true;
if (scheduler) {
this._isScalar = false;
}
}
ScalarObservable.create = function (value, scheduler) {
return new ScalarObservable(value, scheduler);
};
ScalarObservable.dispatch = function (state) {
var done = state.done, value = state.value, subscriber = state.subscriber;
if (done) {
subscriber.complete();
return;
}
subscriber.next(value);
if (subscriber.closed) {
return;
}
state.done = true;
this.schedule(state);
};
ScalarObservable.prototype._subscribe = function (subscriber) {
var value = this.value;
var scheduler = this.scheduler;
if (scheduler) {
return scheduler.schedule(ScalarObservable.dispatch, 0, {
done: false, value: value, subscriber: subscriber
});
}
else {
subscriber.next(value);
if (!subscriber.closed) {
subscriber.complete();
}
}
};
return ScalarObservable;
}(Observable_1.Observable));
exports.ScalarObservable = ScalarObservable;
//# sourceMappingURL=ScalarObservable.js.map
/***/ }),
/* 364 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var mergeMap_1 = __webpack_require__(131);
var identity_1 = __webpack_require__(369);
/**
* Converts a higher-order Observable into a first-order Observable which
* concurrently delivers all values that are emitted on the inner Observables.
*
* <span class="informal">Flattens an Observable-of-Observables.</span>
*
* <img src="./img/mergeAll.png" width="100%">
*
* `mergeAll` subscribes to an Observable that emits Observables, also known as
* a higher-order Observable. Each time it observes one of these emitted inner
* Observables, it subscribes to that and delivers all the values from the
* inner Observable on the output Observable. The output Observable only
* completes once all inner Observables have completed. Any error delivered by
* a inner Observable will be immediately emitted on the output Observable.
*
* @example <caption>Spawn a new interval Observable for each click event, and blend their outputs as one Observable</caption>
* var clicks = Rx.Observable.fromEvent(document, 'click');
* var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000));
* var firstOrder = higherOrder.mergeAll();
* firstOrder.subscribe(x => console.log(x));
*
* @example <caption>Count from 0 to 9 every second for each click, but only allow 2 concurrent timers</caption>
* var clicks = Rx.Observable.fromEvent(document, 'click');
* var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000).take(10));
* var firstOrder = higherOrder.mergeAll(2);
* firstOrder.subscribe(x => console.log(x));
*
* @see {@link combineAll}
* @see {@link concatAll}
* @see {@link exhaust}
* @see {@link merge}
* @see {@link mergeMap}
* @see {@link mergeMapTo}
* @see {@link mergeScan}
* @see {@link switch}
* @see {@link zipAll}
*
* @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of inner
* Observables being subscribed to concurrently.
* @return {Observable} An Observable that emits values coming from all the
* inner Observables emitted by the source Observable.
* @method mergeAll
* @owner Observable
*/
function mergeAll(concurrent) {
if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
return mergeMap_1.mergeMap(identity_1.identity, null, concurrent);
}
exports.mergeAll = mergeAll;
//# sourceMappingURL=mergeAll.js.map
/***/ }),
/* 365 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.isArrayLike = (function (x) { return x && typeof x.length === 'number'; });
//# sourceMappingURL=isArrayLike.js.map
/***/ }),
/* 366 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function isPromise(value) {
return value && typeof value.subscribe !== 'function' && typeof value.then === 'function';
}
exports.isPromise = isPromise;
//# sourceMappingURL=isPromise.js.map
/***/ }),
/* 367 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var root_1 = __webpack_require__(32);
function symbolIteratorPonyfill(root) {
var Symbol = root.Symbol;
if (typeof Symbol === 'function') {
if (!Symbol.iterator) {
Symbol.iterator = Symbol('iterator polyfill');
}
return Symbol.iterator;
}
else {
// [for Mozilla Gecko 27-35:](https://mzl.la/2ewE1zC)
var Set_1 = root.Set;
if (Set_1 && typeof new Set_1()['@@iterator'] === 'function') {
return '@@iterator';
}
var Map_1 = root.Map;
// required for compatability with es6-shim
if (Map_1) {
var keys = Object.getOwnPropertyNames(Map_1.prototype);
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
// according to spec, Map.prototype[@@iterator] and Map.orototype.entries must be equal.
if (key !== 'entries' && key !== 'size' && Map_1.prototype[key] === Map_1.prototype['entries']) {
return key;
}
}
}
return '@@iterator';
}
}
exports.symbolIteratorPonyfill = symbolIteratorPonyfill;
exports.iterator = symbolIteratorPonyfill(root_1.root);
/**
* @deprecated use iterator instead
*/
exports.$$iterator = exports.iterator;
//# sourceMappingURL=iterator.js.map
/***/ }),
/* 368 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Subscriber_1 = __webpack_require__(25);
/**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
var InnerSubscriber = (function (_super) {
__extends(InnerSubscriber, _super);
function InnerSubscriber(parent, outerValue, outerIndex) {
_super.call(this);
this.parent = parent;
this.outerValue = outerValue;
this.outerIndex = outerIndex;
this.index = 0;
}
InnerSubscriber.prototype._next = function (value) {
this.parent.notifyNext(this.outerValue, value, this.outerIndex, this.index++, this);
};
InnerSubscriber.prototype._error = function (error) {
this.parent.notifyError(error, this);
this.unsubscribe();
};
InnerSubscriber.prototype._complete = function () {
this.parent.notifyComplete(this);
this.unsubscribe();
};
return InnerSubscriber;
}(Subscriber_1.Subscriber));
exports.InnerSubscriber = InnerSubscriber;
//# sourceMappingURL=InnerSubscriber.js.map
/***/ }),
/* 369 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function identity(x) {
return x;
}
exports.identity = identity;
//# sourceMappingURL=identity.js.map
/***/ }),
/* 370 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var share_1 = __webpack_require__(371);
/**
* Returns a new Observable that multicasts (shares) the original Observable. As long as there is at least one
* Subscriber this Observable will be subscribed and emitting data. When all subscribers have unsubscribed it will
* unsubscribe from the source Observable. Because the Observable is multicasting it makes the stream `hot`.
*
* This behaves similarly to .publish().refCount(), with a behavior difference when the source observable emits complete.
* .publish().refCount() will not resubscribe to the original source, however .share() will resubscribe to the original source.
* Observable.of("test").publish().refCount() will not re-emit "test" on new subscriptions, Observable.of("test").share() will
* re-emit "test" to new subscriptions.
*
* <img src="./img/share.png" width="100%">
*
* @return {Observable<T>} An Observable that upon connection causes the source Observable to emit items to its Observers.
* @method share
* @owner Observable
*/
function share() {
return share_1.share()(this);
}
exports.share = share;
;
//# sourceMappingURL=share.js.map
/***/ }),
/* 371 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var multicast_1 = __webpack_require__(372);
var refCount_1 = __webpack_require__(132);
var Subject_1 = __webpack_require__(42);
function shareSubjectFactory() {
return new Subject_1.Subject();
}
/**
* Returns a new Observable that multicasts (shares) the original Observable. As long as there is at least one
* Subscriber this Observable will be subscribed and emitting data. When all subscribers have unsubscribed it will
* unsubscribe from the source Observable. Because the Observable is multicasting it makes the stream `hot`.
* This is an alias for .multicast(() => new Subject()).refCount().
*
* <img src="./img/share.png" width="100%">
*
* @return {Observable<T>} An Observable that upon connection causes the source Observable to emit items to its Observers.
* @method share
* @owner Observable
*/
function share() {
return function (source) { return refCount_1.refCount()(multicast_1.multicast(shareSubjectFactory)(source)); };
}
exports.share = share;
;
//# sourceMappingURL=share.js.map
/***/ }),
/* 372 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var ConnectableObservable_1 = __webpack_require__(373);
/* tslint:enable:max-line-length */
/**
* Returns an Observable that emits the results of invoking a specified selector on items
* emitted by a ConnectableObservable that shares a single subscription to the underlying stream.
*
* <img src="./img/multicast.png" width="100%">
*
* @param {Function|Subject} subjectOrSubjectFactory - Factory function to create an intermediate subject through
* which the source sequence's elements will be multicast to the selector function
* or Subject to push source elements into.
* @param {Function} [selector] - Optional selector function that can use the multicasted source stream
* as many times as needed, without causing multiple subscriptions to the source stream.
* Subscribers to the given source will receive all notifications of the source from the
* time of the subscription forward.
* @return {Observable} An Observable that emits the results of invoking the selector
* on the items emitted by a `ConnectableObservable` that shares a single subscription to
* the underlying stream.
* @method multicast
* @owner Observable
*/
function multicast(subjectOrSubjectFactory, selector) {
return function multicastOperatorFunction(source) {
var subjectFactory;
if (typeof subjectOrSubjectFactory === 'function') {
subjectFactory = subjectOrSubjectFactory;
}
else {
subjectFactory = function subjectFactory() {
return subjectOrSubjectFactory;
};
}
if (typeof selector === 'function') {
return source.lift(new MulticastOperator(subjectFactory, selector));
}
var connectable = Object.create(source, ConnectableObservable_1.connectableObservableDescriptor);
connectable.source = source;
connectable.subjectFactory = subjectFactory;
return connectable;
};
}
exports.multicast = multicast;
var MulticastOperator = (function () {
function MulticastOperator(subjectFactory, selector) {
this.subjectFactory = subjectFactory;
this.selector = selector;
}
MulticastOperator.prototype.call = function (subscriber, source) {
var selector = this.selector;
var subject = this.subjectFactory();
var subscription = selector(subject).subscribe(subscriber);
subscription.add(source.subscribe(subject));
return subscription;
};
return MulticastOperator;
}());
exports.MulticastOperator = MulticastOperator;
//# sourceMappingURL=multicast.js.map
/***/ }),
/* 373 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Subject_1 = __webpack_require__(42);
var Observable_1 = __webpack_require__(9);
var Subscriber_1 = __webpack_require__(25);
var Subscription_1 = __webpack_require__(39);
var refCount_1 = __webpack_require__(132);
/**
* @class ConnectableObservable<T>
*/
var ConnectableObservable = (function (_super) {
__extends(ConnectableObservable, _super);
function ConnectableObservable(source, subjectFactory) {
_super.call(this);
this.source = source;
this.subjectFactory = subjectFactory;
this._refCount = 0;
this._isComplete = false;
}
ConnectableObservable.prototype._subscribe = function (subscriber) {
return this.getSubject().subscribe(subscriber);
};
ConnectableObservable.prototype.getSubject = function () {
var subject = this._subject;
if (!subject || subject.isStopped) {
this._subject = this.subjectFactory();
}
return this._subject;
};
ConnectableObservable.prototype.connect = function () {
var connection = this._connection;
if (!connection) {
this._isComplete = false;
connection = this._connection = new Subscription_1.Subscription();
connection.add(this.source
.subscribe(new ConnectableSubscriber(this.getSubject(), this)));
if (connection.closed) {
this._connection = null;
connection = Subscription_1.Subscription.EMPTY;
}
else {
this._connection = connection;
}
}
return connection;
};
ConnectableObservable.prototype.refCount = function () {
return refCount_1.refCount()(this);
};
return ConnectableObservable;
}(Observable_1.Observable));
exports.ConnectableObservable = ConnectableObservable;
var connectableProto = ConnectableObservable.prototype;
exports.connectableObservableDescriptor = {
operator: { value: null },
_refCount: { value: 0, writable: true },
_subject: { value: null, writable: true },
_connection: { value: null, writable: true },
_subscribe: { value: connectableProto._subscribe },
_isComplete: { value: connectableProto._isComplete, writable: true },
getSubject: { value: connectableProto.getSubject },
connect: { value: connectableProto.connect },
refCount: { value: connectableProto.refCount }
};
var ConnectableSubscriber = (function (_super) {
__extends(ConnectableSubscriber, _super);
function ConnectableSubscriber(destination, connectable) {
_super.call(this, destination);
this.connectable = connectable;
}
ConnectableSubscriber.prototype._error = function (err) {
this._unsubscribe();
_super.prototype._error.call(this, err);
};
ConnectableSubscriber.prototype._complete = function () {
this.connectable._isComplete = true;
this._unsubscribe();
_super.prototype._complete.call(this);
};
ConnectableSubscriber.prototype._unsubscribe = function () {
var connectable = this.connectable;
if (connectable) {
this.connectable = null;
var connection = connectable._connection;
connectable._refCount = 0;
connectable._subject = null;
connectable._connection = null;
if (connection) {
connection.unsubscribe();
}
}
};
return ConnectableSubscriber;
}(Subject_1.SubjectSubscriber));
var RefCountOperator = (function () {
function RefCountOperator(connectable) {
this.connectable = connectable;
}
RefCountOperator.prototype.call = function (subscriber, source) {
var connectable = this.connectable;
connectable._refCount++;
var refCounter = new RefCountSubscriber(subscriber, connectable);
var subscription = source.subscribe(refCounter);
if (!refCounter.closed) {
refCounter.connection = connectable.connect();
}
return subscription;
};
return RefCountOperator;
}());
var RefCountSubscriber = (function (_super) {
__extends(RefCountSubscriber, _super);
function RefCountSubscriber(destination, connectable) {
_super.call(this, destination);
this.connectable = connectable;
}
RefCountSubscriber.prototype._unsubscribe = function () {
var connectable = this.connectable;
if (!connectable) {
this.connection = null;
return;
}
this.connectable = null;
var refCount = connectable._refCount;
if (refCount <= 0) {
this.connection = null;
return;
}
connectable._refCount = refCount - 1;
if (refCount > 1) {
this.connection = null;
return;
}
///
// Compare the local RefCountSubscriber's connection Subscription to the
// connection Subscription on the shared ConnectableObservable. In cases
// where the ConnectableObservable source synchronously emits values, and
// the RefCountSubscriber's downstream Observers synchronously unsubscribe,
// execution continues to here before the RefCountOperator has a chance to
// supply the RefCountSubscriber with the shared connection Subscription.
// For example:
// ```
// Observable.range(0, 10)
// .publish()
// .refCount()
// .take(5)
// .subscribe();
// ```
// In order to account for this case, RefCountSubscriber should only dispose
// the ConnectableObservable's shared connection Subscription if the
// connection Subscription exists, *and* either:
// a. RefCountSubscriber doesn't have a reference to the shared connection
// Subscription yet, or,
// b. RefCountSubscriber's connection Subscription reference is identical
// to the shared connection Subscription
///
var connection = this.connection;
var sharedConnection = connectable._connection;
this.connection = null;
if (sharedConnection && (!connection || sharedConnection === connection)) {
sharedConnection.unsubscribe();
}
};
return RefCountSubscriber;
}(Subscriber_1.Subscriber));
//# sourceMappingURL=ConnectableObservable.js.map
/***/ }),
/* 374 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
/**
* An error thrown when an action is invalid because the object has been
* unsubscribed.
*
* @see {@link Subject}
* @see {@link BehaviorSubject}
*
* @class ObjectUnsubscribedError
*/
var ObjectUnsubscribedError = (function (_super) {
__extends(ObjectUnsubscribedError, _super);
function ObjectUnsubscribedError() {
var err = _super.call(this, 'object unsubscribed');
this.name = err.name = 'ObjectUnsubscribedError';
this.stack = err.stack;
this.message = err.message;
}
return ObjectUnsubscribedError;
}(Error));
exports.ObjectUnsubscribedError = ObjectUnsubscribedError;
//# sourceMappingURL=ObjectUnsubscribedError.js.map
/***/ }),
/* 375 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Subscription_1 = __webpack_require__(39);
/**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
var SubjectSubscription = (function (_super) {
__extends(SubjectSubscription, _super);
function SubjectSubscription(subject, subscriber) {
_super.call(this);
this.subject = subject;
this.subscriber = subscriber;
this.closed = false;
}
SubjectSubscription.prototype.unsubscribe = function () {
if (this.closed) {
return;
}
this.closed = true;
var subject = this.subject;
var observers = subject.observers;
this.subject = null;
if (!observers || observers.length === 0 || subject.isStopped || subject.closed) {
return;
}
var subscriberIndex = observers.indexOf(this.subscriber);
if (subscriberIndex !== -1) {
observers.splice(subscriberIndex, 1);
}
};
return SubjectSubscription;
}(Subscription_1.Subscription));
exports.SubjectSubscription = SubjectSubscription;
//# sourceMappingURL=SubjectSubscription.js.map
/***/ }),
/* 376 */,
/* 377 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var ForkJoinObservable_1 = __webpack_require__(378);
exports.forkJoin = ForkJoinObservable_1.ForkJoinObservable.create;
//# sourceMappingURL=forkJoin.js.map
/***/ }),
/* 378 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Observable_1 = __webpack_require__(9);
var EmptyObservable_1 = __webpack_require__(129);
var isArray_1 = __webpack_require__(70);
var subscribeToResult_1 = __webpack_require__(73);
var OuterSubscriber_1 = __webpack_require__(74);
/**
* We need this JSDoc comment for affecting ESDoc.
* @extends {Ignored}
* @hide true
*/
var ForkJoinObservable = (function (_super) {
__extends(ForkJoinObservable, _super);
function ForkJoinObservable(sources, resultSelector) {
_super.call(this);
this.sources = sources;
this.resultSelector = resultSelector;
}
/* tslint:enable:max-line-length */
/**
* Joins last values emitted by passed Observables.
*
* <span class="informal">Wait for Observables to complete and then combine last values they emitted.</span>
*
* <img src="./img/forkJoin.png" width="100%">
*
* `forkJoin` is an operator that takes any number of Observables which can be passed either as an array
* or directly as arguments. If no input Observables are provided, resulting stream will complete
* immediately.
*
* `forkJoin` will wait for all passed Observables to complete and then it will emit an array with last
* values from corresponding Observables. So if you pass `n` Observables to the operator, resulting
* array will have `n` values, where first value is the last thing emitted by the first Observable,
* second value is the last thing emitted by the second Observable and so on. That means `forkJoin` will
* not emit more than once and it will complete after that. If you need to emit combined values not only
* at the end of lifecycle of passed Observables, but also throughout it, try out {@link combineLatest}
* or {@link zip} instead.
*
* In order for resulting array to have the same length as the number of input Observables, whenever any of
* that Observables completes without emitting any value, `forkJoin` will complete at that moment as well
* and it will not emit anything either, even if it already has some last values from other Observables.
* Conversely, if there is an Observable that never completes, `forkJoin` will never complete as well,
* unless at any point some other Observable completes without emitting value, which brings us back to
* the previous case. Overall, in order for `forkJoin` to emit a value, all Observables passed as arguments
* have to emit something at least once and complete.
*
* If any input Observable errors at some point, `forkJoin` will error as well and all other Observables
* will be immediately unsubscribed.
*
* Optionally `forkJoin` accepts project function, that will be called with values which normally
* would land in emitted array. Whatever is returned by project function, will appear in output
* Observable instead. This means that default project can be thought of as a function that takes
* all its arguments and puts them into an array. Note that project function will be called only
* when output Observable is supposed to emit a result.
*
* @example <caption>Use forkJoin with operator emitting immediately</caption>
* const observable = Rx.Observable.forkJoin(
* Rx.Observable.of(1, 2, 3, 4),
* Rx.Observable.of(5, 6, 7, 8)
* );
* observable.subscribe(
* value => console.log(value),
* err => {},
* () => console.log('This is how it ends!')
* );
*
* // Logs:
* // [4, 8]
* // "This is how it ends!"
*
*
* @example <caption>Use forkJoin with operator emitting after some time</caption>
* const observable = Rx.Observable.forkJoin(
* Rx.Observable.interval(1000).take(3), // emit 0, 1, 2 every second and complete
* Rx.Observable.interval(500).take(4) // emit 0, 1, 2, 3 every half a second and complete
* );
* observable.subscribe(
* value => console.log(value),
* err => {},
* () => console.log('This is how it ends!')
* );
*
* // Logs:
* // [2, 3] after 3 seconds
* // "This is how it ends!" immediately after
*
*
* @example <caption>Use forkJoin with project function</caption>
* const observable = Rx.Observable.forkJoin(
* Rx.Observable.interval(1000).take(3), // emit 0, 1, 2 every second and complete
* Rx.Observable.interval(500).take(4), // emit 0, 1, 2, 3 every half a second and complete
* (n, m) => n + m
* );
* observable.subscribe(
* value => console.log(value),
* err => {},
* () => console.log('This is how it ends!')
* );
*
* // Logs:
* // 5 after 3 seconds
* // "This is how it ends!" immediately after
*
* @see {@link combineLatest}
* @see {@link zip}
*
* @param {...SubscribableOrPromise} sources Any number of Observables provided either as an array or as an arguments
* passed directly to the operator.
* @param {function} [project] Function that takes values emitted by input Observables and returns value
* that will appear in resulting Observable instead of default array.
* @return {Observable} Observable emitting either an array of last values emitted by passed Observables
* or value from project function.
* @static true
* @name forkJoin
* @owner Observable
*/
ForkJoinObservable.create = function () {
var sources = [];
for (var _i = 0; _i < arguments.length; _i++) {
sources[_i - 0] = arguments[_i];
}
if (sources === null || arguments.length === 0) {
return new EmptyObservable_1.EmptyObservable();
}
var resultSelector = null;
if (typeof sources[sources.length - 1] === 'function') {
resultSelector = sources.pop();
}
// if the first and only other argument besides the resultSelector is an array
// assume it's been called with `forkJoin([obs1, obs2, obs3], resultSelector)`
if (sources.length === 1 && isArray_1.isArray(sources[0])) {
sources = sources[0];
}
if (sources.length === 0) {
return new EmptyObservable_1.EmptyObservable();
}
return new ForkJoinObservable(sources, resultSelector);
};
ForkJoinObservable.prototype._subscribe = function (subscriber) {
return new ForkJoinSubscriber(subscriber, this.sources, this.resultSelector);
};
return ForkJoinObservable;
}(Observable_1.Observable));
exports.ForkJoinObservable = ForkJoinObservable;
/**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
var ForkJoinSubscriber = (function (_super) {
__extends(ForkJoinSubscriber, _super);
function ForkJoinSubscriber(destination, sources, resultSelector) {
_super.call(this, destination);
this.sources = sources;
this.resultSelector = resultSelector;
this.completed = 0;
this.haveValues = 0;
var len = sources.length;
this.total = len;
this.values = new Array(len);
for (var i = 0; i < len; i++) {
var source = sources[i];
var innerSubscription = subscribeToResult_1.subscribeToResult(this, source, null, i);
if (innerSubscription) {
innerSubscription.outerIndex = i;
this.add(innerSubscription);
}
}
}
ForkJoinSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
this.values[outerIndex] = innerValue;
if (!innerSub._hasValue) {
innerSub._hasValue = true;
this.haveValues++;
}
};
ForkJoinSubscriber.prototype.notifyComplete = function (innerSub) {
var destination = this.destination;
var _a = this, haveValues = _a.haveValues, resultSelector = _a.resultSelector, values = _a.values;
var len = values.length;
if (!innerSub._hasValue) {
destination.complete();
return;
}
this.completed++;
if (this.completed !== len) {
return;
}
if (haveValues === len) {
var value = resultSelector ? resultSelector.apply(this, values) : values;
destination.next(value);
}
destination.complete();
};
return ForkJoinSubscriber;
}(OuterSubscriber_1.OuterSubscriber));
//# sourceMappingURL=ForkJoinObservable.js.map
/***/ }),
/* 379 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var PromiseObservable_1 = __webpack_require__(380);
exports.fromPromise = PromiseObservable_1.PromiseObservable.create;
//# sourceMappingURL=fromPromise.js.map
/***/ }),
/* 380 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var root_1 = __webpack_require__(32);
var Observable_1 = __webpack_require__(9);
/**
* We need this JSDoc comment for affecting ESDoc.
* @extends {Ignored}
* @hide true
*/
var PromiseObservable = (function (_super) {
__extends(PromiseObservable, _super);
function PromiseObservable(promise, scheduler) {
_super.call(this);
this.promise = promise;
this.scheduler = scheduler;
}
/**
* Converts a Promise to an Observable.
*
* <span class="informal">Returns an Observable that just emits the Promise's
* resolved value, then completes.</span>
*
* Converts an ES2015 Promise or a Promises/A+ spec compliant Promise to an
* Observable. If the Promise resolves with a value, the output Observable
* emits that resolved value as a `next`, and then completes. If the Promise
* is rejected, then the output Observable emits the corresponding Error.
*
* @example <caption>Convert the Promise returned by Fetch to an Observable</caption>
* var result = Rx.Observable.fromPromise(fetch('http://myserver.com/'));
* result.subscribe(x => console.log(x), e => console.error(e));
*
* @see {@link bindCallback}
* @see {@link from}
*
* @param {PromiseLike<T>} promise The promise to be converted.
* @param {Scheduler} [scheduler] An optional IScheduler to use for scheduling
* the delivery of the resolved value (or the rejection).
* @return {Observable<T>} An Observable which wraps the Promise.
* @static true
* @name fromPromise
* @owner Observable
*/
PromiseObservable.create = function (promise, scheduler) {
return new PromiseObservable(promise, scheduler);
};
PromiseObservable.prototype._subscribe = function (subscriber) {
var _this = this;
var promise = this.promise;
var scheduler = this.scheduler;
if (scheduler == null) {
if (this._isScalar) {
if (!subscriber.closed) {
subscriber.next(this.value);
subscriber.complete();
}
}
else {
promise.then(function (value) {
_this.value = value;
_this._isScalar = true;
if (!subscriber.closed) {
subscriber.next(value);
subscriber.complete();
}
}, function (err) {
if (!subscriber.closed) {
subscriber.error(err);
}
})
.then(null, function (err) {
// escape the promise trap, throw unhandled errors
root_1.root.setTimeout(function () { throw err; });
});
}
}
else {
if (this._isScalar) {
if (!subscriber.closed) {
return scheduler.schedule(dispatchNext, 0, { value: this.value, subscriber: subscriber });
}
}
else {
promise.then(function (value) {
_this.value = value;
_this._isScalar = true;
if (!subscriber.closed) {
subscriber.add(scheduler.schedule(dispatchNext, 0, { value: value, subscriber: subscriber }));
}
}, function (err) {
if (!subscriber.closed) {
subscriber.add(scheduler.schedule(dispatchError, 0, { err: err, subscriber: subscriber }));
}
})
.then(null, function (err) {
// escape the promise trap, throw unhandled errors
root_1.root.setTimeout(function () { throw err; });
});
}
}
};
return PromiseObservable;
}(Observable_1.Observable));
exports.PromiseObservable = PromiseObservable;
function dispatchNext(arg) {
var value = arg.value, subscriber = arg.subscriber;
if (!subscriber.closed) {
subscriber.next(value);
subscriber.complete();
}
}
function dispatchError(arg) {
var err = arg.err, subscriber = arg.subscriber;
if (!subscriber.closed) {
subscriber.error(err);
}
}
//# sourceMappingURL=PromiseObservable.js.map
/***/ }),
/* 381 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Subscriber_1 = __webpack_require__(25);
/**
* Applies a given `project` function to each value emitted by the source
* Observable, and emits the resulting values as an Observable.
*
* <span class="informal">Like [Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map),
* it passes each source value through a transformation function to get
* corresponding output values.</span>
*
* <img src="./img/map.png" width="100%">
*
* Similar to the well known `Array.prototype.map` function, this operator
* applies a projection to each value and emits that projection in the output
* Observable.
*
* @example <caption>Map every click to the clientX position of that click</caption>
* var clicks = Rx.Observable.fromEvent(document, 'click');
* var positions = clicks.map(ev => ev.clientX);
* positions.subscribe(x => console.log(x));
*
* @see {@link mapTo}
* @see {@link pluck}
*
* @param {function(value: T, index: number): R} project The function to apply
* to each `value` emitted by the source Observable. The `index` parameter is
* the number `i` for the i-th emission that has happened since the
* subscription, starting from the number `0`.
* @param {any} [thisArg] An optional argument to define what `this` is in the
* `project` function.
* @return {Observable<R>} An Observable that emits the values from the source
* Observable transformed by the given `project` function.
* @method map
* @owner Observable
*/
function map(project, thisArg) {
return function mapOperation(source) {
if (typeof project !== 'function') {
throw new TypeError('argument is not a function. Are you looking for `mapTo()`?');
}
return source.lift(new MapOperator(project, thisArg));
};
}
exports.map = map;
var MapOperator = (function () {
function MapOperator(project, thisArg) {
this.project = project;
this.thisArg = thisArg;
}
MapOperator.prototype.call = function (subscriber, source) {
return source.subscribe(new MapSubscriber(subscriber, this.project, this.thisArg));
};
return MapOperator;
}());
exports.MapOperator = MapOperator;
/**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
var MapSubscriber = (function (_super) {
__extends(MapSubscriber, _super);
function MapSubscriber(destination, project, thisArg) {
_super.call(this, destination);
this.project = project;
this.count = 0;
this.thisArg = thisArg || this;
}
// NOTE: This looks unoptimized, but it's actually purposefully NOT
// using try/catch optimizations.
MapSubscriber.prototype._next = function (value) {
var result;
try {
result = this.project.call(this.thisArg, value, this.count++);
}
catch (err) {
this.destination.error(err);
return;
}
this.destination.next(result);
};
return MapSubscriber;
}(Subscriber_1.Subscriber));
//# sourceMappingURL=map.js.map
/***/ }),
/* 382 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return QueryParams; });
/**
* @hidden
*/
var QueryParams = (function () {
function QueryParams() {
this.data = {};
}
QueryParams.prototype.parseUrl = function (url) {
if (url) {
var startIndex = url.indexOf('?');
if (startIndex > -1) {
var queries = url.slice(startIndex + 1).split('&');
for (var i = 0; i < queries.length; i++) {
if (queries[i].indexOf('=') > 0) {
var split = queries[i].split('=');
if (split.length > 1) {
this.data[split[0].toLowerCase()] = split[1].split('#')[0];
}
}
}
}
}
};
QueryParams.prototype.get = function (key) {
return this.data[key.toLowerCase()];
};
return QueryParams;
}());
//# sourceMappingURL=query-params.js.map
/***/ }),
/* 383 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return IOSTransition; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__animations_animation__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__page_transition__ = __webpack_require__(40);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var DURATION = 500;
var EASING = 'cubic-bezier(0.36,0.66,0.04,1)';
var OPACITY = 'opacity';
var TRANSFORM = 'transform';
var TRANSLATEX = 'translateX';
var CENTER = '0%';
var OFF_OPACITY = 0.8;
var SHOW_BACK_BTN_CSS = 'show-back-button';
var IOSTransition = (function (_super) {
__extends(IOSTransition, _super);
function IOSTransition() {
return _super !== null && _super.apply(this, arguments) || this;
}
IOSTransition.prototype.init = function () {
_super.prototype.init.call(this);
var plt = this.plt;
var OFF_RIGHT = plt.isRTL ? '-99.5%' : '99.5%';
var OFF_LEFT = plt.isRTL ? '33%' : '-33%';
var enteringView = this.enteringView;
var leavingView = this.leavingView;
var opts = this.opts;
this.duration(Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["l" /* isPresent */])(opts.duration) ? opts.duration : DURATION);
this.easing(Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["l" /* isPresent */])(opts.easing) ? opts.easing : EASING);
var backDirection = (opts.direction === 'back');
var enteringHasNavbar = (enteringView && enteringView.hasNavbar());
var leavingHasNavbar = (leavingView && leavingView.hasNavbar());
if (enteringView) {
// get the native element for the entering page
var enteringPageEle = enteringView.pageRef().nativeElement;
// entering content
var enteringContent = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](plt, enteringView.contentRef());
enteringContent.element(enteringPageEle.querySelectorAll('ion-header > *:not(ion-navbar),ion-footer > *'));
this.add(enteringContent);
if (backDirection) {
// entering content, back direction
enteringContent
.fromTo(TRANSLATEX, OFF_LEFT, CENTER, true)
.fromTo(OPACITY, OFF_OPACITY, 1, true);
}
else {
// entering content, forward direction
enteringContent
.beforeClearStyles([OPACITY])
.fromTo(TRANSLATEX, OFF_RIGHT, CENTER, true);
}
if (enteringHasNavbar) {
// entering page has a navbar
var enteringNavbarEle = enteringPageEle.querySelector('ion-navbar');
var enteringNavBar = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](plt, enteringNavbarEle);
this.add(enteringNavBar);
var enteringTitle = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](plt, enteringNavbarEle.querySelector('ion-title'));
var enteringNavbarItems = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](plt, enteringNavbarEle.querySelectorAll('ion-buttons,[menuToggle]'));
var enteringNavbarBg = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](plt, enteringNavbarEle.querySelector('.toolbar-background'));
var enteringBackButton = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](plt, enteringNavbarEle.querySelector('.back-button'));
enteringNavBar
.add(enteringTitle)
.add(enteringNavbarItems)
.add(enteringNavbarBg)
.add(enteringBackButton);
enteringTitle.fromTo(OPACITY, 0.01, 1, true);
enteringNavbarItems.fromTo(OPACITY, 0.01, 1, true);
// set properties depending on direction
if (backDirection) {
// entering navbar, back direction
enteringTitle.fromTo(TRANSLATEX, OFF_LEFT, CENTER, true);
if (enteringView.enableBack()) {
// back direction, entering page has a back button
enteringBackButton
.beforeAddClass(SHOW_BACK_BTN_CSS)
.fromTo(OPACITY, 0.01, 1, true);
}
}
else {
// entering navbar, forward direction
enteringTitle.fromTo(TRANSLATEX, OFF_RIGHT, CENTER, true);
enteringNavbarBg
.beforeClearStyles([OPACITY])
.fromTo(TRANSLATEX, OFF_RIGHT, CENTER, true);
if (enteringView.enableBack()) {
// forward direction, entering page has a back button
enteringBackButton
.beforeAddClass(SHOW_BACK_BTN_CSS)
.fromTo(OPACITY, 0.01, 1, true);
var enteringBackBtnText = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](plt, enteringNavbarEle.querySelector('.back-button-text'));
enteringBackBtnText.fromTo(TRANSLATEX, (plt.isRTL ? '-100px' : '100px'), '0px');
enteringNavBar.add(enteringBackBtnText);
}
else {
enteringBackButton.beforeRemoveClass(SHOW_BACK_BTN_CSS);
}
}
}
}
// setup leaving view
if (leavingView && leavingView.pageRef()) {
// leaving content
var leavingPageEle = leavingView.pageRef().nativeElement;
var leavingContent = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](plt, leavingView.contentRef());
leavingContent.element(leavingPageEle.querySelectorAll('ion-header > *:not(ion-navbar),ion-footer > *'));
this.add(leavingContent);
if (backDirection) {
// leaving content, back direction
leavingContent
.beforeClearStyles([OPACITY])
.fromTo(TRANSLATEX, CENTER, (plt.isRTL ? '-100%' : '100%'));
}
else {
// leaving content, forward direction
leavingContent
.fromTo(TRANSLATEX, CENTER, OFF_LEFT)
.fromTo(OPACITY, 1, OFF_OPACITY)
.afterClearStyles([TRANSFORM, OPACITY]);
}
if (leavingHasNavbar) {
// leaving page has a navbar
var leavingNavbarEle = leavingPageEle.querySelector('ion-navbar');
var leavingNavBar = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](plt, leavingNavbarEle);
var leavingTitle = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](plt, leavingNavbarEle.querySelector('ion-title'));
var leavingNavbarItems = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](plt, leavingNavbarEle.querySelectorAll('ion-buttons,[menuToggle]'));
var leavingNavbarBg = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](plt, leavingNavbarEle.querySelector('.toolbar-background'));
var leavingBackButton = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](plt, leavingNavbarEle.querySelector('.back-button'));
leavingNavBar
.add(leavingTitle)
.add(leavingNavbarItems)
.add(leavingBackButton)
.add(leavingNavbarBg);
this.add(leavingNavBar);
// fade out leaving navbar items
leavingBackButton.fromTo(OPACITY, 0.99, 0);
leavingTitle.fromTo(OPACITY, 0.99, 0);
leavingNavbarItems.fromTo(OPACITY, 0.99, 0);
if (backDirection) {
// leaving navbar, back direction
leavingTitle.fromTo(TRANSLATEX, CENTER, (plt.isRTL ? '-100%' : '100%'));
// leaving navbar, back direction, and there's no entering navbar
// should just slide out, no fading out
leavingNavbarBg
.beforeClearStyles([OPACITY])
.fromTo(TRANSLATEX, CENTER, (plt.isRTL ? '-100%' : '100%'));
var leavingBackBtnText = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](plt, leavingNavbarEle.querySelector('.back-button-text'));
leavingBackBtnText.fromTo(TRANSLATEX, CENTER, (plt.isRTL ? -300 : 300) + 'px');
leavingNavBar.add(leavingBackBtnText);
}
else {
// leaving navbar, forward direction
leavingTitle
.fromTo(TRANSLATEX, CENTER, OFF_LEFT)
.afterClearStyles([TRANSFORM]);
leavingBackButton.afterClearStyles([OPACITY]);
leavingTitle.afterClearStyles([OPACITY]);
leavingNavbarItems.afterClearStyles([OPACITY]);
}
}
}
};
return IOSTransition;
}(__WEBPACK_IMPORTED_MODULE_2__page_transition__["a" /* PageTransition */]));
//# sourceMappingURL=transition-ios.js.map
/***/ }),
/* 384 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return MDTransition; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__animations_animation__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__page_transition__ = __webpack_require__(40);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var TRANSLATEY = 'translateY';
var OFF_BOTTOM = '40px';
var CENTER = '0px';
var SHOW_BACK_BTN_CSS = 'show-back-button';
var MDTransition = (function (_super) {
__extends(MDTransition, _super);
function MDTransition() {
return _super !== null && _super.apply(this, arguments) || this;
}
MDTransition.prototype.init = function () {
_super.prototype.init.call(this);
var plt = this.plt;
var enteringView = this.enteringView;
var leavingView = this.leavingView;
var opts = this.opts;
// what direction is the transition going
var backDirection = (opts.direction === 'back');
if (enteringView) {
if (backDirection) {
this.duration(Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["l" /* isPresent */])(opts.duration) ? opts.duration : 200).easing('cubic-bezier(0.47,0,0.745,0.715)');
}
else {
this.duration(Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["l" /* isPresent */])(opts.duration) ? opts.duration : 280).easing('cubic-bezier(0.36,0.66,0.04,1)');
this.enteringPage
.fromTo(TRANSLATEY, OFF_BOTTOM, CENTER, true)
.fromTo('opacity', 0.01, 1, true);
}
if (enteringView.hasNavbar()) {
var enteringPageEle = enteringView.pageRef().nativeElement;
var enteringNavbarEle = enteringPageEle.querySelector('ion-navbar');
var enteringNavBar = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](plt, enteringNavbarEle);
this.add(enteringNavBar);
var enteringBackButton = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](plt, enteringNavbarEle.querySelector('.back-button'));
this.add(enteringBackButton);
if (enteringView.enableBack()) {
enteringBackButton.beforeAddClass(SHOW_BACK_BTN_CSS);
}
else {
enteringBackButton.beforeRemoveClass(SHOW_BACK_BTN_CSS);
}
}
}
// setup leaving view
if (leavingView && backDirection) {
// leaving content
this.duration(opts.duration || 200).easing('cubic-bezier(0.47,0,0.745,0.715)');
var leavingPage = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](plt, leavingView.pageRef());
this.add(leavingPage.fromTo(TRANSLATEY, CENTER, OFF_BOTTOM).fromTo('opacity', 1, 0));
}
};
return MDTransition;
}(__WEBPACK_IMPORTED_MODULE_2__page_transition__["a" /* PageTransition */]));
//# sourceMappingURL=transition-md.js.map
/***/ }),
/* 385 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return WPTransition; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__animations_animation__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__page_transition__ = __webpack_require__(40);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var SHOW_BACK_BTN_CSS = 'show-back-button';
var SCALE_SMALL = .95;
var WPTransition = (function (_super) {
__extends(WPTransition, _super);
function WPTransition() {
return _super !== null && _super.apply(this, arguments) || this;
}
WPTransition.prototype.init = function () {
_super.prototype.init.call(this);
var plt = this.plt;
var enteringView = this.enteringView;
var leavingView = this.leavingView;
var opts = this.opts;
// what direction is the transition going
var backDirection = (opts.direction === 'back');
if (enteringView) {
if (backDirection) {
this.duration(Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["l" /* isPresent */])(opts.duration) ? opts.duration : 120).easing('cubic-bezier(0.47,0,0.745,0.715)');
this.enteringPage.beforeClearStyles(['scale']);
}
else {
this.duration(Object(__WEBPACK_IMPORTED_MODULE_1__util_util__["l" /* isPresent */])(opts.duration) ? opts.duration : 280).easing('cubic-bezier(0,0,0.05,1)');
this.enteringPage
.fromTo('scale', SCALE_SMALL, 1, true)
.fromTo('opacity', 0.01, 1, true);
}
if (enteringView.hasNavbar()) {
var enteringPageEle = enteringView.pageRef().nativeElement;
var enteringNavbarEle = enteringPageEle.querySelector('ion-navbar');
var enteringNavBar = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](plt, enteringNavbarEle);
this.add(enteringNavBar);
var enteringBackButton = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](plt, enteringNavbarEle.querySelector('.back-button'));
this.add(enteringBackButton);
if (enteringView.enableBack()) {
enteringBackButton.beforeAddClass(SHOW_BACK_BTN_CSS);
}
else {
enteringBackButton.beforeRemoveClass(SHOW_BACK_BTN_CSS);
}
}
}
// setup leaving view
if (leavingView && backDirection) {
// leaving content
this.duration(opts.duration || 200).easing('cubic-bezier(0.47,0,0.745,0.715)');
var leavingPage = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](plt, leavingView.pageRef());
this.add(leavingPage.fromTo('scale', 1, SCALE_SMALL).fromTo('opacity', 0.99, 0));
}
};
return WPTransition;
}(__WEBPACK_IMPORTED_MODULE_2__page_transition__["a" /* PageTransition */]));
//# sourceMappingURL=transition-wp.js.map
/***/ }),
/* 386 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SwipeBackGesture; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__gestures_gesture_controller__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__gestures_slide_edge_gesture__ = __webpack_require__(76);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
*/
var SwipeBackGesture = (function (_super) {
__extends(SwipeBackGesture, _super);
function SwipeBackGesture(plt, _nav, gestureCtlr, domCtrl) {
var _this = _super.call(this, plt, plt.doc().body, {
direction: 'x',
edge: 'start',
maxEdgeStart: 75,
threshold: 5,
zone: false,
domController: domCtrl,
gesture: gestureCtlr.createGesture({
name: __WEBPACK_IMPORTED_MODULE_1__gestures_gesture_controller__["b" /* GESTURE_GO_BACK_SWIPE */],
priority: __WEBPACK_IMPORTED_MODULE_1__gestures_gesture_controller__["e" /* GESTURE_PRIORITY_GO_BACK_SWIPE */],
disableScroll: true
})
}) || this;
_this._nav = _nav;
return _this;
}
SwipeBackGesture.prototype.canStart = function (ev) {
// the gesture swipe angle must be mainly horizontal and the
// gesture distance would be relatively short for a swipe back
// and swipe back must be possible on this nav controller
return (this._nav.canSwipeBack() &&
_super.prototype.canStart.call(this, ev));
};
SwipeBackGesture.prototype.onSlideBeforeStart = function (_ev) {
this._nav.swipeBackStart();
};
SwipeBackGesture.prototype.onSlide = function (slide, ev) {
ev.preventDefault();
ev.stopPropagation();
var stepValue = (slide.distance / slide.max);
this._nav.swipeBackProgress(stepValue);
};
SwipeBackGesture.prototype.onSlideEnd = function (slide, _ev) {
var velocity = slide.velocity;
var currentStepValue = (slide.distance / slide.max);
var isResetDirecction = velocity < 0;
var isMovingFast = Math.abs(slide.velocity) > 0.4;
var isInResetZone = Math.abs(slide.delta) < Math.abs(slide.max) * 0.5;
var shouldComplete = !Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["t" /* swipeShouldReset */])(isResetDirecction, isMovingFast, isInResetZone);
this._nav.swipeBackEnd(shouldComplete, currentStepValue, velocity);
};
return SwipeBackGesture;
}(__WEBPACK_IMPORTED_MODULE_2__gestures_slide_edge_gesture__["a" /* SlideEdgeGesture */]));
//# sourceMappingURL=swipe-back.js.map
/***/ }),
/* 387 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PanRecognizer; });
var PanRecognizer = (function () {
function PanRecognizer(direction, threshold, maxAngle) {
this.direction = direction;
this.dirty = false;
this._angle = 0;
this._isPan = 0;
var radians = maxAngle * (Math.PI / 180);
this.maxCosine = Math.cos(radians);
this.threshold = threshold * threshold;
}
PanRecognizer.prototype.start = function (coord) {
this.startCoord = coord;
this._angle = 0;
this._isPan = 0;
this.dirty = true;
};
PanRecognizer.prototype.detect = function (coord) {
if (!this.dirty) {
return false;
}
var deltaX = (coord.x - this.startCoord.x);
var deltaY = (coord.y - this.startCoord.y);
var distance = deltaX * deltaX + deltaY * deltaY;
if (distance >= this.threshold) {
var angle = Math.atan2(deltaY, deltaX);
var cosine = (this.direction === 'y')
? Math.sin(angle)
: Math.cos(angle);
this._angle = angle;
if (cosine > this.maxCosine) {
this._isPan = 1;
}
else if (cosine < -this.maxCosine) {
this._isPan = -1;
}
else {
this._isPan = 0;
}
this.dirty = false;
return true;
}
return false;
};
PanRecognizer.prototype.angle = function () {
return this._angle;
};
PanRecognizer.prototype.pan = function () {
return this._isPan;
};
return PanRecognizer;
}());
//# sourceMappingURL=recognizers.js.map
/***/ }),
/* 388 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ActionSheetSlideIn; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return ActionSheetSlideOut; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ActionSheetMdSlideIn; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ActionSheetMdSlideOut; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return ActionSheetWpSlideIn; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return ActionSheetWpSlideOut; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__animations_animation__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__transitions_transition__ = __webpack_require__(35);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var ActionSheetSlideIn = (function (_super) {
__extends(ActionSheetSlideIn, _super);
function ActionSheetSlideIn() {
return _super !== null && _super.apply(this, arguments) || this;
}
ActionSheetSlideIn.prototype.init = function () {
var ele = this.enteringView.pageRef().nativeElement;
var backdrop = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('ion-backdrop'));
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.action-sheet-wrapper'));
backdrop.fromTo('opacity', 0.01, 0.4);
wrapper.fromTo('translateY', '100%', '0%');
this.easing('cubic-bezier(.36,.66,.04,1)').duration(400).add(backdrop).add(wrapper);
};
return ActionSheetSlideIn;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_transition__["a" /* Transition */]));
var ActionSheetSlideOut = (function (_super) {
__extends(ActionSheetSlideOut, _super);
function ActionSheetSlideOut() {
return _super !== null && _super.apply(this, arguments) || this;
}
ActionSheetSlideOut.prototype.init = function () {
var ele = this.leavingView.pageRef().nativeElement;
var backdrop = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('ion-backdrop'));
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.action-sheet-wrapper'));
backdrop.fromTo('opacity', 0.4, 0);
wrapper.fromTo('translateY', '0%', '100%');
this.easing('cubic-bezier(.36,.66,.04,1)').duration(300).add(backdrop).add(wrapper);
};
return ActionSheetSlideOut;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_transition__["a" /* Transition */]));
var ActionSheetMdSlideIn = (function (_super) {
__extends(ActionSheetMdSlideIn, _super);
function ActionSheetMdSlideIn() {
return _super !== null && _super.apply(this, arguments) || this;
}
ActionSheetMdSlideIn.prototype.init = function () {
var ele = this.enteringView.pageRef().nativeElement;
var backdrop = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('ion-backdrop'));
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.action-sheet-wrapper'));
backdrop.fromTo('opacity', 0.01, 0.26);
wrapper.fromTo('translateY', '100%', '0%');
this.easing('cubic-bezier(.36,.66,.04,1)').duration(400).add(backdrop).add(wrapper);
};
return ActionSheetMdSlideIn;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_transition__["a" /* Transition */]));
var ActionSheetMdSlideOut = (function (_super) {
__extends(ActionSheetMdSlideOut, _super);
function ActionSheetMdSlideOut() {
return _super !== null && _super.apply(this, arguments) || this;
}
ActionSheetMdSlideOut.prototype.init = function () {
var ele = this.leavingView.pageRef().nativeElement;
var backdrop = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('ion-backdrop'));
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.action-sheet-wrapper'));
backdrop.fromTo('opacity', 0.26, 0);
wrapper.fromTo('translateY', '0%', '100%');
this.easing('cubic-bezier(.36,.66,.04,1)').duration(450).add(backdrop).add(wrapper);
};
return ActionSheetMdSlideOut;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_transition__["a" /* Transition */]));
var ActionSheetWpSlideIn = (function (_super) {
__extends(ActionSheetWpSlideIn, _super);
function ActionSheetWpSlideIn() {
return _super !== null && _super.apply(this, arguments) || this;
}
ActionSheetWpSlideIn.prototype.init = function () {
var ele = this.enteringView.pageRef().nativeElement;
var backdrop = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('ion-backdrop'));
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.action-sheet-wrapper'));
backdrop.fromTo('opacity', 0.01, 0.16);
wrapper.fromTo('translateY', '100%', '0%');
this.easing('cubic-bezier(.36,.66,.04,1)').duration(400).add(backdrop).add(wrapper);
};
return ActionSheetWpSlideIn;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_transition__["a" /* Transition */]));
var ActionSheetWpSlideOut = (function (_super) {
__extends(ActionSheetWpSlideOut, _super);
function ActionSheetWpSlideOut() {
return _super !== null && _super.apply(this, arguments) || this;
}
ActionSheetWpSlideOut.prototype.init = function () {
var ele = this.leavingView.pageRef().nativeElement;
var backdrop = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('ion-backdrop'));
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.action-sheet-wrapper'));
backdrop.fromTo('opacity', 0.1, 0);
wrapper.fromTo('translateY', '0%', '100%');
this.easing('cubic-bezier(.36,.66,.04,1)').duration(450).add(backdrop).add(wrapper);
};
return ActionSheetWpSlideOut;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_transition__["a" /* Transition */]));
//# sourceMappingURL=action-sheet-transitions.js.map
/***/ }),
/* 389 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return AlertPopIn; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return AlertPopOut; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AlertMdPopIn; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return AlertMdPopOut; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return AlertWpPopIn; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return AlertWpPopOut; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__animations_animation__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__transitions_transition__ = __webpack_require__(35);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* Animations for alerts
*/
var AlertPopIn = (function (_super) {
__extends(AlertPopIn, _super);
function AlertPopIn() {
return _super !== null && _super.apply(this, arguments) || this;
}
AlertPopIn.prototype.init = function () {
var ele = this.enteringView.pageRef().nativeElement;
var backdrop = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('ion-backdrop'));
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.alert-wrapper'));
wrapper.fromTo('opacity', 0.01, 1).fromTo('scale', 1.1, 1);
backdrop.fromTo('opacity', 0.01, 0.3);
this
.easing('ease-in-out')
.duration(200)
.add(backdrop)
.add(wrapper);
};
return AlertPopIn;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_transition__["a" /* Transition */]));
var AlertPopOut = (function (_super) {
__extends(AlertPopOut, _super);
function AlertPopOut() {
return _super !== null && _super.apply(this, arguments) || this;
}
AlertPopOut.prototype.init = function () {
var ele = this.leavingView.pageRef().nativeElement;
var backdrop = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('ion-backdrop'));
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.alert-wrapper'));
wrapper.fromTo('opacity', 0.99, 0).fromTo('scale', 1, 0.9);
backdrop.fromTo('opacity', 0.3, 0);
this
.easing('ease-in-out')
.duration(200)
.add(backdrop)
.add(wrapper);
};
return AlertPopOut;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_transition__["a" /* Transition */]));
var AlertMdPopIn = (function (_super) {
__extends(AlertMdPopIn, _super);
function AlertMdPopIn() {
return _super !== null && _super.apply(this, arguments) || this;
}
AlertMdPopIn.prototype.init = function () {
var ele = this.enteringView.pageRef().nativeElement;
var backdrop = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('ion-backdrop'));
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.alert-wrapper'));
wrapper.fromTo('opacity', 0.01, 1).fromTo('scale', 1.1, 1);
backdrop.fromTo('opacity', 0.01, 0.5);
this
.easing('ease-in-out')
.duration(200)
.add(backdrop)
.add(wrapper);
};
return AlertMdPopIn;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_transition__["a" /* Transition */]));
var AlertMdPopOut = (function (_super) {
__extends(AlertMdPopOut, _super);
function AlertMdPopOut() {
return _super !== null && _super.apply(this, arguments) || this;
}
AlertMdPopOut.prototype.init = function () {
var ele = this.leavingView.pageRef().nativeElement;
var backdrop = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('ion-backdrop'));
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.alert-wrapper'));
wrapper.fromTo('opacity', 0.99, 0).fromTo('scale', 1, 0.9);
backdrop.fromTo('opacity', 0.5, 0);
this
.easing('ease-in-out')
.duration(200)
.add(backdrop)
.add(wrapper);
};
return AlertMdPopOut;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_transition__["a" /* Transition */]));
var AlertWpPopIn = (function (_super) {
__extends(AlertWpPopIn, _super);
function AlertWpPopIn() {
return _super !== null && _super.apply(this, arguments) || this;
}
AlertWpPopIn.prototype.init = function () {
var ele = this.enteringView.pageRef().nativeElement;
var backdrop = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('ion-backdrop'));
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.alert-wrapper'));
wrapper.fromTo('opacity', 0.01, 1).fromTo('scale', 1.3, 1);
backdrop.fromTo('opacity', 0.01, 0.5);
this
.easing('cubic-bezier(0,0,0.05,1)')
.duration(200)
.add(backdrop)
.add(wrapper);
};
return AlertWpPopIn;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_transition__["a" /* Transition */]));
var AlertWpPopOut = (function (_super) {
__extends(AlertWpPopOut, _super);
function AlertWpPopOut() {
return _super !== null && _super.apply(this, arguments) || this;
}
AlertWpPopOut.prototype.init = function () {
var ele = this.leavingView.pageRef().nativeElement;
var backdrop = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('ion-backdrop'));
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.alert-wrapper'));
wrapper.fromTo('opacity', 0.99, 0).fromTo('scale', 1, 1.3);
backdrop.fromTo('opacity', 0.5, 0);
this
.easing('ease-out')
.duration(150)
.add(backdrop)
.add(wrapper);
};
return AlertWpPopOut;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_transition__["a" /* Transition */]));
//# sourceMappingURL=alert-transitions.js.map
/***/ }),
/* 390 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ItemReorderGesture; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__item_reorder_util__ = __webpack_require__(149);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_dom__ = __webpack_require__(14);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__gestures_ui_event_manager__ = __webpack_require__(28);
/**
* @hidden
*/
var ItemReorderGesture = (function () {
function ItemReorderGesture(plt, reorderList) {
this.plt = plt;
this.reorderList = reorderList;
this.selectedItemEle = null;
this.events = new __WEBPACK_IMPORTED_MODULE_2__gestures_ui_event_manager__["a" /* UIEventManager */](plt);
this.events.pointerEvents({
element: this.reorderList.getNativeElement(),
pointerDown: this.onDragStart.bind(this),
pointerMove: this.onDragMove.bind(this),
pointerUp: this.onDragEnd.bind(this),
zone: false
});
}
ItemReorderGesture.prototype.onDragStart = function (ev) {
if (this.selectedItemEle) {
return false;
}
var reorderElement = ev.target;
if (reorderElement.nodeName !== 'ION-REORDER') {
return false;
}
var reorderMark = reorderElement['$ionComponent'];
if (!reorderMark) {
console.error('ion-reorder does not contain $ionComponent');
return false;
}
this.reorderList._reorderPrepare();
var item = reorderMark.getReorderNode();
if (!item) {
console.error('reorder node not found');
return false;
}
ev.preventDefault();
// Preparing state
this.selectedItemEle = item;
this.selectedItemHeight = item.offsetHeight;
this.lastYcoord = -100;
this.lastToIndex = Object(__WEBPACK_IMPORTED_MODULE_0__item_reorder_util__["b" /* indexForItem */])(item);
this.windowHeight = this.plt.height() - AUTO_SCROLL_MARGIN;
this.lastScrollPosition = this.reorderList._scrollContent(0);
this.offset = Object(__WEBPACK_IMPORTED_MODULE_1__util_dom__["f" /* pointerCoord */])(ev);
this.offset.y += this.lastScrollPosition;
item.classList.add(ITEM_REORDER_ACTIVE);
this.reorderList._reorderStart();
return true;
};
ItemReorderGesture.prototype.onDragMove = function (ev) {
var selectedItem = this.selectedItemEle;
if (!selectedItem) {
return;
}
ev.preventDefault();
// Get coordinate
var coord = Object(__WEBPACK_IMPORTED_MODULE_1__util_dom__["f" /* pointerCoord */])(ev);
var posY = coord.y;
// Scroll if we reach the scroll margins
var scrollPosition = this.scroll(posY);
// Only perform hit test if we moved at least 30px from previous position
if (Math.abs(posY - this.lastYcoord) > 30) {
var overItem = this.itemForCoord(coord);
if (overItem) {
var toIndex = Object(__WEBPACK_IMPORTED_MODULE_0__item_reorder_util__["b" /* indexForItem */])(overItem);
if (toIndex !== undefined && (toIndex !== this.lastToIndex || this.emptyZone)) {
var fromIndex = Object(__WEBPACK_IMPORTED_MODULE_0__item_reorder_util__["b" /* indexForItem */])(selectedItem);
this.lastToIndex = toIndex;
this.lastYcoord = posY;
this.emptyZone = false;
this.reorderList._reorderMove(fromIndex, toIndex, this.selectedItemHeight);
}
}
else {
this.emptyZone = true;
}
}
// Update selected item position
var ydiff = Math.round(posY - this.offset.y + scrollPosition);
selectedItem.style[this.plt.Css.transform] = "translateY(" + ydiff + "px)";
};
ItemReorderGesture.prototype.onDragEnd = function (ev) {
var _this = this;
var selectedItem = this.selectedItemEle;
if (!selectedItem) {
return;
}
if (ev) {
ev.preventDefault();
ev.stopPropagation();
}
var toIndex = this.lastToIndex;
var fromIndex = Object(__WEBPACK_IMPORTED_MODULE_0__item_reorder_util__["b" /* indexForItem */])(selectedItem);
var reorderInactive = function () {
_this.selectedItemEle.style.transition = '';
_this.selectedItemEle.classList.remove(ITEM_REORDER_ACTIVE);
_this.selectedItemEle = null;
};
if (toIndex === fromIndex) {
selectedItem.style.transition = 'transform 200ms ease-in-out';
setTimeout(reorderInactive, 200);
}
else {
reorderInactive();
}
this.reorderList._reorderEmit(fromIndex, toIndex);
};
ItemReorderGesture.prototype.itemForCoord = function (coord) {
var sideOffset = this.reorderList._isStart === this.plt.isRTL ? -100 : 100;
var x = this.offset.x + sideOffset;
var y = coord.y;
var element = this.plt.getElementFromPoint(x, y);
return Object(__WEBPACK_IMPORTED_MODULE_0__item_reorder_util__["a" /* findReorderItem */])(element, this.reorderList.getNativeElement());
};
ItemReorderGesture.prototype.scroll = function (posY) {
if (posY < AUTO_SCROLL_MARGIN) {
this.lastScrollPosition = this.reorderList._scrollContent(-SCROLL_JUMP);
}
else if (posY > this.windowHeight) {
this.lastScrollPosition = this.reorderList._scrollContent(SCROLL_JUMP);
}
return this.lastScrollPosition;
};
/**
* @hidden
*/
ItemReorderGesture.prototype.destroy = function () {
this.onDragEnd(null);
this.events.destroy();
this.events = null;
this.reorderList = null;
};
return ItemReorderGesture;
}());
var AUTO_SCROLL_MARGIN = 60;
var SCROLL_JUMP = 10;
var ITEM_REORDER_ACTIVE = 'reorder-active';
//# sourceMappingURL=item-reorder-gesture.js.map
/***/ }),
/* 391 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return PICKER_OPT_SELECTED; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DECELERATION_FRICTION; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return FRAME_MS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return MAX_PICKER_SPEED; });
var PICKER_OPT_SELECTED = 'picker-opt-selected';
var DECELERATION_FRICTION = 0.97;
var FRAME_MS = (1000 / 60);
var MAX_PICKER_SPEED = 60;
//# sourceMappingURL=picker-options.js.map
/***/ }),
/* 392 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PickerSlideIn; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return PickerSlideOut; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__animations_animation__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__transitions_transition__ = __webpack_require__(35);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* Animations for pickers
*/
var PickerSlideIn = (function (_super) {
__extends(PickerSlideIn, _super);
function PickerSlideIn() {
return _super !== null && _super.apply(this, arguments) || this;
}
PickerSlideIn.prototype.init = function () {
var ele = this.enteringView.pageRef().nativeElement;
var backdrop = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('ion-backdrop'));
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.picker-wrapper'));
backdrop.fromTo('opacity', 0.01, 0.26);
wrapper.fromTo('translateY', '100%', '0%');
this.easing('cubic-bezier(.36,.66,.04,1)').duration(400).add(backdrop).add(wrapper);
};
return PickerSlideIn;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_transition__["a" /* Transition */]));
var PickerSlideOut = (function (_super) {
__extends(PickerSlideOut, _super);
function PickerSlideOut() {
return _super !== null && _super.apply(this, arguments) || this;
}
PickerSlideOut.prototype.init = function () {
var ele = this.leavingView.pageRef().nativeElement;
var backdrop = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('ion-backdrop'));
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.picker-wrapper'));
backdrop.fromTo('opacity', 0.26, 0);
wrapper.fromTo('translateY', '0%', '100%');
this.easing('cubic-bezier(.36,.66,.04,1)').duration(450).add(backdrop).add(wrapper);
};
return PickerSlideOut;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_transition__["a" /* Transition */]));
//# sourceMappingURL=picker-transitions.js.map
/***/ }),
/* 393 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (immutable) */ __webpack_exports__["k"] = renderDateTime;
/* harmony export (immutable) */ __webpack_exports__["l"] = renderTextFormat;
/* harmony export (immutable) */ __webpack_exports__["f"] = dateValueRange;
/* harmony export (immutable) */ __webpack_exports__["e"] = dateSortValue;
/* harmony export (immutable) */ __webpack_exports__["d"] = dateDataSortValue;
/* harmony export (immutable) */ __webpack_exports__["g"] = daysInMonth;
/* unused harmony export isLeapYear */
/* harmony export (immutable) */ __webpack_exports__["i"] = parseDate;
/* harmony export (immutable) */ __webpack_exports__["a"] = compareDates;
/* harmony export (immutable) */ __webpack_exports__["m"] = updateDate;
/* harmony export (immutable) */ __webpack_exports__["j"] = parseTemplate;
/* harmony export (immutable) */ __webpack_exports__["h"] = getValueFromFormat;
/* harmony export (immutable) */ __webpack_exports__["c"] = convertFormatToKey;
/* harmony export (immutable) */ __webpack_exports__["b"] = convertDataToISO;
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util__ = __webpack_require__(3);
function renderDateTime(template, value, locale) {
if (Object(__WEBPACK_IMPORTED_MODULE_0__util__["f" /* isBlank */])(value)) {
return '';
}
var tokens = [];
var hasText = false;
FORMAT_KEYS.forEach(function (format, index) {
if (template.indexOf(format.f) > -1) {
var token = '{' + index + '}';
var text = renderTextFormat(format.f, value[format.k], value, locale);
if (!hasText && text && Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(value[format.k])) {
hasText = true;
}
tokens.push(token, text);
template = template.replace(format.f, token);
}
});
if (!hasText) {
return '';
}
for (var i = 0; i < tokens.length; i += 2) {
template = template.replace(tokens[i], tokens[i + 1]);
}
return template;
}
function renderTextFormat(format, value, date, locale) {
if (format === FORMAT_DDDD || format === FORMAT_DDD) {
try {
value = (new Date(date.year, date.month - 1, date.day)).getDay();
if (format === FORMAT_DDDD) {
return (Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(locale.dayNames) ? locale.dayNames : DAY_NAMES)[value];
}
return (Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(locale.dayShortNames) ? locale.dayShortNames : DAY_SHORT_NAMES)[value];
}
catch (e) { }
return '';
}
if (format === FORMAT_A) {
return date ? date.hour < 12 ? 'AM' : 'PM' : Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(value) ? value.toUpperCase() : '';
}
if (format === FORMAT_a) {
return date ? date.hour < 12 ? 'am' : 'pm' : Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(value) ? value : '';
}
if (Object(__WEBPACK_IMPORTED_MODULE_0__util__["f" /* isBlank */])(value)) {
return '';
}
if (format === FORMAT_YY || format === FORMAT_MM ||
format === FORMAT_DD || format === FORMAT_HH ||
format === FORMAT_mm || format === FORMAT_ss) {
return twoDigit(value);
}
if (format === FORMAT_YYYY) {
return fourDigit(value);
}
if (format === FORMAT_MMMM) {
return (Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(locale.monthNames) ? locale.monthNames : MONTH_NAMES)[value - 1];
}
if (format === FORMAT_MMM) {
return (Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(locale.monthShortNames) ? locale.monthShortNames : MONTH_SHORT_NAMES)[value - 1];
}
if (format === FORMAT_hh || format === FORMAT_h) {
if (value === 0) {
return '12';
}
if (value > 12) {
value -= 12;
}
if (format === FORMAT_hh && value < 10) {
return ('0' + value);
}
}
return value.toString();
}
function dateValueRange(format, min, max) {
var opts = [];
var i;
if (format === FORMAT_YYYY || format === FORMAT_YY) {
// year
i = max.year;
while (i >= min.year) {
opts.push(i--);
}
}
else if (format === FORMAT_MMMM || format === FORMAT_MMM ||
format === FORMAT_MM || format === FORMAT_M ||
format === FORMAT_hh || format === FORMAT_h) {
// month or 12-hour
for (i = 1; i < 13; i++) {
opts.push(i);
}
}
else if (format === FORMAT_DDDD || format === FORMAT_DDD ||
format === FORMAT_DD || format === FORMAT_D) {
// day
for (i = 1; i < 32; i++) {
opts.push(i);
}
}
else if (format === FORMAT_HH || format === FORMAT_H) {
// 24-hour
for (i = 0; i < 24; i++) {
opts.push(i);
}
}
else if (format === FORMAT_mm || format === FORMAT_m) {
// minutes
for (i = 0; i < 60; i++) {
opts.push(i);
}
}
else if (format === FORMAT_ss || format === FORMAT_s) {
// seconds
for (i = 0; i < 60; i++) {
opts.push(i);
}
}
else if (format === FORMAT_A || format === FORMAT_a) {
// AM/PM
opts.push('am', 'pm');
}
return opts;
}
function dateSortValue(year, month, day, hour, minute) {
if (hour === void 0) { hour = 0; }
if (minute === void 0) { minute = 0; }
return parseInt("1" + fourDigit(year) + twoDigit(month) + twoDigit(day) + twoDigit(hour) + twoDigit(minute), 10);
}
function dateDataSortValue(data) {
if (data) {
return dateSortValue(data.year, data.month, data.day, data.hour, data.minute);
}
return -1;
}
function daysInMonth(month, year) {
return (month === 4 || month === 6 || month === 9 || month === 11) ? 30 : (month === 2) ? isLeapYear(year) ? 29 : 28 : 31;
}
function isLeapYear(year) {
return (year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0);
}
var ISO_8601_REGEXP = /^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/;
var TIME_REGEXP = /^((\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/;
function parseDate(val) {
// manually parse IS0 cuz Date.parse cannot be trusted
// ISO 8601 format: 1994-12-15T13:47:20Z
var parse;
if (Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(val) && val !== '') {
// try parsing for just time first, HH:MM
parse = TIME_REGEXP.exec(val);
if (Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(parse)) {
// adjust the array so it fits nicely with the datetime parse
parse.unshift(undefined, undefined);
parse[2] = parse[3] = undefined;
}
else {
// try parsing for full ISO datetime
parse = ISO_8601_REGEXP.exec(val);
}
}
if (Object(__WEBPACK_IMPORTED_MODULE_0__util__["f" /* isBlank */])(parse)) {
// wasn't able to parse the ISO datetime
return null;
}
// ensure all the parse values exist with at least 0
for (var i = 1; i < 8; i++) {
parse[i] = (parse[i] !== undefined ? parseInt(parse[i], 10) : null);
}
var tzOffset = 0;
if (Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(parse[9]) && Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(parse[10])) {
// hours
tzOffset = parseInt(parse[10], 10) * 60;
if (Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(parse[11])) {
// minutes
tzOffset += parseInt(parse[11], 10);
}
if (parse[9] === '-') {
// + or -
tzOffset *= -1;
}
}
return {
year: parse[1],
month: parse[2],
day: parse[3],
hour: parse[4],
minute: parse[5],
second: parse[6],
millisecond: parse[7],
tzOffset: tzOffset,
};
}
function compareDates(d1, d2) {
var date1 = new Date(d1.year, d1.month, d1.day, d1.hour, d1.minute, d1.second);
var date2 = new Date(d2.year, d2.month, d2.day, d2.hour, d2.minute, d2.second);
return date1.getTime() - date2.getTime();
}
function updateDate(existingData, newData) {
if (Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(newData) && newData !== '') {
if (Object(__WEBPACK_IMPORTED_MODULE_0__util__["n" /* isString */])(newData)) {
// new date is a string, and hopefully in the ISO format
// convert it to our DateTimeData if a valid ISO
newData = parseDate(newData);
if (newData) {
// successfully parsed the ISO string to our DateTimeData
Object.assign(existingData, newData);
return true;
}
}
else if ((Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(newData.year) || Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(newData.hour) || Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(newData.month) || Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(newData.day) || Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(newData.minute) || Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(newData.second))) {
// newData is from of a datetime picker's selected values
// update the existing DateTimeData data with the new values
// do some magic for 12-hour values
if (Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(newData.ampm) && Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(newData.hour)) {
if (newData.ampm.value === 'pm') {
newData.hour.value = (newData.hour.value === 12 ? 12 : newData.hour.value + 12);
}
else {
newData.hour.value = (newData.hour.value === 12 ? 0 : newData.hour.value);
}
}
// merge new values from the picker's selection
// to the existing DateTimeData values
for (var k in newData) {
existingData[k] = newData[k].value;
}
return true;
}
// eww, invalid data
console.warn("Error parsing date: \"" + newData + "\". Please provide a valid ISO 8601 datetime format: https://www.w3.org/TR/NOTE-datetime");
}
else {
// blank data, clear everything out
for (var k in existingData) {
delete existingData[k];
}
}
return false;
}
function parseTemplate(template) {
var formats = [];
template = template.replace(/[^\w\s]/gi, ' ');
FORMAT_KEYS.forEach(function (format) {
if (format.f.length > 1 && template.indexOf(format.f) > -1 && template.indexOf(format.f + format.f.charAt(0)) < 0) {
template = template.replace(format.f, ' ' + format.f + ' ');
}
});
var words = template.split(' ').filter(function (w) { return w.length > 0; });
words.forEach(function (word, i) {
FORMAT_KEYS.forEach(function (format) {
if (word === format.f) {
if (word === FORMAT_A || word === FORMAT_a) {
// this format is an am/pm format, so it's an "a" or "A"
if ((formats.indexOf(FORMAT_h) < 0 && formats.indexOf(FORMAT_hh) < 0) ||
VALID_AMPM_PREFIX.indexOf(words[i - 1]) === -1) {
// template does not already have a 12-hour format
// or this am/pm format doesn't have a hour, minute, or second format immediately before it
// so do not treat this word "a" or "A" as the am/pm format
return;
}
}
formats.push(word);
}
});
});
return formats;
}
function getValueFromFormat(date, format) {
if (format === FORMAT_A || format === FORMAT_a) {
return (date.hour < 12 ? 'am' : 'pm');
}
if (format === FORMAT_hh || format === FORMAT_h) {
return (date.hour > 12 ? date.hour - 12 : date.hour);
}
return date[convertFormatToKey(format)];
}
function convertFormatToKey(format) {
for (var k in FORMAT_KEYS) {
if (FORMAT_KEYS[k].f === format) {
return FORMAT_KEYS[k].k;
}
}
return null;
}
function convertDataToISO(data) {
// https://www.w3.org/TR/NOTE-datetime
var rtn = '';
if (Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(data)) {
if (Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(data.year)) {
// YYYY
rtn = fourDigit(data.year);
if (Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(data.month)) {
// YYYY-MM
rtn += '-' + twoDigit(data.month);
if (Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(data.day)) {
// YYYY-MM-DD
rtn += '-' + twoDigit(data.day);
if (Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(data.hour)) {
// YYYY-MM-DDTHH:mm:SS
rtn += "T" + twoDigit(data.hour) + ":" + twoDigit(data.minute) + ":" + twoDigit(data.second);
if (data.millisecond > 0) {
// YYYY-MM-DDTHH:mm:SS.SSS
rtn += '.' + threeDigit(data.millisecond);
}
if (Object(__WEBPACK_IMPORTED_MODULE_0__util__["f" /* isBlank */])(data.tzOffset) || data.tzOffset === 0) {
// YYYY-MM-DDTHH:mm:SSZ
rtn += 'Z';
}
else {
// YYYY-MM-DDTHH:mm:SS+/-HH:mm
rtn += (data.tzOffset > 0 ? '+' : '-') + twoDigit(Math.floor(data.tzOffset / 60)) + ':' + twoDigit(data.tzOffset % 60);
}
}
}
}
}
else if (Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(data.hour)) {
// HH:mm
rtn = twoDigit(data.hour) + ':' + twoDigit(data.minute);
if (Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(data.second)) {
// HH:mm:SS
rtn += ':' + twoDigit(data.second);
if (Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(data.millisecond)) {
// HH:mm:SS.SSS
rtn += '.' + threeDigit(data.millisecond);
}
}
}
}
return rtn;
}
function twoDigit(val) {
return ('0' + (Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(val) ? Math.abs(val) : '0')).slice(-2);
}
function threeDigit(val) {
return ('00' + (Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(val) ? Math.abs(val) : '0')).slice(-3);
}
function fourDigit(val) {
return ('000' + (Object(__WEBPACK_IMPORTED_MODULE_0__util__["l" /* isPresent */])(val) ? Math.abs(val) : '0')).slice(-4);
}
var FORMAT_YYYY = 'YYYY';
var FORMAT_YY = 'YY';
var FORMAT_MMMM = 'MMMM';
var FORMAT_MMM = 'MMM';
var FORMAT_MM = 'MM';
var FORMAT_M = 'M';
var FORMAT_DDDD = 'DDDD';
var FORMAT_DDD = 'DDD';
var FORMAT_DD = 'DD';
var FORMAT_D = 'D';
var FORMAT_HH = 'HH';
var FORMAT_H = 'H';
var FORMAT_hh = 'hh';
var FORMAT_h = 'h';
var FORMAT_mm = 'mm';
var FORMAT_m = 'm';
var FORMAT_ss = 'ss';
var FORMAT_s = 's';
var FORMAT_A = 'A';
var FORMAT_a = 'a';
var FORMAT_KEYS = [
{ f: FORMAT_YYYY, k: 'year' },
{ f: FORMAT_MMMM, k: 'month' },
{ f: FORMAT_DDDD, k: 'day' },
{ f: FORMAT_MMM, k: 'month' },
{ f: FORMAT_DDD, k: 'day' },
{ f: FORMAT_YY, k: 'year' },
{ f: FORMAT_MM, k: 'month' },
{ f: FORMAT_DD, k: 'day' },
{ f: FORMAT_HH, k: 'hour' },
{ f: FORMAT_hh, k: 'hour' },
{ f: FORMAT_mm, k: 'minute' },
{ f: FORMAT_ss, k: 'second' },
{ f: FORMAT_M, k: 'month' },
{ f: FORMAT_D, k: 'day' },
{ f: FORMAT_H, k: 'hour' },
{ f: FORMAT_h, k: 'hour' },
{ f: FORMAT_m, k: 'minute' },
{ f: FORMAT_s, k: 'second' },
{ f: FORMAT_A, k: 'ampm' },
{ f: FORMAT_a, k: 'ampm' },
];
var DAY_NAMES = [
'Sunday',
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday',
];
var DAY_SHORT_NAMES = [
'Sun',
'Mon',
'Tue',
'Wed',
'Thu',
'Fri',
'Sat',
];
var MONTH_NAMES = [
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December',
];
var MONTH_SHORT_NAMES = [
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec',
];
var VALID_AMPM_PREFIX = [
FORMAT_hh, FORMAT_h, FORMAT_mm, FORMAT_m, FORMAT_ss, FORMAT_s
];
//# sourceMappingURL=datetime-util.js.map
/***/ }),
/* 394 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var takeUntil_1 = __webpack_require__(395);
/**
* Emits the values emitted by the source Observable until a `notifier`
* Observable emits a value.
*
* <span class="informal">Lets values pass until a second Observable,
* `notifier`, emits something. Then, it completes.</span>
*
* <img src="./img/takeUntil.png" width="100%">
*
* `takeUntil` subscribes and begins mirroring the source Observable. It also
* monitors a second Observable, `notifier` that you provide. If the `notifier`
* emits a value, the output Observable stops mirroring the source Observable
* and completes.
*
* @example <caption>Tick every second until the first click happens</caption>
* var interval = Rx.Observable.interval(1000);
* var clicks = Rx.Observable.fromEvent(document, 'click');
* var result = interval.takeUntil(clicks);
* result.subscribe(x => console.log(x));
*
* @see {@link take}
* @see {@link takeLast}
* @see {@link takeWhile}
* @see {@link skip}
*
* @param {Observable} notifier The Observable whose first emitted value will
* cause the output Observable of `takeUntil` to stop emitting values from the
* source Observable.
* @return {Observable<T>} An Observable that emits the values from the source
* Observable until such time as `notifier` emits its first value.
* @method takeUntil
* @owner Observable
*/
function takeUntil(notifier) {
return takeUntil_1.takeUntil(notifier)(this);
}
exports.takeUntil = takeUntil;
//# sourceMappingURL=takeUntil.js.map
/***/ }),
/* 395 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var OuterSubscriber_1 = __webpack_require__(74);
var subscribeToResult_1 = __webpack_require__(73);
/**
* Emits the values emitted by the source Observable until a `notifier`
* Observable emits a value.
*
* <span class="informal">Lets values pass until a second Observable,
* `notifier`, emits something. Then, it completes.</span>
*
* <img src="./img/takeUntil.png" width="100%">
*
* `takeUntil` subscribes and begins mirroring the source Observable. It also
* monitors a second Observable, `notifier` that you provide. If the `notifier`
* emits a value or a complete notification, the output Observable stops
* mirroring the source Observable and completes.
*
* @example <caption>Tick every second until the first click happens</caption>
* var interval = Rx.Observable.interval(1000);
* var clicks = Rx.Observable.fromEvent(document, 'click');
* var result = interval.takeUntil(clicks);
* result.subscribe(x => console.log(x));
*
* @see {@link take}
* @see {@link takeLast}
* @see {@link takeWhile}
* @see {@link skip}
*
* @param {Observable} notifier The Observable whose first emitted value will
* cause the output Observable of `takeUntil` to stop emitting values from the
* source Observable.
* @return {Observable<T>} An Observable that emits the values from the source
* Observable until such time as `notifier` emits its first value.
* @method takeUntil
* @owner Observable
*/
function takeUntil(notifier) {
return function (source) { return source.lift(new TakeUntilOperator(notifier)); };
}
exports.takeUntil = takeUntil;
var TakeUntilOperator = (function () {
function TakeUntilOperator(notifier) {
this.notifier = notifier;
}
TakeUntilOperator.prototype.call = function (subscriber, source) {
return source.subscribe(new TakeUntilSubscriber(subscriber, this.notifier));
};
return TakeUntilOperator;
}());
/**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
var TakeUntilSubscriber = (function (_super) {
__extends(TakeUntilSubscriber, _super);
function TakeUntilSubscriber(destination, notifier) {
_super.call(this, destination);
this.notifier = notifier;
this.add(subscribeToResult_1.subscribeToResult(this, notifier));
}
TakeUntilSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
this.complete();
};
TakeUntilSubscriber.prototype.notifyComplete = function () {
// noop
};
return TakeUntilSubscriber;
}(OuterSubscriber_1.OuterSubscriber));
//# sourceMappingURL=takeUntil.js.map
/***/ }),
/* 396 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ItemSlidingGesture; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__gestures_gesture_controller__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__gestures_pan_gesture__ = __webpack_require__(54);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_dom__ = __webpack_require__(14);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
*/
var ItemSlidingGesture = (function (_super) {
__extends(ItemSlidingGesture, _super);
function ItemSlidingGesture(plt, list, gestureCtrl, domCtrl) {
var _this = _super.call(this, plt, list.getNativeElement(), {
maxAngle: 20,
threshold: 5,
zone: false,
domController: domCtrl,
gesture: gestureCtrl.createGesture({
name: __WEBPACK_IMPORTED_MODULE_0__gestures_gesture_controller__["c" /* GESTURE_ITEM_SWIPE */],
priority: __WEBPACK_IMPORTED_MODULE_0__gestures_gesture_controller__["h" /* GESTURE_PRIORITY_SLIDING_ITEM */],
disableScroll: true
})
}) || this;
_this.list = list;
_this.preSelectedContainer = null;
_this.selectedContainer = null;
_this.openContainer = null;
return _this;
}
ItemSlidingGesture.prototype.canStart = function (ev) {
if (this.selectedContainer) {
return false;
}
// Get swiped sliding container
var container = getContainer(ev);
if (!container) {
this.closeOpened();
return false;
}
// Close open container if it is not the selected one.
if (container !== this.openContainer) {
this.closeOpened();
}
var coord = Object(__WEBPACK_IMPORTED_MODULE_2__util_dom__["f" /* pointerCoord */])(ev);
this.preSelectedContainer = container;
this.firstCoordX = coord.x;
this.firstTimestamp = Date.now();
return true;
};
ItemSlidingGesture.prototype.onDragStart = function (ev) {
ev.preventDefault();
var coord = Object(__WEBPACK_IMPORTED_MODULE_2__util_dom__["f" /* pointerCoord */])(ev);
this.selectedContainer = this.openContainer = this.preSelectedContainer;
this.selectedContainer.startSliding(coord.x);
};
ItemSlidingGesture.prototype.onDragMove = function (ev) {
ev.preventDefault();
this.selectedContainer.moveSliding(Object(__WEBPACK_IMPORTED_MODULE_2__util_dom__["f" /* pointerCoord */])(ev).x);
};
ItemSlidingGesture.prototype.onDragEnd = function (ev) {
ev.preventDefault();
var coordX = Object(__WEBPACK_IMPORTED_MODULE_2__util_dom__["f" /* pointerCoord */])(ev).x;
var deltaX = (coordX - this.firstCoordX);
var deltaT = (Date.now() - this.firstTimestamp);
this.selectedContainer.endSliding(deltaX / deltaT);
this.selectedContainer = null;
this.preSelectedContainer = null;
};
ItemSlidingGesture.prototype.notCaptured = function (ev) {
if (!clickedOptionButton(ev)) {
this.closeOpened();
}
};
ItemSlidingGesture.prototype.closeOpened = function () {
this.selectedContainer = null;
if (this.openContainer) {
this.openContainer.close();
this.openContainer = null;
return true;
}
return false;
};
ItemSlidingGesture.prototype.destroy = function () {
_super.prototype.destroy.call(this);
this.closeOpened();
this.list = null;
this.preSelectedContainer = null;
this.selectedContainer = null;
this.openContainer = null;
};
return ItemSlidingGesture;
}(__WEBPACK_IMPORTED_MODULE_1__gestures_pan_gesture__["a" /* PanGesture */]));
function getContainer(ev) {
var ele = ev.target.closest('ion-item-sliding');
if (ele) {
return ele['$ionComponent'];
}
return null;
}
function clickedOptionButton(ev) {
var ele = ev.target.closest('ion-item-options>button');
return !!ele;
}
//# sourceMappingURL=item-sliding-gesture.js.map
/***/ }),
/* 397 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return LoadingPopIn; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return LoadingPopOut; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return LoadingMdPopIn; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return LoadingMdPopOut; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return LoadingWpPopIn; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return LoadingWpPopOut; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__animations_animation__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__transitions_transition__ = __webpack_require__(35);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* Animations for loading
*/
var LoadingPopIn = (function (_super) {
__extends(LoadingPopIn, _super);
function LoadingPopIn() {
return _super !== null && _super.apply(this, arguments) || this;
}
LoadingPopIn.prototype.init = function () {
var ele = this.enteringView.pageRef().nativeElement;
var backdrop = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('ion-backdrop'));
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.loading-wrapper'));
wrapper.fromTo('opacity', 0.01, 1).fromTo('scale', 1.1, 1);
backdrop.fromTo('opacity', 0.01, 0.3);
this
.easing('ease-in-out')
.duration(200)
.add(backdrop)
.add(wrapper);
};
return LoadingPopIn;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_transition__["a" /* Transition */]));
var LoadingPopOut = (function (_super) {
__extends(LoadingPopOut, _super);
function LoadingPopOut() {
return _super !== null && _super.apply(this, arguments) || this;
}
LoadingPopOut.prototype.init = function () {
var ele = this.leavingView.pageRef().nativeElement;
var backdrop = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('ion-backdrop'));
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.loading-wrapper'));
wrapper.fromTo('opacity', 0.99, 0).fromTo('scale', 1, 0.9);
backdrop.fromTo('opacity', 0.3, 0);
this
.easing('ease-in-out')
.duration(200)
.add(backdrop)
.add(wrapper);
};
return LoadingPopOut;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_transition__["a" /* Transition */]));
var LoadingMdPopIn = (function (_super) {
__extends(LoadingMdPopIn, _super);
function LoadingMdPopIn() {
return _super !== null && _super.apply(this, arguments) || this;
}
LoadingMdPopIn.prototype.init = function () {
var ele = this.enteringView.pageRef().nativeElement;
var backdrop = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('ion-backdrop'));
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.loading-wrapper'));
wrapper.fromTo('opacity', 0.01, 1).fromTo('scale', 1.1, 1);
backdrop.fromTo('opacity', 0.01, 0.5);
this
.easing('ease-in-out')
.duration(200)
.add(backdrop)
.add(wrapper);
};
return LoadingMdPopIn;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_transition__["a" /* Transition */]));
var LoadingMdPopOut = (function (_super) {
__extends(LoadingMdPopOut, _super);
function LoadingMdPopOut() {
return _super !== null && _super.apply(this, arguments) || this;
}
LoadingMdPopOut.prototype.init = function () {
var ele = this.leavingView.pageRef().nativeElement;
var backdrop = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('ion-backdrop'));
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.loading-wrapper'));
wrapper.fromTo('opacity', 0.99, 0).fromTo('scale', 1, 0.9);
backdrop.fromTo('opacity', 0.5, 0);
this
.easing('ease-in-out')
.duration(200)
.add(backdrop)
.add(wrapper);
};
return LoadingMdPopOut;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_transition__["a" /* Transition */]));
var LoadingWpPopIn = (function (_super) {
__extends(LoadingWpPopIn, _super);
function LoadingWpPopIn() {
return _super !== null && _super.apply(this, arguments) || this;
}
LoadingWpPopIn.prototype.init = function () {
var ele = this.enteringView.pageRef().nativeElement;
var backdrop = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('ion-backdrop'));
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.loading-wrapper'));
wrapper.fromTo('opacity', 0.01, 1).fromTo('scale', 1.3, 1);
backdrop.fromTo('opacity', 0.01, 0.16);
this
.easing('cubic-bezier(0,0,0.05,1)')
.duration(200)
.add(backdrop)
.add(wrapper);
};
return LoadingWpPopIn;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_transition__["a" /* Transition */]));
var LoadingWpPopOut = (function (_super) {
__extends(LoadingWpPopOut, _super);
function LoadingWpPopOut() {
return _super !== null && _super.apply(this, arguments) || this;
}
LoadingWpPopOut.prototype.init = function () {
var ele = this.leavingView.pageRef().nativeElement;
var backdrop = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('ion-backdrop'));
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.loading-wrapper'));
wrapper.fromTo('opacity', 0.99, 0).fromTo('scale', 1, 1.3);
backdrop.fromTo('opacity', 0.16, 0);
this
.easing('ease-out')
.duration(150)
.add(backdrop)
.add(wrapper);
};
return LoadingWpPopOut;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_transition__["a" /* Transition */]));
//# sourceMappingURL=loading-transitions.js.map
/***/ }),
/* 398 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return MenuContentGesture; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__gestures_gesture_controller__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__gestures_slide_edge_gesture__ = __webpack_require__(76);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* Gesture attached to the content which the menu is assigned to
*/
var MenuContentGesture = (function (_super) {
__extends(MenuContentGesture, _super);
function MenuContentGesture(plt, menu, gestureCtrl, domCtrl) {
var _this = _super.call(this, plt, plt.doc().body, {
direction: 'x',
edge: menu.side,
threshold: 5,
maxEdgeStart: menu.maxEdgeStart || 50,
zone: false,
passive: true,
domController: domCtrl,
gesture: gestureCtrl.createGesture({
name: __WEBPACK_IMPORTED_MODULE_0__gestures_gesture_controller__["d" /* GESTURE_MENU_SWIPE */],
priority: __WEBPACK_IMPORTED_MODULE_0__gestures_gesture_controller__["f" /* GESTURE_PRIORITY_MENU_SWIPE */],
disableScroll: true
})
}) || this;
_this.menu = menu;
return _this;
}
MenuContentGesture.prototype.canStart = function (ev) {
var menu = this.menu;
if (!menu.canSwipe()) {
return false;
}
if (menu.isOpen) {
return true;
}
else if (menu.getMenuController().getOpen()) {
return false;
}
return _super.prototype.canStart.call(this, ev);
};
// Set CSS, then wait one frame for it to apply before sliding starts
MenuContentGesture.prototype.onSlideBeforeStart = function () {
(void 0) /* console.debug */;
this.menu._swipeBeforeStart();
};
MenuContentGesture.prototype.onSlideStart = function () {
(void 0) /* console.debug */;
this.menu._swipeStart();
};
MenuContentGesture.prototype.onSlide = function (slide) {
var z = (this.menu.isRightSide !== this.plt.isRTL ? slide.min : slide.max);
var stepValue = (slide.distance / z);
this.menu._swipeProgress(stepValue);
};
MenuContentGesture.prototype.onSlideEnd = function (slide) {
var z = (this.menu.isRightSide !== this.plt.isRTL ? slide.min : slide.max);
var currentStepValue = (slide.distance / z);
var velocity = slide.velocity;
z = Math.abs(z * 0.5);
var shouldCompleteRight = (velocity >= 0)
&& (velocity > 0.2 || slide.delta > z);
var shouldCompleteLeft = (velocity <= 0)
&& (velocity < -0.2 || slide.delta < -z);
(void 0) /* console.debug */;
this.menu._swipeEnd(shouldCompleteLeft, shouldCompleteRight, currentStepValue, velocity);
};
MenuContentGesture.prototype.getElementStartPos = function (slide) {
var menu = this.menu;
if (menu.isRightSide !== this.plt.isRTL) {
return menu.isOpen ? slide.min : slide.max;
}
// left menu
return menu.isOpen ? slide.max : slide.min;
};
MenuContentGesture.prototype.getSlideBoundaries = function () {
var menu = this.menu;
if (menu.isRightSide !== this.plt.isRTL) {
return {
min: -menu.width(),
max: 0
};
}
// left menu
return {
min: 0,
max: menu.width()
};
};
return MenuContentGesture;
}(__WEBPACK_IMPORTED_MODULE_1__gestures_slide_edge_gesture__["a" /* SlideEdgeGesture */]));
//# sourceMappingURL=menu-gestures.js.map
/***/ }),
/* 399 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export MenuType */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__animations_animation__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__app_menu_controller__ = __webpack_require__(34);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
* Menu Type
* Base class which is extended by the various types. Each
* type will provide their own animations for open and close
* and registers itself with Menu.
*/
var MenuType = (function () {
function MenuType(plt) {
this.ani = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](plt);
this.ani
.easing('cubic-bezier(0.0, 0.0, 0.2, 1)')
.easingReverse('cubic-bezier(0.4, 0.0, 0.6, 1)')
.duration(280);
}
MenuType.prototype.setOpen = function (shouldOpen, animated, done) {
var ani = this.ani
.onFinish(done, true, true)
.reverse(!shouldOpen);
if (animated) {
ani.play();
}
else {
ani.syncPlay();
}
};
MenuType.prototype.setProgressStart = function (isOpen) {
this.isOpening = !isOpen;
// the cloned animation should not use an easing curve during seek
this.ani
.reverse(isOpen)
.progressStart();
};
MenuType.prototype.setProgessStep = function (stepValue) {
// adjust progress value depending if it opening or closing
this.ani.progressStep(stepValue);
};
MenuType.prototype.setProgressEnd = function (shouldComplete, currentStepValue, velocity, done) {
var _this = this;
var isOpen = (this.isOpening && shouldComplete);
if (!this.isOpening && !shouldComplete) {
isOpen = true;
}
var ani = this.ani;
ani.onFinish(function () {
_this.isOpening = false;
done(isOpen);
}, true);
var factor = 1 - Math.min(Math.abs(velocity) / 4, 0.7);
var dur = ani.getDuration() * factor;
ani.progressEnd(shouldComplete, currentStepValue, dur);
};
MenuType.prototype.destroy = function () {
this.ani.destroy();
this.ani = null;
};
return MenuType;
}());
/**
* @hidden
* Menu Reveal Type
* The content slides over to reveal the menu underneath.
* The menu itself, which is under the content, does not move.
*/
var MenuRevealType = (function (_super) {
__extends(MenuRevealType, _super);
function MenuRevealType(menu, plt) {
var _this = _super.call(this, plt) || this;
var openedX = (menu.width() * (menu.isRightSide ? -1 : 1)) + 'px';
var contentOpen = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](plt, menu.getContentElement());
contentOpen.fromTo('translateX', '0px', openedX);
_this.ani.add(contentOpen);
return _this;
}
return MenuRevealType;
}(MenuType));
__WEBPACK_IMPORTED_MODULE_1__app_menu_controller__["a" /* MenuController */].registerType('reveal', MenuRevealType);
/**
* @hidden
* Menu Push Type
* The content slides over to reveal the menu underneath.
* The menu itself also slides over to reveal its bad self.
*/
var MenuPushType = (function (_super) {
__extends(MenuPushType, _super);
function MenuPushType(menu, plt) {
var _this = _super.call(this, plt) || this;
var contentOpenedX, menuClosedX, menuOpenedX;
var width = menu.width();
if (menu.isRightSide) {
// right side
contentOpenedX = -width + 'px';
menuClosedX = width + 'px';
menuOpenedX = '0px';
}
else {
contentOpenedX = width + 'px';
menuOpenedX = '0px';
menuClosedX = -width + 'px';
}
var menuAni = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](plt, menu.getMenuElement());
menuAni.fromTo('translateX', menuClosedX, menuOpenedX);
_this.ani.add(menuAni);
var contentApi = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](plt, menu.getContentElement());
contentApi.fromTo('translateX', '0px', contentOpenedX);
_this.ani.add(contentApi);
return _this;
}
return MenuPushType;
}(MenuType));
__WEBPACK_IMPORTED_MODULE_1__app_menu_controller__["a" /* MenuController */].registerType('push', MenuPushType);
/**
* @hidden
* Menu Overlay Type
* The menu slides over the content. The content
* itself, which is under the menu, does not move.
*/
var MenuOverlayType = (function (_super) {
__extends(MenuOverlayType, _super);
function MenuOverlayType(menu, plt) {
var _this = _super.call(this, plt) || this;
var closedX, openedX;
var width = menu.width();
if (menu.isRightSide) {
// right side
closedX = 8 + width + 'px';
openedX = '0px';
}
else {
// left side
closedX = -(8 + width) + 'px';
openedX = '0px';
}
var menuAni = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](plt, menu.getMenuElement());
menuAni.fromTo('translateX', closedX, openedX);
_this.ani.add(menuAni);
var backdropApi = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](plt, menu.getBackdropElement());
backdropApi.fromTo('opacity', 0.01, 0.35);
_this.ani.add(backdropApi);
return _this;
}
return MenuOverlayType;
}(MenuType));
__WEBPACK_IMPORTED_MODULE_1__app_menu_controller__["a" /* MenuController */].registerType('overlay', MenuOverlayType);
//# sourceMappingURL=menu-types.js.map
/***/ }),
/* 400 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ModalImpl; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__app_app_constants__ = __webpack_require__(44);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__modal_component__ = __webpack_require__(95);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__modal_transitions__ = __webpack_require__(475);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__navigation_view_controller__ = __webpack_require__(7);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
*/
var ModalImpl = (function (_super) {
__extends(ModalImpl, _super);
function ModalImpl(app, component, data, opts, config) {
if (opts === void 0) { opts = {}; }
var _this = this;
data = data || {};
data.component = component;
opts.showBackdrop = Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["l" /* isPresent */])(opts.showBackdrop) ? !!opts.showBackdrop : true;
opts.enableBackdropDismiss = Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["l" /* isPresent */])(opts.enableBackdropDismiss) ? !!opts.enableBackdropDismiss : true;
data.opts = opts;
_this = _super.call(this, __WEBPACK_IMPORTED_MODULE_2__modal_component__["a" /* ModalCmp */], data, null) || this;
_this._app = app;
_this._enterAnimation = opts.enterAnimation;
_this._leaveAnimation = opts.leaveAnimation;
_this.isOverlay = true;
config.setTransition('modal-slide-in', __WEBPACK_IMPORTED_MODULE_3__modal_transitions__["c" /* ModalSlideIn */]);
config.setTransition('modal-slide-out', __WEBPACK_IMPORTED_MODULE_3__modal_transitions__["d" /* ModalSlideOut */]);
config.setTransition('modal-md-slide-in', __WEBPACK_IMPORTED_MODULE_3__modal_transitions__["a" /* ModalMDSlideIn */]);
config.setTransition('modal-md-slide-out', __WEBPACK_IMPORTED_MODULE_3__modal_transitions__["b" /* ModalMDSlideOut */]);
return _this;
}
/**
* @hidden
*/
ModalImpl.prototype.getTransitionName = function (direction) {
var key;
if (direction === 'back') {
if (this._leaveAnimation) {
return this._leaveAnimation;
}
key = 'modalLeave';
}
else {
if (this._enterAnimation) {
return this._enterAnimation;
}
key = 'modalEnter';
}
return this._nav && this._nav.config.get(key);
};
/**
* Present the action sheet instance.
*
* @param {NavOptions} [navOptions={}] Nav options to go with this transition.
* @returns {Promise} Returns a promise which is resolved when the transition has completed.
*/
ModalImpl.prototype.present = function (navOptions) {
if (navOptions === void 0) { navOptions = {}; }
navOptions.minClickBlockDuration = navOptions.minClickBlockDuration || 400;
return this._app.present(this, navOptions, __WEBPACK_IMPORTED_MODULE_1__app_app_constants__["c" /* PORTAL_MODAL */]);
};
return ModalImpl;
}(__WEBPACK_IMPORTED_MODULE_4__navigation_view_controller__["a" /* ViewController */]));
//# sourceMappingURL=modal-impl.js.map
/***/ }),
/* 401 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var ArrayObservable_1 = __webpack_require__(128);
exports.of = ArrayObservable_1.ArrayObservable.of;
//# sourceMappingURL=of.js.map
/***/ }),
/* 402 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var concatMap_1 = __webpack_require__(403);
/* tslint:enable:max-line-length */
/**
* Projects each source value to an Observable which is merged in the output
* Observable, in a serialized fashion waiting for each one to complete before
* merging the next.
*
* <span class="informal">Maps each value to an Observable, then flattens all of
* these inner Observables using {@link concatAll}.</span>
*
* <img src="./img/concatMap.png" width="100%">
*
* Returns an Observable that emits items based on applying a function that you
* supply to each item emitted by the source Observable, where that function
* returns an (so-called "inner") Observable. Each new inner Observable is
* concatenated with the previous inner Observable.
*
* __Warning:__ if source values arrive endlessly and faster than their
* corresponding inner Observables can complete, it will result in memory issues
* as inner Observables amass in an unbounded buffer waiting for their turn to
* be subscribed to.
*
* Note: `concatMap` is equivalent to `mergeMap` with concurrency parameter set
* to `1`.
*
* @example <caption>For each click event, tick every second from 0 to 3, with no concurrency</caption>
* var clicks = Rx.Observable.fromEvent(document, 'click');
* var result = clicks.concatMap(ev => Rx.Observable.interval(1000).take(4));
* result.subscribe(x => console.log(x));
*
* // Results in the following:
* // (results are not concurrent)
* // For every click on the "document" it will emit values 0 to 3 spaced
* // on a 1000ms interval
* // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3
*
* @see {@link concat}
* @see {@link concatAll}
* @see {@link concatMapTo}
* @see {@link exhaustMap}
* @see {@link mergeMap}
* @see {@link switchMap}
*
* @param {function(value: T, ?index: number): ObservableInput} project A function
* that, when applied to an item emitted by the source Observable, returns an
* Observable.
* @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector]
* A function to produce the value on the output Observable based on the values
* and the indices of the source (outer) emission and the inner Observable
* emission. The arguments passed to this function are:
* - `outerValue`: the value that came from the source
* - `innerValue`: the value that came from the projected Observable
* - `outerIndex`: the "index" of the value that came from the source
* - `innerIndex`: the "index" of the value from the projected Observable
* @return {Observable} An Observable that emits the result of applying the
* projection function (and the optional `resultSelector`) to each item emitted
* by the source Observable and taking values from each projected inner
* Observable sequentially.
* @method concatMap
* @owner Observable
*/
function concatMap(project, resultSelector) {
return concatMap_1.concatMap(project, resultSelector)(this);
}
exports.concatMap = concatMap;
//# sourceMappingURL=concatMap.js.map
/***/ }),
/* 403 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var mergeMap_1 = __webpack_require__(131);
/* tslint:enable:max-line-length */
/**
* Projects each source value to an Observable which is merged in the output
* Observable, in a serialized fashion waiting for each one to complete before
* merging the next.
*
* <span class="informal">Maps each value to an Observable, then flattens all of
* these inner Observables using {@link concatAll}.</span>
*
* <img src="./img/concatMap.png" width="100%">
*
* Returns an Observable that emits items based on applying a function that you
* supply to each item emitted by the source Observable, where that function
* returns an (so-called "inner") Observable. Each new inner Observable is
* concatenated with the previous inner Observable.
*
* __Warning:__ if source values arrive endlessly and faster than their
* corresponding inner Observables can complete, it will result in memory issues
* as inner Observables amass in an unbounded buffer waiting for their turn to
* be subscribed to.
*
* Note: `concatMap` is equivalent to `mergeMap` with concurrency parameter set
* to `1`.
*
* @example <caption>For each click event, tick every second from 0 to 3, with no concurrency</caption>
* var clicks = Rx.Observable.fromEvent(document, 'click');
* var result = clicks.concatMap(ev => Rx.Observable.interval(1000).take(4));
* result.subscribe(x => console.log(x));
*
* // Results in the following:
* // (results are not concurrent)
* // For every click on the "document" it will emit values 0 to 3 spaced
* // on a 1000ms interval
* // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3
*
* @see {@link concat}
* @see {@link concatAll}
* @see {@link concatMapTo}
* @see {@link exhaustMap}
* @see {@link mergeMap}
* @see {@link switchMap}
*
* @param {function(value: T, ?index: number): ObservableInput} project A function
* that, when applied to an item emitted by the source Observable, returns an
* Observable.
* @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector]
* A function to produce the value on the output Observable based on the values
* and the indices of the source (outer) emission and the inner Observable
* emission. The arguments passed to this function are:
* - `outerValue`: the value that came from the source
* - `innerValue`: the value that came from the projected Observable
* - `outerIndex`: the "index" of the value that came from the source
* - `innerIndex`: the "index" of the value from the projected Observable
* @return {Observable} An Observable that emits the result of applying the
* projection function (and the optional `resultSelector`) to each item emitted
* by the source Observable and taking values from each projected inner
* Observable sequentially.
* @method concatMap
* @owner Observable
*/
function concatMap(project, resultSelector) {
return mergeMap_1.mergeMap(project, resultSelector, 1);
}
exports.concatMap = concatMap;
//# sourceMappingURL=concatMap.js.map
/***/ }),
/* 404 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var filter_1 = __webpack_require__(405);
/* tslint:enable:max-line-length */
/**
* Filter items emitted by the source Observable by only emitting those that
* satisfy a specified predicate.
*
* <span class="informal">Like
* [Array.prototype.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter),
* it only emits a value from the source if it passes a criterion function.</span>
*
* <img src="./img/filter.png" width="100%">
*
* Similar to the well-known `Array.prototype.filter` method, this operator
* takes values from the source Observable, passes them through a `predicate`
* function and only emits those values that yielded `true`.
*
* @example <caption>Emit only click events whose target was a DIV element</caption>
* var clicks = Rx.Observable.fromEvent(document, 'click');
* var clicksOnDivs = clicks.filter(ev => ev.target.tagName === 'DIV');
* clicksOnDivs.subscribe(x => console.log(x));
*
* @see {@link distinct}
* @see {@link distinctUntilChanged}
* @see {@link distinctUntilKeyChanged}
* @see {@link ignoreElements}
* @see {@link partition}
* @see {@link skip}
*
* @param {function(value: T, index: number): boolean} predicate A function that
* evaluates each value emitted by the source Observable. If it returns `true`,
* the value is emitted, if `false` the value is not passed to the output
* Observable. The `index` parameter is the number `i` for the i-th source
* emission that has happened since the subscription, starting from the number
* `0`.
* @param {any} [thisArg] An optional argument to determine the value of `this`
* in the `predicate` function.
* @return {Observable} An Observable of values from the source that were
* allowed by the `predicate` function.
* @method filter
* @owner Observable
*/
function filter(predicate, thisArg) {
return filter_1.filter(predicate, thisArg)(this);
}
exports.filter = filter;
//# sourceMappingURL=filter.js.map
/***/ }),
/* 405 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Subscriber_1 = __webpack_require__(25);
/* tslint:enable:max-line-length */
/**
* Filter items emitted by the source Observable by only emitting those that
* satisfy a specified predicate.
*
* <span class="informal">Like
* [Array.prototype.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter),
* it only emits a value from the source if it passes a criterion function.</span>
*
* <img src="./img/filter.png" width="100%">
*
* Similar to the well-known `Array.prototype.filter` method, this operator
* takes values from the source Observable, passes them through a `predicate`
* function and only emits those values that yielded `true`.
*
* @example <caption>Emit only click events whose target was a DIV element</caption>
* var clicks = Rx.Observable.fromEvent(document, 'click');
* var clicksOnDivs = clicks.filter(ev => ev.target.tagName === 'DIV');
* clicksOnDivs.subscribe(x => console.log(x));
*
* @see {@link distinct}
* @see {@link distinctUntilChanged}
* @see {@link distinctUntilKeyChanged}
* @see {@link ignoreElements}
* @see {@link partition}
* @see {@link skip}
*
* @param {function(value: T, index: number): boolean} predicate A function that
* evaluates each value emitted by the source Observable. If it returns `true`,
* the value is emitted, if `false` the value is not passed to the output
* Observable. The `index` parameter is the number `i` for the i-th source
* emission that has happened since the subscription, starting from the number
* `0`.
* @param {any} [thisArg] An optional argument to determine the value of `this`
* in the `predicate` function.
* @return {Observable} An Observable of values from the source that were
* allowed by the `predicate` function.
* @method filter
* @owner Observable
*/
function filter(predicate, thisArg) {
return function filterOperatorFunction(source) {
return source.lift(new FilterOperator(predicate, thisArg));
};
}
exports.filter = filter;
var FilterOperator = (function () {
function FilterOperator(predicate, thisArg) {
this.predicate = predicate;
this.thisArg = thisArg;
}
FilterOperator.prototype.call = function (subscriber, source) {
return source.subscribe(new FilterSubscriber(subscriber, this.predicate, this.thisArg));
};
return FilterOperator;
}());
/**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
var FilterSubscriber = (function (_super) {
__extends(FilterSubscriber, _super);
function FilterSubscriber(destination, predicate, thisArg) {
_super.call(this, destination);
this.predicate = predicate;
this.thisArg = thisArg;
this.count = 0;
}
// the try catch block below is left specifically for
// optimization and perf reasons. a tryCatcher is not necessary here.
FilterSubscriber.prototype._next = function (value) {
var result;
try {
result = this.predicate.call(this.thisArg, value, this.count++);
}
catch (err) {
this.destination.error(err);
return;
}
if (result) {
this.destination.next(value);
}
};
return FilterSubscriber;
}(Subscriber_1.Subscriber));
//# sourceMappingURL=filter.js.map
/***/ }),
/* 406 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Storage; });
/* unused harmony export getDefaultConfig */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return StorageConfigToken; });
/* harmony export (immutable) */ __webpack_exports__["c"] = provideStorage;
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_localforage__ = __webpack_require__(407);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_localforage___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_localforage__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_localforage_cordovasqlitedriver__ = __webpack_require__(408);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_localforage_cordovasqlitedriver___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_localforage_cordovasqlitedriver__);
/**
* Storage is an easy way to store key/value pairs and JSON objects.
* Storage uses a variety of storage engines underneath, picking the best one available
* depending on the platform.
*
* When running in a native app context, Storage will prioritize using SQLite, as it's one of
* the most stable and widely used file-based databases, and avoids some of the
* pitfalls of things like localstorage and IndexedDB, such as the OS deciding to clear out such
* data in low disk-space situations.
*
* When running in the web or as a Progressive Web App, Storage will attempt to use
* IndexedDB, WebSQL, and localstorage, in that order.
*
* @usage
* First, if you'd like to use SQLite, install the cordova-sqlite-storage plugin:
* ```bash
* ionic cordova plugin add cordova-sqlite-storage
* ```
*
* Next, install the package (comes by default for Ionic apps > Ionic V1):
* ```bash
* npm install --save @ionic/storage
* ```
*
* Next, add it to the imports list in your `NgModule` declaration (for example, in `src/app/app.module.ts`):
*
* ```typescript
* import { IonicStorageModule } from '@ionic/storage';
*
* @NgModule({
* declarations: [
* // ...
* ],
* imports: [
* BrowserModule,
* IonicModule.forRoot(MyApp),
* IonicStorageModule.forRoot()
* ],
* bootstrap: [IonicApp],
* entryComponents: [
* // ...
* ],
* providers: [
* // ...
* ]
* })
* export class AppModule {}
*```
*
* Finally, inject it into any of your components or pages:
* ```typescript
* import { Storage } from '@ionic/storage';
* export class MyApp {
* constructor(private storage: Storage) { }
*
* ...
*
* // set a key/value
* storage.set('name', 'Max');
*
* // Or to get a key/value pair
* storage.get('age').then((val) => {
* console.log('Your age is', val);
* });
* }
* ```
*
*
* ### Configuring Storage
*
* The Storage engine can be configured both with specific storage engine priorities, or custom configuration
* options to pass to localForage. See the localForage config docs for possible options: https://github.com/localForage/localForage#configuration
*
* Note: Any custom configurations will be merged with the default configuration
*
* ```typescript
* import { IonicStorageModule } from '@ionic/storage';
*
* @NgModule({
* declarations: [...],
* imports: [
* IonicStorageModule.forRoot({
* name: '__mydb',
driverOrder: ['indexeddb', 'sqlite', 'websql']
* })
* ],
* bootstrap: [...],
* entryComponents: [...],
* providers: [...]
* })
* export class AppModule { }
* ```
*/
var Storage = (function () {
/**
* Create a new Storage instance using the order of drivers and any additional config
* options to pass to LocalForage.
*
* Possible driver options are: ['sqlite', 'indexeddb', 'websql', 'localstorage'] and the
* default is that exact ordering.
*/
function Storage(config) {
var _this = this;
this._driver = null;
this._dbPromise = new Promise(function (resolve, reject) {
var db;
var defaultConfig = getDefaultConfig();
var actualConfig = Object.assign(defaultConfig, config || {});
__WEBPACK_IMPORTED_MODULE_1_localforage___default.a.defineDriver(__WEBPACK_IMPORTED_MODULE_2_localforage_cordovasqlitedriver___default.a).then(function () {
db = __WEBPACK_IMPORTED_MODULE_1_localforage___default.a.createInstance(actualConfig);
})
.then(function () { return db.setDriver(_this._getDriverOrder(actualConfig.driverOrder)); })
.then(function () {
_this._driver = db.driver();
resolve(db);
})
.catch(function (reason) { return reject(reason); });
});
}
Object.defineProperty(Storage.prototype, "driver", {
/**
* Get the name of the driver being used.
* @returns {string | null} Name of the driver
*/
get: function () {
return this._driver;
},
enumerable: true,
configurable: true
});
/**
* Reflect the readiness of the store.
* @returns {Promise<LocalForage>} Returns a promise that resolves when the store is ready
*/
Storage.prototype.ready = function () {
return this._dbPromise;
};
Storage.prototype._getDriverOrder = function (driverOrder) {
return driverOrder.map(function (driver) {
switch (driver) {
case 'sqlite':
return __WEBPACK_IMPORTED_MODULE_2_localforage_cordovasqlitedriver___default.a._driver;
case 'indexeddb':
return __WEBPACK_IMPORTED_MODULE_1_localforage___default.a.INDEXEDDB;
case 'websql':
return __WEBPACK_IMPORTED_MODULE_1_localforage___default.a.WEBSQL;
case 'localstorage':
return __WEBPACK_IMPORTED_MODULE_1_localforage___default.a.LOCALSTORAGE;
}
});
};
/**
* Get the value associated with the given key.
* @param {any} key the key to identify this value
* @returns {Promise} Returns a promise with the value of the given key
*/
Storage.prototype.get = function (key) {
return this._dbPromise.then(function (db) { return db.getItem(key); });
};
/**
* Set the value for the given key.
* @param {any} key the key to identify this value
* @param {any} value the value for this key
* @returns {Promise} Returns a promise that resolves when the key and value are set
*/
Storage.prototype.set = function (key, value) {
return this._dbPromise.then(function (db) { return db.setItem(key, value); });
};
/**
* Remove any value associated with this key.
* @param {any} key the key to identify this value
* @returns {Promise} Returns a promise that resolves when the value is removed
*/
Storage.prototype.remove = function (key) {
return this._dbPromise.then(function (db) { return db.removeItem(key); });
};
/**
* Clear the entire key value store. WARNING: HOT!
* @returns {Promise} Returns a promise that resolves when the store is cleared
*/
Storage.prototype.clear = function () {
return this._dbPromise.then(function (db) { return db.clear(); });
};
/**
* @returns {Promise} Returns a promise that resolves with the number of keys stored.
*/
Storage.prototype.length = function () {
return this._dbPromise.then(function (db) { return db.length(); });
};
/**
* @returns {Promise} Returns a promise that resolves with the keys in the store.
*/
Storage.prototype.keys = function () {
return this._dbPromise.then(function (db) { return db.keys(); });
};
/**
* Iterate through each key,value pair.
* @param {any} iteratorCallback a callback of the form (value, key, iterationNumber)
* @returns {Promise} Returns a promise that resolves when the iteration has finished.
*/
Storage.prototype.forEach = function (iteratorCallback) {
return this._dbPromise.then(function (db) { return db.iterate(iteratorCallback); });
};
return Storage;
}());
/** @hidden */
function getDefaultConfig() {
return {
name: '_ionicstorage',
storeName: '_ionickv',
driverOrder: ['sqlite', 'indexeddb', 'websql', 'localstorage']
};
}
;
/** @hidden */
var StorageConfigToken = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["B" /* InjectionToken */]('STORAGE_CONFIG_TOKEN');
/** @hidden */
function provideStorage(storageConfig) {
var config = !!storageConfig ? storageConfig : getDefaultConfig();
return new Storage(config);
}
/***/ }),
/* 407 */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {var require;var require;/*!
localForage -- Offline Storage, Improved
Version 1.4.3
https://mozilla.github.io/localForage
(c) 2013-2016 Mozilla, Apache License 2.0
*/
(function(f){if(true){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.localforage = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return require(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw (f.code="MODULE_NOT_FOUND", f)}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
'use strict';
var immediate = _dereq_(2);
/* istanbul ignore next */
function INTERNAL() {}
var handlers = {};
var REJECTED = ['REJECTED'];
var FULFILLED = ['FULFILLED'];
var PENDING = ['PENDING'];
module.exports = exports = Promise;
function Promise(resolver) {
if (typeof resolver !== 'function') {
throw new TypeError('resolver must be a function');
}
this.state = PENDING;
this.queue = [];
this.outcome = void 0;
if (resolver !== INTERNAL) {
safelyResolveThenable(this, resolver);
}
}
Promise.prototype["catch"] = function (onRejected) {
return this.then(null, onRejected);
};
Promise.prototype.then = function (onFulfilled, onRejected) {
if (typeof onFulfilled !== 'function' && this.state === FULFILLED ||
typeof onRejected !== 'function' && this.state === REJECTED) {
return this;
}
var promise = new this.constructor(INTERNAL);
if (this.state !== PENDING) {
var resolver = this.state === FULFILLED ? onFulfilled : onRejected;
unwrap(promise, resolver, this.outcome);
} else {
this.queue.push(new QueueItem(promise, onFulfilled, onRejected));
}
return promise;
};
function QueueItem(promise, onFulfilled, onRejected) {
this.promise = promise;
if (typeof onFulfilled === 'function') {
this.onFulfilled = onFulfilled;
this.callFulfilled = this.otherCallFulfilled;
}
if (typeof onRejected === 'function') {
this.onRejected = onRejected;
this.callRejected = this.otherCallRejected;
}
}
QueueItem.prototype.callFulfilled = function (value) {
handlers.resolve(this.promise, value);
};
QueueItem.prototype.otherCallFulfilled = function (value) {
unwrap(this.promise, this.onFulfilled, value);
};
QueueItem.prototype.callRejected = function (value) {
handlers.reject(this.promise, value);
};
QueueItem.prototype.otherCallRejected = function (value) {
unwrap(this.promise, this.onRejected, value);
};
function unwrap(promise, func, value) {
immediate(function () {
var returnValue;
try {
returnValue = func(value);
} catch (e) {
return handlers.reject(promise, e);
}
if (returnValue === promise) {
handlers.reject(promise, new TypeError('Cannot resolve promise with itself'));
} else {
handlers.resolve(promise, returnValue);
}
});
}
handlers.resolve = function (self, value) {
var result = tryCatch(getThen, value);
if (result.status === 'error') {
return handlers.reject(self, result.value);
}
var thenable = result.value;
if (thenable) {
safelyResolveThenable(self, thenable);
} else {
self.state = FULFILLED;
self.outcome = value;
var i = -1;
var len = self.queue.length;
while (++i < len) {
self.queue[i].callFulfilled(value);
}
}
return self;
};
handlers.reject = function (self, error) {
self.state = REJECTED;
self.outcome = error;
var i = -1;
var len = self.queue.length;
while (++i < len) {
self.queue[i].callRejected(error);
}
return self;
};
function getThen(obj) {
// Make sure we only access the accessor once as required by the spec
var then = obj && obj.then;
if (obj && typeof obj === 'object' && typeof then === 'function') {
return function appyThen() {
then.apply(obj, arguments);
};
}
}
function safelyResolveThenable(self, thenable) {
// Either fulfill, reject or reject with error
var called = false;
function onError(value) {
if (called) {
return;
}
called = true;
handlers.reject(self, value);
}
function onSuccess(value) {
if (called) {
return;
}
called = true;
handlers.resolve(self, value);
}
function tryToUnwrap() {
thenable(onSuccess, onError);
}
var result = tryCatch(tryToUnwrap);
if (result.status === 'error') {
onError(result.value);
}
}
function tryCatch(func, value) {
var out = {};
try {
out.value = func(value);
out.status = 'success';
} catch (e) {
out.status = 'error';
out.value = e;
}
return out;
}
exports.resolve = resolve;
function resolve(value) {
if (value instanceof this) {
return value;
}
return handlers.resolve(new this(INTERNAL), value);
}
exports.reject = reject;
function reject(reason) {
var promise = new this(INTERNAL);
return handlers.reject(promise, reason);
}
exports.all = all;
function all(iterable) {
var self = this;
if (Object.prototype.toString.call(iterable) !== '[object Array]') {
return this.reject(new TypeError('must be an array'));
}
var len = iterable.length;
var called = false;
if (!len) {
return this.resolve([]);
}
var values = new Array(len);
var resolved = 0;
var i = -1;
var promise = new this(INTERNAL);
while (++i < len) {
allResolver(iterable[i], i);
}
return promise;
function allResolver(value, i) {
self.resolve(value).then(resolveFromAll, function (error) {
if (!called) {
called = true;
handlers.reject(promise, error);
}
});
function resolveFromAll(outValue) {
values[i] = outValue;
if (++resolved === len && !called) {
called = true;
handlers.resolve(promise, values);
}
}
}
}
exports.race = race;
function race(iterable) {
var self = this;
if (Object.prototype.toString.call(iterable) !== '[object Array]') {
return this.reject(new TypeError('must be an array'));
}
var len = iterable.length;
var called = false;
if (!len) {
return this.resolve([]);
}
var i = -1;
var promise = new this(INTERNAL);
while (++i < len) {
resolver(iterable[i]);
}
return promise;
function resolver(value) {
self.resolve(value).then(function (response) {
if (!called) {
called = true;
handlers.resolve(promise, response);
}
}, function (error) {
if (!called) {
called = true;
handlers.reject(promise, error);
}
});
}
}
},{"2":2}],2:[function(_dereq_,module,exports){
(function (global){
'use strict';
var Mutation = global.MutationObserver || global.WebKitMutationObserver;
var scheduleDrain;
{
if (Mutation) {
var called = 0;
var observer = new Mutation(nextTick);
var element = global.document.createTextNode('');
observer.observe(element, {
characterData: true
});
scheduleDrain = function () {
element.data = (called = ++called % 2);
};
} else if (!global.setImmediate && typeof global.MessageChannel !== 'undefined') {
var channel = new global.MessageChannel();
channel.port1.onmessage = nextTick;
scheduleDrain = function () {
channel.port2.postMessage(0);
};
} else if ('document' in global && 'onreadystatechange' in global.document.createElement('script')) {
scheduleDrain = function () {
// Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
// into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
var scriptEl = global.document.createElement('script');
scriptEl.onreadystatechange = function () {
nextTick();
scriptEl.onreadystatechange = null;
scriptEl.parentNode.removeChild(scriptEl);
scriptEl = null;
};
global.document.documentElement.appendChild(scriptEl);
};
} else {
scheduleDrain = function () {
setTimeout(nextTick, 0);
};
}
}
var draining;
var queue = [];
//named nextTick for less confusing stack traces
function nextTick() {
draining = true;
var i, oldQueue;
var len = queue.length;
while (len) {
oldQueue = queue;
queue = [];
i = -1;
while (++i < len) {
oldQueue[i]();
}
len = queue.length;
}
draining = false;
}
module.exports = immediate;
function immediate(task) {
if (queue.push(task) === 1 && !draining) {
scheduleDrain();
}
}
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}],3:[function(_dereq_,module,exports){
(function (global){
'use strict';
if (typeof global.Promise !== 'function') {
global.Promise = _dereq_(1);
}
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"1":1}],4:[function(_dereq_,module,exports){
'use strict';
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function getIDB() {
/* global indexedDB,webkitIndexedDB,mozIndexedDB,OIndexedDB,msIndexedDB */
try {
if (typeof indexedDB !== 'undefined') {
return indexedDB;
}
if (typeof webkitIndexedDB !== 'undefined') {
return webkitIndexedDB;
}
if (typeof mozIndexedDB !== 'undefined') {
return mozIndexedDB;
}
if (typeof OIndexedDB !== 'undefined') {
return OIndexedDB;
}
if (typeof msIndexedDB !== 'undefined') {
return msIndexedDB;
}
} catch (e) {}
}
var idb = getIDB();
function isIndexedDBValid() {
try {
// Initialize IndexedDB; fall back to vendor-prefixed versions
// if needed.
if (!idb) {
return false;
}
// We mimic PouchDB here; just UA test for Safari (which, as of
// iOS 8/Yosemite, doesn't properly support IndexedDB).
// IndexedDB support is broken and different from Blink's.
// This is faster than the test case (and it's sync), so we just
// do this. *SIGH*
// http://bl.ocks.org/nolanlawson/raw/c83e9039edf2278047e9/
//
// We test for openDatabase because IE Mobile identifies itself
// as Safari. Oh the lulz...
if (typeof openDatabase !== 'undefined' && typeof navigator !== 'undefined' && navigator.userAgent && /Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent)) {
return false;
}
return idb && typeof idb.open === 'function' &&
// Some Samsung/HTC Android 4.0-4.3 devices
// have older IndexedDB specs; if this isn't available
// their IndexedDB is too old for us to use.
// (Replaces the onupgradeneeded test.)
typeof IDBKeyRange !== 'undefined';
} catch (e) {
return false;
}
}
function isWebSQLValid() {
return typeof openDatabase === 'function';
}
function isLocalStorageValid() {
try {
return typeof localStorage !== 'undefined' && 'setItem' in localStorage && localStorage.setItem;
} catch (e) {
return false;
}
}
// Abstracts constructing a Blob object, so it also works in older
// browsers that don't support the native Blob constructor. (i.e.
// old QtWebKit versions, at least).
// Abstracts constructing a Blob object, so it also works in older
// browsers that don't support the native Blob constructor. (i.e.
// old QtWebKit versions, at least).
function createBlob(parts, properties) {
/* global BlobBuilder,MSBlobBuilder,MozBlobBuilder,WebKitBlobBuilder */
parts = parts || [];
properties = properties || {};
try {
return new Blob(parts, properties);
} catch (e) {
if (e.name !== 'TypeError') {
throw e;
}
var Builder = typeof BlobBuilder !== 'undefined' ? BlobBuilder : typeof MSBlobBuilder !== 'undefined' ? MSBlobBuilder : typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder : WebKitBlobBuilder;
var builder = new Builder();
for (var i = 0; i < parts.length; i += 1) {
builder.append(parts[i]);
}
return builder.getBlob(properties.type);
}
}
// This is CommonJS because lie is an external dependency, so Rollup
// can just ignore it.
if (typeof Promise === 'undefined' && typeof _dereq_ !== 'undefined') {
_dereq_(3);
}
var Promise$1 = Promise;
function executeCallback(promise, callback) {
if (callback) {
promise.then(function (result) {
callback(null, result);
}, function (error) {
callback(error);
});
}
}
function executeTwoCallbacks(promise, callback, errorCallback) {
if (typeof callback === 'function') {
promise.then(callback);
}
if (typeof errorCallback === 'function') {
promise["catch"](errorCallback);
}
}
// Some code originally from async_storage.js in
// [Gaia](https://github.com/mozilla-b2g/gaia).
var DETECT_BLOB_SUPPORT_STORE = 'local-forage-detect-blob-support';
var supportsBlobs;
var dbContexts;
var toString = Object.prototype.toString;
// Transform a binary string to an array buffer, because otherwise
// weird stuff happens when you try to work with the binary string directly.
// It is known.
// From http://stackoverflow.com/questions/14967647/ (continues on next line)
// encode-decode-image-with-base64-breaks-image (2013-04-21)
function _binStringToArrayBuffer(bin) {
var length = bin.length;
var buf = new ArrayBuffer(length);
var arr = new Uint8Array(buf);
for (var i = 0; i < length; i++) {
arr[i] = bin.charCodeAt(i);
}
return buf;
}
//
// Blobs are not supported in all versions of IndexedDB, notably
// Chrome <37 and Android <5. In those versions, storing a blob will throw.
//
// Various other blob bugs exist in Chrome v37-42 (inclusive).
// Detecting them is expensive and confusing to users, and Chrome 37-42
// is at very low usage worldwide, so we do a hacky userAgent check instead.
//
// content-type bug: https://code.google.com/p/chromium/issues/detail?id=408120
// 404 bug: https://code.google.com/p/chromium/issues/detail?id=447916
// FileReader bug: https://code.google.com/p/chromium/issues/detail?id=447836
//
// Code borrowed from PouchDB. See:
// https://github.com/pouchdb/pouchdb/blob/9c25a23/src/adapters/idb/blobSupport.js
//
function _checkBlobSupportWithoutCaching(txn) {
return new Promise$1(function (resolve) {
var blob = createBlob(['']);
txn.objectStore(DETECT_BLOB_SUPPORT_STORE).put(blob, 'key');
txn.onabort = function (e) {
// If the transaction aborts now its due to not being able to
// write to the database, likely due to the disk being full
e.preventDefault();
e.stopPropagation();
resolve(false);
};
txn.oncomplete = function () {
var matchedChrome = navigator.userAgent.match(/Chrome\/(\d+)/);
var matchedEdge = navigator.userAgent.match(/Edge\//);
// MS Edge pretends to be Chrome 42:
// https://msdn.microsoft.com/en-us/library/hh869301%28v=vs.85%29.aspx
resolve(matchedEdge || !matchedChrome || parseInt(matchedChrome[1], 10) >= 43);
};
})["catch"](function () {
return false; // error, so assume unsupported
});
}
function _checkBlobSupport(idb) {
if (typeof supportsBlobs === 'boolean') {
return Promise$1.resolve(supportsBlobs);
}
return _checkBlobSupportWithoutCaching(idb).then(function (value) {
supportsBlobs = value;
return supportsBlobs;
});
}
function _deferReadiness(dbInfo) {
var dbContext = dbContexts[dbInfo.name];
// Create a deferred object representing the current database operation.
var deferredOperation = {};
deferredOperation.promise = new Promise$1(function (resolve) {
deferredOperation.resolve = resolve;
});
// Enqueue the deferred operation.
dbContext.deferredOperations.push(deferredOperation);
// Chain its promise to the database readiness.
if (!dbContext.dbReady) {
dbContext.dbReady = deferredOperation.promise;
} else {
dbContext.dbReady = dbContext.dbReady.then(function () {
return deferredOperation.promise;
});
}
}
function _advanceReadiness(dbInfo) {
var dbContext = dbContexts[dbInfo.name];
// Dequeue a deferred operation.
var deferredOperation = dbContext.deferredOperations.pop();
// Resolve its promise (which is part of the database readiness
// chain of promises).
if (deferredOperation) {
deferredOperation.resolve();
}
}
function _getConnection(dbInfo, upgradeNeeded) {
return new Promise$1(function (resolve, reject) {
if (dbInfo.db) {
if (upgradeNeeded) {
_deferReadiness(dbInfo);
dbInfo.db.close();
} else {
return resolve(dbInfo.db);
}
}
var dbArgs = [dbInfo.name];
if (upgradeNeeded) {
dbArgs.push(dbInfo.version);
}
var openreq = idb.open.apply(idb, dbArgs);
if (upgradeNeeded) {
openreq.onupgradeneeded = function (e) {
var db = openreq.result;
try {
db.createObjectStore(dbInfo.storeName);
if (e.oldVersion <= 1) {
// Added when support for blob shims was added
db.createObjectStore(DETECT_BLOB_SUPPORT_STORE);
}
} catch (ex) {
if (ex.name === 'ConstraintError') {
console.warn('The database "' + dbInfo.name + '"' + ' has been upgraded from version ' + e.oldVersion + ' to version ' + e.newVersion + ', but the storage "' + dbInfo.storeName + '" already exists.');
} else {
throw ex;
}
}
};
}
openreq.onerror = function () {
reject(openreq.error);
};
openreq.onsuccess = function () {
resolve(openreq.result);
_advanceReadiness(dbInfo);
};
});
}
function _getOriginalConnection(dbInfo) {
return _getConnection(dbInfo, false);
}
function _getUpgradedConnection(dbInfo) {
return _getConnection(dbInfo, true);
}
function _isUpgradeNeeded(dbInfo, defaultVersion) {
if (!dbInfo.db) {
return true;
}
var isNewStore = !dbInfo.db.objectStoreNames.contains(dbInfo.storeName);
var isDowngrade = dbInfo.version < dbInfo.db.version;
var isUpgrade = dbInfo.version > dbInfo.db.version;
if (isDowngrade) {
// If the version is not the default one
// then warn for impossible downgrade.
if (dbInfo.version !== defaultVersion) {
console.warn('The database "' + dbInfo.name + '"' + ' can\'t be downgraded from version ' + dbInfo.db.version + ' to version ' + dbInfo.version + '.');
}
// Align the versions to prevent errors.
dbInfo.version = dbInfo.db.version;
}
if (isUpgrade || isNewStore) {
// If the store is new then increment the version (if needed).
// This will trigger an "upgradeneeded" event which is required
// for creating a store.
if (isNewStore) {
var incVersion = dbInfo.db.version + 1;
if (incVersion > dbInfo.version) {
dbInfo.version = incVersion;
}
}
return true;
}
return false;
}
// encode a blob for indexeddb engines that don't support blobs
function _encodeBlob(blob) {
return new Promise$1(function (resolve, reject) {
var reader = new FileReader();
reader.onerror = reject;
reader.onloadend = function (e) {
var base64 = btoa(e.target.result || '');
resolve({
__local_forage_encoded_blob: true,
data: base64,
type: blob.type
});
};
reader.readAsBinaryString(blob);
});
}
// decode an encoded blob
function _decodeBlob(encodedBlob) {
var arrayBuff = _binStringToArrayBuffer(atob(encodedBlob.data));
return createBlob([arrayBuff], { type: encodedBlob.type });
}
// is this one of our fancy encoded blobs?
function _isEncodedBlob(value) {
return value && value.__local_forage_encoded_blob;
}
// Specialize the default `ready()` function by making it dependent
// on the current database operations. Thus, the driver will be actually
// ready when it's been initialized (default) *and* there are no pending
// operations on the database (initiated by some other instances).
function _fullyReady(callback) {
var self = this;
var promise = self._initReady().then(function () {
var dbContext = dbContexts[self._dbInfo.name];
if (dbContext && dbContext.dbReady) {
return dbContext.dbReady;
}
});
executeTwoCallbacks(promise, callback, callback);
return promise;
}
// Open the IndexedDB database (automatically creates one if one didn't
// previously exist), using any options set in the config.
function _initStorage(options) {
var self = this;
var dbInfo = {
db: null
};
if (options) {
for (var i in options) {
dbInfo[i] = options[i];
}
}
// Initialize a singleton container for all running localForages.
if (!dbContexts) {
dbContexts = {};
}
// Get the current context of the database;
var dbContext = dbContexts[dbInfo.name];
// ...or create a new context.
if (!dbContext) {
dbContext = {
// Running localForages sharing a database.
forages: [],
// Shared database.
db: null,
// Database readiness (promise).
dbReady: null,
// Deferred operations on the database.
deferredOperations: []
};
// Register the new context in the global container.
dbContexts[dbInfo.name] = dbContext;
}
// Register itself as a running localForage in the current context.
dbContext.forages.push(self);
// Replace the default `ready()` function with the specialized one.
if (!self._initReady) {
self._initReady = self.ready;
self.ready = _fullyReady;
}
// Create an array of initialization states of the related localForages.
var initPromises = [];
function ignoreErrors() {
// Don't handle errors here,
// just makes sure related localForages aren't pending.
return Promise$1.resolve();
}
for (var j = 0; j < dbContext.forages.length; j++) {
var forage = dbContext.forages[j];
if (forage !== self) {
// Don't wait for itself...
initPromises.push(forage._initReady()["catch"](ignoreErrors));
}
}
// Take a snapshot of the related localForages.
var forages = dbContext.forages.slice(0);
// Initialize the connection process only when
// all the related localForages aren't pending.
return Promise$1.all(initPromises).then(function () {
dbInfo.db = dbContext.db;
// Get the connection or open a new one without upgrade.
return _getOriginalConnection(dbInfo);
}).then(function (db) {
dbInfo.db = db;
if (_isUpgradeNeeded(dbInfo, self._defaultConfig.version)) {
// Reopen the database for upgrading.
return _getUpgradedConnection(dbInfo);
}
return db;
}).then(function (db) {
dbInfo.db = dbContext.db = db;
self._dbInfo = dbInfo;
// Share the final connection amongst related localForages.
for (var k = 0; k < forages.length; k++) {
var forage = forages[k];
if (forage !== self) {
// Self is already up-to-date.
forage._dbInfo.db = dbInfo.db;
forage._dbInfo.version = dbInfo.version;
}
}
});
}
function getItem(key, callback) {
var self = this;
// Cast the key to a string, as that's all we can set as a key.
if (typeof key !== 'string') {
console.warn(key + ' used as a key, but it is not a string.');
key = String(key);
}
var promise = new Promise$1(function (resolve, reject) {
self.ready().then(function () {
var dbInfo = self._dbInfo;
var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly').objectStore(dbInfo.storeName);
var req = store.get(key);
req.onsuccess = function () {
var value = req.result;
if (value === undefined) {
value = null;
}
if (_isEncodedBlob(value)) {
value = _decodeBlob(value);
}
resolve(value);
};
req.onerror = function () {
reject(req.error);
};
})["catch"](reject);
});
executeCallback(promise, callback);
return promise;
}
// Iterate over all items stored in database.
function iterate(iterator, callback) {
var self = this;
var promise = new Promise$1(function (resolve, reject) {
self.ready().then(function () {
var dbInfo = self._dbInfo;
var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly').objectStore(dbInfo.storeName);
var req = store.openCursor();
var iterationNumber = 1;
req.onsuccess = function () {
var cursor = req.result;
if (cursor) {
var value = cursor.value;
if (_isEncodedBlob(value)) {
value = _decodeBlob(value);
}
var result = iterator(value, cursor.key, iterationNumber++);
if (result !== void 0) {
resolve(result);
} else {
cursor["continue"]();
}
} else {
resolve();
}
};
req.onerror = function () {
reject(req.error);
};
})["catch"](reject);
});
executeCallback(promise, callback);
return promise;
}
function setItem(key, value, callback) {
var self = this;
// Cast the key to a string, as that's all we can set as a key.
if (typeof key !== 'string') {
console.warn(key + ' used as a key, but it is not a string.');
key = String(key);
}
var promise = new Promise$1(function (resolve, reject) {
var dbInfo;
self.ready().then(function () {
dbInfo = self._dbInfo;
if (toString.call(value) === '[object Blob]') {
return _checkBlobSupport(dbInfo.db).then(function (blobSupport) {
if (blobSupport) {
return value;
}
return _encodeBlob(value);
});
}
return value;
}).then(function (value) {
var transaction = dbInfo.db.transaction(dbInfo.storeName, 'readwrite');
var store = transaction.objectStore(dbInfo.storeName);
// The reason we don't _save_ null is because IE 10 does
// not support saving the `null` type in IndexedDB. How
// ironic, given the bug below!
// See: https://github.com/mozilla/localForage/issues/161
if (value === null) {
value = undefined;
}
transaction.oncomplete = function () {
// Cast to undefined so the value passed to
// callback/promise is the same as what one would get out
// of `getItem()` later. This leads to some weirdness
// (setItem('foo', undefined) will return `null`), but
// it's not my fault localStorage is our baseline and that
// it's weird.
if (value === undefined) {
value = null;
}
resolve(value);
};
transaction.onabort = transaction.onerror = function () {
var err = req.error ? req.error : req.transaction.error;
reject(err);
};
var req = store.put(value, key);
})["catch"](reject);
});
executeCallback(promise, callback);
return promise;
}
function removeItem(key, callback) {
var self = this;
// Cast the key to a string, as that's all we can set as a key.
if (typeof key !== 'string') {
console.warn(key + ' used as a key, but it is not a string.');
key = String(key);
}
var promise = new Promise$1(function (resolve, reject) {
self.ready().then(function () {
var dbInfo = self._dbInfo;
var transaction = dbInfo.db.transaction(dbInfo.storeName, 'readwrite');
var store = transaction.objectStore(dbInfo.storeName);
// We use a Grunt task to make this safe for IE and some
// versions of Android (including those used by Cordova).
// Normally IE won't like `.delete()` and will insist on
// using `['delete']()`, but we have a build step that
// fixes this for us now.
var req = store["delete"](key);
transaction.oncomplete = function () {
resolve();
};
transaction.onerror = function () {
reject(req.error);
};
// The request will be also be aborted if we've exceeded our storage
// space.
transaction.onabort = function () {
var err = req.error ? req.error : req.transaction.error;
reject(err);
};
})["catch"](reject);
});
executeCallback(promise, callback);
return promise;
}
function clear(callback) {
var self = this;
var promise = new Promise$1(function (resolve, reject) {
self.ready().then(function () {
var dbInfo = self._dbInfo;
var transaction = dbInfo.db.transaction(dbInfo.storeName, 'readwrite');
var store = transaction.objectStore(dbInfo.storeName);
var req = store.clear();
transaction.oncomplete = function () {
resolve();
};
transaction.onabort = transaction.onerror = function () {
var err = req.error ? req.error : req.transaction.error;
reject(err);
};
})["catch"](reject);
});
executeCallback(promise, callback);
return promise;
}
function length(callback) {
var self = this;
var promise = new Promise$1(function (resolve, reject) {
self.ready().then(function () {
var dbInfo = self._dbInfo;
var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly').objectStore(dbInfo.storeName);
var req = store.count();
req.onsuccess = function () {
resolve(req.result);
};
req.onerror = function () {
reject(req.error);
};
})["catch"](reject);
});
executeCallback(promise, callback);
return promise;
}
function key(n, callback) {
var self = this;
var promise = new Promise$1(function (resolve, reject) {
if (n < 0) {
resolve(null);
return;
}
self.ready().then(function () {
var dbInfo = self._dbInfo;
var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly').objectStore(dbInfo.storeName);
var advanced = false;
var req = store.openCursor();
req.onsuccess = function () {
var cursor = req.result;
if (!cursor) {
// this means there weren't enough keys
resolve(null);
return;
}
if (n === 0) {
// We have the first key, return it if that's what they
// wanted.
resolve(cursor.key);
} else {
if (!advanced) {
// Otherwise, ask the cursor to skip ahead n
// records.
advanced = true;
cursor.advance(n);
} else {
// When we get here, we've got the nth key.
resolve(cursor.key);
}
}
};
req.onerror = function () {
reject(req.error);
};
})["catch"](reject);
});
executeCallback(promise, callback);
return promise;
}
function keys(callback) {
var self = this;
var promise = new Promise$1(function (resolve, reject) {
self.ready().then(function () {
var dbInfo = self._dbInfo;
var store = dbInfo.db.transaction(dbInfo.storeName, 'readonly').objectStore(dbInfo.storeName);
var req = store.openCursor();
var keys = [];
req.onsuccess = function () {
var cursor = req.result;
if (!cursor) {
resolve(keys);
return;
}
keys.push(cursor.key);
cursor["continue"]();
};
req.onerror = function () {
reject(req.error);
};
})["catch"](reject);
});
executeCallback(promise, callback);
return promise;
}
var asyncStorage = {
_driver: 'asyncStorage',
_initStorage: _initStorage,
iterate: iterate,
getItem: getItem,
setItem: setItem,
removeItem: removeItem,
clear: clear,
length: length,
key: key,
keys: keys
};
// Sadly, the best way to save binary data in WebSQL/localStorage is serializing
// it to Base64, so this is how we store it to prevent very strange errors with less
// verbose ways of binary <-> string data storage.
var BASE_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
var BLOB_TYPE_PREFIX = '~~local_forage_type~';
var BLOB_TYPE_PREFIX_REGEX = /^~~local_forage_type~([^~]+)~/;
var SERIALIZED_MARKER = '__lfsc__:';
var SERIALIZED_MARKER_LENGTH = SERIALIZED_MARKER.length;
// OMG the serializations!
var TYPE_ARRAYBUFFER = 'arbf';
var TYPE_BLOB = 'blob';
var TYPE_INT8ARRAY = 'si08';
var TYPE_UINT8ARRAY = 'ui08';
var TYPE_UINT8CLAMPEDARRAY = 'uic8';
var TYPE_INT16ARRAY = 'si16';
var TYPE_INT32ARRAY = 'si32';
var TYPE_UINT16ARRAY = 'ur16';
var TYPE_UINT32ARRAY = 'ui32';
var TYPE_FLOAT32ARRAY = 'fl32';
var TYPE_FLOAT64ARRAY = 'fl64';
var TYPE_SERIALIZED_MARKER_LENGTH = SERIALIZED_MARKER_LENGTH + TYPE_ARRAYBUFFER.length;
var toString$1 = Object.prototype.toString;
function stringToBuffer(serializedString) {
// Fill the string into a ArrayBuffer.
var bufferLength = serializedString.length * 0.75;
var len = serializedString.length;
var i;
var p = 0;
var encoded1, encoded2, encoded3, encoded4;
if (serializedString[serializedString.length - 1] === '=') {
bufferLength--;
if (serializedString[serializedString.length - 2] === '=') {
bufferLength--;
}
}
var buffer = new ArrayBuffer(bufferLength);
var bytes = new Uint8Array(buffer);
for (i = 0; i < len; i += 4) {
encoded1 = BASE_CHARS.indexOf(serializedString[i]);
encoded2 = BASE_CHARS.indexOf(serializedString[i + 1]);
encoded3 = BASE_CHARS.indexOf(serializedString[i + 2]);
encoded4 = BASE_CHARS.indexOf(serializedString[i + 3]);
/*jslint bitwise: true */
bytes[p++] = encoded1 << 2 | encoded2 >> 4;
bytes[p++] = (encoded2 & 15) << 4 | encoded3 >> 2;
bytes[p++] = (encoded3 & 3) << 6 | encoded4 & 63;
}
return buffer;
}
// Converts a buffer to a string to store, serialized, in the backend
// storage library.
function bufferToString(buffer) {
// base64-arraybuffer
var bytes = new Uint8Array(buffer);
var base64String = '';
var i;
for (i = 0; i < bytes.length; i += 3) {
/*jslint bitwise: true */
base64String += BASE_CHARS[bytes[i] >> 2];
base64String += BASE_CHARS[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];
base64String += BASE_CHARS[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];
base64String += BASE_CHARS[bytes[i + 2] & 63];
}
if (bytes.length % 3 === 2) {
base64String = base64String.substring(0, base64String.length - 1) + '=';
} else if (bytes.length % 3 === 1) {
base64String = base64String.substring(0, base64String.length - 2) + '==';
}
return base64String;
}
// Serialize a value, afterwards executing a callback (which usually
// instructs the `setItem()` callback/promise to be executed). This is how
// we store binary data with localStorage.
function serialize(value, callback) {
var valueType = '';
if (value) {
valueType = toString$1.call(value);
}
// Cannot use `value instanceof ArrayBuffer` or such here, as these
// checks fail when running the tests using casper.js...
//
// TODO: See why those tests fail and use a better solution.
if (value && (valueType === '[object ArrayBuffer]' || value.buffer && toString$1.call(value.buffer) === '[object ArrayBuffer]')) {
// Convert binary arrays to a string and prefix the string with
// a special marker.
var buffer;
var marker = SERIALIZED_MARKER;
if (value instanceof ArrayBuffer) {
buffer = value;
marker += TYPE_ARRAYBUFFER;
} else {
buffer = value.buffer;
if (valueType === '[object Int8Array]') {
marker += TYPE_INT8ARRAY;
} else if (valueType === '[object Uint8Array]') {
marker += TYPE_UINT8ARRAY;
} else if (valueType === '[object Uint8ClampedArray]') {
marker += TYPE_UINT8CLAMPEDARRAY;
} else if (valueType === '[object Int16Array]') {
marker += TYPE_INT16ARRAY;
} else if (valueType === '[object Uint16Array]') {
marker += TYPE_UINT16ARRAY;
} else if (valueType === '[object Int32Array]') {
marker += TYPE_INT32ARRAY;
} else if (valueType === '[object Uint32Array]') {
marker += TYPE_UINT32ARRAY;
} else if (valueType === '[object Float32Array]') {
marker += TYPE_FLOAT32ARRAY;
} else if (valueType === '[object Float64Array]') {
marker += TYPE_FLOAT64ARRAY;
} else {
callback(new Error('Failed to get type for BinaryArray'));
}
}
callback(marker + bufferToString(buffer));
} else if (valueType === '[object Blob]') {
// Conver the blob to a binaryArray and then to a string.
var fileReader = new FileReader();
fileReader.onload = function () {
// Backwards-compatible prefix for the blob type.
var str = BLOB_TYPE_PREFIX + value.type + '~' + bufferToString(this.result);
callback(SERIALIZED_MARKER + TYPE_BLOB + str);
};
fileReader.readAsArrayBuffer(value);
} else {
try {
callback(JSON.stringify(value));
} catch (e) {
console.error("Couldn't convert value into a JSON string: ", value);
callback(null, e);
}
}
}
// Deserialize data we've inserted into a value column/field. We place
// special markers into our strings to mark them as encoded; this isn't
// as nice as a meta field, but it's the only sane thing we can do whilst
// keeping localStorage support intact.
//
// Oftentimes this will just deserialize JSON content, but if we have a
// special marker (SERIALIZED_MARKER, defined above), we will extract
// some kind of arraybuffer/binary data/typed array out of the string.
function deserialize(value) {
// If we haven't marked this string as being specially serialized (i.e.
// something other than serialized JSON), we can just return it and be
// done with it.
if (value.substring(0, SERIALIZED_MARKER_LENGTH) !== SERIALIZED_MARKER) {
return JSON.parse(value);
}
// The following code deals with deserializing some kind of Blob or
// TypedArray. First we separate out the type of data we're dealing
// with from the data itself.
var serializedString = value.substring(TYPE_SERIALIZED_MARKER_LENGTH);
var type = value.substring(SERIALIZED_MARKER_LENGTH, TYPE_SERIALIZED_MARKER_LENGTH);
var blobType;
// Backwards-compatible blob type serialization strategy.
// DBs created with older versions of localForage will simply not have the blob type.
if (type === TYPE_BLOB && BLOB_TYPE_PREFIX_REGEX.test(serializedString)) {
var matcher = serializedString.match(BLOB_TYPE_PREFIX_REGEX);
blobType = matcher[1];
serializedString = serializedString.substring(matcher[0].length);
}
var buffer = stringToBuffer(serializedString);
// Return the right type based on the code/type set during
// serialization.
switch (type) {
case TYPE_ARRAYBUFFER:
return buffer;
case TYPE_BLOB:
return createBlob([buffer], { type: blobType });
case TYPE_INT8ARRAY:
return new Int8Array(buffer);
case TYPE_UINT8ARRAY:
return new Uint8Array(buffer);
case TYPE_UINT8CLAMPEDARRAY:
return new Uint8ClampedArray(buffer);
case TYPE_INT16ARRAY:
return new Int16Array(buffer);
case TYPE_UINT16ARRAY:
return new Uint16Array(buffer);
case TYPE_INT32ARRAY:
return new Int32Array(buffer);
case TYPE_UINT32ARRAY:
return new Uint32Array(buffer);
case TYPE_FLOAT32ARRAY:
return new Float32Array(buffer);
case TYPE_FLOAT64ARRAY:
return new Float64Array(buffer);
default:
throw new Error('Unkown type: ' + type);
}
}
var localforageSerializer = {
serialize: serialize,
deserialize: deserialize,
stringToBuffer: stringToBuffer,
bufferToString: bufferToString
};
/*
* Includes code from:
*
* base64-arraybuffer
* https://github.com/niklasvh/base64-arraybuffer
*
* Copyright (c) 2012 Niklas von Hertzen
* Licensed under the MIT license.
*/
// Open the WebSQL database (automatically creates one if one didn't
// previously exist), using any options set in the config.
function _initStorage$1(options) {
var self = this;
var dbInfo = {
db: null
};
if (options) {
for (var i in options) {
dbInfo[i] = typeof options[i] !== 'string' ? options[i].toString() : options[i];
}
}
var dbInfoPromise = new Promise$1(function (resolve, reject) {
// Open the database; the openDatabase API will automatically
// create it for us if it doesn't exist.
try {
dbInfo.db = openDatabase(dbInfo.name, String(dbInfo.version), dbInfo.description, dbInfo.size);
} catch (e) {
return reject(e);
}
// Create our key/value table if it doesn't exist.
dbInfo.db.transaction(function (t) {
t.executeSql('CREATE TABLE IF NOT EXISTS ' + dbInfo.storeName + ' (id INTEGER PRIMARY KEY, key unique, value)', [], function () {
self._dbInfo = dbInfo;
resolve();
}, function (t, error) {
reject(error);
});
});
});
dbInfo.serializer = localforageSerializer;
return dbInfoPromise;
}
function getItem$1(key, callback) {
var self = this;
// Cast the key to a string, as that's all we can set as a key.
if (typeof key !== 'string') {
console.warn(key + ' used as a key, but it is not a string.');
key = String(key);
}
var promise = new Promise$1(function (resolve, reject) {
self.ready().then(function () {
var dbInfo = self._dbInfo;
dbInfo.db.transaction(function (t) {
t.executeSql('SELECT * FROM ' + dbInfo.storeName + ' WHERE key = ? LIMIT 1', [key], function (t, results) {
var result = results.rows.length ? results.rows.item(0).value : null;
// Check to see if this is serialized content we need to
// unpack.
if (result) {
result = dbInfo.serializer.deserialize(result);
}
resolve(result);
}, function (t, error) {
reject(error);
});
});
})["catch"](reject);
});
executeCallback(promise, callback);
return promise;
}
function iterate$1(iterator, callback) {
var self = this;
var promise = new Promise$1(function (resolve, reject) {
self.ready().then(function () {
var dbInfo = self._dbInfo;
dbInfo.db.transaction(function (t) {
t.executeSql('SELECT * FROM ' + dbInfo.storeName, [], function (t, results) {
var rows = results.rows;
var length = rows.length;
for (var i = 0; i < length; i++) {
var item = rows.item(i);
var result = item.value;
// Check to see if this is serialized content
// we need to unpack.
if (result) {
result = dbInfo.serializer.deserialize(result);
}
result = iterator(result, item.key, i + 1);
// void(0) prevents problems with redefinition
// of `undefined`.
if (result !== void 0) {
resolve(result);
return;
}
}
resolve();
}, function (t, error) {
reject(error);
});
});
})["catch"](reject);
});
executeCallback(promise, callback);
return promise;
}
function setItem$1(key, value, callback) {
var self = this;
// Cast the key to a string, as that's all we can set as a key.
if (typeof key !== 'string') {
console.warn(key + ' used as a key, but it is not a string.');
key = String(key);
}
var promise = new Promise$1(function (resolve, reject) {
self.ready().then(function () {
// The localStorage API doesn't return undefined values in an
// "expected" way, so undefined is always cast to null in all
// drivers. See: https://github.com/mozilla/localForage/pull/42
if (value === undefined) {
value = null;
}
// Save the original value to pass to the callback.
var originalValue = value;
var dbInfo = self._dbInfo;
dbInfo.serializer.serialize(value, function (value, error) {
if (error) {
reject(error);
} else {
dbInfo.db.transaction(function (t) {
t.executeSql('INSERT OR REPLACE INTO ' + dbInfo.storeName + ' (key, value) VALUES (?, ?)', [key, value], function () {
resolve(originalValue);
}, function (t, error) {
reject(error);
});
}, function (sqlError) {
// The transaction failed; check
// to see if it's a quota error.
if (sqlError.code === sqlError.QUOTA_ERR) {
// We reject the callback outright for now, but
// it's worth trying to re-run the transaction.
// Even if the user accepts the prompt to use
// more storage on Safari, this error will
// be called.
//
// TODO: Try to re-run the transaction.
reject(sqlError);
}
});
}
});
})["catch"](reject);
});
executeCallback(promise, callback);
return promise;
}
function removeItem$1(key, callback) {
var self = this;
// Cast the key to a string, as that's all we can set as a key.
if (typeof key !== 'string') {
console.warn(key + ' used as a key, but it is not a string.');
key = String(key);
}
var promise = new Promise$1(function (resolve, reject) {
self.ready().then(function () {
var dbInfo = self._dbInfo;
dbInfo.db.transaction(function (t) {
t.executeSql('DELETE FROM ' + dbInfo.storeName + ' WHERE key = ?', [key], function () {
resolve();
}, function (t, error) {
reject(error);
});
});
})["catch"](reject);
});
executeCallback(promise, callback);
return promise;
}
// Deletes every item in the table.
// TODO: Find out if this resets the AUTO_INCREMENT number.
function clear$1(callback) {
var self = this;
var promise = new Promise$1(function (resolve, reject) {
self.ready().then(function () {
var dbInfo = self._dbInfo;
dbInfo.db.transaction(function (t) {
t.executeSql('DELETE FROM ' + dbInfo.storeName, [], function () {
resolve();
}, function (t, error) {
reject(error);
});
});
})["catch"](reject);
});
executeCallback(promise, callback);
return promise;
}
// Does a simple `COUNT(key)` to get the number of items stored in
// localForage.
function length$1(callback) {
var self = this;
var promise = new Promise$1(function (resolve, reject) {
self.ready().then(function () {
var dbInfo = self._dbInfo;
dbInfo.db.transaction(function (t) {
// Ahhh, SQL makes this one soooooo easy.
t.executeSql('SELECT COUNT(key) as c FROM ' + dbInfo.storeName, [], function (t, results) {
var result = results.rows.item(0).c;
resolve(result);
}, function (t, error) {
reject(error);
});
});
})["catch"](reject);
});
executeCallback(promise, callback);
return promise;
}
// Return the key located at key index X; essentially gets the key from a
// `WHERE id = ?`. This is the most efficient way I can think to implement
// this rarely-used (in my experience) part of the API, but it can seem
// inconsistent, because we do `INSERT OR REPLACE INTO` on `setItem()`, so
// the ID of each key will change every time it's updated. Perhaps a stored
// procedure for the `setItem()` SQL would solve this problem?
// TODO: Don't change ID on `setItem()`.
function key$1(n, callback) {
var self = this;
var promise = new Promise$1(function (resolve, reject) {
self.ready().then(function () {
var dbInfo = self._dbInfo;
dbInfo.db.transaction(function (t) {
t.executeSql('SELECT key FROM ' + dbInfo.storeName + ' WHERE id = ? LIMIT 1', [n + 1], function (t, results) {
var result = results.rows.length ? results.rows.item(0).key : null;
resolve(result);
}, function (t, error) {
reject(error);
});
});
})["catch"](reject);
});
executeCallback(promise, callback);
return promise;
}
function keys$1(callback) {
var self = this;
var promise = new Promise$1(function (resolve, reject) {
self.ready().then(function () {
var dbInfo = self._dbInfo;
dbInfo.db.transaction(function (t) {
t.executeSql('SELECT key FROM ' + dbInfo.storeName, [], function (t, results) {
var keys = [];
for (var i = 0; i < results.rows.length; i++) {
keys.push(results.rows.item(i).key);
}
resolve(keys);
}, function (t, error) {
reject(error);
});
});
})["catch"](reject);
});
executeCallback(promise, callback);
return promise;
}
var webSQLStorage = {
_driver: 'webSQLStorage',
_initStorage: _initStorage$1,
iterate: iterate$1,
getItem: getItem$1,
setItem: setItem$1,
removeItem: removeItem$1,
clear: clear$1,
length: length$1,
key: key$1,
keys: keys$1
};
// Config the localStorage backend, using options set in the config.
function _initStorage$2(options) {
var self = this;
var dbInfo = {};
if (options) {
for (var i in options) {
dbInfo[i] = options[i];
}
}
dbInfo.keyPrefix = dbInfo.name + '/';
if (dbInfo.storeName !== self._defaultConfig.storeName) {
dbInfo.keyPrefix += dbInfo.storeName + '/';
}
self._dbInfo = dbInfo;
dbInfo.serializer = localforageSerializer;
return Promise$1.resolve();
}
// Remove all keys from the datastore, effectively destroying all data in
// the app's key/value store!
function clear$2(callback) {
var self = this;
var promise = self.ready().then(function () {
var keyPrefix = self._dbInfo.keyPrefix;
for (var i = localStorage.length - 1; i >= 0; i--) {
var key = localStorage.key(i);
if (key.indexOf(keyPrefix) === 0) {
localStorage.removeItem(key);
}
}
});
executeCallback(promise, callback);
return promise;
}
// Retrieve an item from the store. Unlike the original async_storage
// library in Gaia, we don't modify return values at all. If a key's value
// is `undefined`, we pass that value to the callback function.
function getItem$2(key, callback) {
var self = this;
// Cast the key to a string, as that's all we can set as a key.
if (typeof key !== 'string') {
console.warn(key + ' used as a key, but it is not a string.');
key = String(key);
}
var promise = self.ready().then(function () {
var dbInfo = self._dbInfo;
var result = localStorage.getItem(dbInfo.keyPrefix + key);
// If a result was found, parse it from the serialized
// string into a JS object. If result isn't truthy, the key
// is likely undefined and we'll pass it straight to the
// callback.
if (result) {
result = dbInfo.serializer.deserialize(result);
}
return result;
});
executeCallback(promise, callback);
return promise;
}
// Iterate over all items in the store.
function iterate$2(iterator, callback) {
var self = this;
var promise = self.ready().then(function () {
var dbInfo = self._dbInfo;
var keyPrefix = dbInfo.keyPrefix;
var keyPrefixLength = keyPrefix.length;
var length = localStorage.length;
// We use a dedicated iterator instead of the `i` variable below
// so other keys we fetch in localStorage aren't counted in
// the `iterationNumber` argument passed to the `iterate()`
// callback.
//
// See: github.com/mozilla/localForage/pull/435#discussion_r38061530
var iterationNumber = 1;
for (var i = 0; i < length; i++) {
var key = localStorage.key(i);
if (key.indexOf(keyPrefix) !== 0) {
continue;
}
var value = localStorage.getItem(key);
// If a result was found, parse it from the serialized
// string into a JS object. If result isn't truthy, the
// key is likely undefined and we'll pass it straight
// to the iterator.
if (value) {
value = dbInfo.serializer.deserialize(value);
}
value = iterator(value, key.substring(keyPrefixLength), iterationNumber++);
if (value !== void 0) {
return value;
}
}
});
executeCallback(promise, callback);
return promise;
}
// Same as localStorage's key() method, except takes a callback.
function key$2(n, callback) {
var self = this;
var promise = self.ready().then(function () {
var dbInfo = self._dbInfo;
var result;
try {
result = localStorage.key(n);
} catch (error) {
result = null;
}
// Remove the prefix from the key, if a key is found.
if (result) {
result = result.substring(dbInfo.keyPrefix.length);
}
return result;
});
executeCallback(promise, callback);
return promise;
}
function keys$2(callback) {
var self = this;
var promise = self.ready().then(function () {
var dbInfo = self._dbInfo;
var length = localStorage.length;
var keys = [];
for (var i = 0; i < length; i++) {
if (localStorage.key(i).indexOf(dbInfo.keyPrefix) === 0) {
keys.push(localStorage.key(i).substring(dbInfo.keyPrefix.length));
}
}
return keys;
});
executeCallback(promise, callback);
return promise;
}
// Supply the number of keys in the datastore to the callback function.
function length$2(callback) {
var self = this;
var promise = self.keys().then(function (keys) {
return keys.length;
});
executeCallback(promise, callback);
return promise;
}
// Remove an item from the store, nice and simple.
function removeItem$2(key, callback) {
var self = this;
// Cast the key to a string, as that's all we can set as a key.
if (typeof key !== 'string') {
console.warn(key + ' used as a key, but it is not a string.');
key = String(key);
}
var promise = self.ready().then(function () {
var dbInfo = self._dbInfo;
localStorage.removeItem(dbInfo.keyPrefix + key);
});
executeCallback(promise, callback);
return promise;
}
// Set a key's value and run an optional callback once the value is set.
// Unlike Gaia's implementation, the callback function is passed the value,
// in case you want to operate on that value only after you're sure it
// saved, or something like that.
function setItem$2(key, value, callback) {
var self = this;
// Cast the key to a string, as that's all we can set as a key.
if (typeof key !== 'string') {
console.warn(key + ' used as a key, but it is not a string.');
key = String(key);
}
var promise = self.ready().then(function () {
// Convert undefined values to null.
// https://github.com/mozilla/localForage/pull/42
if (value === undefined) {
value = null;
}
// Save the original value to pass to the callback.
var originalValue = value;
return new Promise$1(function (resolve, reject) {
var dbInfo = self._dbInfo;
dbInfo.serializer.serialize(value, function (value, error) {
if (error) {
reject(error);
} else {
try {
localStorage.setItem(dbInfo.keyPrefix + key, value);
resolve(originalValue);
} catch (e) {
// localStorage capacity exceeded.
// TODO: Make this a specific error/event.
if (e.name === 'QuotaExceededError' || e.name === 'NS_ERROR_DOM_QUOTA_REACHED') {
reject(e);
}
reject(e);
}
}
});
});
});
executeCallback(promise, callback);
return promise;
}
var localStorageWrapper = {
_driver: 'localStorageWrapper',
_initStorage: _initStorage$2,
// Default API, from Gaia/localStorage.
iterate: iterate$2,
getItem: getItem$2,
setItem: setItem$2,
removeItem: removeItem$2,
clear: clear$2,
length: length$2,
key: key$2,
keys: keys$2
};
// Custom drivers are stored here when `defineDriver()` is called.
// They are shared across all instances of localForage.
var CustomDrivers = {};
var DriverType = {
INDEXEDDB: 'asyncStorage',
LOCALSTORAGE: 'localStorageWrapper',
WEBSQL: 'webSQLStorage'
};
var DefaultDriverOrder = [DriverType.INDEXEDDB, DriverType.WEBSQL, DriverType.LOCALSTORAGE];
var LibraryMethods = ['clear', 'getItem', 'iterate', 'key', 'keys', 'length', 'removeItem', 'setItem'];
var DefaultConfig = {
description: '',
driver: DefaultDriverOrder.slice(),
name: 'localforage',
// Default DB size is _JUST UNDER_ 5MB, as it's the highest size
// we can use without a prompt.
size: 4980736,
storeName: 'keyvaluepairs',
version: 1.0
};
var driverSupport = {};
// Check to see if IndexedDB is available and if it is the latest
// implementation; it's our preferred backend library. We use "_spec_test"
// as the name of the database because it's not the one we'll operate on,
// but it's useful to make sure its using the right spec.
// See: https://github.com/mozilla/localForage/issues/128
driverSupport[DriverType.INDEXEDDB] = isIndexedDBValid();
driverSupport[DriverType.WEBSQL] = isWebSQLValid();
driverSupport[DriverType.LOCALSTORAGE] = isLocalStorageValid();
var isArray = Array.isArray || function (arg) {
return Object.prototype.toString.call(arg) === '[object Array]';
};
function callWhenReady(localForageInstance, libraryMethod) {
localForageInstance[libraryMethod] = function () {
var _args = arguments;
return localForageInstance.ready().then(function () {
return localForageInstance[libraryMethod].apply(localForageInstance, _args);
});
};
}
function extend() {
for (var i = 1; i < arguments.length; i++) {
var arg = arguments[i];
if (arg) {
for (var key in arg) {
if (arg.hasOwnProperty(key)) {
if (isArray(arg[key])) {
arguments[0][key] = arg[key].slice();
} else {
arguments[0][key] = arg[key];
}
}
}
}
}
return arguments[0];
}
function isLibraryDriver(driverName) {
for (var driver in DriverType) {
if (DriverType.hasOwnProperty(driver) && DriverType[driver] === driverName) {
return true;
}
}
return false;
}
var LocalForage = function () {
function LocalForage(options) {
_classCallCheck(this, LocalForage);
this.INDEXEDDB = DriverType.INDEXEDDB;
this.LOCALSTORAGE = DriverType.LOCALSTORAGE;
this.WEBSQL = DriverType.WEBSQL;
this._defaultConfig = extend({}, DefaultConfig);
this._config = extend({}, this._defaultConfig, options);
this._driverSet = null;
this._initDriver = null;
this._ready = false;
this._dbInfo = null;
this._wrapLibraryMethodsWithReady();
this.setDriver(this._config.driver);
}
// Set any config values for localForage; can be called anytime before
// the first API call (e.g. `getItem`, `setItem`).
// We loop through options so we don't overwrite existing config
// values.
LocalForage.prototype.config = function config(options) {
// If the options argument is an object, we use it to set values.
// Otherwise, we return either a specified config value or all
// config values.
if ((typeof options === 'undefined' ? 'undefined' : _typeof(options)) === 'object') {
// If localforage is ready and fully initialized, we can't set
// any new configuration values. Instead, we return an error.
if (this._ready) {
return new Error("Can't call config() after localforage " + 'has been used.');
}
for (var i in options) {
if (i === 'storeName') {
options[i] = options[i].replace(/\W/g, '_');
}
this._config[i] = options[i];
}
// after all config options are set and
// the driver option is used, try setting it
if ('driver' in options && options.driver) {
this.setDriver(this._config.driver);
}
return true;
} else if (typeof options === 'string') {
return this._config[options];
} else {
return this._config;
}
};
// Used to define a custom driver, shared across all instances of
// localForage.
LocalForage.prototype.defineDriver = function defineDriver(driverObject, callback, errorCallback) {
var promise = new Promise$1(function (resolve, reject) {
try {
var driverName = driverObject._driver;
var complianceError = new Error('Custom driver not compliant; see ' + 'https://mozilla.github.io/localForage/#definedriver');
var namingError = new Error('Custom driver name already in use: ' + driverObject._driver);
// A driver name should be defined and not overlap with the
// library-defined, default drivers.
if (!driverObject._driver) {
reject(complianceError);
return;
}
if (isLibraryDriver(driverObject._driver)) {
reject(namingError);
return;
}
var customDriverMethods = LibraryMethods.concat('_initStorage');
for (var i = 0; i < customDriverMethods.length; i++) {
var customDriverMethod = customDriverMethods[i];
if (!customDriverMethod || !driverObject[customDriverMethod] || typeof driverObject[customDriverMethod] !== 'function') {
reject(complianceError);
return;
}
}
var supportPromise = Promise$1.resolve(true);
if ('_support' in driverObject) {
if (driverObject._support && typeof driverObject._support === 'function') {
supportPromise = driverObject._support();
} else {
supportPromise = Promise$1.resolve(!!driverObject._support);
}
}
supportPromise.then(function (supportResult) {
driverSupport[driverName] = supportResult;
CustomDrivers[driverName] = driverObject;
resolve();
}, reject);
} catch (e) {
reject(e);
}
});
executeTwoCallbacks(promise, callback, errorCallback);
return promise;
};
LocalForage.prototype.driver = function driver() {
return this._driver || null;
};
LocalForage.prototype.getDriver = function getDriver(driverName, callback, errorCallback) {
var self = this;
var getDriverPromise = Promise$1.resolve().then(function () {
if (isLibraryDriver(driverName)) {
switch (driverName) {
case self.INDEXEDDB:
return asyncStorage;
case self.LOCALSTORAGE:
return localStorageWrapper;
case self.WEBSQL:
return webSQLStorage;
}
} else if (CustomDrivers[driverName]) {
return CustomDrivers[driverName];
} else {
throw new Error('Driver not found.');
}
});
executeTwoCallbacks(getDriverPromise, callback, errorCallback);
return getDriverPromise;
};
LocalForage.prototype.getSerializer = function getSerializer(callback) {
var serializerPromise = Promise$1.resolve(localforageSerializer);
executeTwoCallbacks(serializerPromise, callback);
return serializerPromise;
};
LocalForage.prototype.ready = function ready(callback) {
var self = this;
var promise = self._driverSet.then(function () {
if (self._ready === null) {
self._ready = self._initDriver();
}
return self._ready;
});
executeTwoCallbacks(promise, callback, callback);
return promise;
};
LocalForage.prototype.setDriver = function setDriver(drivers, callback, errorCallback) {
var self = this;
if (!isArray(drivers)) {
drivers = [drivers];
}
var supportedDrivers = this._getSupportedDrivers(drivers);
function setDriverToConfig() {
self._config.driver = self.driver();
}
function initDriver(supportedDrivers) {
return function () {
var currentDriverIndex = 0;
function driverPromiseLoop() {
while (currentDriverIndex < supportedDrivers.length) {
var driverName = supportedDrivers[currentDriverIndex];
currentDriverIndex++;
self._dbInfo = null;
self._ready = null;
return self.getDriver(driverName).then(function (driver) {
self._extend(driver);
setDriverToConfig();
self._ready = self._initStorage(self._config);
return self._ready;
})["catch"](driverPromiseLoop);
}
setDriverToConfig();
var error = new Error('No available storage method found.');
self._driverSet = Promise$1.reject(error);
return self._driverSet;
}
return driverPromiseLoop();
};
}
// There might be a driver initialization in progress
// so wait for it to finish in order to avoid a possible
// race condition to set _dbInfo
var oldDriverSetDone = this._driverSet !== null ? this._driverSet["catch"](function () {
return Promise$1.resolve();
}) : Promise$1.resolve();
this._driverSet = oldDriverSetDone.then(function () {
var driverName = supportedDrivers[0];
self._dbInfo = null;
self._ready = null;
return self.getDriver(driverName).then(function (driver) {
self._driver = driver._driver;
setDriverToConfig();
self._wrapLibraryMethodsWithReady();
self._initDriver = initDriver(supportedDrivers);
});
})["catch"](function () {
setDriverToConfig();
var error = new Error('No available storage method found.');
self._driverSet = Promise$1.reject(error);
return self._driverSet;
});
executeTwoCallbacks(this._driverSet, callback, errorCallback);
return this._driverSet;
};
LocalForage.prototype.supports = function supports(driverName) {
return !!driverSupport[driverName];
};
LocalForage.prototype._extend = function _extend(libraryMethodsAndProperties) {
extend(this, libraryMethodsAndProperties);
};
LocalForage.prototype._getSupportedDrivers = function _getSupportedDrivers(drivers) {
var supportedDrivers = [];
for (var i = 0, len = drivers.length; i < len; i++) {
var driverName = drivers[i];
if (this.supports(driverName)) {
supportedDrivers.push(driverName);
}
}
return supportedDrivers;
};
LocalForage.prototype._wrapLibraryMethodsWithReady = function _wrapLibraryMethodsWithReady() {
// Add a stub for each driver API method that delays the call to the
// corresponding driver method until localForage is ready. These stubs
// will be replaced by the driver methods as soon as the driver is
// loaded, so there is no performance impact.
for (var i = 0; i < LibraryMethods.length; i++) {
callWhenReady(this, LibraryMethods[i]);
}
};
LocalForage.prototype.createInstance = function createInstance(options) {
return new LocalForage(options);
};
return LocalForage;
}();
// The actual localForage object that we expose as a module or via a
// global. It's extended by pulling in one of our other libraries.
var localforage_js = new LocalForage();
module.exports = localforage_js;
},{"3":3}]},{},[4])(4)
});
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(68)))
/***/ }),
/* 408 */
/***/ (function(module, exports, __webpack_require__) {
(function (global, factory) {
true ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.cordovaSQLiteDriver = factory());
}(this, function () { 'use strict';
function getSerializerPromise(localForageInstance) {
if (getSerializerPromise.result) {
return getSerializerPromise.result;
}
if (!localForageInstance || typeof localForageInstance.getSerializer !== 'function') {
return Promise.reject(new Error('localforage.getSerializer() was not available! ' + 'localforage v1.4+ is required!'));
}
getSerializerPromise.result = localForageInstance.getSerializer();
return getSerializerPromise.result;
}
function getDriverPromise(localForageInstance, driverName) {
getDriverPromise.result = getDriverPromise.result || {};
if (getDriverPromise.result[driverName]) {
return getDriverPromise.result[driverName];
}
if (!localForageInstance || typeof localForageInstance.getDriver !== 'function') {
return Promise.reject(new Error('localforage.getDriver() was not available! ' + 'localforage v1.4+ is required!'));
}
getDriverPromise.result[driverName] = localForageInstance.getDriver(driverName);
return getDriverPromise.result[driverName];
}
function getWebSqlDriverPromise(localForageInstance) {
return getDriverPromise(localForageInstance, localForageInstance.WEBSQL);
}
/* global document, sqlitePlugin */
// we can't import this, since it gets defined later
// import sqlitePlugin from 'sqlitePlugin';
var deviceReady = new Promise(function (resolve, reject) {
if (typeof sqlitePlugin !== 'undefined') {
resolve();
} else if (typeof cordova === 'undefined') {
reject(new Error('cordova is not defined.'));
} else {
// Wait for Cordova to load
document.addEventListener("deviceready", function () {
return resolve();
}, false);
}
});
var deviceReadyDone = deviceReady.catch(function () {
return Promise.resolve();
});
function getOpenDatabasePromise() {
return deviceReadyDone.then(function () {
if (typeof sqlitePlugin !== 'undefined' && typeof sqlitePlugin.openDatabase === 'function') {
return sqlitePlugin.openDatabase;
} else {
throw new Error('SQLite plugin is not present.');
}
});
}
// // If cordova is not present, we can stop now.
// if (!globalObject.cordova) {
// return;
// }
// Open the cordova sqlite plugin database (automatically creates one if one didn't
// previously exist), using any options set in the config.
function _initStorage(options) {
var self = this;
var dbInfo = {
db: null
};
if (options) {
for (var i in options) {
dbInfo[i] = typeof options[i] !== 'string' ? options[i].toString() : options[i];
}
}
var dbInfoPromise = getOpenDatabasePromise().then(function (openDatabase) {
return new Promise(function (resolve, reject) {
// Open the database; the openDatabase API will automatically
// create it for us if it doesn't exist.
try {
dbInfo.location = dbInfo.location || 'default';
dbInfo.db = openDatabase({
name: dbInfo.name,
version: String(dbInfo.version),
description: dbInfo.description,
size: dbInfo.size,
location: dbInfo.location
});
} catch (e) {
reject(e);
}
// Create our key/value table if it doesn't exist.
dbInfo.db.transaction(function (t) {
t.executeSql('CREATE TABLE IF NOT EXISTS ' + dbInfo.storeName + ' (id INTEGER PRIMARY KEY, key unique, value)', [], function () {
self._dbInfo = dbInfo;
resolve();
}, function (t, error) {
reject(error);
});
});
});
});
var serializerPromise = getSerializerPromise(self);
var webSqlDriverPromise = getWebSqlDriverPromise(self);
return Promise.all([serializerPromise, webSqlDriverPromise, dbInfoPromise]).then(function (results) {
dbInfo.serializer = results[0];
return dbInfoPromise;
});
}
var cordovaSQLiteDriver = {
_driver: 'cordovaSQLiteDriver',
_initStorage: _initStorage,
_support: function _support() {
return getOpenDatabasePromise().then(function (openDatabase) {
return !!openDatabase;
}).catch(function () {
return false;
});
}
};
function wireUpDriverMethods(driver) {
var LibraryMethods = ['clear', 'getItem', 'iterate', 'key', 'keys', 'length', 'removeItem', 'setItem'];
function wireUpDriverMethod(driver, methodName) {
driver[methodName] = function () {
var localForageInstance = this;
var args = arguments;
return getWebSqlDriverPromise(localForageInstance).then(function (webSqlDriver) {
return webSqlDriver[methodName].apply(localForageInstance, args);
});
};
}
for (var i = 0, len = LibraryMethods.length; i < len; i++) {
wireUpDriverMethod(driver, LibraryMethods[i]);
}
}
wireUpDriverMethods(cordovaSQLiteDriver);
return cordovaSQLiteDriver;
}));
/***/ }),
/* 409 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (immutable) */ __webpack_exports__["a"] = checkReady;
function checkReady() {
var DEVICE_READY_TIMEOUT = 5000;
// To help developers using cordova, we listen for the device ready event and
// log an error if it didn't fire in a reasonable amount of time. Generally,
// when this happens, developers should remove and reinstall plugins, since
// an inconsistent plugin is often the culprit.
var before = Date.now();
var didFireReady = false;
document.addEventListener('deviceready', function () {
console.log("Ionic Native: deviceready event fired after " + (Date.now() - before) + " ms");
didFireReady = true;
});
setTimeout(function () {
if (!didFireReady && !!window.cordova) {
console.warn("Ionic Native: deviceready did not fire within " + DEVICE_READY_TIMEOUT + "ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.");
}
}, DEVICE_READY_TIMEOUT);
}
//# sourceMappingURL=bootstrap.js.map
/***/ }),
/* 410 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var Observable_1 = __webpack_require__(9);
var fromEvent_1 = __webpack_require__(411);
Observable_1.Observable.fromEvent = fromEvent_1.fromEvent;
//# sourceMappingURL=fromEvent.js.map
/***/ }),
/* 411 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var FromEventObservable_1 = __webpack_require__(412);
exports.fromEvent = FromEventObservable_1.FromEventObservable.create;
//# sourceMappingURL=fromEvent.js.map
/***/ }),
/* 412 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Observable_1 = __webpack_require__(9);
var tryCatch_1 = __webpack_require__(124);
var isFunction_1 = __webpack_require__(69);
var errorObject_1 = __webpack_require__(71);
var Subscription_1 = __webpack_require__(39);
var toString = Object.prototype.toString;
function isNodeStyleEventEmitter(sourceObj) {
return !!sourceObj && typeof sourceObj.addListener === 'function' && typeof sourceObj.removeListener === 'function';
}
function isJQueryStyleEventEmitter(sourceObj) {
return !!sourceObj && typeof sourceObj.on === 'function' && typeof sourceObj.off === 'function';
}
function isNodeList(sourceObj) {
return !!sourceObj && toString.call(sourceObj) === '[object NodeList]';
}
function isHTMLCollection(sourceObj) {
return !!sourceObj && toString.call(sourceObj) === '[object HTMLCollection]';
}
function isEventTarget(sourceObj) {
return !!sourceObj && typeof sourceObj.addEventListener === 'function' && typeof sourceObj.removeEventListener === 'function';
}
/**
* We need this JSDoc comment for affecting ESDoc.
* @extends {Ignored}
* @hide true
*/
var FromEventObservable = (function (_super) {
__extends(FromEventObservable, _super);
function FromEventObservable(sourceObj, eventName, selector, options) {
_super.call(this);
this.sourceObj = sourceObj;
this.eventName = eventName;
this.selector = selector;
this.options = options;
}
/* tslint:enable:max-line-length */
/**
* Creates an Observable that emits events of a specific type coming from the
* given event target.
*
* <span class="informal">Creates an Observable from DOM events, or Node.js
* EventEmitter events or others.</span>
*
* <img src="./img/fromEvent.png" width="100%">
*
* `fromEvent` accepts as a first argument event target, which is an object with methods
* for registering event handler functions. As a second argument it takes string that indicates
* type of event we want to listen for. `fromEvent` supports selected types of event targets,
* which are described in detail below. If your event target does not match any of the ones listed,
* you should use {@link fromEventPattern}, which can be used on arbitrary APIs.
* When it comes to APIs supported by `fromEvent`, their methods for adding and removing event
* handler functions have different names, but they all accept a string describing event type
* and function itself, which will be called whenever said event happens.
*
* Every time resulting Observable is subscribed, event handler function will be registered
* to event target on given event type. When that event fires, value
* passed as a first argument to registered function will be emitted by output Observable.
* When Observable is unsubscribed, function will be unregistered from event target.
*
* Note that if event target calls registered function with more than one argument, second
* and following arguments will not appear in resulting stream. In order to get access to them,
* you can pass to `fromEvent` optional project function, which will be called with all arguments
* passed to event handler. Output Observable will then emit value returned by project function,
* instead of the usual value.
*
* Remember that event targets listed below are checked via duck typing. It means that
* no matter what kind of object you have and no matter what environment you work in,
* you can safely use `fromEvent` on that object if it exposes described methods (provided
* of course they behave as was described above). So for example if Node.js library exposes
* event target which has the same method names as DOM EventTarget, `fromEvent` is still
* a good choice.
*
* If the API you use is more callback then event handler oriented (subscribed
* callback function fires only once and thus there is no need to manually
* unregister it), you should use {@link bindCallback} or {@link bindNodeCallback}
* instead.
*
* `fromEvent` supports following types of event targets:
*
* **DOM EventTarget**
*
* This is an object with `addEventListener` and `removeEventListener` methods.
*
* In the browser, `addEventListener` accepts - apart from event type string and event
* handler function arguments - optional third parameter, which is either an object or boolean,
* both used for additional configuration how and when passed function will be called. When
* `fromEvent` is used with event target of that type, you can provide this values
* as third parameter as well.
*
* **Node.js EventEmitter**
*
* An object with `addListener` and `removeListener` methods.
*
* **JQuery-style event target**
*
* An object with `on` and `off` methods
*
* **DOM NodeList**
*
* List of DOM Nodes, returned for example by `document.querySelectorAll` or `Node.childNodes`.
*
* Although this collection is not event target in itself, `fromEvent` will iterate over all Nodes
* it contains and install event handler function in every of them. When returned Observable
* is unsubscribed, function will be removed from all Nodes.
*
* **DOM HtmlCollection**
*
* Just as in case of NodeList it is a collection of DOM nodes. Here as well event handler function is
* installed and removed in each of elements.
*
*
* @example <caption>Emits clicks happening on the DOM document</caption>
* var clicks = Rx.Observable.fromEvent(document, 'click');
* clicks.subscribe(x => console.log(x));
*
* // Results in:
* // MouseEvent object logged to console every time a click
* // occurs on the document.
*
*
* @example <caption>Use addEventListener with capture option</caption>
* var clicksInDocument = Rx.Observable.fromEvent(document, 'click', true); // note optional configuration parameter
* // which will be passed to addEventListener
* var clicksInDiv = Rx.Observable.fromEvent(someDivInDocument, 'click');
*
* clicksInDocument.subscribe(() => console.log('document'));
* clicksInDiv.subscribe(() => console.log('div'));
*
* // By default events bubble UP in DOM tree, so normally
* // when we would click on div in document
* // "div" would be logged first and then "document".
* // Since we specified optional `capture` option, document
* // will catch event when it goes DOWN DOM tree, so console
* // will log "document" and then "div".
*
* @see {@link bindCallback}
* @see {@link bindNodeCallback}
* @see {@link fromEventPattern}
*
* @param {EventTargetLike} target The DOM EventTarget, Node.js
* EventEmitter, JQuery-like event target, NodeList or HTMLCollection to attach the event handler to.
* @param {string} eventName The event name of interest, being emitted by the
* `target`.
* @param {EventListenerOptions} [options] Options to pass through to addEventListener
* @param {SelectorMethodSignature<T>} [selector] An optional function to
* post-process results. It takes the arguments from the event handler and
* should return a single value.
* @return {Observable<T>}
* @static true
* @name fromEvent
* @owner Observable
*/
FromEventObservable.create = function (target, eventName, options, selector) {
if (isFunction_1.isFunction(options)) {
selector = options;
options = undefined;
}
return new FromEventObservable(target, eventName, selector, options);
};
FromEventObservable.setupSubscription = function (sourceObj, eventName, handler, subscriber, options) {
var unsubscribe;
if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) {
for (var i = 0, len = sourceObj.length; i < len; i++) {
FromEventObservable.setupSubscription(sourceObj[i], eventName, handler, subscriber, options);
}
}
else if (isEventTarget(sourceObj)) {
var source_1 = sourceObj;
sourceObj.addEventListener(eventName, handler, options);
unsubscribe = function () { return source_1.removeEventListener(eventName, handler); };
}
else if (isJQueryStyleEventEmitter(sourceObj)) {
var source_2 = sourceObj;
sourceObj.on(eventName, handler);
unsubscribe = function () { return source_2.off(eventName, handler); };
}
else if (isNodeStyleEventEmitter(sourceObj)) {
var source_3 = sourceObj;
sourceObj.addListener(eventName, handler);
unsubscribe = function () { return source_3.removeListener(eventName, handler); };
}
else {
throw new TypeError('Invalid event target');
}
subscriber.add(new Subscription_1.Subscription(unsubscribe));
};
FromEventObservable.prototype._subscribe = function (subscriber) {
var sourceObj = this.sourceObj;
var eventName = this.eventName;
var options = this.options;
var selector = this.selector;
var handler = selector ? function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
var result = tryCatch_1.tryCatch(selector).apply(void 0, args);
if (result === errorObject_1.errorObject) {
subscriber.error(errorObject_1.errorObject.e);
}
else {
subscriber.next(result);
}
} : function (e) { return subscriber.next(e); };
FromEventObservable.setupSubscription(sourceObj, eventName, handler, subscriber, options);
};
return FromEventObservable;
}(Observable_1.Observable));
exports.FromEventObservable = FromEventObservable;
//# sourceMappingURL=FromEventObservable.js.map
/***/ }),
/* 413 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export InstanceCheck */
/* unused harmony export CordovaCheck */
/* harmony export (immutable) */ __webpack_exports__["d"] = Plugin;
/* harmony export (immutable) */ __webpack_exports__["a"] = Cordova;
/* harmony export (immutable) */ __webpack_exports__["b"] = CordovaInstance;
/* harmony export (immutable) */ __webpack_exports__["c"] = CordovaProperty;
/* unused harmony export InstanceProperty */
/* unused harmony export CordovaFunctionOverride */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__plugin__ = __webpack_require__(178);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util__ = __webpack_require__(98);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_Observable__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_Observable___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_rxjs_Observable__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_observable_throw__ = __webpack_require__(414);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_observable_throw___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_rxjs_observable_throw__);
/**
* @private
*/
function InstanceCheck(opts) {
if (opts === void 0) { opts = {}; }
return function (pluginObj, methodName, descriptor) {
return {
value: function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (Object(__WEBPACK_IMPORTED_MODULE_0__plugin__["b" /* instanceAvailability */])(this)) {
return descriptor.value.apply(this, args);
}
else {
if (opts.sync) {
return;
}
else if (opts.observable) {
return new __WEBPACK_IMPORTED_MODULE_2_rxjs_Observable__["Observable"](function () { });
}
return Object(__WEBPACK_IMPORTED_MODULE_1__util__["c" /* getPromise */])(function () { });
}
},
enumerable: true
};
};
}
/**
* Executes function only if plugin is available
* @private
*/
function CordovaCheck(opts) {
if (opts === void 0) { opts = {}; }
return function (pluginObj, methodName, descriptor) {
return {
value: function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var check = Object(__WEBPACK_IMPORTED_MODULE_0__plugin__["a" /* checkAvailability */])(pluginObj);
if (check === true) {
return descriptor.value.apply(this, args);
}
else {
if (opts.sync) {
return null;
}
else if (opts.observable) {
return __WEBPACK_IMPORTED_MODULE_2_rxjs_Observable__["Observable"].throw(new Error(check && check.error));
}
return Promise.reject(check && check.error);
}
},
enumerable: true
};
};
}
/**
* @private
*
* Class decorator specifying Plugin metadata. Required for all plugins.
*
* @usage
* ```typescript
* @Plugin({
* pluginName: 'MyPlugin',
* plugin: 'cordova-plugin-myplugin',
* pluginRef: 'window.myplugin'
* })
* export class MyPlugin {
*
* // Plugin wrappers, properties, and functions go here ...
*
* }
* ```
*/
function Plugin(config) {
return function (cls) {
// Add these fields to the class
for (var prop in config) {
cls[prop] = config[prop];
}
cls['installed'] = function (printWarning) {
return !!Object(__WEBPACK_IMPORTED_MODULE_1__util__["b" /* getPlugin */])(config.pluginRef);
};
cls['getPlugin'] = function () {
return Object(__WEBPACK_IMPORTED_MODULE_1__util__["b" /* getPlugin */])(config.pluginRef);
};
cls['checkInstall'] = function () {
return Object(__WEBPACK_IMPORTED_MODULE_0__plugin__["a" /* checkAvailability */])(cls) === true;
};
cls['getPluginName'] = function () {
return config.pluginName;
};
cls['getPluginRef'] = function () {
return config.pluginRef;
};
cls['getPluginInstallName'] = function () {
return config.plugin;
};
cls['getPluginRepo'] = function () {
return config.repo;
};
cls['getSupportedPlatforms'] = function () {
return config.platforms;
};
return cls;
};
}
/**
* @private
*
* Wrap a stub function in a call to a Cordova plugin, checking if both Cordova
* and the required plugin are installed.
*/
function Cordova(opts) {
if (opts === void 0) { opts = {}; }
return function (target, methodName, descriptor) {
return {
value: function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return Object(__WEBPACK_IMPORTED_MODULE_0__plugin__["d" /* wrap */])(this, methodName, opts).apply(this, args);
},
enumerable: true
};
};
}
/**
* @private
*
* Wrap an instance method
*/
function CordovaInstance(opts) {
if (opts === void 0) { opts = {}; }
return function (target, methodName) {
return {
value: function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return Object(__WEBPACK_IMPORTED_MODULE_0__plugin__["e" /* wrapInstance */])(this, methodName, opts).apply(this, args);
},
enumerable: true
};
};
}
/**
* @private
*
*
* Before calling the original method, ensure Cordova and the plugin are installed.
*/
function CordovaProperty(target, key) {
Object.defineProperty(target, key, {
enumerable: true,
get: function () {
if (Object(__WEBPACK_IMPORTED_MODULE_0__plugin__["a" /* checkAvailability */])(target, key) === true) {
return Object(__WEBPACK_IMPORTED_MODULE_1__util__["b" /* getPlugin */])(target.constructor.getPluginRef())[key];
}
else {
return null;
}
},
set: function (value) {
if (Object(__WEBPACK_IMPORTED_MODULE_0__plugin__["a" /* checkAvailability */])(target, key) === true) {
Object(__WEBPACK_IMPORTED_MODULE_1__util__["b" /* getPlugin */])(target.constructor.getPluginRef())[key] = value;
}
}
});
}
/**
* @private
* @param target
* @param key
* @constructor
*/
function InstanceProperty(target, key) {
Object.defineProperty(target, key, {
enumerable: true,
get: function () {
return this._objectInstance[key];
},
set: function (value) {
this._objectInstance[key] = value;
}
});
}
/**
* @private
*
* Wrap a stub function in a call to a Cordova plugin, checking if both Cordova
* and the required plugin are installed.
*/
function CordovaFunctionOverride(opts) {
if (opts === void 0) { opts = {}; }
return function (target, methodName, descriptor) {
return {
value: function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return Object(__WEBPACK_IMPORTED_MODULE_0__plugin__["c" /* overrideFunction */])(this, methodName, opts);
},
enumerable: true
};
};
}
//# sourceMappingURL=decorators.js.map
/***/ }),
/* 414 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var ErrorObservable_1 = __webpack_require__(415);
exports._throw = ErrorObservable_1.ErrorObservable.create;
//# sourceMappingURL=throw.js.map
/***/ }),
/* 415 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Observable_1 = __webpack_require__(9);
/**
* We need this JSDoc comment for affecting ESDoc.
* @extends {Ignored}
* @hide true
*/
var ErrorObservable = (function (_super) {
__extends(ErrorObservable, _super);
function ErrorObservable(error, scheduler) {
_super.call(this);
this.error = error;
this.scheduler = scheduler;
}
/**
* Creates an Observable that emits no items to the Observer and immediately
* emits an error notification.
*
* <span class="informal">Just emits 'error', and nothing else.
* </span>
*
* <img src="./img/throw.png" width="100%">
*
* This static operator is useful for creating a simple Observable that only
* emits the error notification. It can be used for composing with other
* Observables, such as in a {@link mergeMap}.
*
* @example <caption>Emit the number 7, then emit an error.</caption>
* var result = Rx.Observable.throw(new Error('oops!')).startWith(7);
* result.subscribe(x => console.log(x), e => console.error(e));
*
* @example <caption>Map and flatten numbers to the sequence 'a', 'b', 'c', but throw an error for 13</caption>
* var interval = Rx.Observable.interval(1000);
* var result = interval.mergeMap(x =>
* x === 13 ?
* Rx.Observable.throw('Thirteens are bad') :
* Rx.Observable.of('a', 'b', 'c')
* );
* result.subscribe(x => console.log(x), e => console.error(e));
*
* @see {@link create}
* @see {@link empty}
* @see {@link never}
* @see {@link of}
*
* @param {any} error The particular Error to pass to the error notification.
* @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling
* the emission of the error notification.
* @return {Observable} An error Observable: emits only the error notification
* using the given error argument.
* @static true
* @name throw
* @owner Observable
*/
ErrorObservable.create = function (error, scheduler) {
return new ErrorObservable(error, scheduler);
};
ErrorObservable.dispatch = function (arg) {
var error = arg.error, subscriber = arg.subscriber;
subscriber.error(error);
};
ErrorObservable.prototype._subscribe = function (subscriber) {
var error = this.error;
var scheduler = this.scheduler;
subscriber.syncErrorThrowable = true;
if (scheduler) {
return scheduler.schedule(ErrorObservable.dispatch, 0, {
error: error, subscriber: subscriber
});
}
else {
subscriber.error(error);
}
};
return ErrorObservable;
}(Observable_1.Observable));
exports.ErrorObservable = ErrorObservable;
//# sourceMappingURL=ErrorObservable.js.map
/***/ }),
/* 416 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return IonicNativePlugin; });
var IonicNativePlugin = (function () {
function IonicNativePlugin() {
}
/**
* Returns a boolean that indicates whether the plugin is installed
* @return {boolean}
*/
/**
* Returns a boolean that indicates whether the plugin is installed
* @return {boolean}
*/
IonicNativePlugin.installed = /**
* Returns a boolean that indicates whether the plugin is installed
* @return {boolean}
*/
function () { return false; };
/**
* Returns the original plugin object
*/
/**
* Returns the original plugin object
*/
IonicNativePlugin.getPlugin = /**
* Returns the original plugin object
*/
function () { };
/**
* Returns the plugin's name
*/
/**
* Returns the plugin's name
*/
IonicNativePlugin.getPluginName = /**
* Returns the plugin's name
*/
function () { return; };
/**
* Returns the plugin's reference
*/
/**
* Returns the plugin's reference
*/
IonicNativePlugin.getPluginRef = /**
* Returns the plugin's reference
*/
function () { return; };
/**
* Returns the plugin's install name
*/
/**
* Returns the plugin's install name
*/
IonicNativePlugin.getPluginInstallName = /**
* Returns the plugin's install name
*/
function () { return; };
/**
* Returns the plugin's supported platforms
*/
/**
* Returns the plugin's supported platforms
*/
IonicNativePlugin.getSupportedPlatforms = /**
* Returns the plugin's supported platforms
*/
function () { return; };
return IonicNativePlugin;
}());
//# sourceMappingURL=ionic-native-plugin.js.map
/***/ }),
/* 417 */,
/* 418 */,
/* 419 */
/***/ (function(module, exports, __webpack_require__) {
/**
* @namespace Chart
*/
var Chart = __webpack_require__(420)();
Chart.helpers = __webpack_require__(5);
// @todo dispatch these helpers into appropriated helpers/helpers.* file and write unit tests!
__webpack_require__(424)(Chart);
Chart.defaults = __webpack_require__(8);
Chart.Element = __webpack_require__(22);
Chart.elements = __webpack_require__(30);
Chart.Interaction = __webpack_require__(185);
Chart.layouts = __webpack_require__(50);
Chart.platform = __webpack_require__(186);
Chart.plugins = __webpack_require__(187);
Chart.Ticks = __webpack_require__(51);
__webpack_require__(434)(Chart);
__webpack_require__(435)(Chart);
__webpack_require__(436)(Chart);
__webpack_require__(437)(Chart);
__webpack_require__(438)(Chart);
__webpack_require__(439)(Chart);
__webpack_require__(440)(Chart);
__webpack_require__(441)(Chart);
__webpack_require__(442)(Chart);
__webpack_require__(443)(Chart);
__webpack_require__(444)(Chart);
__webpack_require__(445)(Chart);
// Controllers must be loaded after elements
// See Chart.core.datasetController.dataElementType
__webpack_require__(448)(Chart);
__webpack_require__(449)(Chart);
__webpack_require__(450)(Chart);
__webpack_require__(451)(Chart);
__webpack_require__(452)(Chart);
__webpack_require__(453)(Chart);
__webpack_require__(454)(Chart);
__webpack_require__(455)(Chart);
__webpack_require__(456)(Chart);
__webpack_require__(457)(Chart);
__webpack_require__(458)(Chart);
__webpack_require__(459)(Chart);
__webpack_require__(460)(Chart);
__webpack_require__(461)(Chart);
// Loading built-it plugins
var plugins = __webpack_require__(462);
for (var k in plugins) {
if (plugins.hasOwnProperty(k)) {
Chart.plugins.register(plugins[k]);
}
}
Chart.platform.initialize();
module.exports = Chart;
if (typeof window !== 'undefined') {
window.Chart = Chart;
}
// DEPRECATIONS
/**
* Provided for backward compatibility, not available anymore
* @namespace Chart.Legend
* @deprecated since version 2.1.5
* @todo remove at version 3
* @private
*/
Chart.Legend = plugins.legend._element;
/**
* Provided for backward compatibility, not available anymore
* @namespace Chart.Title
* @deprecated since version 2.1.5
* @todo remove at version 3
* @private
*/
Chart.Title = plugins.title._element;
/**
* Provided for backward compatibility, use Chart.plugins instead
* @namespace Chart.pluginService
* @deprecated since version 2.1.5
* @todo remove at version 3
* @private
*/
Chart.pluginService = Chart.plugins;
/**
* Provided for backward compatibility, inheriting from Chart.PlugingBase has no
* effect, instead simply create/register plugins via plain JavaScript objects.
* @interface Chart.PluginBase
* @deprecated since version 2.5.0
* @todo remove at version 3
* @private
*/
Chart.PluginBase = Chart.Element.extend({});
/**
* Provided for backward compatibility, use Chart.helpers.canvas instead.
* @namespace Chart.canvasHelpers
* @deprecated since version 2.6.0
* @todo remove at version 3
* @private
*/
Chart.canvasHelpers = Chart.helpers.canvas;
/**
* Provided for backward compatibility, use Chart.layouts instead.
* @namespace Chart.layoutService
* @deprecated since version 2.8.0
* @todo remove at version 3
* @private
*/
Chart.layoutService = Chart.layouts;
/***/ }),
/* 420 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var defaults = __webpack_require__(8);
defaults._set('global', {
responsive: true,
responsiveAnimationDuration: 0,
maintainAspectRatio: true,
events: ['mousemove', 'mouseout', 'click', 'touchstart', 'touchmove'],
hover: {
onHover: null,
mode: 'nearest',
intersect: true,
animationDuration: 400
},
onClick: null,
defaultColor: 'rgba(0,0,0,0.1)',
defaultFontColor: '#666',
defaultFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
defaultFontSize: 12,
defaultFontStyle: 'normal',
showLines: true,
// Element defaults defined in element extensions
elements: {},
// Layout options such as padding
layout: {
padding: {
top: 0,
right: 0,
bottom: 0,
left: 0
}
}
});
module.exports = function() {
// Occupy the global variable of Chart, and create a simple base class
var Chart = function(item, config) {
this.construct(item, config);
return this;
};
Chart.Chart = Chart;
return Chart;
};
/***/ }),
/* 421 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var helpers = __webpack_require__(61);
/**
* Easing functions adapted from Robert Penner's easing equations.
* @namespace Chart.helpers.easingEffects
* @see http://www.robertpenner.com/easing/
*/
var effects = {
linear: function(t) {
return t;
},
easeInQuad: function(t) {
return t * t;
},
easeOutQuad: function(t) {
return -t * (t - 2);
},
easeInOutQuad: function(t) {
if ((t /= 0.5) < 1) {
return 0.5 * t * t;
}
return -0.5 * ((--t) * (t - 2) - 1);
},
easeInCubic: function(t) {
return t * t * t;
},
easeOutCubic: function(t) {
return (t = t - 1) * t * t + 1;
},
easeInOutCubic: function(t) {
if ((t /= 0.5) < 1) {
return 0.5 * t * t * t;
}
return 0.5 * ((t -= 2) * t * t + 2);
},
easeInQuart: function(t) {
return t * t * t * t;
},
easeOutQuart: function(t) {
return -((t = t - 1) * t * t * t - 1);
},
easeInOutQuart: function(t) {
if ((t /= 0.5) < 1) {
return 0.5 * t * t * t * t;
}
return -0.5 * ((t -= 2) * t * t * t - 2);
},
easeInQuint: function(t) {
return t * t * t * t * t;
},
easeOutQuint: function(t) {
return (t = t - 1) * t * t * t * t + 1;
},
easeInOutQuint: function(t) {
if ((t /= 0.5) < 1) {
return 0.5 * t * t * t * t * t;
}
return 0.5 * ((t -= 2) * t * t * t * t + 2);
},
easeInSine: function(t) {
return -Math.cos(t * (Math.PI / 2)) + 1;
},
easeOutSine: function(t) {
return Math.sin(t * (Math.PI / 2));
},
easeInOutSine: function(t) {
return -0.5 * (Math.cos(Math.PI * t) - 1);
},
easeInExpo: function(t) {
return (t === 0) ? 0 : Math.pow(2, 10 * (t - 1));
},
easeOutExpo: function(t) {
return (t === 1) ? 1 : -Math.pow(2, -10 * t) + 1;
},
easeInOutExpo: function(t) {
if (t === 0) {
return 0;
}
if (t === 1) {
return 1;
}
if ((t /= 0.5) < 1) {
return 0.5 * Math.pow(2, 10 * (t - 1));
}
return 0.5 * (-Math.pow(2, -10 * --t) + 2);
},
easeInCirc: function(t) {
if (t >= 1) {
return t;
}
return -(Math.sqrt(1 - t * t) - 1);
},
easeOutCirc: function(t) {
return Math.sqrt(1 - (t = t - 1) * t);
},
easeInOutCirc: function(t) {
if ((t /= 0.5) < 1) {
return -0.5 * (Math.sqrt(1 - t * t) - 1);
}
return 0.5 * (Math.sqrt(1 - (t -= 2) * t) + 1);
},
easeInElastic: function(t) {
var s = 1.70158;
var p = 0;
var a = 1;
if (t === 0) {
return 0;
}
if (t === 1) {
return 1;
}
if (!p) {
p = 0.3;
}
if (a < 1) {
a = 1;
s = p / 4;
} else {
s = p / (2 * Math.PI) * Math.asin(1 / a);
}
return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p));
},
easeOutElastic: function(t) {
var s = 1.70158;
var p = 0;
var a = 1;
if (t === 0) {
return 0;
}
if (t === 1) {
return 1;
}
if (!p) {
p = 0.3;
}
if (a < 1) {
a = 1;
s = p / 4;
} else {
s = p / (2 * Math.PI) * Math.asin(1 / a);
}
return a * Math.pow(2, -10 * t) * Math.sin((t - s) * (2 * Math.PI) / p) + 1;
},
easeInOutElastic: function(t) {
var s = 1.70158;
var p = 0;
var a = 1;
if (t === 0) {
return 0;
}
if ((t /= 0.5) === 2) {
return 1;
}
if (!p) {
p = 0.45;
}
if (a < 1) {
a = 1;
s = p / 4;
} else {
s = p / (2 * Math.PI) * Math.asin(1 / a);
}
if (t < 1) {
return -0.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p));
}
return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t - s) * (2 * Math.PI) / p) * 0.5 + 1;
},
easeInBack: function(t) {
var s = 1.70158;
return t * t * ((s + 1) * t - s);
},
easeOutBack: function(t) {
var s = 1.70158;
return (t = t - 1) * t * ((s + 1) * t + s) + 1;
},
easeInOutBack: function(t) {
var s = 1.70158;
if ((t /= 0.5) < 1) {
return 0.5 * (t * t * (((s *= (1.525)) + 1) * t - s));
}
return 0.5 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2);
},
easeInBounce: function(t) {
return 1 - effects.easeOutBounce(1 - t);
},
easeOutBounce: function(t) {
if (t < (1 / 2.75)) {
return 7.5625 * t * t;
}
if (t < (2 / 2.75)) {
return 7.5625 * (t -= (1.5 / 2.75)) * t + 0.75;
}
if (t < (2.5 / 2.75)) {
return 7.5625 * (t -= (2.25 / 2.75)) * t + 0.9375;
}
return 7.5625 * (t -= (2.625 / 2.75)) * t + 0.984375;
},
easeInOutBounce: function(t) {
if (t < 0.5) {
return effects.easeInBounce(t * 2) * 0.5;
}
return effects.easeOutBounce(t * 2 - 1) * 0.5 + 0.5;
}
};
module.exports = {
effects: effects
};
// DEPRECATIONS
/**
* Provided for backward compatibility, use Chart.helpers.easing.effects instead.
* @function Chart.helpers.easingEffects
* @deprecated since version 2.7.0
* @todo remove at version 3
* @private
*/
helpers.easingEffects = effects;
/***/ }),
/* 422 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var helpers = __webpack_require__(61);
/**
* @namespace Chart.helpers.canvas
*/
var exports = module.exports = {
/**
* Clears the entire canvas associated to the given `chart`.
* @param {Chart} chart - The chart for which to clear the canvas.
*/
clear: function(chart) {
chart.ctx.clearRect(0, 0, chart.width, chart.height);
},
/**
* Creates a "path" for a rectangle with rounded corners at position (x, y) with a
* given size (width, height) and the same `radius` for all corners.
* @param {CanvasRenderingContext2D} ctx - The canvas 2D Context.
* @param {Number} x - The x axis of the coordinate for the rectangle starting point.
* @param {Number} y - The y axis of the coordinate for the rectangle starting point.
* @param {Number} width - The rectangle's width.
* @param {Number} height - The rectangle's height.
* @param {Number} radius - The rounded amount (in pixels) for the four corners.
* @todo handle `radius` as top-left, top-right, bottom-right, bottom-left array/object?
*/
roundedRect: function(ctx, x, y, width, height, radius) {
if (radius) {
var rx = Math.min(radius, width / 2);
var ry = Math.min(radius, height / 2);
ctx.moveTo(x + rx, y);
ctx.lineTo(x + width - rx, y);
ctx.quadraticCurveTo(x + width, y, x + width, y + ry);
ctx.lineTo(x + width, y + height - ry);
ctx.quadraticCurveTo(x + width, y + height, x + width - rx, y + height);
ctx.lineTo(x + rx, y + height);
ctx.quadraticCurveTo(x, y + height, x, y + height - ry);
ctx.lineTo(x, y + ry);
ctx.quadraticCurveTo(x, y, x + rx, y);
} else {
ctx.rect(x, y, width, height);
}
},
drawPoint: function(ctx, style, radius, x, y) {
var type, edgeLength, xOffset, yOffset, height, size;
if (style && typeof style === 'object') {
type = style.toString();
if (type === '[object HTMLImageElement]' || type === '[object HTMLCanvasElement]') {
ctx.drawImage(style, x - style.width / 2, y - style.height / 2, style.width, style.height);
return;
}
}
if (isNaN(radius) || radius <= 0) {
return;
}
switch (style) {
// Default includes circle
default:
ctx.beginPath();
ctx.arc(x, y, radius, 0, Math.PI * 2);
ctx.closePath();
ctx.fill();
break;
case 'triangle':
ctx.beginPath();
edgeLength = 3 * radius / Math.sqrt(3);
height = edgeLength * Math.sqrt(3) / 2;
ctx.moveTo(x - edgeLength / 2, y + height / 3);
ctx.lineTo(x + edgeLength / 2, y + height / 3);
ctx.lineTo(x, y - 2 * height / 3);
ctx.closePath();
ctx.fill();
break;
case 'rect':
size = 1 / Math.SQRT2 * radius;
ctx.beginPath();
ctx.fillRect(x - size, y - size, 2 * size, 2 * size);
ctx.strokeRect(x - size, y - size, 2 * size, 2 * size);
break;
case 'rectRounded':
var offset = radius / Math.SQRT2;
var leftX = x - offset;
var topY = y - offset;
var sideSize = Math.SQRT2 * radius;
ctx.beginPath();
this.roundedRect(ctx, leftX, topY, sideSize, sideSize, radius / 2);
ctx.closePath();
ctx.fill();
break;
case 'rectRot':
size = 1 / Math.SQRT2 * radius;
ctx.beginPath();
ctx.moveTo(x - size, y);
ctx.lineTo(x, y + size);
ctx.lineTo(x + size, y);
ctx.lineTo(x, y - size);
ctx.closePath();
ctx.fill();
break;
case 'cross':
ctx.beginPath();
ctx.moveTo(x, y + radius);
ctx.lineTo(x, y - radius);
ctx.moveTo(x - radius, y);
ctx.lineTo(x + radius, y);
ctx.closePath();
break;
case 'crossRot':
ctx.beginPath();
xOffset = Math.cos(Math.PI / 4) * radius;
yOffset = Math.sin(Math.PI / 4) * radius;
ctx.moveTo(x - xOffset, y - yOffset);
ctx.lineTo(x + xOffset, y + yOffset);
ctx.moveTo(x - xOffset, y + yOffset);
ctx.lineTo(x + xOffset, y - yOffset);
ctx.closePath();
break;
case 'star':
ctx.beginPath();
ctx.moveTo(x, y + radius);
ctx.lineTo(x, y - radius);
ctx.moveTo(x - radius, y);
ctx.lineTo(x + radius, y);
xOffset = Math.cos(Math.PI / 4) * radius;
yOffset = Math.sin(Math.PI / 4) * radius;
ctx.moveTo(x - xOffset, y - yOffset);
ctx.lineTo(x + xOffset, y + yOffset);
ctx.moveTo(x - xOffset, y + yOffset);
ctx.lineTo(x + xOffset, y - yOffset);
ctx.closePath();
break;
case 'line':
ctx.beginPath();
ctx.moveTo(x - radius, y);
ctx.lineTo(x + radius, y);
ctx.closePath();
break;
case 'dash':
ctx.beginPath();
ctx.moveTo(x, y);
ctx.lineTo(x + radius, y);
ctx.closePath();
break;
}
ctx.stroke();
},
clipArea: function(ctx, area) {
ctx.save();
ctx.beginPath();
ctx.rect(area.left, area.top, area.right - area.left, area.bottom - area.top);
ctx.clip();
},
unclipArea: function(ctx) {
ctx.restore();
},
lineTo: function(ctx, previous, target, flip) {
if (target.steppedLine) {
if ((target.steppedLine === 'after' && !flip) || (target.steppedLine !== 'after' && flip)) {
ctx.lineTo(previous.x, target.y);
} else {
ctx.lineTo(target.x, previous.y);
}
ctx.lineTo(target.x, target.y);
return;
}
if (!target.tension) {
ctx.lineTo(target.x, target.y);
return;
}
ctx.bezierCurveTo(
flip ? previous.controlPointPreviousX : previous.controlPointNextX,
flip ? previous.controlPointPreviousY : previous.controlPointNextY,
flip ? target.controlPointNextX : target.controlPointPreviousX,
flip ? target.controlPointNextY : target.controlPointPreviousY,
target.x,
target.y);
}
};
// DEPRECATIONS
/**
* Provided for backward compatibility, use Chart.helpers.canvas.clear instead.
* @namespace Chart.helpers.clear
* @deprecated since version 2.7.0
* @todo remove at version 3
* @private
*/
helpers.clear = exports.clear;
/**
* Provided for backward compatibility, use Chart.helpers.canvas.roundedRect instead.
* @namespace Chart.helpers.drawRoundedRectangle
* @deprecated since version 2.7.0
* @todo remove at version 3
* @private
*/
helpers.drawRoundedRectangle = function(ctx) {
ctx.beginPath();
exports.roundedRect.apply(exports, arguments);
ctx.closePath();
};
/***/ }),
/* 423 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var helpers = __webpack_require__(61);
/**
* @alias Chart.helpers.options
* @namespace
*/
module.exports = {
/**
* Converts the given line height `value` in pixels for a specific font `size`.
* @param {Number|String} value - The lineHeight to parse (eg. 1.6, '14px', '75%', '1.6em').
* @param {Number} size - The font size (in pixels) used to resolve relative `value`.
* @returns {Number} The effective line height in pixels (size * 1.2 if value is invalid).
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/line-height
* @since 2.7.0
*/
toLineHeight: function(value, size) {
var matches = ('' + value).match(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/);
if (!matches || matches[1] === 'normal') {
return size * 1.2;
}
value = +matches[2];
switch (matches[3]) {
case 'px':
return value;
case '%':
value /= 100;
break;
default:
break;
}
return size * value;
},
/**
* Converts the given value into a padding object with pre-computed width/height.
* @param {Number|Object} value - If a number, set the value to all TRBL component,
* else, if and object, use defined properties and sets undefined ones to 0.
* @returns {Object} The padding values (top, right, bottom, left, width, height)
* @since 2.7.0
*/
toPadding: function(value) {
var t, r, b, l;
if (helpers.isObject(value)) {
t = +value.top || 0;
r = +value.right || 0;
b = +value.bottom || 0;
l = +value.left || 0;
} else {
t = r = b = l = +value || 0;
}
return {
top: t,
right: r,
bottom: b,
left: l,
height: t + b,
width: l + r
};
},
/**
* Evaluates the given `inputs` sequentially and returns the first defined value.
* @param {Array[]} inputs - An array of values, falling back to the last value.
* @param {Object} [context] - If defined and the current value is a function, the value
* is called with `context` as first argument and the result becomes the new input.
* @param {Number} [index] - If defined and the current value is an array, the value
* at `index` become the new input.
* @since 2.7.0
*/
resolve: function(inputs, context, index) {
var i, ilen, value;
for (i = 0, ilen = inputs.length; i < ilen; ++i) {
value = inputs[i];
if (value === undefined) {
continue;
}
if (context !== undefined && typeof value === 'function') {
value = value(context);
}
if (index !== undefined && helpers.isArray(value)) {
value = value[index];
}
if (value !== undefined) {
return value;
}
}
}
};
/***/ }),
/* 424 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* global window: false */
/* global document: false */
var color = __webpack_require__(182);
var defaults = __webpack_require__(8);
var helpers = __webpack_require__(5);
module.exports = function(Chart) {
// -- Basic js utility methods
helpers.configMerge = function(/* objects ... */) {
return helpers.merge(helpers.clone(arguments[0]), [].slice.call(arguments, 1), {
merger: function(key, target, source, options) {
var tval = target[key] || {};
var sval = source[key];
if (key === 'scales') {
// scale config merging is complex. Add our own function here for that
target[key] = helpers.scaleMerge(tval, sval);
} else if (key === 'scale') {
// used in polar area & radar charts since there is only one scale
target[key] = helpers.merge(tval, [Chart.scaleService.getScaleDefaults(sval.type), sval]);
} else {
helpers._merger(key, target, source, options);
}
}
});
};
helpers.scaleMerge = function(/* objects ... */) {
return helpers.merge(helpers.clone(arguments[0]), [].slice.call(arguments, 1), {
merger: function(key, target, source, options) {
if (key === 'xAxes' || key === 'yAxes') {
var slen = source[key].length;
var i, type, scale;
if (!target[key]) {
target[key] = [];
}
for (i = 0; i < slen; ++i) {
scale = source[key][i];
type = helpers.valueOrDefault(scale.type, key === 'xAxes' ? 'category' : 'linear');
if (i >= target[key].length) {
target[key].push({});
}
if (!target[key][i].type || (scale.type && scale.type !== target[key][i].type)) {
// new/untyped scale or type changed: let's apply the new defaults
// then merge source scale to correctly overwrite the defaults.
helpers.merge(target[key][i], [Chart.scaleService.getScaleDefaults(type), scale]);
} else {
// scales type are the same
helpers.merge(target[key][i], scale);
}
}
} else {
helpers._merger(key, target, source, options);
}
}
});
};
helpers.where = function(collection, filterCallback) {
if (helpers.isArray(collection) && Array.prototype.filter) {
return collection.filter(filterCallback);
}
var filtered = [];
helpers.each(collection, function(item) {
if (filterCallback(item)) {
filtered.push(item);
}
});
return filtered;
};
helpers.findIndex = Array.prototype.findIndex ?
function(array, callback, scope) {
return array.findIndex(callback, scope);
} :
function(array, callback, scope) {
scope = scope === undefined ? array : scope;
for (var i = 0, ilen = array.length; i < ilen; ++i) {
if (callback.call(scope, array[i], i, array)) {
return i;
}
}
return -1;
};
helpers.findNextWhere = function(arrayToSearch, filterCallback, startIndex) {
// Default to start of the array
if (helpers.isNullOrUndef(startIndex)) {
startIndex = -1;
}
for (var i = startIndex + 1; i < arrayToSearch.length; i++) {
var currentItem = arrayToSearch[i];
if (filterCallback(currentItem)) {
return currentItem;
}
}
};
helpers.findPreviousWhere = function(arrayToSearch, filterCallback, startIndex) {
// Default to end of the array
if (helpers.isNullOrUndef(startIndex)) {
startIndex = arrayToSearch.length;
}
for (var i = startIndex - 1; i >= 0; i--) {
var currentItem = arrayToSearch[i];
if (filterCallback(currentItem)) {
return currentItem;
}
}
};
// -- Math methods
helpers.isNumber = function(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
};
helpers.almostEquals = function(x, y, epsilon) {
return Math.abs(x - y) < epsilon;
};
helpers.almostWhole = function(x, epsilon) {
var rounded = Math.round(x);
return (((rounded - epsilon) < x) && ((rounded + epsilon) > x));
};
helpers.max = function(array) {
return array.reduce(function(max, value) {
if (!isNaN(value)) {
return Math.max(max, value);
}
return max;
}, Number.NEGATIVE_INFINITY);
};
helpers.min = function(array) {
return array.reduce(function(min, value) {
if (!isNaN(value)) {
return Math.min(min, value);
}
return min;
}, Number.POSITIVE_INFINITY);
};
helpers.sign = Math.sign ?
function(x) {
return Math.sign(x);
} :
function(x) {
x = +x; // convert to a number
if (x === 0 || isNaN(x)) {
return x;
}
return x > 0 ? 1 : -1;
};
helpers.log10 = Math.log10 ?
function(x) {
return Math.log10(x);
} :
function(x) {
var exponent = Math.log(x) * Math.LOG10E; // Math.LOG10E = 1 / Math.LN10.
// Check for whole powers of 10,
// which due to floating point rounding error should be corrected.
var powerOf10 = Math.round(exponent);
var isPowerOf10 = x === Math.pow(10, powerOf10);
return isPowerOf10 ? powerOf10 : exponent;
};
helpers.toRadians = function(degrees) {
return degrees * (Math.PI / 180);
};
helpers.toDegrees = function(radians) {
return radians * (180 / Math.PI);
};
// Gets the angle from vertical upright to the point about a centre.
helpers.getAngleFromPoint = function(centrePoint, anglePoint) {
var distanceFromXCenter = anglePoint.x - centrePoint.x;
var distanceFromYCenter = anglePoint.y - centrePoint.y;
var radialDistanceFromCenter = Math.sqrt(distanceFromXCenter * distanceFromXCenter + distanceFromYCenter * distanceFromYCenter);
var angle = Math.atan2(distanceFromYCenter, distanceFromXCenter);
if (angle < (-0.5 * Math.PI)) {
angle += 2.0 * Math.PI; // make sure the returned angle is in the range of (-PI/2, 3PI/2]
}
return {
angle: angle,
distance: radialDistanceFromCenter
};
};
helpers.distanceBetweenPoints = function(pt1, pt2) {
return Math.sqrt(Math.pow(pt2.x - pt1.x, 2) + Math.pow(pt2.y - pt1.y, 2));
};
helpers.aliasPixel = function(pixelWidth) {
return (pixelWidth % 2 === 0) ? 0 : 0.5;
};
helpers.splineCurve = function(firstPoint, middlePoint, afterPoint, t) {
// Props to Rob Spencer at scaled innovation for his post on splining between points
// http://scaledinnovation.com/analytics/splines/aboutSplines.html
// This function must also respect "skipped" points
var previous = firstPoint.skip ? middlePoint : firstPoint;
var current = middlePoint;
var next = afterPoint.skip ? middlePoint : afterPoint;
var d01 = Math.sqrt(Math.pow(current.x - previous.x, 2) + Math.pow(current.y - previous.y, 2));
var d12 = Math.sqrt(Math.pow(next.x - current.x, 2) + Math.pow(next.y - current.y, 2));
var s01 = d01 / (d01 + d12);
var s12 = d12 / (d01 + d12);
// If all points are the same, s01 & s02 will be inf
s01 = isNaN(s01) ? 0 : s01;
s12 = isNaN(s12) ? 0 : s12;
var fa = t * s01; // scaling factor for triangle Ta
var fb = t * s12;
return {
previous: {
x: current.x - fa * (next.x - previous.x),
y: current.y - fa * (next.y - previous.y)
},
next: {
x: current.x + fb * (next.x - previous.x),
y: current.y + fb * (next.y - previous.y)
}
};
};
helpers.EPSILON = Number.EPSILON || 1e-14;
helpers.splineCurveMonotone = function(points) {
// This function calculates Bézier control points in a similar way than |splineCurve|,
// but preserves monotonicity of the provided data and ensures no local extremums are added
// between the dataset discrete points due to the interpolation.
// See : https://en.wikipedia.org/wiki/Monotone_cubic_interpolation
var pointsWithTangents = (points || []).map(function(point) {
return {
model: point._model,
deltaK: 0,
mK: 0
};
});
// Calculate slopes (deltaK) and initialize tangents (mK)
var pointsLen = pointsWithTangents.length;
var i, pointBefore, pointCurrent, pointAfter;
for (i = 0; i < pointsLen; ++i) {
pointCurrent = pointsWithTangents[i];
if (pointCurrent.model.skip) {
continue;
}
pointBefore = i > 0 ? pointsWithTangents[i - 1] : null;
pointAfter = i < pointsLen - 1 ? pointsWithTangents[i + 1] : null;
if (pointAfter && !pointAfter.model.skip) {
var slopeDeltaX = (pointAfter.model.x - pointCurrent.model.x);
// In the case of two points that appear at the same x pixel, slopeDeltaX is 0
pointCurrent.deltaK = slopeDeltaX !== 0 ? (pointAfter.model.y - pointCurrent.model.y) / slopeDeltaX : 0;
}
if (!pointBefore || pointBefore.model.skip) {
pointCurrent.mK = pointCurrent.deltaK;
} else if (!pointAfter || pointAfter.model.skip) {
pointCurrent.mK = pointBefore.deltaK;
} else if (this.sign(pointBefore.deltaK) !== this.sign(pointCurrent.deltaK)) {
pointCurrent.mK = 0;
} else {
pointCurrent.mK = (pointBefore.deltaK + pointCurrent.deltaK) / 2;
}
}
// Adjust tangents to ensure monotonic properties
var alphaK, betaK, tauK, squaredMagnitude;
for (i = 0; i < pointsLen - 1; ++i) {
pointCurrent = pointsWithTangents[i];
pointAfter = pointsWithTangents[i + 1];
if (pointCurrent.model.skip || pointAfter.model.skip) {
continue;
}
if (helpers.almostEquals(pointCurrent.deltaK, 0, this.EPSILON)) {
pointCurrent.mK = pointAfter.mK = 0;
continue;
}
alphaK = pointCurrent.mK / pointCurrent.deltaK;
betaK = pointAfter.mK / pointCurrent.deltaK;
squaredMagnitude = Math.pow(alphaK, 2) + Math.pow(betaK, 2);
if (squaredMagnitude <= 9) {
continue;
}
tauK = 3 / Math.sqrt(squaredMagnitude);
pointCurrent.mK = alphaK * tauK * pointCurrent.deltaK;
pointAfter.mK = betaK * tauK * pointCurrent.deltaK;
}
// Compute control points
var deltaX;
for (i = 0; i < pointsLen; ++i) {
pointCurrent = pointsWithTangents[i];
if (pointCurrent.model.skip) {
continue;
}
pointBefore = i > 0 ? pointsWithTangents[i - 1] : null;
pointAfter = i < pointsLen - 1 ? pointsWithTangents[i + 1] : null;
if (pointBefore && !pointBefore.model.skip) {
deltaX = (pointCurrent.model.x - pointBefore.model.x) / 3;
pointCurrent.model.controlPointPreviousX = pointCurrent.model.x - deltaX;
pointCurrent.model.controlPointPreviousY = pointCurrent.model.y - deltaX * pointCurrent.mK;
}
if (pointAfter && !pointAfter.model.skip) {
deltaX = (pointAfter.model.x - pointCurrent.model.x) / 3;
pointCurrent.model.controlPointNextX = pointCurrent.model.x + deltaX;
pointCurrent.model.controlPointNextY = pointCurrent.model.y + deltaX * pointCurrent.mK;
}
}
};
helpers.nextItem = function(collection, index, loop) {
if (loop) {
return index >= collection.length - 1 ? collection[0] : collection[index + 1];
}
return index >= collection.length - 1 ? collection[collection.length - 1] : collection[index + 1];
};
helpers.previousItem = function(collection, index, loop) {
if (loop) {
return index <= 0 ? collection[collection.length - 1] : collection[index - 1];
}
return index <= 0 ? collection[0] : collection[index - 1];
};
// Implementation of the nice number algorithm used in determining where axis labels will go
helpers.niceNum = function(range, round) {
var exponent = Math.floor(helpers.log10(range));
var fraction = range / Math.pow(10, exponent);
var niceFraction;
if (round) {
if (fraction < 1.5) {
niceFraction = 1;
} else if (fraction < 3) {
niceFraction = 2;
} else if (fraction < 7) {
niceFraction = 5;
} else {
niceFraction = 10;
}
} else if (fraction <= 1.0) {
niceFraction = 1;
} else if (fraction <= 2) {
niceFraction = 2;
} else if (fraction <= 5) {
niceFraction = 5;
} else {
niceFraction = 10;
}
return niceFraction * Math.pow(10, exponent);
};
// Request animation polyfill - http://www.paulirish.com/2011/requestanimationframe-for-smart-animating/
helpers.requestAnimFrame = (function() {
if (typeof window === 'undefined') {
return function(callback) {
callback();
};
}
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(callback) {
return window.setTimeout(callback, 1000 / 60);
};
}());
// -- DOM methods
helpers.getRelativePosition = function(evt, chart) {
var mouseX, mouseY;
var e = evt.originalEvent || evt;
var canvas = evt.currentTarget || evt.srcElement;
var boundingRect = canvas.getBoundingClientRect();
var touches = e.touches;
if (touches && touches.length > 0) {
mouseX = touches[0].clientX;
mouseY = touches[0].clientY;
} else {
mouseX = e.clientX;
mouseY = e.clientY;
}
// Scale mouse coordinates into canvas coordinates
// by following the pattern laid out by 'jerryj' in the comments of
// http://www.html5canvastutorials.com/advanced/html5-canvas-mouse-coordinates/
var paddingLeft = parseFloat(helpers.getStyle(canvas, 'padding-left'));
var paddingTop = parseFloat(helpers.getStyle(canvas, 'padding-top'));
var paddingRight = parseFloat(helpers.getStyle(canvas, 'padding-right'));
var paddingBottom = parseFloat(helpers.getStyle(canvas, 'padding-bottom'));
var width = boundingRect.right - boundingRect.left - paddingLeft - paddingRight;
var height = boundingRect.bottom - boundingRect.top - paddingTop - paddingBottom;
// We divide by the current device pixel ratio, because the canvas is scaled up by that amount in each direction. However
// the backend model is in unscaled coordinates. Since we are going to deal with our model coordinates, we go back here
mouseX = Math.round((mouseX - boundingRect.left - paddingLeft) / (width) * canvas.width / chart.currentDevicePixelRatio);
mouseY = Math.round((mouseY - boundingRect.top - paddingTop) / (height) * canvas.height / chart.currentDevicePixelRatio);
return {
x: mouseX,
y: mouseY
};
};
// Private helper function to convert max-width/max-height values that may be percentages into a number
function parseMaxStyle(styleValue, node, parentProperty) {
var valueInPixels;
if (typeof styleValue === 'string') {
valueInPixels = parseInt(styleValue, 10);
if (styleValue.indexOf('%') !== -1) {
// percentage * size in dimension
valueInPixels = valueInPixels / 100 * node.parentNode[parentProperty];
}
} else {
valueInPixels = styleValue;
}
return valueInPixels;
}
/**
* Returns if the given value contains an effective constraint.
* @private
*/
function isConstrainedValue(value) {
return value !== undefined && value !== null && value !== 'none';
}
// Private helper to get a constraint dimension
// @param domNode : the node to check the constraint on
// @param maxStyle : the style that defines the maximum for the direction we are using (maxWidth / maxHeight)
// @param percentageProperty : property of parent to use when calculating width as a percentage
// @see http://www.nathanaeljones.com/blog/2013/reading-max-width-cross-browser
function getConstraintDimension(domNode, maxStyle, percentageProperty) {
var view = document.defaultView;
var parentNode = domNode.parentNode;
var constrainedNode = view.getComputedStyle(domNode)[maxStyle];
var constrainedContainer = view.getComputedStyle(parentNode)[maxStyle];
var hasCNode = isConstrainedValue(constrainedNode);
var hasCContainer = isConstrainedValue(constrainedContainer);
var infinity = Number.POSITIVE_INFINITY;
if (hasCNode || hasCContainer) {
return Math.min(
hasCNode ? parseMaxStyle(constrainedNode, domNode, percentageProperty) : infinity,
hasCContainer ? parseMaxStyle(constrainedContainer, parentNode, percentageProperty) : infinity);
}
return 'none';
}
// returns Number or undefined if no constraint
helpers.getConstraintWidth = function(domNode) {
return getConstraintDimension(domNode, 'max-width', 'clientWidth');
};
// returns Number or undefined if no constraint
helpers.getConstraintHeight = function(domNode) {
return getConstraintDimension(domNode, 'max-height', 'clientHeight');
};
helpers.getMaximumWidth = function(domNode) {
var container = domNode.parentNode;
if (!container) {
return domNode.clientWidth;
}
var paddingLeft = parseInt(helpers.getStyle(container, 'padding-left'), 10);
var paddingRight = parseInt(helpers.getStyle(container, 'padding-right'), 10);
var w = container.clientWidth - paddingLeft - paddingRight;
var cw = helpers.getConstraintWidth(domNode);
return isNaN(cw) ? w : Math.min(w, cw);
};
helpers.getMaximumHeight = function(domNode) {
var container = domNode.parentNode;
if (!container) {
return domNode.clientHeight;
}
var paddingTop = parseInt(helpers.getStyle(container, 'padding-top'), 10);
var paddingBottom = parseInt(helpers.getStyle(container, 'padding-bottom'), 10);
var h = container.clientHeight - paddingTop - paddingBottom;
var ch = helpers.getConstraintHeight(domNode);
return isNaN(ch) ? h : Math.min(h, ch);
};
helpers.getStyle = function(el, property) {
return el.currentStyle ?
el.currentStyle[property] :
document.defaultView.getComputedStyle(el, null).getPropertyValue(property);
};
helpers.retinaScale = function(chart, forceRatio) {
var pixelRatio = chart.currentDevicePixelRatio = forceRatio || window.devicePixelRatio || 1;
if (pixelRatio === 1) {
return;
}
var canvas = chart.canvas;
var height = chart.height;
var width = chart.width;
canvas.height = height * pixelRatio;
canvas.width = width * pixelRatio;
chart.ctx.scale(pixelRatio, pixelRatio);
// If no style has been set on the canvas, the render size is used as display size,
// making the chart visually bigger, so let's enforce it to the "correct" values.
// See https://github.com/chartjs/Chart.js/issues/3575
if (!canvas.style.height && !canvas.style.width) {
canvas.style.height = height + 'px';
canvas.style.width = width + 'px';
}
};
// -- Canvas methods
helpers.fontString = function(pixelSize, fontStyle, fontFamily) {
return fontStyle + ' ' + pixelSize + 'px ' + fontFamily;
};
helpers.longestText = function(ctx, font, arrayOfThings, cache) {
cache = cache || {};
var data = cache.data = cache.data || {};
var gc = cache.garbageCollect = cache.garbageCollect || [];
if (cache.font !== font) {
data = cache.data = {};
gc = cache.garbageCollect = [];
cache.font = font;
}
ctx.font = font;
var longest = 0;
helpers.each(arrayOfThings, function(thing) {
// Undefined strings and arrays should not be measured
if (thing !== undefined && thing !== null && helpers.isArray(thing) !== true) {
longest = helpers.measureText(ctx, data, gc, longest, thing);
} else if (helpers.isArray(thing)) {
// if it is an array lets measure each element
// to do maybe simplify this function a bit so we can do this more recursively?
helpers.each(thing, function(nestedThing) {
// Undefined strings and arrays should not be measured
if (nestedThing !== undefined && nestedThing !== null && !helpers.isArray(nestedThing)) {
longest = helpers.measureText(ctx, data, gc, longest, nestedThing);
}
});
}
});
var gcLen = gc.length / 2;
if (gcLen > arrayOfThings.length) {
for (var i = 0; i < gcLen; i++) {
delete data[gc[i]];
}
gc.splice(0, gcLen);
}
return longest;
};
helpers.measureText = function(ctx, data, gc, longest, string) {
var textWidth = data[string];
if (!textWidth) {
textWidth = data[string] = ctx.measureText(string).width;
gc.push(string);
}
if (textWidth > longest) {
longest = textWidth;
}
return longest;
};
helpers.numberOfLabelLines = function(arrayOfThings) {
var numberOfLines = 1;
helpers.each(arrayOfThings, function(thing) {
if (helpers.isArray(thing)) {
if (thing.length > numberOfLines) {
numberOfLines = thing.length;
}
}
});
return numberOfLines;
};
helpers.color = !color ?
function(value) {
console.error('Color.js not found!');
return value;
} :
function(value) {
/* global CanvasGradient */
if (value instanceof CanvasGradient) {
value = defaults.global.defaultColor;
}
return color(value);
};
helpers.getHoverColor = function(colorValue) {
/* global CanvasPattern */
return (colorValue instanceof CanvasPattern) ?
colorValue :
helpers.color(colorValue).saturate(0.5).darken(0.1).rgbString();
};
};
/***/ }),
/* 425 */
/***/ (function(module, exports, __webpack_require__) {
var conversions = __webpack_require__(183);
var route = __webpack_require__(426);
var convert = {};
var models = Object.keys(conversions);
function wrapRaw(fn) {
var wrappedFn = function (args) {
if (args === undefined || args === null) {
return args;
}
if (arguments.length > 1) {
args = Array.prototype.slice.call(arguments);
}
return fn(args);
};
// preserve .conversion property if there is one
if ('conversion' in fn) {
wrappedFn.conversion = fn.conversion;
}
return wrappedFn;
}
function wrapRounded(fn) {
var wrappedFn = function (args) {
if (args === undefined || args === null) {
return args;
}
if (arguments.length > 1) {
args = Array.prototype.slice.call(arguments);
}
var result = fn(args);
// we're assuming the result is an array here.
// see notice in conversions.js; don't use box types
// in conversion functions.
if (typeof result === 'object') {
for (var len = result.length, i = 0; i < len; i++) {
result[i] = Math.round(result[i]);
}
}
return result;
};
// preserve .conversion property if there is one
if ('conversion' in fn) {
wrappedFn.conversion = fn.conversion;
}
return wrappedFn;
}
models.forEach(function (fromModel) {
convert[fromModel] = {};
Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});
Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});
var routes = route(fromModel);
var routeModels = Object.keys(routes);
routeModels.forEach(function (toModel) {
var fn = routes[toModel];
convert[fromModel][toModel] = wrapRounded(fn);
convert[fromModel][toModel].raw = wrapRaw(fn);
});
});
module.exports = convert;
/***/ }),
/* 426 */
/***/ (function(module, exports, __webpack_require__) {
var conversions = __webpack_require__(183);
/*
this function routes a model to all other models.
all functions that are routed have a property `.conversion` attached
to the returned synthetic function. This property is an array
of strings, each with the steps in between the 'from' and 'to'
color models (inclusive).
conversions that are not possible simply are not included.
*/
function buildGraph() {
var graph = {};
// https://jsperf.com/object-keys-vs-for-in-with-closure/3
var models = Object.keys(conversions);
for (var len = models.length, i = 0; i < len; i++) {
graph[models[i]] = {
// http://jsperf.com/1-vs-infinity
// micro-opt, but this is simple.
distance: -1,
parent: null
};
}
return graph;
}
// https://en.wikipedia.org/wiki/Breadth-first_search
function deriveBFS(fromModel) {
var graph = buildGraph();
var queue = [fromModel]; // unshift -> queue -> pop
graph[fromModel].distance = 0;
while (queue.length) {
var current = queue.pop();
var adjacents = Object.keys(conversions[current]);
for (var len = adjacents.length, i = 0; i < len; i++) {
var adjacent = adjacents[i];
var node = graph[adjacent];
if (node.distance === -1) {
node.distance = graph[current].distance + 1;
node.parent = current;
queue.unshift(adjacent);
}
}
}
return graph;
}
function link(from, to) {
return function (args) {
return to(from(args));
};
}
function wrapConversion(toModel, graph) {
var path = [graph[toModel].parent, toModel];
var fn = conversions[graph[toModel].parent][toModel];
var cur = graph[toModel].parent;
while (graph[cur].parent) {
path.unshift(graph[cur].parent);
fn = link(conversions[graph[cur].parent][cur], fn);
cur = graph[cur].parent;
}
fn.conversion = path;
return fn;
}
module.exports = function (fromModel) {
var graph = deriveBFS(fromModel);
var conversion = {};
var models = Object.keys(graph);
for (var len = models.length, i = 0; i < len; i++) {
var toModel = models[i];
var node = graph[toModel];
if (node.parent === null) {
// no possible conversion, or this node is the source model.
continue;
}
conversion[toModel] = wrapConversion(toModel, graph);
}
return conversion;
};
/***/ }),
/* 427 */
/***/ (function(module, exports, __webpack_require__) {
/* MIT license */
var colorNames = __webpack_require__(184);
module.exports = {
getRgba: getRgba,
getHsla: getHsla,
getRgb: getRgb,
getHsl: getHsl,
getHwb: getHwb,
getAlpha: getAlpha,
hexString: hexString,
rgbString: rgbString,
rgbaString: rgbaString,
percentString: percentString,
percentaString: percentaString,
hslString: hslString,
hslaString: hslaString,
hwbString: hwbString,
keyword: keyword
}
function getRgba(string) {
if (!string) {
return;
}
var abbr = /^#([a-fA-F0-9]{3})$/i,
hex = /^#([a-fA-F0-9]{6})$/i,
rgba = /^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i,
per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/i,
keyword = /(\w+)/;
var rgb = [0, 0, 0],
a = 1,
match = string.match(abbr);
if (match) {
match = match[1];
for (var i = 0; i < rgb.length; i++) {
rgb[i] = parseInt(match[i] + match[i], 16);
}
}
else if (match = string.match(hex)) {
match = match[1];
for (var i = 0; i < rgb.length; i++) {
rgb[i] = parseInt(match.slice(i * 2, i * 2 + 2), 16);
}
}
else if (match = string.match(rgba)) {
for (var i = 0; i < rgb.length; i++) {
rgb[i] = parseInt(match[i + 1]);
}
a = parseFloat(match[4]);
}
else if (match = string.match(per)) {
for (var i = 0; i < rgb.length; i++) {
rgb[i] = Math.round(parseFloat(match[i + 1]) * 2.55);
}
a = parseFloat(match[4]);
}
else if (match = string.match(keyword)) {
if (match[1] == "transparent") {
return [0, 0, 0, 0];
}
rgb = colorNames[match[1]];
if (!rgb) {
return;
}
}
for (var i = 0; i < rgb.length; i++) {
rgb[i] = scale(rgb[i], 0, 255);
}
if (!a && a != 0) {
a = 1;
}
else {
a = scale(a, 0, 1);
}
rgb[3] = a;
return rgb;
}
function getHsla(string) {
if (!string) {
return;
}
var hsl = /^hsla?\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/;
var match = string.match(hsl);
if (match) {
var alpha = parseFloat(match[4]);
var h = scale(parseInt(match[1]), 0, 360),
s = scale(parseFloat(match[2]), 0, 100),
l = scale(parseFloat(match[3]), 0, 100),
a = scale(isNaN(alpha) ? 1 : alpha, 0, 1);
return [h, s, l, a];
}
}
function getHwb(string) {
if (!string) {
return;
}
var hwb = /^hwb\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/;
var match = string.match(hwb);
if (match) {
var alpha = parseFloat(match[4]);
var h = scale(parseInt(match[1]), 0, 360),
w = scale(parseFloat(match[2]), 0, 100),
b = scale(parseFloat(match[3]), 0, 100),
a = scale(isNaN(alpha) ? 1 : alpha, 0, 1);
return [h, w, b, a];
}
}
function getRgb(string) {
var rgba = getRgba(string);
return rgba && rgba.slice(0, 3);
}
function getHsl(string) {
var hsla = getHsla(string);
return hsla && hsla.slice(0, 3);
}
function getAlpha(string) {
var vals = getRgba(string);
if (vals) {
return vals[3];
}
else if (vals = getHsla(string)) {
return vals[3];
}
else if (vals = getHwb(string)) {
return vals[3];
}
}
// generators
function hexString(rgb) {
return "#" + hexDouble(rgb[0]) + hexDouble(rgb[1])
+ hexDouble(rgb[2]);
}
function rgbString(rgba, alpha) {
if (alpha < 1 || (rgba[3] && rgba[3] < 1)) {
return rgbaString(rgba, alpha);
}
return "rgb(" + rgba[0] + ", " + rgba[1] + ", " + rgba[2] + ")";
}
function rgbaString(rgba, alpha) {
if (alpha === undefined) {
alpha = (rgba[3] !== undefined ? rgba[3] : 1);
}
return "rgba(" + rgba[0] + ", " + rgba[1] + ", " + rgba[2]
+ ", " + alpha + ")";
}
function percentString(rgba, alpha) {
if (alpha < 1 || (rgba[3] && rgba[3] < 1)) {
return percentaString(rgba, alpha);
}
var r = Math.round(rgba[0]/255 * 100),
g = Math.round(rgba[1]/255 * 100),
b = Math.round(rgba[2]/255 * 100);
return "rgb(" + r + "%, " + g + "%, " + b + "%)";
}
function percentaString(rgba, alpha) {
var r = Math.round(rgba[0]/255 * 100),
g = Math.round(rgba[1]/255 * 100),
b = Math.round(rgba[2]/255 * 100);
return "rgba(" + r + "%, " + g + "%, " + b + "%, " + (alpha || rgba[3] || 1) + ")";
}
function hslString(hsla, alpha) {
if (alpha < 1 || (hsla[3] && hsla[3] < 1)) {
return hslaString(hsla, alpha);
}
return "hsl(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%)";
}
function hslaString(hsla, alpha) {
if (alpha === undefined) {
alpha = (hsla[3] !== undefined ? hsla[3] : 1);
}
return "hsla(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%, "
+ alpha + ")";
}
// hwb is a bit different than rgb(a) & hsl(a) since there is no alpha specific syntax
// (hwb have alpha optional & 1 is default value)
function hwbString(hwb, alpha) {
if (alpha === undefined) {
alpha = (hwb[3] !== undefined ? hwb[3] : 1);
}
return "hwb(" + hwb[0] + ", " + hwb[1] + "%, " + hwb[2] + "%"
+ (alpha !== undefined && alpha !== 1 ? ", " + alpha : "") + ")";
}
function keyword(rgb) {
return reverseNames[rgb.slice(0, 3)];
}
// helpers
function scale(num, min, max) {
return Math.min(Math.max(min, num), max);
}
function hexDouble(num) {
var str = num.toString(16).toUpperCase();
return (str.length < 2) ? "0" + str : str;
}
//create a list of reverse color names
var reverseNames = {};
for (var name in colorNames) {
reverseNames[colorNames[name]] = name;
}
/***/ }),
/* 428 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var defaults = __webpack_require__(8);
var Element = __webpack_require__(22);
var helpers = __webpack_require__(5);
defaults._set('global', {
elements: {
arc: {
backgroundColor: defaults.global.defaultColor,
borderColor: '#fff',
borderWidth: 2
}
}
});
module.exports = Element.extend({
inLabelRange: function(mouseX) {
var vm = this._view;
if (vm) {
return (Math.pow(mouseX - vm.x, 2) < Math.pow(vm.radius + vm.hoverRadius, 2));
}
return false;
},
inRange: function(chartX, chartY) {
var vm = this._view;
if (vm) {
var pointRelativePosition = helpers.getAngleFromPoint(vm, {x: chartX, y: chartY});
var angle = pointRelativePosition.angle;
var distance = pointRelativePosition.distance;
// Sanitise angle range
var startAngle = vm.startAngle;
var endAngle = vm.endAngle;
while (endAngle < startAngle) {
endAngle += 2.0 * Math.PI;
}
while (angle > endAngle) {
angle -= 2.0 * Math.PI;
}
while (angle < startAngle) {
angle += 2.0 * Math.PI;
}
// Check if within the range of the open/close angle
var betweenAngles = (angle >= startAngle && angle <= endAngle);
var withinRadius = (distance >= vm.innerRadius && distance <= vm.outerRadius);
return (betweenAngles && withinRadius);
}
return false;
},
getCenterPoint: function() {
var vm = this._view;
var halfAngle = (vm.startAngle + vm.endAngle) / 2;
var halfRadius = (vm.innerRadius + vm.outerRadius) / 2;
return {
x: vm.x + Math.cos(halfAngle) * halfRadius,
y: vm.y + Math.sin(halfAngle) * halfRadius
};
},
getArea: function() {
var vm = this._view;
return Math.PI * ((vm.endAngle - vm.startAngle) / (2 * Math.PI)) * (Math.pow(vm.outerRadius, 2) - Math.pow(vm.innerRadius, 2));
},
tooltipPosition: function() {
var vm = this._view;
var centreAngle = vm.startAngle + ((vm.endAngle - vm.startAngle) / 2);
var rangeFromCentre = (vm.outerRadius - vm.innerRadius) / 2 + vm.innerRadius;
return {
x: vm.x + (Math.cos(centreAngle) * rangeFromCentre),
y: vm.y + (Math.sin(centreAngle) * rangeFromCentre)
};
},
draw: function() {
var ctx = this._chart.ctx;
var vm = this._view;
var sA = vm.startAngle;
var eA = vm.endAngle;
ctx.beginPath();
ctx.arc(vm.x, vm.y, vm.outerRadius, sA, eA);
ctx.arc(vm.x, vm.y, vm.innerRadius, eA, sA, true);
ctx.closePath();
ctx.strokeStyle = vm.borderColor;
ctx.lineWidth = vm.borderWidth;
ctx.fillStyle = vm.backgroundColor;
ctx.fill();
ctx.lineJoin = 'bevel';
if (vm.borderWidth) {
ctx.stroke();
}
}
});
/***/ }),
/* 429 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var defaults = __webpack_require__(8);
var Element = __webpack_require__(22);
var helpers = __webpack_require__(5);
var globalDefaults = defaults.global;
defaults._set('global', {
elements: {
line: {
tension: 0.4,
backgroundColor: globalDefaults.defaultColor,
borderWidth: 3,
borderColor: globalDefaults.defaultColor,
borderCapStyle: 'butt',
borderDash: [],
borderDashOffset: 0.0,
borderJoinStyle: 'miter',
capBezierPoints: true,
fill: true, // do we fill in the area between the line and its base axis
}
}
});
module.exports = Element.extend({
draw: function() {
var me = this;
var vm = me._view;
var ctx = me._chart.ctx;
var spanGaps = vm.spanGaps;
var points = me._children.slice(); // clone array
var globalOptionLineElements = globalDefaults.elements.line;
var lastDrawnIndex = -1;
var index, current, previous, currentVM;
// If we are looping, adding the first point again
if (me._loop && points.length) {
points.push(points[0]);
}
ctx.save();
// Stroke Line Options
ctx.lineCap = vm.borderCapStyle || globalOptionLineElements.borderCapStyle;
// IE 9 and 10 do not support line dash
if (ctx.setLineDash) {
ctx.setLineDash(vm.borderDash || globalOptionLineElements.borderDash);
}
ctx.lineDashOffset = vm.borderDashOffset || globalOptionLineElements.borderDashOffset;
ctx.lineJoin = vm.borderJoinStyle || globalOptionLineElements.borderJoinStyle;
ctx.lineWidth = vm.borderWidth || globalOptionLineElements.borderWidth;
ctx.strokeStyle = vm.borderColor || globalDefaults.defaultColor;
// Stroke Line
ctx.beginPath();
lastDrawnIndex = -1;
for (index = 0; index < points.length; ++index) {
current = points[index];
previous = helpers.previousItem(points, index);
currentVM = current._view;
// First point moves to it's starting position no matter what
if (index === 0) {
if (!currentVM.skip) {
ctx.moveTo(currentVM.x, currentVM.y);
lastDrawnIndex = index;
}
} else {
previous = lastDrawnIndex === -1 ? previous : points[lastDrawnIndex];
if (!currentVM.skip) {
if ((lastDrawnIndex !== (index - 1) && !spanGaps) || lastDrawnIndex === -1) {
// There was a gap and this is the first point after the gap
ctx.moveTo(currentVM.x, currentVM.y);
} else {
// Line to next point
helpers.canvas.lineTo(ctx, previous._view, current._view);
}
lastDrawnIndex = index;
}
}
}
ctx.stroke();
ctx.restore();
}
});
/***/ }),
/* 430 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var defaults = __webpack_require__(8);
var Element = __webpack_require__(22);
var helpers = __webpack_require__(5);
var defaultColor = defaults.global.defaultColor;
defaults._set('global', {
elements: {
point: {
radius: 3,
pointStyle: 'circle',
backgroundColor: defaultColor,
borderColor: defaultColor,
borderWidth: 1,
// Hover
hitRadius: 1,
hoverRadius: 4,
hoverBorderWidth: 1
}
}
});
function xRange(mouseX) {
var vm = this._view;
return vm ? (Math.abs(mouseX - vm.x) < vm.radius + vm.hitRadius) : false;
}
function yRange(mouseY) {
var vm = this._view;
return vm ? (Math.abs(mouseY - vm.y) < vm.radius + vm.hitRadius) : false;
}
module.exports = Element.extend({
inRange: function(mouseX, mouseY) {
var vm = this._view;
return vm ? ((Math.pow(mouseX - vm.x, 2) + Math.pow(mouseY - vm.y, 2)) < Math.pow(vm.hitRadius + vm.radius, 2)) : false;
},
inLabelRange: xRange,
inXRange: xRange,
inYRange: yRange,
getCenterPoint: function() {
var vm = this._view;
return {
x: vm.x,
y: vm.y
};
},
getArea: function() {
return Math.PI * Math.pow(this._view.radius, 2);
},
tooltipPosition: function() {
var vm = this._view;
return {
x: vm.x,
y: vm.y,
padding: vm.radius + vm.borderWidth
};
},
draw: function(chartArea) {
var vm = this._view;
var model = this._model;
var ctx = this._chart.ctx;
var pointStyle = vm.pointStyle;
var radius = vm.radius;
var x = vm.x;
var y = vm.y;
var color = helpers.color;
var errMargin = 1.01; // 1.01 is margin for Accumulated error. (Especially Edge, IE.)
var ratio = 0;
if (vm.skip) {
return;
}
ctx.strokeStyle = vm.borderColor || defaultColor;
ctx.lineWidth = helpers.valueOrDefault(vm.borderWidth, defaults.global.elements.point.borderWidth);
ctx.fillStyle = vm.backgroundColor || defaultColor;
// Cliping for Points.
// going out from inner charArea?
if ((chartArea !== undefined) && ((model.x < chartArea.left) || (chartArea.right * errMargin < model.x) || (model.y < chartArea.top) || (chartArea.bottom * errMargin < model.y))) {
// Point fade out
if (model.x < chartArea.left) {
ratio = (x - model.x) / (chartArea.left - model.x);
} else if (chartArea.right * errMargin < model.x) {
ratio = (model.x - x) / (model.x - chartArea.right);
} else if (model.y < chartArea.top) {
ratio = (y - model.y) / (chartArea.top - model.y);
} else if (chartArea.bottom * errMargin < model.y) {
ratio = (model.y - y) / (model.y - chartArea.bottom);
}
ratio = Math.round(ratio * 100) / 100;
ctx.strokeStyle = color(ctx.strokeStyle).alpha(ratio).rgbString();
ctx.fillStyle = color(ctx.fillStyle).alpha(ratio).rgbString();
}
helpers.canvas.drawPoint(ctx, pointStyle, radius, x, y);
}
});
/***/ }),
/* 431 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var defaults = __webpack_require__(8);
var Element = __webpack_require__(22);
defaults._set('global', {
elements: {
rectangle: {
backgroundColor: defaults.global.defaultColor,
borderColor: defaults.global.defaultColor,
borderSkipped: 'bottom',
borderWidth: 0
}
}
});
function isVertical(bar) {
return bar._view.width !== undefined;
}
/**
* Helper function to get the bounds of the bar regardless of the orientation
* @param bar {Chart.Element.Rectangle} the bar
* @return {Bounds} bounds of the bar
* @private
*/
function getBarBounds(bar) {
var vm = bar._view;
var x1, x2, y1, y2;
if (isVertical(bar)) {
// vertical
var halfWidth = vm.width / 2;
x1 = vm.x - halfWidth;
x2 = vm.x + halfWidth;
y1 = Math.min(vm.y, vm.base);
y2 = Math.max(vm.y, vm.base);
} else {
// horizontal bar
var halfHeight = vm.height / 2;
x1 = Math.min(vm.x, vm.base);
x2 = Math.max(vm.x, vm.base);
y1 = vm.y - halfHeight;
y2 = vm.y + halfHeight;
}
return {
left: x1,
top: y1,
right: x2,
bottom: y2
};
}
module.exports = Element.extend({
draw: function() {
var ctx = this._chart.ctx;
var vm = this._view;
var left, right, top, bottom, signX, signY, borderSkipped;
var borderWidth = vm.borderWidth;
if (!vm.horizontal) {
// bar
left = vm.x - vm.width / 2;
right = vm.x + vm.width / 2;
top = vm.y;
bottom = vm.base;
signX = 1;
signY = bottom > top ? 1 : -1;
borderSkipped = vm.borderSkipped || 'bottom';
} else {
// horizontal bar
left = vm.base;
right = vm.x;
top = vm.y - vm.height / 2;
bottom = vm.y + vm.height / 2;
signX = right > left ? 1 : -1;
signY = 1;
borderSkipped = vm.borderSkipped || 'left';
}
// Canvas doesn't allow us to stroke inside the width so we can
// adjust the sizes to fit if we're setting a stroke on the line
if (borderWidth) {
// borderWidth shold be less than bar width and bar height.
var barSize = Math.min(Math.abs(left - right), Math.abs(top - bottom));
borderWidth = borderWidth > barSize ? barSize : borderWidth;
var halfStroke = borderWidth / 2;
// Adjust borderWidth when bar top position is near vm.base(zero).
var borderLeft = left + (borderSkipped !== 'left' ? halfStroke * signX : 0);
var borderRight = right + (borderSkipped !== 'right' ? -halfStroke * signX : 0);
var borderTop = top + (borderSkipped !== 'top' ? halfStroke * signY : 0);
var borderBottom = bottom + (borderSkipped !== 'bottom' ? -halfStroke * signY : 0);
// not become a vertical line?
if (borderLeft !== borderRight) {
top = borderTop;
bottom = borderBottom;
}
// not become a horizontal line?
if (borderTop !== borderBottom) {
left = borderLeft;
right = borderRight;
}
}
ctx.beginPath();
ctx.fillStyle = vm.backgroundColor;
ctx.strokeStyle = vm.borderColor;
ctx.lineWidth = borderWidth;
// Corner points, from bottom-left to bottom-right clockwise
// | 1 2 |
// | 0 3 |
var corners = [
[left, bottom],
[left, top],
[right, top],
[right, bottom]
];
// Find first (starting) corner with fallback to 'bottom'
var borders = ['bottom', 'left', 'top', 'right'];
var startCorner = borders.indexOf(borderSkipped, 0);
if (startCorner === -1) {
startCorner = 0;
}
function cornerAt(index) {
return corners[(startCorner + index) % 4];
}
// Draw rectangle from 'startCorner'
var corner = cornerAt(0);
ctx.moveTo(corner[0], corner[1]);
for (var i = 1; i < 4; i++) {
corner = cornerAt(i);
ctx.lineTo(corner[0], corner[1]);
}
ctx.fill();
if (borderWidth) {
ctx.stroke();
}
},
height: function() {
var vm = this._view;
return vm.base - vm.y;
},
inRange: function(mouseX, mouseY) {
var inRange = false;
if (this._view) {
var bounds = getBarBounds(this);
inRange = mouseX >= bounds.left && mouseX <= bounds.right && mouseY >= bounds.top && mouseY <= bounds.bottom;
}
return inRange;
},
inLabelRange: function(mouseX, mouseY) {
var me = this;
if (!me._view) {
return false;
}
var inRange = false;
var bounds = getBarBounds(me);
if (isVertical(me)) {
inRange = mouseX >= bounds.left && mouseX <= bounds.right;
} else {
inRange = mouseY >= bounds.top && mouseY <= bounds.bottom;
}
return inRange;
},
inXRange: function(mouseX) {
var bounds = getBarBounds(this);
return mouseX >= bounds.left && mouseX <= bounds.right;
},
inYRange: function(mouseY) {
var bounds = getBarBounds(this);
return mouseY >= bounds.top && mouseY <= bounds.bottom;
},
getCenterPoint: function() {
var vm = this._view;
var x, y;
if (isVertical(this)) {
x = vm.x;
y = (vm.y + vm.base) / 2;
} else {
x = (vm.x + vm.base) / 2;
y = vm.y;
}
return {x: x, y: y};
},
getArea: function() {
var vm = this._view;
return vm.width * Math.abs(vm.y - vm.base);
},
tooltipPosition: function() {
var vm = this._view;
return {
x: vm.x,
y: vm.y
};
}
});
/***/ }),
/* 432 */
/***/ (function(module, exports) {
/**
* Platform fallback implementation (minimal).
* @see https://github.com/chartjs/Chart.js/pull/4591#issuecomment-319575939
*/
module.exports = {
acquireContext: function(item) {
if (item && item.canvas) {
// Support for any object associated to a canvas (including a context2d)
item = item.canvas;
}
return item && item.getContext('2d') || null;
}
};
/***/ }),
/* 433 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Chart.Platform implementation for targeting a web browser
*/
var helpers = __webpack_require__(5);
var EXPANDO_KEY = '$chartjs';
var CSS_PREFIX = 'chartjs-';
var CSS_RENDER_MONITOR = CSS_PREFIX + 'render-monitor';
var CSS_RENDER_ANIMATION = CSS_PREFIX + 'render-animation';
var ANIMATION_START_EVENTS = ['animationstart', 'webkitAnimationStart'];
/**
* DOM event types -> Chart.js event types.
* Note: only events with different types are mapped.
* @see https://developer.mozilla.org/en-US/docs/Web/Events
*/
var EVENT_TYPES = {
touchstart: 'mousedown',
touchmove: 'mousemove',
touchend: 'mouseup',
pointerenter: 'mouseenter',
pointerdown: 'mousedown',
pointermove: 'mousemove',
pointerup: 'mouseup',
pointerleave: 'mouseout',
pointerout: 'mouseout'
};
/**
* The "used" size is the final value of a dimension property after all calculations have
* been performed. This method uses the computed style of `element` but returns undefined
* if the computed style is not expressed in pixels. That can happen in some cases where
* `element` has a size relative to its parent and this last one is not yet displayed,
* for example because of `display: none` on a parent node.
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/used_value
* @returns {Number} Size in pixels or undefined if unknown.
*/
function readUsedSize(element, property) {
var value = helpers.getStyle(element, property);
var matches = value && value.match(/^(\d+)(\.\d+)?px$/);
return matches ? Number(matches[1]) : undefined;
}
/**
* Initializes the canvas style and render size without modifying the canvas display size,
* since responsiveness is handled by the controller.resize() method. The config is used
* to determine the aspect ratio to apply in case no explicit height has been specified.
*/
function initCanvas(canvas, config) {
var style = canvas.style;
// NOTE(SB) canvas.getAttribute('width') !== canvas.width: in the first case it
// returns null or '' if no explicit value has been set to the canvas attribute.
var renderHeight = canvas.getAttribute('height');
var renderWidth = canvas.getAttribute('width');
// Chart.js modifies some canvas values that we want to restore on destroy
canvas[EXPANDO_KEY] = {
initial: {
height: renderHeight,
width: renderWidth,
style: {
display: style.display,
height: style.height,
width: style.width
}
}
};
// Force canvas to display as block to avoid extra space caused by inline
// elements, which would interfere with the responsive resize process.
// https://github.com/chartjs/Chart.js/issues/2538
style.display = style.display || 'block';
if (renderWidth === null || renderWidth === '') {
var displayWidth = readUsedSize(canvas, 'width');
if (displayWidth !== undefined) {
canvas.width = displayWidth;
}
}
if (renderHeight === null || renderHeight === '') {
if (canvas.style.height === '') {
// If no explicit render height and style height, let's apply the aspect ratio,
// which one can be specified by the user but also by charts as default option
// (i.e. options.aspectRatio). If not specified, use canvas aspect ratio of 2.
canvas.height = canvas.width / (config.options.aspectRatio || 2);
} else {
var displayHeight = readUsedSize(canvas, 'height');
if (displayWidth !== undefined) {
canvas.height = displayHeight;
}
}
}
return canvas;
}
/**
* Detects support for options object argument in addEventListener.
* https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Safely_detecting_option_support
* @private
*/
var supportsEventListenerOptions = (function() {
var supports = false;
try {
var options = Object.defineProperty({}, 'passive', {
get: function() {
supports = true;
}
});
window.addEventListener('e', null, options);
} catch (e) {
// continue regardless of error
}
return supports;
}());
// Default passive to true as expected by Chrome for 'touchstart' and 'touchend' events.
// https://github.com/chartjs/Chart.js/issues/4287
var eventListenerOptions = supportsEventListenerOptions ? {passive: true} : false;
function addEventListener(node, type, listener) {
node.addEventListener(type, listener, eventListenerOptions);
}
function removeEventListener(node, type, listener) {
node.removeEventListener(type, listener, eventListenerOptions);
}
function createEvent(type, chart, x, y, nativeEvent) {
return {
type: type,
chart: chart,
native: nativeEvent || null,
x: x !== undefined ? x : null,
y: y !== undefined ? y : null,
};
}
function fromNativeEvent(event, chart) {
var type = EVENT_TYPES[event.type] || event.type;
var pos = helpers.getRelativePosition(event, chart);
return createEvent(type, chart, pos.x, pos.y, event);
}
function throttled(fn, thisArg) {
var ticking = false;
var args = [];
return function() {
args = Array.prototype.slice.call(arguments);
thisArg = thisArg || this;
if (!ticking) {
ticking = true;
helpers.requestAnimFrame.call(window, function() {
ticking = false;
fn.apply(thisArg, args);
});
}
};
}
// Implementation based on https://github.com/marcj/css-element-queries
function createResizer(handler) {
var resizer = document.createElement('div');
var cls = CSS_PREFIX + 'size-monitor';
var maxSize = 1000000;
var style =
'position:absolute;' +
'left:0;' +
'top:0;' +
'right:0;' +
'bottom:0;' +
'overflow:hidden;' +
'pointer-events:none;' +
'visibility:hidden;' +
'z-index:-1;';
resizer.style.cssText = style;
resizer.className = cls;
resizer.innerHTML =
'<div class="' + cls + '-expand" style="' + style + '">' +
'<div style="' +
'position:absolute;' +
'width:' + maxSize + 'px;' +
'height:' + maxSize + 'px;' +
'left:0;' +
'top:0">' +
'</div>' +
'</div>' +
'<div class="' + cls + '-shrink" style="' + style + '">' +
'<div style="' +
'position:absolute;' +
'width:200%;' +
'height:200%;' +
'left:0; ' +
'top:0">' +
'</div>' +
'</div>';
var expand = resizer.childNodes[0];
var shrink = resizer.childNodes[1];
resizer._reset = function() {
expand.scrollLeft = maxSize;
expand.scrollTop = maxSize;
shrink.scrollLeft = maxSize;
shrink.scrollTop = maxSize;
};
var onScroll = function() {
resizer._reset();
handler();
};
addEventListener(expand, 'scroll', onScroll.bind(expand, 'expand'));
addEventListener(shrink, 'scroll', onScroll.bind(shrink, 'shrink'));
return resizer;
}
// https://davidwalsh.name/detect-node-insertion
function watchForRender(node, handler) {
var expando = node[EXPANDO_KEY] || (node[EXPANDO_KEY] = {});
var proxy = expando.renderProxy = function(e) {
if (e.animationName === CSS_RENDER_ANIMATION) {
handler();
}
};
helpers.each(ANIMATION_START_EVENTS, function(type) {
addEventListener(node, type, proxy);
});
// #4737: Chrome might skip the CSS animation when the CSS_RENDER_MONITOR class
// is removed then added back immediately (same animation frame?). Accessing the
// `offsetParent` property will force a reflow and re-evaluate the CSS animation.
// https://gist.github.com/paulirish/5d52fb081b3570c81e3a#box-metrics
// https://github.com/chartjs/Chart.js/issues/4737
expando.reflow = !!node.offsetParent;
node.classList.add(CSS_RENDER_MONITOR);
}
function unwatchForRender(node) {
var expando = node[EXPANDO_KEY] || {};
var proxy = expando.renderProxy;
if (proxy) {
helpers.each(ANIMATION_START_EVENTS, function(type) {
removeEventListener(node, type, proxy);
});
delete expando.renderProxy;
}
node.classList.remove(CSS_RENDER_MONITOR);
}
function addResizeListener(node, listener, chart) {
var expando = node[EXPANDO_KEY] || (node[EXPANDO_KEY] = {});
// Let's keep track of this added resizer and thus avoid DOM query when removing it.
var resizer = expando.resizer = createResizer(throttled(function() {
if (expando.resizer) {
return listener(createEvent('resize', chart));
}
}));
// The resizer needs to be attached to the node parent, so we first need to be
// sure that `node` is attached to the DOM before injecting the resizer element.
watchForRender(node, function() {
if (expando.resizer) {
var container = node.parentNode;
if (container && container !== resizer.parentNode) {
container.insertBefore(resizer, container.firstChild);
}
// The container size might have changed, let's reset the resizer state.
resizer._reset();
}
});
}
function removeResizeListener(node) {
var expando = node[EXPANDO_KEY] || {};
var resizer = expando.resizer;
delete expando.resizer;
unwatchForRender(node);
if (resizer && resizer.parentNode) {
resizer.parentNode.removeChild(resizer);
}
}
function injectCSS(platform, css) {
// http://stackoverflow.com/q/3922139
var style = platform._style || document.createElement('style');
if (!platform._style) {
platform._style = style;
css = '/* Chart.js */\n' + css;
style.setAttribute('type', 'text/css');
document.getElementsByTagName('head')[0].appendChild(style);
}
style.appendChild(document.createTextNode(css));
}
module.exports = {
/**
* This property holds whether this platform is enabled for the current environment.
* Currently used by platform.js to select the proper implementation.
* @private
*/
_enabled: typeof window !== 'undefined' && typeof document !== 'undefined',
initialize: function() {
var keyframes = 'from{opacity:0.99}to{opacity:1}';
injectCSS(this,
// DOM rendering detection
// https://davidwalsh.name/detect-node-insertion
'@-webkit-keyframes ' + CSS_RENDER_ANIMATION + '{' + keyframes + '}' +
'@keyframes ' + CSS_RENDER_ANIMATION + '{' + keyframes + '}' +
'.' + CSS_RENDER_MONITOR + '{' +
'-webkit-animation:' + CSS_RENDER_ANIMATION + ' 0.001s;' +
'animation:' + CSS_RENDER_ANIMATION + ' 0.001s;' +
'}'
);
},
acquireContext: function(item, config) {
if (typeof item === 'string') {
item = document.getElementById(item);
} else if (item.length) {
// Support for array based queries (such as jQuery)
item = item[0];
}
if (item && item.canvas) {
// Support for any object associated to a canvas (including a context2d)
item = item.canvas;
}
// To prevent canvas fingerprinting, some add-ons undefine the getContext
// method, for example: https://github.com/kkapsner/CanvasBlocker
// https://github.com/chartjs/Chart.js/issues/2807
var context = item && item.getContext && item.getContext('2d');
// `instanceof HTMLCanvasElement/CanvasRenderingContext2D` fails when the item is
// inside an iframe or when running in a protected environment. We could guess the
// types from their toString() value but let's keep things flexible and assume it's
// a sufficient condition if the item has a context2D which has item as `canvas`.
// https://github.com/chartjs/Chart.js/issues/3887
// https://github.com/chartjs/Chart.js/issues/4102
// https://github.com/chartjs/Chart.js/issues/4152
if (context && context.canvas === item) {
initCanvas(item, config);
return context;
}
return null;
},
releaseContext: function(context) {
var canvas = context.canvas;
if (!canvas[EXPANDO_KEY]) {
return;
}
var initial = canvas[EXPANDO_KEY].initial;
['height', 'width'].forEach(function(prop) {
var value = initial[prop];
if (helpers.isNullOrUndef(value)) {
canvas.removeAttribute(prop);
} else {
canvas.setAttribute(prop, value);
}
});
helpers.each(initial.style || {}, function(value, key) {
canvas.style[key] = value;
});
// The canvas render size might have been changed (and thus the state stack discarded),
// we can't use save() and restore() to restore the initial state. So make sure that at
// least the canvas context is reset to the default state by setting the canvas width.
// https://www.w3.org/TR/2011/WD-html5-20110525/the-canvas-element.html
canvas.width = canvas.width;
delete canvas[EXPANDO_KEY];
},
addEventListener: function(chart, type, listener) {
var canvas = chart.canvas;
if (type === 'resize') {
// Note: the resize event is not supported on all browsers.
addResizeListener(canvas, listener, chart);
return;
}
var expando = listener[EXPANDO_KEY] || (listener[EXPANDO_KEY] = {});
var proxies = expando.proxies || (expando.proxies = {});
var proxy = proxies[chart.id + '_' + type] = function(event) {
listener(fromNativeEvent(event, chart));
};
addEventListener(canvas, type, proxy);
},
removeEventListener: function(chart, type, listener) {
var canvas = chart.canvas;
if (type === 'resize') {
// Note: the resize event is not supported on all browsers.
removeResizeListener(canvas, listener);
return;
}
var expando = listener[EXPANDO_KEY] || {};
var proxies = expando.proxies || {};
var proxy = proxies[chart.id + '_' + type];
if (!proxy) {
return;
}
removeEventListener(canvas, type, proxy);
}
};
// DEPRECATIONS
/**
* Provided for backward compatibility, use EventTarget.addEventListener instead.
* EventTarget.addEventListener compatibility: Chrome, Opera 7, Safari, FF1.5+, IE9+
* @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
* @function Chart.helpers.addEvent
* @deprecated since version 2.7.0
* @todo remove at version 3
* @private
*/
helpers.addEvent = addEventListener;
/**
* Provided for backward compatibility, use EventTarget.removeEventListener instead.
* EventTarget.removeEventListener compatibility: Chrome, Opera 7, Safari, FF1.5+, IE9+
* @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/removeEventListener
* @function Chart.helpers.removeEvent
* @deprecated since version 2.7.0
* @todo remove at version 3
* @private
*/
helpers.removeEvent = removeEventListener;
/***/ }),
/* 434 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* global window: false */
var defaults = __webpack_require__(8);
var Element = __webpack_require__(22);
var helpers = __webpack_require__(5);
defaults._set('global', {
animation: {
duration: 1000,
easing: 'easeOutQuart',
onProgress: helpers.noop,
onComplete: helpers.noop
}
});
module.exports = function(Chart) {
Chart.Animation = Element.extend({
chart: null, // the animation associated chart instance
currentStep: 0, // the current animation step
numSteps: 60, // default number of steps
easing: '', // the easing to use for this animation
render: null, // render function used by the animation service
onAnimationProgress: null, // user specified callback to fire on each step of the animation
onAnimationComplete: null, // user specified callback to fire when the animation finishes
});
Chart.animationService = {
frameDuration: 17,
animations: [],
dropFrames: 0,
request: null,
/**
* @param {Chart} chart - The chart to animate.
* @param {Chart.Animation} animation - The animation that we will animate.
* @param {Number} duration - The animation duration in ms.
* @param {Boolean} lazy - if true, the chart is not marked as animating to enable more responsive interactions
*/
addAnimation: function(chart, animation, duration, lazy) {
var animations = this.animations;
var i, ilen;
animation.chart = chart;
if (!lazy) {
chart.animating = true;
}
for (i = 0, ilen = animations.length; i < ilen; ++i) {
if (animations[i].chart === chart) {
animations[i] = animation;
return;
}
}
animations.push(animation);
// If there are no animations queued, manually kickstart a digest, for lack of a better word
if (animations.length === 1) {
this.requestAnimationFrame();
}
},
cancelAnimation: function(chart) {
var index = helpers.findIndex(this.animations, function(animation) {
return animation.chart === chart;
});
if (index !== -1) {
this.animations.splice(index, 1);
chart.animating = false;
}
},
requestAnimationFrame: function() {
var me = this;
if (me.request === null) {
// Skip animation frame requests until the active one is executed.
// This can happen when processing mouse events, e.g. 'mousemove'
// and 'mouseout' events will trigger multiple renders.
me.request = helpers.requestAnimFrame.call(window, function() {
me.request = null;
me.startDigest();
});
}
},
/**
* @private
*/
startDigest: function() {
var me = this;
var startTime = Date.now();
var framesToDrop = 0;
if (me.dropFrames > 1) {
framesToDrop = Math.floor(me.dropFrames);
me.dropFrames = me.dropFrames % 1;
}
me.advance(1 + framesToDrop);
var endTime = Date.now();
me.dropFrames += (endTime - startTime) / me.frameDuration;
// Do we have more stuff to animate?
if (me.animations.length > 0) {
me.requestAnimationFrame();
}
},
/**
* @private
*/
advance: function(count) {
var animations = this.animations;
var animation, chart;
var i = 0;
while (i < animations.length) {
animation = animations[i];
chart = animation.chart;
animation.currentStep = (animation.currentStep || 0) + count;
animation.currentStep = Math.min(animation.currentStep, animation.numSteps);
helpers.callback(animation.render, [chart, animation], chart);
helpers.callback(animation.onAnimationProgress, [animation], chart);
if (animation.currentStep >= animation.numSteps) {
helpers.callback(animation.onAnimationComplete, [animation], chart);
chart.animating = false;
animations.splice(i, 1);
} else {
++i;
}
}
}
};
/**
* Provided for backward compatibility, use Chart.Animation instead
* @prop Chart.Animation#animationObject
* @deprecated since version 2.6.0
* @todo remove at version 3
*/
Object.defineProperty(Chart.Animation.prototype, 'animationObject', {
get: function() {
return this;
}
});
/**
* Provided for backward compatibility, use Chart.Animation#chart instead
* @prop Chart.Animation#chartInstance
* @deprecated since version 2.6.0
* @todo remove at version 3
*/
Object.defineProperty(Chart.Animation.prototype, 'chartInstance', {
get: function() {
return this.chart;
},
set: function(value) {
this.chart = value;
}
});
};
/***/ }),
/* 435 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var defaults = __webpack_require__(8);
var helpers = __webpack_require__(5);
var Interaction = __webpack_require__(185);
var layouts = __webpack_require__(50);
var platform = __webpack_require__(186);
var plugins = __webpack_require__(187);
module.exports = function(Chart) {
// Create a dictionary of chart types, to allow for extension of existing types
Chart.types = {};
// Store a reference to each instance - allowing us to globally resize chart instances on window resize.
// Destroy method on the chart will remove the instance of the chart from this reference.
Chart.instances = {};
// Controllers available for dataset visualization eg. bar, line, slice, etc.
Chart.controllers = {};
/**
* Initializes the given config with global and chart default values.
*/
function initConfig(config) {
config = config || {};
// Do NOT use configMerge() for the data object because this method merges arrays
// and so would change references to labels and datasets, preventing data updates.
var data = config.data = config.data || {};
data.datasets = data.datasets || [];
data.labels = data.labels || [];
config.options = helpers.configMerge(
defaults.global,
defaults[config.type],
config.options || {});
return config;
}
/**
* Updates the config of the chart
* @param chart {Chart} chart to update the options for
*/
function updateConfig(chart) {
var newOptions = chart.options;
helpers.each(chart.scales, function(scale) {
layouts.removeBox(chart, scale);
});
newOptions = helpers.configMerge(
Chart.defaults.global,
Chart.defaults[chart.config.type],
newOptions);
chart.options = chart.config.options = newOptions;
chart.ensureScalesHaveIDs();
chart.buildOrUpdateScales();
// Tooltip
chart.tooltip._options = newOptions.tooltips;
chart.tooltip.initialize();
}
function positionIsHorizontal(position) {
return position === 'top' || position === 'bottom';
}
helpers.extend(Chart.prototype, /** @lends Chart */ {
/**
* @private
*/
construct: function(item, config) {
var me = this;
config = initConfig(config);
var context = platform.acquireContext(item, config);
var canvas = context && context.canvas;
var height = canvas && canvas.height;
var width = canvas && canvas.width;
me.id = helpers.uid();
me.ctx = context;
me.canvas = canvas;
me.config = config;
me.width = width;
me.height = height;
me.aspectRatio = height ? width / height : null;
me.options = config.options;
me._bufferedRender = false;
/**
* Provided for backward compatibility, Chart and Chart.Controller have been merged,
* the "instance" still need to be defined since it might be called from plugins.
* @prop Chart#chart
* @deprecated since version 2.6.0
* @todo remove at version 3
* @private
*/
me.chart = me;
me.controller = me; // chart.chart.controller #inception
// Add the chart instance to the global namespace
Chart.instances[me.id] = me;
// Define alias to the config data: `chart.data === chart.config.data`
Object.defineProperty(me, 'data', {
get: function() {
return me.config.data;
},
set: function(value) {
me.config.data = value;
}
});
if (!context || !canvas) {
// The given item is not a compatible context2d element, let's return before finalizing
// the chart initialization but after setting basic chart / controller properties that
// can help to figure out that the chart is not valid (e.g chart.canvas !== null);
// https://github.com/chartjs/Chart.js/issues/2807
console.error("Failed to create chart: can't acquire context from the given item");
return;
}
me.initialize();
me.update();
},
/**
* @private
*/
initialize: function() {
var me = this;
// Before init plugin notification
plugins.notify(me, 'beforeInit');
helpers.retinaScale(me, me.options.devicePixelRatio);
me.bindEvents();
if (me.options.responsive) {
// Initial resize before chart draws (must be silent to preserve initial animations).
me.resize(true);
}
// Make sure scales have IDs and are built before we build any controllers.
me.ensureScalesHaveIDs();
me.buildOrUpdateScales();
me.initToolTip();
// After init plugin notification
plugins.notify(me, 'afterInit');
return me;
},
clear: function() {
helpers.canvas.clear(this);
return this;
},
stop: function() {
// Stops any current animation loop occurring
Chart.animationService.cancelAnimation(this);
return this;
},
resize: function(silent) {
var me = this;
var options = me.options;
var canvas = me.canvas;
var aspectRatio = (options.maintainAspectRatio && me.aspectRatio) || null;
// the canvas render width and height will be casted to integers so make sure that
// the canvas display style uses the same integer values to avoid blurring effect.
// Set to 0 instead of canvas.size because the size defaults to 300x150 if the element is collased
var newWidth = Math.max(0, Math.floor(helpers.getMaximumWidth(canvas)));
var newHeight = Math.max(0, Math.floor(aspectRatio ? newWidth / aspectRatio : helpers.getMaximumHeight(canvas)));
if (me.width === newWidth && me.height === newHeight) {
return;
}
canvas.width = me.width = newWidth;
canvas.height = me.height = newHeight;
canvas.style.width = newWidth + 'px';
canvas.style.height = newHeight + 'px';
helpers.retinaScale(me, options.devicePixelRatio);
if (!silent) {
// Notify any plugins about the resize
var newSize = {width: newWidth, height: newHeight};
plugins.notify(me, 'resize', [newSize]);
// Notify of resize
if (me.options.onResize) {
me.options.onResize(me, newSize);
}
me.stop();
me.update(me.options.responsiveAnimationDuration);
}
},
ensureScalesHaveIDs: function() {
var options = this.options;
var scalesOptions = options.scales || {};
var scaleOptions = options.scale;
helpers.each(scalesOptions.xAxes, function(xAxisOptions, index) {
xAxisOptions.id = xAxisOptions.id || ('x-axis-' + index);
});
helpers.each(scalesOptions.yAxes, function(yAxisOptions, index) {
yAxisOptions.id = yAxisOptions.id || ('y-axis-' + index);
});
if (scaleOptions) {
scaleOptions.id = scaleOptions.id || 'scale';
}
},
/**
* Builds a map of scale ID to scale object for future lookup.
*/
buildOrUpdateScales: function() {
var me = this;
var options = me.options;
var scales = me.scales || {};
var items = [];
var updated = Object.keys(scales).reduce(function(obj, id) {
obj[id] = false;
return obj;
}, {});
if (options.scales) {
items = items.concat(
(options.scales.xAxes || []).map(function(xAxisOptions) {
return {options: xAxisOptions, dtype: 'category', dposition: 'bottom'};
}),
(options.scales.yAxes || []).map(function(yAxisOptions) {
return {options: yAxisOptions, dtype: 'linear', dposition: 'left'};
})
);
}
if (options.scale) {
items.push({
options: options.scale,
dtype: 'radialLinear',
isDefault: true,
dposition: 'chartArea'
});
}
helpers.each(items, function(item) {
var scaleOptions = item.options;
var id = scaleOptions.id;
var scaleType = helpers.valueOrDefault(scaleOptions.type, item.dtype);
if (positionIsHorizontal(scaleOptions.position) !== positionIsHorizontal(item.dposition)) {
scaleOptions.position = item.dposition;
}
updated[id] = true;
var scale = null;
if (id in scales && scales[id].type === scaleType) {
scale = scales[id];
scale.options = scaleOptions;
scale.ctx = me.ctx;
scale.chart = me;
} else {
var scaleClass = Chart.scaleService.getScaleConstructor(scaleType);
if (!scaleClass) {
return;
}
scale = new scaleClass({
id: id,
type: scaleType,
options: scaleOptions,
ctx: me.ctx,
chart: me
});
scales[scale.id] = scale;
}
scale.mergeTicksOptions();
// TODO(SB): I think we should be able to remove this custom case (options.scale)
// and consider it as a regular scale part of the "scales"" map only! This would
// make the logic easier and remove some useless? custom code.
if (item.isDefault) {
me.scale = scale;
}
});
// clear up discarded scales
helpers.each(updated, function(hasUpdated, id) {
if (!hasUpdated) {
delete scales[id];
}
});
me.scales = scales;
Chart.scaleService.addScalesToLayout(this);
},
buildOrUpdateControllers: function() {
var me = this;
var types = [];
var newControllers = [];
helpers.each(me.data.datasets, function(dataset, datasetIndex) {
var meta = me.getDatasetMeta(datasetIndex);
var type = dataset.type || me.config.type;
if (meta.type && meta.type !== type) {
me.destroyDatasetMeta(datasetIndex);
meta = me.getDatasetMeta(datasetIndex);
}
meta.type = type;
types.push(meta.type);
if (meta.controller) {
meta.controller.updateIndex(datasetIndex);
meta.controller.linkScales();
} else {
var ControllerClass = Chart.controllers[meta.type];
if (ControllerClass === undefined) {
throw new Error('"' + meta.type + '" is not a chart type.');
}
meta.controller = new ControllerClass(me, datasetIndex);
newControllers.push(meta.controller);
}
}, me);
return newControllers;
},
/**
* Reset the elements of all datasets
* @private
*/
resetElements: function() {
var me = this;
helpers.each(me.data.datasets, function(dataset, datasetIndex) {
me.getDatasetMeta(datasetIndex).controller.reset();
}, me);
},
/**
* Resets the chart back to it's state before the initial animation
*/
reset: function() {
this.resetElements();
this.tooltip.initialize();
},
update: function(config) {
var me = this;
if (!config || typeof config !== 'object') {
// backwards compatibility
config = {
duration: config,
lazy: arguments[1]
};
}
updateConfig(me);
// plugins options references might have change, let's invalidate the cache
// https://github.com/chartjs/Chart.js/issues/5111#issuecomment-355934167
plugins._invalidate(me);
if (plugins.notify(me, 'beforeUpdate') === false) {
return;
}
// In case the entire data object changed
me.tooltip._data = me.data;
// Make sure dataset controllers are updated and new controllers are reset
var newControllers = me.buildOrUpdateControllers();
// Make sure all dataset controllers have correct meta data counts
helpers.each(me.data.datasets, function(dataset, datasetIndex) {
me.getDatasetMeta(datasetIndex).controller.buildOrUpdateElements();
}, me);
me.updateLayout();
// Can only reset the new controllers after the scales have been updated
if (me.options.animation && me.options.animation.duration) {
helpers.each(newControllers, function(controller) {
controller.reset();
});
}
me.updateDatasets();
// Need to reset tooltip in case it is displayed with elements that are removed
// after update.
me.tooltip.initialize();
// Last active contains items that were previously in the tooltip.
// When we reset the tooltip, we need to clear it
me.lastActive = [];
// Do this before render so that any plugins that need final scale updates can use it
plugins.notify(me, 'afterUpdate');
if (me._bufferedRender) {
me._bufferedRequest = {
duration: config.duration,
easing: config.easing,
lazy: config.lazy
};
} else {
me.render(config);
}
},
/**
* Updates the chart layout unless a plugin returns `false` to the `beforeLayout`
* hook, in which case, plugins will not be called on `afterLayout`.
* @private
*/
updateLayout: function() {
var me = this;
if (plugins.notify(me, 'beforeLayout') === false) {
return;
}
layouts.update(this, this.width, this.height);
/**
* Provided for backward compatibility, use `afterLayout` instead.
* @method IPlugin#afterScaleUpdate
* @deprecated since version 2.5.0
* @todo remove at version 3
* @private
*/
plugins.notify(me, 'afterScaleUpdate');
plugins.notify(me, 'afterLayout');
},
/**
* Updates all datasets unless a plugin returns `false` to the `beforeDatasetsUpdate`
* hook, in which case, plugins will not be called on `afterDatasetsUpdate`.
* @private
*/
updateDatasets: function() {
var me = this;
if (plugins.notify(me, 'beforeDatasetsUpdate') === false) {
return;
}
for (var i = 0, ilen = me.data.datasets.length; i < ilen; ++i) {
me.updateDataset(i);
}
plugins.notify(me, 'afterDatasetsUpdate');
},
/**
* Updates dataset at index unless a plugin returns `false` to the `beforeDatasetUpdate`
* hook, in which case, plugins will not be called on `afterDatasetUpdate`.
* @private
*/
updateDataset: function(index) {
var me = this;
var meta = me.getDatasetMeta(index);
var args = {
meta: meta,
index: index
};
if (plugins.notify(me, 'beforeDatasetUpdate', [args]) === false) {
return;
}
meta.controller.update();
plugins.notify(me, 'afterDatasetUpdate', [args]);
},
render: function(config) {
var me = this;
if (!config || typeof config !== 'object') {
// backwards compatibility
config = {
duration: config,
lazy: arguments[1]
};
}
var duration = config.duration;
var lazy = config.lazy;
if (plugins.notify(me, 'beforeRender') === false) {
return;
}
var animationOptions = me.options.animation;
var onComplete = function(animation) {
plugins.notify(me, 'afterRender');
helpers.callback(animationOptions && animationOptions.onComplete, [animation], me);
};
if (animationOptions && ((typeof duration !== 'undefined' && duration !== 0) || (typeof duration === 'undefined' && animationOptions.duration !== 0))) {
var animation = new Chart.Animation({
numSteps: (duration || animationOptions.duration) / 16.66, // 60 fps
easing: config.easing || animationOptions.easing,
render: function(chart, animationObject) {
var easingFunction = helpers.easing.effects[animationObject.easing];
var currentStep = animationObject.currentStep;
var stepDecimal = currentStep / animationObject.numSteps;
chart.draw(easingFunction(stepDecimal), stepDecimal, currentStep);
},
onAnimationProgress: animationOptions.onProgress,
onAnimationComplete: onComplete
});
Chart.animationService.addAnimation(me, animation, duration, lazy);
} else {
me.draw();
// See https://github.com/chartjs/Chart.js/issues/3781
onComplete(new Chart.Animation({numSteps: 0, chart: me}));
}
return me;
},
draw: function(easingValue) {
var me = this;
me.clear();
if (helpers.isNullOrUndef(easingValue)) {
easingValue = 1;
}
me.transition(easingValue);
if (plugins.notify(me, 'beforeDraw', [easingValue]) === false) {
return;
}
// Draw all the scales
helpers.each(me.boxes, function(box) {
box.draw(me.chartArea);
}, me);
if (me.scale) {
me.scale.draw();
}
me.drawDatasets(easingValue);
me._drawTooltip(easingValue);
plugins.notify(me, 'afterDraw', [easingValue]);
},
/**
* @private
*/
transition: function(easingValue) {
var me = this;
for (var i = 0, ilen = (me.data.datasets || []).length; i < ilen; ++i) {
if (me.isDatasetVisible(i)) {
me.getDatasetMeta(i).controller.transition(easingValue);
}
}
me.tooltip.transition(easingValue);
},
/**
* Draws all datasets unless a plugin returns `false` to the `beforeDatasetsDraw`
* hook, in which case, plugins will not be called on `afterDatasetsDraw`.
* @private
*/
drawDatasets: function(easingValue) {
var me = this;
if (plugins.notify(me, 'beforeDatasetsDraw', [easingValue]) === false) {
return;
}
// Draw datasets reversed to support proper line stacking
for (var i = (me.data.datasets || []).length - 1; i >= 0; --i) {
if (me.isDatasetVisible(i)) {
me.drawDataset(i, easingValue);
}
}
plugins.notify(me, 'afterDatasetsDraw', [easingValue]);
},
/**
* Draws dataset at index unless a plugin returns `false` to the `beforeDatasetDraw`
* hook, in which case, plugins will not be called on `afterDatasetDraw`.
* @private
*/
drawDataset: function(index, easingValue) {
var me = this;
var meta = me.getDatasetMeta(index);
var args = {
meta: meta,
index: index,
easingValue: easingValue
};
if (plugins.notify(me, 'beforeDatasetDraw', [args]) === false) {
return;
}
meta.controller.draw(easingValue);
plugins.notify(me, 'afterDatasetDraw', [args]);
},
/**
* Draws tooltip unless a plugin returns `false` to the `beforeTooltipDraw`
* hook, in which case, plugins will not be called on `afterTooltipDraw`.
* @private
*/
_drawTooltip: function(easingValue) {
var me = this;
var tooltip = me.tooltip;
var args = {
tooltip: tooltip,
easingValue: easingValue
};
if (plugins.notify(me, 'beforeTooltipDraw', [args]) === false) {
return;
}
tooltip.draw();
plugins.notify(me, 'afterTooltipDraw', [args]);
},
// Get the single element that was clicked on
// @return : An object containing the dataset index and element index of the matching element. Also contains the rectangle that was draw
getElementAtEvent: function(e) {
return Interaction.modes.single(this, e);
},
getElementsAtEvent: function(e) {
return Interaction.modes.label(this, e, {intersect: true});
},
getElementsAtXAxis: function(e) {
return Interaction.modes['x-axis'](this, e, {intersect: true});
},
getElementsAtEventForMode: function(e, mode, options) {
var method = Interaction.modes[mode];
if (typeof method === 'function') {
return method(this, e, options);
}
return [];
},
getDatasetAtEvent: function(e) {
return Interaction.modes.dataset(this, e, {intersect: true});
},
getDatasetMeta: function(datasetIndex) {
var me = this;
var dataset = me.data.datasets[datasetIndex];
if (!dataset._meta) {
dataset._meta = {};
}
var meta = dataset._meta[me.id];
if (!meta) {
meta = dataset._meta[me.id] = {
type: null,
data: [],
dataset: null,
controller: null,
hidden: null, // See isDatasetVisible() comment
xAxisID: null,
yAxisID: null
};
}
return meta;
},
getVisibleDatasetCount: function() {
var count = 0;
for (var i = 0, ilen = this.data.datasets.length; i < ilen; ++i) {
if (this.isDatasetVisible(i)) {
count++;
}
}
return count;
},
isDatasetVisible: function(datasetIndex) {
var meta = this.getDatasetMeta(datasetIndex);
// meta.hidden is a per chart dataset hidden flag override with 3 states: if true or false,
// the dataset.hidden value is ignored, else if null, the dataset hidden state is returned.
return typeof meta.hidden === 'boolean' ? !meta.hidden : !this.data.datasets[datasetIndex].hidden;
},
generateLegend: function() {
return this.options.legendCallback(this);
},
/**
* @private
*/
destroyDatasetMeta: function(datasetIndex) {
var id = this.id;
var dataset = this.data.datasets[datasetIndex];
var meta = dataset._meta && dataset._meta[id];
if (meta) {
meta.controller.destroy();
delete dataset._meta[id];
}
},
destroy: function() {
var me = this;
var canvas = me.canvas;
var i, ilen;
me.stop();
// dataset controllers need to cleanup associated data
for (i = 0, ilen = me.data.datasets.length; i < ilen; ++i) {
me.destroyDatasetMeta(i);
}
if (canvas) {
me.unbindEvents();
helpers.canvas.clear(me);
platform.releaseContext(me.ctx);
me.canvas = null;
me.ctx = null;
}
plugins.notify(me, 'destroy');
delete Chart.instances[me.id];
},
toBase64Image: function() {
return this.canvas.toDataURL.apply(this.canvas, arguments);
},
initToolTip: function() {
var me = this;
me.tooltip = new Chart.Tooltip({
_chart: me,
_chartInstance: me, // deprecated, backward compatibility
_data: me.data,
_options: me.options.tooltips
}, me);
},
/**
* @private
*/
bindEvents: function() {
var me = this;
var listeners = me._listeners = {};
var listener = function() {
me.eventHandler.apply(me, arguments);
};
helpers.each(me.options.events, function(type) {
platform.addEventListener(me, type, listener);
listeners[type] = listener;
});
// Elements used to detect size change should not be injected for non responsive charts.
// See https://github.com/chartjs/Chart.js/issues/2210
if (me.options.responsive) {
listener = function() {
me.resize();
};
platform.addEventListener(me, 'resize', listener);
listeners.resize = listener;
}
},
/**
* @private
*/
unbindEvents: function() {
var me = this;
var listeners = me._listeners;
if (!listeners) {
return;
}
delete me._listeners;
helpers.each(listeners, function(listener, type) {
platform.removeEventListener(me, type, listener);
});
},
updateHoverStyle: function(elements, mode, enabled) {
var method = enabled ? 'setHoverStyle' : 'removeHoverStyle';
var element, i, ilen;
for (i = 0, ilen = elements.length; i < ilen; ++i) {
element = elements[i];
if (element) {
this.getDatasetMeta(element._datasetIndex).controller[method](element);
}
}
},
/**
* @private
*/
eventHandler: function(e) {
var me = this;
var tooltip = me.tooltip;
if (plugins.notify(me, 'beforeEvent', [e]) === false) {
return;
}
// Buffer any update calls so that renders do not occur
me._bufferedRender = true;
me._bufferedRequest = null;
var changed = me.handleEvent(e);
// for smooth tooltip animations issue #4989
// the tooltip should be the source of change
// Animation check workaround:
// tooltip._start will be null when tooltip isn't animating
if (tooltip) {
changed = tooltip._start
? tooltip.handleEvent(e)
: changed | tooltip.handleEvent(e);
}
plugins.notify(me, 'afterEvent', [e]);
var bufferedRequest = me._bufferedRequest;
if (bufferedRequest) {
// If we have an update that was triggered, we need to do a normal render
me.render(bufferedRequest);
} else if (changed && !me.animating) {
// If entering, leaving, or changing elements, animate the change via pivot
me.stop();
// We only need to render at this point. Updating will cause scales to be
// recomputed generating flicker & using more memory than necessary.
me.render(me.options.hover.animationDuration, true);
}
me._bufferedRender = false;
me._bufferedRequest = null;
return me;
},
/**
* Handle an event
* @private
* @param {IEvent} event the event to handle
* @return {Boolean} true if the chart needs to re-render
*/
handleEvent: function(e) {
var me = this;
var options = me.options || {};
var hoverOptions = options.hover;
var changed = false;
me.lastActive = me.lastActive || [];
// Find Active Elements for hover and tooltips
if (e.type === 'mouseout') {
me.active = [];
} else {
me.active = me.getElementsAtEventForMode(e, hoverOptions.mode, hoverOptions);
}
// Invoke onHover hook
// Need to call with native event here to not break backwards compatibility
helpers.callback(options.onHover || options.hover.onHover, [e.native, me.active], me);
if (e.type === 'mouseup' || e.type === 'click') {
if (options.onClick) {
// Use e.native here for backwards compatibility
options.onClick.call(me, e.native, me.active);
}
}
// Remove styling for last active (even if it may still be active)
if (me.lastActive.length) {
me.updateHoverStyle(me.lastActive, hoverOptions.mode, false);
}
// Built in hover styling
if (me.active.length && hoverOptions.mode) {
me.updateHoverStyle(me.active, hoverOptions.mode, true);
}
changed = !helpers.arrayEquals(me.active, me.lastActive);
// Remember Last Actives
me.lastActive = me.active;
return changed;
}
});
/**
* Provided for backward compatibility, use Chart instead.
* @class Chart.Controller
* @deprecated since version 2.6.0
* @todo remove at version 3
* @private
*/
Chart.Controller = Chart;
};
/***/ }),
/* 436 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var helpers = __webpack_require__(5);
module.exports = function(Chart) {
var arrayEvents = ['push', 'pop', 'shift', 'splice', 'unshift'];
/**
* Hooks the array methods that add or remove values ('push', pop', 'shift', 'splice',
* 'unshift') and notify the listener AFTER the array has been altered. Listeners are
* called on the 'onData*' callbacks (e.g. onDataPush, etc.) with same arguments.
*/
function listenArrayEvents(array, listener) {
if (array._chartjs) {
array._chartjs.listeners.push(listener);
return;
}
Object.defineProperty(array, '_chartjs', {
configurable: true,
enumerable: false,
value: {
listeners: [listener]
}
});
arrayEvents.forEach(function(key) {
var method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);
var base = array[key];
Object.defineProperty(array, key, {
configurable: true,
enumerable: false,
value: function() {
var args = Array.prototype.slice.call(arguments);
var res = base.apply(this, args);
helpers.each(array._chartjs.listeners, function(object) {
if (typeof object[method] === 'function') {
object[method].apply(object, args);
}
});
return res;
}
});
});
}
/**
* Removes the given array event listener and cleanup extra attached properties (such as
* the _chartjs stub and overridden methods) if array doesn't have any more listeners.
*/
function unlistenArrayEvents(array, listener) {
var stub = array._chartjs;
if (!stub) {
return;
}
var listeners = stub.listeners;
var index = listeners.indexOf(listener);
if (index !== -1) {
listeners.splice(index, 1);
}
if (listeners.length > 0) {
return;
}
arrayEvents.forEach(function(key) {
delete array[key];
});
delete array._chartjs;
}
// Base class for all dataset controllers (line, bar, etc)
Chart.DatasetController = function(chart, datasetIndex) {
this.initialize(chart, datasetIndex);
};
helpers.extend(Chart.DatasetController.prototype, {
/**
* Element type used to generate a meta dataset (e.g. Chart.element.Line).
* @type {Chart.core.element}
*/
datasetElementType: null,
/**
* Element type used to generate a meta data (e.g. Chart.element.Point).
* @type {Chart.core.element}
*/
dataElementType: null,
initialize: function(chart, datasetIndex) {
var me = this;
me.chart = chart;
me.index = datasetIndex;
me.linkScales();
me.addElements();
},
updateIndex: function(datasetIndex) {
this.index = datasetIndex;
},
linkScales: function() {
var me = this;
var meta = me.getMeta();
var dataset = me.getDataset();
if (meta.xAxisID === null || !(meta.xAxisID in me.chart.scales)) {
meta.xAxisID = dataset.xAxisID || me.chart.options.scales.xAxes[0].id;
}
if (meta.yAxisID === null || !(meta.yAxisID in me.chart.scales)) {
meta.yAxisID = dataset.yAxisID || me.chart.options.scales.yAxes[0].id;
}
},
getDataset: function() {
return this.chart.data.datasets[this.index];
},
getMeta: function() {
return this.chart.getDatasetMeta(this.index);
},
getScaleForId: function(scaleID) {
return this.chart.scales[scaleID];
},
reset: function() {
this.update(true);
},
/**
* @private
*/
destroy: function() {
if (this._data) {
unlistenArrayEvents(this._data, this);
}
},
createMetaDataset: function() {
var me = this;
var type = me.datasetElementType;
return type && new type({
_chart: me.chart,
_datasetIndex: me.index
});
},
createMetaData: function(index) {
var me = this;
var type = me.dataElementType;
return type && new type({
_chart: me.chart,
_datasetIndex: me.index,
_index: index
});
},
addElements: function() {
var me = this;
var meta = me.getMeta();
var data = me.getDataset().data || [];
var metaData = meta.data;
var i, ilen;
for (i = 0, ilen = data.length; i < ilen; ++i) {
metaData[i] = metaData[i] || me.createMetaData(i);
}
meta.dataset = meta.dataset || me.createMetaDataset();
},
addElementAndReset: function(index) {
var element = this.createMetaData(index);
this.getMeta().data.splice(index, 0, element);
this.updateElement(element, index, true);
},
buildOrUpdateElements: function() {
var me = this;
var dataset = me.getDataset();
var data = dataset.data || (dataset.data = []);
// In order to correctly handle data addition/deletion animation (an thus simulate
// real-time charts), we need to monitor these data modifications and synchronize
// the internal meta data accordingly.
if (me._data !== data) {
if (me._data) {
// This case happens when the user replaced the data array instance.
unlistenArrayEvents(me._data, me);
}
listenArrayEvents(data, me);
me._data = data;
}
// Re-sync meta data in case the user replaced the data array or if we missed
// any updates and so make sure that we handle number of datapoints changing.
me.resyncElements();
},
update: helpers.noop,
transition: function(easingValue) {
var meta = this.getMeta();
var elements = meta.data || [];
var ilen = elements.length;
var i = 0;
for (; i < ilen; ++i) {
elements[i].transition(easingValue);
}
if (meta.dataset) {
meta.dataset.transition(easingValue);
}
},
draw: function() {
var meta = this.getMeta();
var elements = meta.data || [];
var ilen = elements.length;
var i = 0;
if (meta.dataset) {
meta.dataset.draw();
}
for (; i < ilen; ++i) {
elements[i].draw();
}
},
removeHoverStyle: function(element, elementOpts) {
var dataset = this.chart.data.datasets[element._datasetIndex];
var index = element._index;
var custom = element.custom || {};
var valueOrDefault = helpers.valueAtIndexOrDefault;
var model = element._model;
model.backgroundColor = custom.backgroundColor ? custom.backgroundColor : valueOrDefault(dataset.backgroundColor, index, elementOpts.backgroundColor);
model.borderColor = custom.borderColor ? custom.borderColor : valueOrDefault(dataset.borderColor, index, elementOpts.borderColor);
model.borderWidth = custom.borderWidth ? custom.borderWidth : valueOrDefault(dataset.borderWidth, index, elementOpts.borderWidth);
},
setHoverStyle: function(element) {
var dataset = this.chart.data.datasets[element._datasetIndex];
var index = element._index;
var custom = element.custom || {};
var valueOrDefault = helpers.valueAtIndexOrDefault;
var getHoverColor = helpers.getHoverColor;
var model = element._model;
model.backgroundColor = custom.hoverBackgroundColor ? custom.hoverBackgroundColor : valueOrDefault(dataset.hoverBackgroundColor, index, getHoverColor(model.backgroundColor));
model.borderColor = custom.hoverBorderColor ? custom.hoverBorderColor : valueOrDefault(dataset.hoverBorderColor, index, getHoverColor(model.borderColor));
model.borderWidth = custom.hoverBorderWidth ? custom.hoverBorderWidth : valueOrDefault(dataset.hoverBorderWidth, index, model.borderWidth);
},
/**
* @private
*/
resyncElements: function() {
var me = this;
var meta = me.getMeta();
var data = me.getDataset().data;
var numMeta = meta.data.length;
var numData = data.length;
if (numData < numMeta) {
meta.data.splice(numData, numMeta - numData);
} else if (numData > numMeta) {
me.insertElements(numMeta, numData - numMeta);
}
},
/**
* @private
*/
insertElements: function(start, count) {
for (var i = 0; i < count; ++i) {
this.addElementAndReset(start + i);
}
},
/**
* @private
*/
onDataPush: function() {
this.insertElements(this.getDataset().data.length - 1, arguments.length);
},
/**
* @private
*/
onDataPop: function() {
this.getMeta().data.pop();
},
/**
* @private
*/
onDataShift: function() {
this.getMeta().data.shift();
},
/**
* @private
*/
onDataSplice: function(start, count) {
this.getMeta().data.splice(start, count);
this.insertElements(start, arguments.length - 2);
},
/**
* @private
*/
onDataUnshift: function() {
this.insertElements(0, arguments.length);
}
});
Chart.DatasetController.extend = helpers.inherits;
};
/***/ }),
/* 437 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var defaults = __webpack_require__(8);
var helpers = __webpack_require__(5);
var layouts = __webpack_require__(50);
module.exports = function(Chart) {
Chart.scaleService = {
// Scale registration object. Extensions can register new scale types (such as log or DB scales) and then
// use the new chart options to grab the correct scale
constructors: {},
// Use a registration function so that we can move to an ES6 map when we no longer need to support
// old browsers
// Scale config defaults
defaults: {},
registerScaleType: function(type, scaleConstructor, scaleDefaults) {
this.constructors[type] = scaleConstructor;
this.defaults[type] = helpers.clone(scaleDefaults);
},
getScaleConstructor: function(type) {
return this.constructors.hasOwnProperty(type) ? this.constructors[type] : undefined;
},
getScaleDefaults: function(type) {
// Return the scale defaults merged with the global settings so that we always use the latest ones
return this.defaults.hasOwnProperty(type) ? helpers.merge({}, [defaults.scale, this.defaults[type]]) : {};
},
updateScaleDefaults: function(type, additions) {
var me = this;
if (me.defaults.hasOwnProperty(type)) {
me.defaults[type] = helpers.extend(me.defaults[type], additions);
}
},
addScalesToLayout: function(chart) {
// Adds each scale to the chart.boxes array to be sized accordingly
helpers.each(chart.scales, function(scale) {
// Set ILayoutItem parameters for backwards compatibility
scale.fullWidth = scale.options.fullWidth;
scale.position = scale.options.position;
scale.weight = scale.options.weight;
layouts.addBox(chart, scale);
});
}
};
};
/***/ }),
/* 438 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var defaults = __webpack_require__(8);
var Element = __webpack_require__(22);
var helpers = __webpack_require__(5);
var Ticks = __webpack_require__(51);
defaults._set('scale', {
display: true,
position: 'left',
offset: false,
// grid line settings
gridLines: {
display: true,
color: 'rgba(0, 0, 0, 0.1)',
lineWidth: 1,
drawBorder: true,
drawOnChartArea: true,
drawTicks: true,
tickMarkLength: 10,
zeroLineWidth: 1,
zeroLineColor: 'rgba(0,0,0,0.25)',
zeroLineBorderDash: [],
zeroLineBorderDashOffset: 0.0,
offsetGridLines: false,
borderDash: [],
borderDashOffset: 0.0
},
// scale label
scaleLabel: {
// display property
display: false,
// actual label
labelString: '',
// line height
lineHeight: 1.2,
// top/bottom padding
padding: {
top: 4,
bottom: 4
}
},
// label settings
ticks: {
beginAtZero: false,
minRotation: 0,
maxRotation: 50,
mirror: false,
padding: 0,
reverse: false,
display: true,
autoSkip: true,
autoSkipPadding: 0,
labelOffset: 0,
// We pass through arrays to be rendered as multiline labels, we convert Others to strings here.
callback: Ticks.formatters.values,
minor: {},
major: {}
}
});
function labelsFromTicks(ticks) {
var labels = [];
var i, ilen;
for (i = 0, ilen = ticks.length; i < ilen; ++i) {
labels.push(ticks[i].label);
}
return labels;
}
function getLineValue(scale, index, offsetGridLines) {
var lineValue = scale.getPixelForTick(index);
if (offsetGridLines) {
if (index === 0) {
lineValue -= (scale.getPixelForTick(1) - lineValue) / 2;
} else {
lineValue -= (lineValue - scale.getPixelForTick(index - 1)) / 2;
}
}
return lineValue;
}
module.exports = function(Chart) {
function computeTextSize(context, tick, font) {
return helpers.isArray(tick) ?
helpers.longestText(context, font, tick) :
context.measureText(tick).width;
}
function parseFontOptions(options) {
var valueOrDefault = helpers.valueOrDefault;
var globalDefaults = defaults.global;
var size = valueOrDefault(options.fontSize, globalDefaults.defaultFontSize);
var style = valueOrDefault(options.fontStyle, globalDefaults.defaultFontStyle);
var family = valueOrDefault(options.fontFamily, globalDefaults.defaultFontFamily);
return {
size: size,
style: style,
family: family,
font: helpers.fontString(size, style, family)
};
}
function parseLineHeight(options) {
return helpers.options.toLineHeight(
helpers.valueOrDefault(options.lineHeight, 1.2),
helpers.valueOrDefault(options.fontSize, defaults.global.defaultFontSize));
}
Chart.Scale = Element.extend({
/**
* Get the padding needed for the scale
* @method getPadding
* @private
* @returns {Padding} the necessary padding
*/
getPadding: function() {
var me = this;
return {
left: me.paddingLeft || 0,
top: me.paddingTop || 0,
right: me.paddingRight || 0,
bottom: me.paddingBottom || 0
};
},
/**
* Returns the scale tick objects ({label, major})
* @since 2.7
*/
getTicks: function() {
return this._ticks;
},
// These methods are ordered by lifecyle. Utilities then follow.
// Any function defined here is inherited by all scale types.
// Any function can be extended by the scale type
mergeTicksOptions: function() {
var ticks = this.options.ticks;
if (ticks.minor === false) {
ticks.minor = {
display: false
};
}
if (ticks.major === false) {
ticks.major = {
display: false
};
}
for (var key in ticks) {
if (key !== 'major' && key !== 'minor') {
if (typeof ticks.minor[key] === 'undefined') {
ticks.minor[key] = ticks[key];
}
if (typeof ticks.major[key] === 'undefined') {
ticks.major[key] = ticks[key];
}
}
}
},
beforeUpdate: function() {
helpers.callback(this.options.beforeUpdate, [this]);
},
update: function(maxWidth, maxHeight, margins) {
var me = this;
var i, ilen, labels, label, ticks, tick;
// Update Lifecycle - Probably don't want to ever extend or overwrite this function ;)
me.beforeUpdate();
// Absorb the master measurements
me.maxWidth = maxWidth;
me.maxHeight = maxHeight;
me.margins = helpers.extend({
left: 0,
right: 0,
top: 0,
bottom: 0
}, margins);
me.longestTextCache = me.longestTextCache || {};
// Dimensions
me.beforeSetDimensions();
me.setDimensions();
me.afterSetDimensions();
// Data min/max
me.beforeDataLimits();
me.determineDataLimits();
me.afterDataLimits();
// Ticks - `this.ticks` is now DEPRECATED!
// Internal ticks are now stored as objects in the PRIVATE `this._ticks` member
// and must not be accessed directly from outside this class. `this.ticks` being
// around for long time and not marked as private, we can't change its structure
// without unexpected breaking changes. If you need to access the scale ticks,
// use scale.getTicks() instead.
me.beforeBuildTicks();
// New implementations should return an array of objects but for BACKWARD COMPAT,
// we still support no return (`this.ticks` internally set by calling this method).
ticks = me.buildTicks() || [];
me.afterBuildTicks();
me.beforeTickToLabelConversion();
// New implementations should return the formatted tick labels but for BACKWARD
// COMPAT, we still support no return (`this.ticks` internally changed by calling
// this method and supposed to contain only string values).
labels = me.convertTicksToLabels(ticks) || me.ticks;
me.afterTickToLabelConversion();
me.ticks = labels; // BACKWARD COMPATIBILITY
// IMPORTANT: from this point, we consider that `this.ticks` will NEVER change!
// BACKWARD COMPAT: synchronize `_ticks` with labels (so potentially `this.ticks`)
for (i = 0, ilen = labels.length; i < ilen; ++i) {
label = labels[i];
tick = ticks[i];
if (!tick) {
ticks.push(tick = {
label: label,
major: false
});
} else {
tick.label = label;
}
}
me._ticks = ticks;
// Tick Rotation
me.beforeCalculateTickRotation();
me.calculateTickRotation();
me.afterCalculateTickRotation();
// Fit
me.beforeFit();
me.fit();
me.afterFit();
//
me.afterUpdate();
return me.minSize;
},
afterUpdate: function() {
helpers.callback(this.options.afterUpdate, [this]);
},
//
beforeSetDimensions: function() {
helpers.callback(this.options.beforeSetDimensions, [this]);
},
setDimensions: function() {
var me = this;
// Set the unconstrained dimension before label rotation
if (me.isHorizontal()) {
// Reset position before calculating rotation
me.width = me.maxWidth;
me.left = 0;
me.right = me.width;
} else {
me.height = me.maxHeight;
// Reset position before calculating rotation
me.top = 0;
me.bottom = me.height;
}
// Reset padding
me.paddingLeft = 0;
me.paddingTop = 0;
me.paddingRight = 0;
me.paddingBottom = 0;
},
afterSetDimensions: function() {
helpers.callback(this.options.afterSetDimensions, [this]);
},
// Data limits
beforeDataLimits: function() {
helpers.callback(this.options.beforeDataLimits, [this]);
},
determineDataLimits: helpers.noop,
afterDataLimits: function() {
helpers.callback(this.options.afterDataLimits, [this]);
},
//
beforeBuildTicks: function() {
helpers.callback(this.options.beforeBuildTicks, [this]);
},
buildTicks: helpers.noop,
afterBuildTicks: function() {
helpers.callback(this.options.afterBuildTicks, [this]);
},
beforeTickToLabelConversion: function() {
helpers.callback(this.options.beforeTickToLabelConversion, [this]);
},
convertTicksToLabels: function() {
var me = this;
// Convert ticks to strings
var tickOpts = me.options.ticks;
me.ticks = me.ticks.map(tickOpts.userCallback || tickOpts.callback, this);
},
afterTickToLabelConversion: function() {
helpers.callback(this.options.afterTickToLabelConversion, [this]);
},
//
beforeCalculateTickRotation: function() {
helpers.callback(this.options.beforeCalculateTickRotation, [this]);
},
calculateTickRotation: function() {
var me = this;
var context = me.ctx;
var tickOpts = me.options.ticks;
var labels = labelsFromTicks(me._ticks);
// Get the width of each grid by calculating the difference
// between x offsets between 0 and 1.
var tickFont = parseFontOptions(tickOpts);
context.font = tickFont.font;
var labelRotation = tickOpts.minRotation || 0;
if (labels.length && me.options.display && me.isHorizontal()) {
var originalLabelWidth = helpers.longestText(context, tickFont.font, labels, me.longestTextCache);
var labelWidth = originalLabelWidth;
var cosRotation, sinRotation;
// Allow 3 pixels x2 padding either side for label readability
var tickWidth = me.getPixelForTick(1) - me.getPixelForTick(0) - 6;
// Max label rotation can be set or default to 90 - also act as a loop counter
while (labelWidth > tickWidth && labelRotation < tickOpts.maxRotation) {
var angleRadians = helpers.toRadians(labelRotation);
cosRotation = Math.cos(angleRadians);
sinRotation = Math.sin(angleRadians);
if (sinRotation * originalLabelWidth > me.maxHeight) {
// go back one step
labelRotation--;
break;
}
labelRotation++;
labelWidth = cosRotation * originalLabelWidth;
}
}
me.labelRotation = labelRotation;
},
afterCalculateTickRotation: function() {
helpers.callback(this.options.afterCalculateTickRotation, [this]);
},
//
beforeFit: function() {
helpers.callback(this.options.beforeFit, [this]);
},
fit: function() {
var me = this;
// Reset
var minSize = me.minSize = {
width: 0,
height: 0
};
var labels = labelsFromTicks(me._ticks);
var opts = me.options;
var tickOpts = opts.ticks;
var scaleLabelOpts = opts.scaleLabel;
var gridLineOpts = opts.gridLines;
var display = opts.display;
var isHorizontal = me.isHorizontal();
var tickFont = parseFontOptions(tickOpts);
var tickMarkLength = opts.gridLines.tickMarkLength;
// Width
if (isHorizontal) {
// subtract the margins to line up with the chartArea if we are a full width scale
minSize.width = me.isFullWidth() ? me.maxWidth - me.margins.left - me.margins.right : me.maxWidth;
} else {
minSize.width = display && gridLineOpts.drawTicks ? tickMarkLength : 0;
}
// height
if (isHorizontal) {
minSize.height = display && gridLineOpts.drawTicks ? tickMarkLength : 0;
} else {
minSize.height = me.maxHeight; // fill all the height
}
// Are we showing a title for the scale?
if (scaleLabelOpts.display && display) {
var scaleLabelLineHeight = parseLineHeight(scaleLabelOpts);
var scaleLabelPadding = helpers.options.toPadding(scaleLabelOpts.padding);
var deltaHeight = scaleLabelLineHeight + scaleLabelPadding.height;
if (isHorizontal) {
minSize.height += deltaHeight;
} else {
minSize.width += deltaHeight;
}
}
// Don't bother fitting the ticks if we are not showing them
if (tickOpts.display && display) {
var largestTextWidth = helpers.longestText(me.ctx, tickFont.font, labels, me.longestTextCache);
var tallestLabelHeightInLines = helpers.numberOfLabelLines(labels);
var lineSpace = tickFont.size * 0.5;
var tickPadding = me.options.ticks.padding;
if (isHorizontal) {
// A horizontal axis is more constrained by the height.
me.longestLabelWidth = largestTextWidth;
var angleRadians = helpers.toRadians(me.labelRotation);
var cosRotation = Math.cos(angleRadians);
var sinRotation = Math.sin(angleRadians);
// TODO - improve this calculation
var labelHeight = (sinRotation * largestTextWidth)
+ (tickFont.size * tallestLabelHeightInLines)
+ (lineSpace * (tallestLabelHeightInLines - 1))
+ lineSpace; // padding
minSize.height = Math.min(me.maxHeight, minSize.height + labelHeight + tickPadding);
me.ctx.font = tickFont.font;
var firstLabelWidth = computeTextSize(me.ctx, labels[0], tickFont.font);
var lastLabelWidth = computeTextSize(me.ctx, labels[labels.length - 1], tickFont.font);
// Ensure that our ticks are always inside the canvas. When rotated, ticks are right aligned
// which means that the right padding is dominated by the font height
if (me.labelRotation !== 0) {
me.paddingLeft = opts.position === 'bottom' ? (cosRotation * firstLabelWidth) + 3 : (cosRotation * lineSpace) + 3; // add 3 px to move away from canvas edges
me.paddingRight = opts.position === 'bottom' ? (cosRotation * lineSpace) + 3 : (cosRotation * lastLabelWidth) + 3;
} else {
me.paddingLeft = firstLabelWidth / 2 + 3; // add 3 px to move away from canvas edges
me.paddingRight = lastLabelWidth / 2 + 3;
}
} else {
// A vertical axis is more constrained by the width. Labels are the
// dominant factor here, so get that length first and account for padding
if (tickOpts.mirror) {
largestTextWidth = 0;
} else {
// use lineSpace for consistency with horizontal axis
// tickPadding is not implemented for horizontal
largestTextWidth += tickPadding + lineSpace;
}
minSize.width = Math.min(me.maxWidth, minSize.width + largestTextWidth);
me.paddingTop = tickFont.size / 2;
me.paddingBottom = tickFont.size / 2;
}
}
me.handleMargins();
me.width = minSize.width;
me.height = minSize.height;
},
/**
* Handle margins and padding interactions
* @private
*/
handleMargins: function() {
var me = this;
if (me.margins) {
me.paddingLeft = Math.max(me.paddingLeft - me.margins.left, 0);
me.paddingTop = Math.max(me.paddingTop - me.margins.top, 0);
me.paddingRight = Math.max(me.paddingRight - me.margins.right, 0);
me.paddingBottom = Math.max(me.paddingBottom - me.margins.bottom, 0);
}
},
afterFit: function() {
helpers.callback(this.options.afterFit, [this]);
},
// Shared Methods
isHorizontal: function() {
return this.options.position === 'top' || this.options.position === 'bottom';
},
isFullWidth: function() {
return (this.options.fullWidth);
},
// Get the correct value. NaN bad inputs, If the value type is object get the x or y based on whether we are horizontal or not
getRightValue: function(rawValue) {
// Null and undefined values first
if (helpers.isNullOrUndef(rawValue)) {
return NaN;
}
// isNaN(object) returns true, so make sure NaN is checking for a number; Discard Infinite values
if (typeof rawValue === 'number' && !isFinite(rawValue)) {
return NaN;
}
// If it is in fact an object, dive in one more level
if (rawValue) {
if (this.isHorizontal()) {
if (rawValue.x !== undefined) {
return this.getRightValue(rawValue.x);
}
} else if (rawValue.y !== undefined) {
return this.getRightValue(rawValue.y);
}
}
// Value is good, return it
return rawValue;
},
/**
* Used to get the value to display in the tooltip for the data at the given index
* @param index
* @param datasetIndex
*/
getLabelForIndex: helpers.noop,
/**
* Returns the location of the given data point. Value can either be an index or a numerical value
* The coordinate (0, 0) is at the upper-left corner of the canvas
* @param value
* @param index
* @param datasetIndex
*/
getPixelForValue: helpers.noop,
/**
* Used to get the data value from a given pixel. This is the inverse of getPixelForValue
* The coordinate (0, 0) is at the upper-left corner of the canvas
* @param pixel
*/
getValueForPixel: helpers.noop,
/**
* Returns the location of the tick at the given index
* The coordinate (0, 0) is at the upper-left corner of the canvas
*/
getPixelForTick: function(index) {
var me = this;
var offset = me.options.offset;
if (me.isHorizontal()) {
var innerWidth = me.width - (me.paddingLeft + me.paddingRight);
var tickWidth = innerWidth / Math.max((me._ticks.length - (offset ? 0 : 1)), 1);
var pixel = (tickWidth * index) + me.paddingLeft;
if (offset) {
pixel += tickWidth / 2;
}
var finalVal = me.left + Math.round(pixel);
finalVal += me.isFullWidth() ? me.margins.left : 0;
return finalVal;
}
var innerHeight = me.height - (me.paddingTop + me.paddingBottom);
return me.top + (index * (innerHeight / (me._ticks.length - 1)));
},
/**
* Utility for getting the pixel location of a percentage of scale
* The coordinate (0, 0) is at the upper-left corner of the canvas
*/
getPixelForDecimal: function(decimal) {
var me = this;
if (me.isHorizontal()) {
var innerWidth = me.width - (me.paddingLeft + me.paddingRight);
var valueOffset = (innerWidth * decimal) + me.paddingLeft;
var finalVal = me.left + Math.round(valueOffset);
finalVal += me.isFullWidth() ? me.margins.left : 0;
return finalVal;
}
return me.top + (decimal * me.height);
},
/**
* Returns the pixel for the minimum chart value
* The coordinate (0, 0) is at the upper-left corner of the canvas
*/
getBasePixel: function() {
return this.getPixelForValue(this.getBaseValue());
},
getBaseValue: function() {
var me = this;
var min = me.min;
var max = me.max;
return me.beginAtZero ? 0 :
min < 0 && max < 0 ? max :
min > 0 && max > 0 ? min :
0;
},
/**
* Returns a subset of ticks to be plotted to avoid overlapping labels.
* @private
*/
_autoSkip: function(ticks) {
var skipRatio;
var me = this;
var isHorizontal = me.isHorizontal();
var optionTicks = me.options.ticks.minor;
var tickCount = ticks.length;
var labelRotationRadians = helpers.toRadians(me.labelRotation);
var cosRotation = Math.cos(labelRotationRadians);
var longestRotatedLabel = me.longestLabelWidth * cosRotation;
var result = [];
var i, tick, shouldSkip;
// figure out the maximum number of gridlines to show
var maxTicks;
if (optionTicks.maxTicksLimit) {
maxTicks = optionTicks.maxTicksLimit;
}
if (isHorizontal) {
skipRatio = false;
if ((longestRotatedLabel + optionTicks.autoSkipPadding) * tickCount > (me.width - (me.paddingLeft + me.paddingRight))) {
skipRatio = 1 + Math.floor(((longestRotatedLabel + optionTicks.autoSkipPadding) * tickCount) / (me.width - (me.paddingLeft + me.paddingRight)));
}
// if they defined a max number of optionTicks,
// increase skipRatio until that number is met
if (maxTicks && tickCount > maxTicks) {
skipRatio = Math.max(skipRatio, Math.floor(tickCount / maxTicks));
}
}
for (i = 0; i < tickCount; i++) {
tick = ticks[i];
// Since we always show the last tick,we need may need to hide the last shown one before
shouldSkip = (skipRatio > 1 && i % skipRatio > 0) || (i % skipRatio === 0 && i + skipRatio >= tickCount);
if (shouldSkip && i !== tickCount - 1) {
// leave tick in place but make sure it's not displayed (#4635)
delete tick.label;
}
result.push(tick);
}
return result;
},
// Actually draw the scale on the canvas
// @param {rectangle} chartArea : the area of the chart to draw full grid lines on
draw: function(chartArea) {
var me = this;
var options = me.options;
if (!options.display) {
return;
}
var context = me.ctx;
var globalDefaults = defaults.global;
var optionTicks = options.ticks.minor;
var optionMajorTicks = options.ticks.major || optionTicks;
var gridLines = options.gridLines;
var scaleLabel = options.scaleLabel;
var isRotated = me.labelRotation !== 0;
var isHorizontal = me.isHorizontal();
var ticks = optionTicks.autoSkip ? me._autoSkip(me.getTicks()) : me.getTicks();
var tickFontColor = helpers.valueOrDefault(optionTicks.fontColor, globalDefaults.defaultFontColor);
var tickFont = parseFontOptions(optionTicks);
var majorTickFontColor = helpers.valueOrDefault(optionMajorTicks.fontColor, globalDefaults.defaultFontColor);
var majorTickFont = parseFontOptions(optionMajorTicks);
var tl = gridLines.drawTicks ? gridLines.tickMarkLength : 0;
var scaleLabelFontColor = helpers.valueOrDefault(scaleLabel.fontColor, globalDefaults.defaultFontColor);
var scaleLabelFont = parseFontOptions(scaleLabel);
var scaleLabelPadding = helpers.options.toPadding(scaleLabel.padding);
var labelRotationRadians = helpers.toRadians(me.labelRotation);
var itemsToDraw = [];
var axisWidth = me.options.gridLines.lineWidth;
var xTickStart = options.position === 'right' ? me.right : me.right - axisWidth - tl;
var xTickEnd = options.position === 'right' ? me.right + tl : me.right;
var yTickStart = options.position === 'bottom' ? me.top + axisWidth : me.bottom - tl - axisWidth;
var yTickEnd = options.position === 'bottom' ? me.top + axisWidth + tl : me.bottom + axisWidth;
helpers.each(ticks, function(tick, index) {
// autoskipper skipped this tick (#4635)
if (helpers.isNullOrUndef(tick.label)) {
return;
}
var label = tick.label;
var lineWidth, lineColor, borderDash, borderDashOffset;
if (index === me.zeroLineIndex && options.offset === gridLines.offsetGridLines) {
// Draw the first index specially
lineWidth = gridLines.zeroLineWidth;
lineColor = gridLines.zeroLineColor;
borderDash = gridLines.zeroLineBorderDash;
borderDashOffset = gridLines.zeroLineBorderDashOffset;
} else {
lineWidth = helpers.valueAtIndexOrDefault(gridLines.lineWidth, index);
lineColor = helpers.valueAtIndexOrDefault(gridLines.color, index);
borderDash = helpers.valueOrDefault(gridLines.borderDash, globalDefaults.borderDash);
borderDashOffset = helpers.valueOrDefault(gridLines.borderDashOffset, globalDefaults.borderDashOffset);
}
// Common properties
var tx1, ty1, tx2, ty2, x1, y1, x2, y2, labelX, labelY;
var textAlign = 'middle';
var textBaseline = 'middle';
var tickPadding = optionTicks.padding;
if (isHorizontal) {
var labelYOffset = tl + tickPadding;
if (options.position === 'bottom') {
// bottom
textBaseline = !isRotated ? 'top' : 'middle';
textAlign = !isRotated ? 'center' : 'right';
labelY = me.top + labelYOffset;
} else {
// top
textBaseline = !isRotated ? 'bottom' : 'middle';
textAlign = !isRotated ? 'center' : 'left';
labelY = me.bottom - labelYOffset;
}
var xLineValue = getLineValue(me, index, gridLines.offsetGridLines && ticks.length > 1);
if (xLineValue < me.left) {
lineColor = 'rgba(0,0,0,0)';
}
xLineValue += helpers.aliasPixel(lineWidth);
labelX = me.getPixelForTick(index) + optionTicks.labelOffset; // x values for optionTicks (need to consider offsetLabel option)
tx1 = tx2 = x1 = x2 = xLineValue;
ty1 = yTickStart;
ty2 = yTickEnd;
y1 = chartArea.top;
y2 = chartArea.bottom + axisWidth;
} else {
var isLeft = options.position === 'left';
var labelXOffset;
if (optionTicks.mirror) {
textAlign = isLeft ? 'left' : 'right';
labelXOffset = tickPadding;
} else {
textAlign = isLeft ? 'right' : 'left';
labelXOffset = tl + tickPadding;
}
labelX = isLeft ? me.right - labelXOffset : me.left + labelXOffset;
var yLineValue = getLineValue(me, index, gridLines.offsetGridLines && ticks.length > 1);
if (yLineValue < me.top) {
lineColor = 'rgba(0,0,0,0)';
}
yLineValue += helpers.aliasPixel(lineWidth);
labelY = me.getPixelForTick(index) + optionTicks.labelOffset;
tx1 = xTickStart;
tx2 = xTickEnd;
x1 = chartArea.left;
x2 = chartArea.right + axisWidth;
ty1 = ty2 = y1 = y2 = yLineValue;
}
itemsToDraw.push({
tx1: tx1,
ty1: ty1,
tx2: tx2,
ty2: ty2,
x1: x1,
y1: y1,
x2: x2,
y2: y2,
labelX: labelX,
labelY: labelY,
glWidth: lineWidth,
glColor: lineColor,
glBorderDash: borderDash,
glBorderDashOffset: borderDashOffset,
rotation: -1 * labelRotationRadians,
label: label,
major: tick.major,
textBaseline: textBaseline,
textAlign: textAlign
});
});
// Draw all of the tick labels, tick marks, and grid lines at the correct places
helpers.each(itemsToDraw, function(itemToDraw) {
if (gridLines.display) {
context.save();
context.lineWidth = itemToDraw.glWidth;
context.strokeStyle = itemToDraw.glColor;
if (context.setLineDash) {
context.setLineDash(itemToDraw.glBorderDash);
context.lineDashOffset = itemToDraw.glBorderDashOffset;
}
context.beginPath();
if (gridLines.drawTicks) {
context.moveTo(itemToDraw.tx1, itemToDraw.ty1);
context.lineTo(itemToDraw.tx2, itemToDraw.ty2);
}
if (gridLines.drawOnChartArea) {
context.moveTo(itemToDraw.x1, itemToDraw.y1);
context.lineTo(itemToDraw.x2, itemToDraw.y2);
}
context.stroke();
context.restore();
}
if (optionTicks.display) {
// Make sure we draw text in the correct color and font
context.save();
context.translate(itemToDraw.labelX, itemToDraw.labelY);
context.rotate(itemToDraw.rotation);
context.font = itemToDraw.major ? majorTickFont.font : tickFont.font;
context.fillStyle = itemToDraw.major ? majorTickFontColor : tickFontColor;
context.textBaseline = itemToDraw.textBaseline;
context.textAlign = itemToDraw.textAlign;
var label = itemToDraw.label;
if (helpers.isArray(label)) {
var lineCount = label.length;
var lineHeight = tickFont.size * 1.5;
var y = me.isHorizontal() ? 0 : -lineHeight * (lineCount - 1) / 2;
for (var i = 0; i < lineCount; ++i) {
// We just make sure the multiline element is a string here..
context.fillText('' + label[i], 0, y);
// apply same lineSpacing as calculated @ L#320
y += lineHeight;
}
} else {
context.fillText(label, 0, 0);
}
context.restore();
}
});
if (scaleLabel.display) {
// Draw the scale label
var scaleLabelX;
var scaleLabelY;
var rotation = 0;
var halfLineHeight = parseLineHeight(scaleLabel) / 2;
if (isHorizontal) {
scaleLabelX = me.left + ((me.right - me.left) / 2); // midpoint of the width
scaleLabelY = options.position === 'bottom'
? me.bottom - halfLineHeight - scaleLabelPadding.bottom
: me.top + halfLineHeight + scaleLabelPadding.top;
} else {
var isLeft = options.position === 'left';
scaleLabelX = isLeft
? me.left + halfLineHeight + scaleLabelPadding.top
: me.right - halfLineHeight - scaleLabelPadding.top;
scaleLabelY = me.top + ((me.bottom - me.top) / 2);
rotation = isLeft ? -0.5 * Math.PI : 0.5 * Math.PI;
}
context.save();
context.translate(scaleLabelX, scaleLabelY);
context.rotate(rotation);
context.textAlign = 'center';
context.textBaseline = 'middle';
context.fillStyle = scaleLabelFontColor; // render in correct colour
context.font = scaleLabelFont.font;
context.fillText(scaleLabel.labelString, 0, 0);
context.restore();
}
if (gridLines.drawBorder) {
// Draw the line at the edge of the axis
context.lineWidth = helpers.valueAtIndexOrDefault(gridLines.lineWidth, 0);
context.strokeStyle = helpers.valueAtIndexOrDefault(gridLines.color, 0);
var x1 = me.left;
var x2 = me.right + axisWidth;
var y1 = me.top;
var y2 = me.bottom + axisWidth;
var aliasPixel = helpers.aliasPixel(context.lineWidth);
if (isHorizontal) {
y1 = y2 = options.position === 'top' ? me.bottom : me.top;
y1 += aliasPixel;
y2 += aliasPixel;
} else {
x1 = x2 = options.position === 'left' ? me.right : me.left;
x1 += aliasPixel;
x2 += aliasPixel;
}
context.beginPath();
context.moveTo(x1, y1);
context.lineTo(x2, y2);
context.stroke();
}
}
});
};
/***/ }),
/* 439 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var defaults = __webpack_require__(8);
var Element = __webpack_require__(22);
var helpers = __webpack_require__(5);
defaults._set('global', {
tooltips: {
enabled: true,
custom: null,
mode: 'nearest',
position: 'average',
intersect: true,
backgroundColor: 'rgba(0,0,0,0.8)',
titleFontStyle: 'bold',
titleSpacing: 2,
titleMarginBottom: 6,
titleFontColor: '#fff',
titleAlign: 'left',
bodySpacing: 2,
bodyFontColor: '#fff',
bodyAlign: 'left',
footerFontStyle: 'bold',
footerSpacing: 2,
footerMarginTop: 6,
footerFontColor: '#fff',
footerAlign: 'left',
yPadding: 6,
xPadding: 6,
caretPadding: 2,
caretSize: 5,
cornerRadius: 6,
multiKeyBackground: '#fff',
displayColors: true,
borderColor: 'rgba(0,0,0,0)',
borderWidth: 0,
callbacks: {
// Args are: (tooltipItems, data)
beforeTitle: helpers.noop,
title: function(tooltipItems, data) {
// Pick first xLabel for now
var title = '';
var labels = data.labels;
var labelCount = labels ? labels.length : 0;
if (tooltipItems.length > 0) {
var item = tooltipItems[0];
if (item.xLabel) {
title = item.xLabel;
} else if (labelCount > 0 && item.index < labelCount) {
title = labels[item.index];
}
}
return title;
},
afterTitle: helpers.noop,
// Args are: (tooltipItems, data)
beforeBody: helpers.noop,
// Args are: (tooltipItem, data)
beforeLabel: helpers.noop,
label: function(tooltipItem, data) {
var label = data.datasets[tooltipItem.datasetIndex].label || '';
if (label) {
label += ': ';
}
label += tooltipItem.yLabel;
return label;
},
labelColor: function(tooltipItem, chart) {
var meta = chart.getDatasetMeta(tooltipItem.datasetIndex);
var activeElement = meta.data[tooltipItem.index];
var view = activeElement._view;
return {
borderColor: view.borderColor,
backgroundColor: view.backgroundColor
};
},
labelTextColor: function() {
return this._options.bodyFontColor;
},
afterLabel: helpers.noop,
// Args are: (tooltipItems, data)
afterBody: helpers.noop,
// Args are: (tooltipItems, data)
beforeFooter: helpers.noop,
footer: helpers.noop,
afterFooter: helpers.noop
}
}
});
module.exports = function(Chart) {
/**
* Helper method to merge the opacity into a color
*/
function mergeOpacity(colorString, opacity) {
var color = helpers.color(colorString);
return color.alpha(opacity * color.alpha()).rgbaString();
}
// Helper to push or concat based on if the 2nd parameter is an array or not
function pushOrConcat(base, toPush) {
if (toPush) {
if (helpers.isArray(toPush)) {
// base = base.concat(toPush);
Array.prototype.push.apply(base, toPush);
} else {
base.push(toPush);
}
}
return base;
}
// Private helper to create a tooltip item model
// @param element : the chart element (point, arc, bar) to create the tooltip item for
// @return : new tooltip item
function createTooltipItem(element) {
var xScale = element._xScale;
var yScale = element._yScale || element._scale; // handle radar || polarArea charts
var index = element._index;
var datasetIndex = element._datasetIndex;
return {
xLabel: xScale ? xScale.getLabelForIndex(index, datasetIndex) : '',
yLabel: yScale ? yScale.getLabelForIndex(index, datasetIndex) : '',
index: index,
datasetIndex: datasetIndex,
x: element._model.x,
y: element._model.y
};
}
/**
* Helper to get the reset model for the tooltip
* @param tooltipOpts {Object} the tooltip options
*/
function getBaseModel(tooltipOpts) {
var globalDefaults = defaults.global;
var valueOrDefault = helpers.valueOrDefault;
return {
// Positioning
xPadding: tooltipOpts.xPadding,
yPadding: tooltipOpts.yPadding,
xAlign: tooltipOpts.xAlign,
yAlign: tooltipOpts.yAlign,
// Body
bodyFontColor: tooltipOpts.bodyFontColor,
_bodyFontFamily: valueOrDefault(tooltipOpts.bodyFontFamily, globalDefaults.defaultFontFamily),
_bodyFontStyle: valueOrDefault(tooltipOpts.bodyFontStyle, globalDefaults.defaultFontStyle),
_bodyAlign: tooltipOpts.bodyAlign,
bodyFontSize: valueOrDefault(tooltipOpts.bodyFontSize, globalDefaults.defaultFontSize),
bodySpacing: tooltipOpts.bodySpacing,
// Title
titleFontColor: tooltipOpts.titleFontColor,
_titleFontFamily: valueOrDefault(tooltipOpts.titleFontFamily, globalDefaults.defaultFontFamily),
_titleFontStyle: valueOrDefault(tooltipOpts.titleFontStyle, globalDefaults.defaultFontStyle),
titleFontSize: valueOrDefault(tooltipOpts.titleFontSize, globalDefaults.defaultFontSize),
_titleAlign: tooltipOpts.titleAlign,
titleSpacing: tooltipOpts.titleSpacing,
titleMarginBottom: tooltipOpts.titleMarginBottom,
// Footer
footerFontColor: tooltipOpts.footerFontColor,
_footerFontFamily: valueOrDefault(tooltipOpts.footerFontFamily, globalDefaults.defaultFontFamily),
_footerFontStyle: valueOrDefault(tooltipOpts.footerFontStyle, globalDefaults.defaultFontStyle),
footerFontSize: valueOrDefault(tooltipOpts.footerFontSize, globalDefaults.defaultFontSize),
_footerAlign: tooltipOpts.footerAlign,
footerSpacing: tooltipOpts.footerSpacing,
footerMarginTop: tooltipOpts.footerMarginTop,
// Appearance
caretSize: tooltipOpts.caretSize,
cornerRadius: tooltipOpts.cornerRadius,
backgroundColor: tooltipOpts.backgroundColor,
opacity: 0,
legendColorBackground: tooltipOpts.multiKeyBackground,
displayColors: tooltipOpts.displayColors,
borderColor: tooltipOpts.borderColor,
borderWidth: tooltipOpts.borderWidth
};
}
/**
* Get the size of the tooltip
*/
function getTooltipSize(tooltip, model) {
var ctx = tooltip._chart.ctx;
var height = model.yPadding * 2; // Tooltip Padding
var width = 0;
// Count of all lines in the body
var body = model.body;
var combinedBodyLength = body.reduce(function(count, bodyItem) {
return count + bodyItem.before.length + bodyItem.lines.length + bodyItem.after.length;
}, 0);
combinedBodyLength += model.beforeBody.length + model.afterBody.length;
var titleLineCount = model.title.length;
var footerLineCount = model.footer.length;
var titleFontSize = model.titleFontSize;
var bodyFontSize = model.bodyFontSize;
var footerFontSize = model.footerFontSize;
height += titleLineCount * titleFontSize; // Title Lines
height += titleLineCount ? (titleLineCount - 1) * model.titleSpacing : 0; // Title Line Spacing
height += titleLineCount ? model.titleMarginBottom : 0; // Title's bottom Margin
height += combinedBodyLength * bodyFontSize; // Body Lines
height += combinedBodyLength ? (combinedBodyLength - 1) * model.bodySpacing : 0; // Body Line Spacing
height += footerLineCount ? model.footerMarginTop : 0; // Footer Margin
height += footerLineCount * (footerFontSize); // Footer Lines
height += footerLineCount ? (footerLineCount - 1) * model.footerSpacing : 0; // Footer Line Spacing
// Title width
var widthPadding = 0;
var maxLineWidth = function(line) {
width = Math.max(width, ctx.measureText(line).width + widthPadding);
};
ctx.font = helpers.fontString(titleFontSize, model._titleFontStyle, model._titleFontFamily);
helpers.each(model.title, maxLineWidth);
// Body width
ctx.font = helpers.fontString(bodyFontSize, model._bodyFontStyle, model._bodyFontFamily);
helpers.each(model.beforeBody.concat(model.afterBody), maxLineWidth);
// Body lines may include some extra width due to the color box
widthPadding = model.displayColors ? (bodyFontSize + 2) : 0;
helpers.each(body, function(bodyItem) {
helpers.each(bodyItem.before, maxLineWidth);
helpers.each(bodyItem.lines, maxLineWidth);
helpers.each(bodyItem.after, maxLineWidth);
});
// Reset back to 0
widthPadding = 0;
// Footer width
ctx.font = helpers.fontString(footerFontSize, model._footerFontStyle, model._footerFontFamily);
helpers.each(model.footer, maxLineWidth);
// Add padding
width += 2 * model.xPadding;
return {
width: width,
height: height
};
}
/**
* Helper to get the alignment of a tooltip given the size
*/
function determineAlignment(tooltip, size) {
var model = tooltip._model;
var chart = tooltip._chart;
var chartArea = tooltip._chart.chartArea;
var xAlign = 'center';
var yAlign = 'center';
if (model.y < size.height) {
yAlign = 'top';
} else if (model.y > (chart.height - size.height)) {
yAlign = 'bottom';
}
var lf, rf; // functions to determine left, right alignment
var olf, orf; // functions to determine if left/right alignment causes tooltip to go outside chart
var yf; // function to get the y alignment if the tooltip goes outside of the left or right edges
var midX = (chartArea.left + chartArea.right) / 2;
var midY = (chartArea.top + chartArea.bottom) / 2;
if (yAlign === 'center') {
lf = function(x) {
return x <= midX;
};
rf = function(x) {
return x > midX;
};
} else {
lf = function(x) {
return x <= (size.width / 2);
};
rf = function(x) {
return x >= (chart.width - (size.width / 2));
};
}
olf = function(x) {
return x + size.width + model.caretSize + model.caretPadding > chart.width;
};
orf = function(x) {
return x - size.width - model.caretSize - model.caretPadding < 0;
};
yf = function(y) {
return y <= midY ? 'top' : 'bottom';
};
if (lf(model.x)) {
xAlign = 'left';
// Is tooltip too wide and goes over the right side of the chart.?
if (olf(model.x)) {
xAlign = 'center';
yAlign = yf(model.y);
}
} else if (rf(model.x)) {
xAlign = 'right';
// Is tooltip too wide and goes outside left edge of canvas?
if (orf(model.x)) {
xAlign = 'center';
yAlign = yf(model.y);
}
}
var opts = tooltip._options;
return {
xAlign: opts.xAlign ? opts.xAlign : xAlign,
yAlign: opts.yAlign ? opts.yAlign : yAlign
};
}
/**
* @Helper to get the location a tooltip needs to be placed at given the initial position (via the vm) and the size and alignment
*/
function getBackgroundPoint(vm, size, alignment, chart) {
// Background Position
var x = vm.x;
var y = vm.y;
var caretSize = vm.caretSize;
var caretPadding = vm.caretPadding;
var cornerRadius = vm.cornerRadius;
var xAlign = alignment.xAlign;
var yAlign = alignment.yAlign;
var paddingAndSize = caretSize + caretPadding;
var radiusAndPadding = cornerRadius + caretPadding;
if (xAlign === 'right') {
x -= size.width;
} else if (xAlign === 'center') {
x -= (size.width / 2);
if (x + size.width > chart.width) {
x = chart.width - size.width;
}
if (x < 0) {
x = 0;
}
}
if (yAlign === 'top') {
y += paddingAndSize;
} else if (yAlign === 'bottom') {
y -= size.height + paddingAndSize;
} else {
y -= (size.height / 2);
}
if (yAlign === 'center') {
if (xAlign === 'left') {
x += paddingAndSize;
} else if (xAlign === 'right') {
x -= paddingAndSize;
}
} else if (xAlign === 'left') {
x -= radiusAndPadding;
} else if (xAlign === 'right') {
x += radiusAndPadding;
}
return {
x: x,
y: y
};
}
Chart.Tooltip = Element.extend({
initialize: function() {
this._model = getBaseModel(this._options);
this._lastActive = [];
},
// Get the title
// Args are: (tooltipItem, data)
getTitle: function() {
var me = this;
var opts = me._options;
var callbacks = opts.callbacks;
var beforeTitle = callbacks.beforeTitle.apply(me, arguments);
var title = callbacks.title.apply(me, arguments);
var afterTitle = callbacks.afterTitle.apply(me, arguments);
var lines = [];
lines = pushOrConcat(lines, beforeTitle);
lines = pushOrConcat(lines, title);
lines = pushOrConcat(lines, afterTitle);
return lines;
},
// Args are: (tooltipItem, data)
getBeforeBody: function() {
var lines = this._options.callbacks.beforeBody.apply(this, arguments);
return helpers.isArray(lines) ? lines : lines !== undefined ? [lines] : [];
},
// Args are: (tooltipItem, data)
getBody: function(tooltipItems, data) {
var me = this;
var callbacks = me._options.callbacks;
var bodyItems = [];
helpers.each(tooltipItems, function(tooltipItem) {
var bodyItem = {
before: [],
lines: [],
after: []
};
pushOrConcat(bodyItem.before, callbacks.beforeLabel.call(me, tooltipItem, data));
pushOrConcat(bodyItem.lines, callbacks.label.call(me, tooltipItem, data));
pushOrConcat(bodyItem.after, callbacks.afterLabel.call(me, tooltipItem, data));
bodyItems.push(bodyItem);
});
return bodyItems;
},
// Args are: (tooltipItem, data)
getAfterBody: function() {
var lines = this._options.callbacks.afterBody.apply(this, arguments);
return helpers.isArray(lines) ? lines : lines !== undefined ? [lines] : [];
},
// Get the footer and beforeFooter and afterFooter lines
// Args are: (tooltipItem, data)
getFooter: function() {
var me = this;
var callbacks = me._options.callbacks;
var beforeFooter = callbacks.beforeFooter.apply(me, arguments);
var footer = callbacks.footer.apply(me, arguments);
var afterFooter = callbacks.afterFooter.apply(me, arguments);
var lines = [];
lines = pushOrConcat(lines, beforeFooter);
lines = pushOrConcat(lines, footer);
lines = pushOrConcat(lines, afterFooter);
return lines;
},
update: function(changed) {
var me = this;
var opts = me._options;
// Need to regenerate the model because its faster than using extend and it is necessary due to the optimization in Chart.Element.transition
// that does _view = _model if ease === 1. This causes the 2nd tooltip update to set properties in both the view and model at the same time
// which breaks any animations.
var existingModel = me._model;
var model = me._model = getBaseModel(opts);
var active = me._active;
var data = me._data;
// In the case where active.length === 0 we need to keep these at existing values for good animations
var alignment = {
xAlign: existingModel.xAlign,
yAlign: existingModel.yAlign
};
var backgroundPoint = {
x: existingModel.x,
y: existingModel.y
};
var tooltipSize = {
width: existingModel.width,
height: existingModel.height
};
var tooltipPosition = {
x: existingModel.caretX,
y: existingModel.caretY
};
var i, len;
if (active.length) {
model.opacity = 1;
var labelColors = [];
var labelTextColors = [];
tooltipPosition = Chart.Tooltip.positioners[opts.position].call(me, active, me._eventPosition);
var tooltipItems = [];
for (i = 0, len = active.length; i < len; ++i) {
tooltipItems.push(createTooltipItem(active[i]));
}
// If the user provided a filter function, use it to modify the tooltip items
if (opts.filter) {
tooltipItems = tooltipItems.filter(function(a) {
return opts.filter(a, data);
});
}
// If the user provided a sorting function, use it to modify the tooltip items
if (opts.itemSort) {
tooltipItems = tooltipItems.sort(function(a, b) {
return opts.itemSort(a, b, data);
});
}
// Determine colors for boxes
helpers.each(tooltipItems, function(tooltipItem) {
labelColors.push(opts.callbacks.labelColor.call(me, tooltipItem, me._chart));
labelTextColors.push(opts.callbacks.labelTextColor.call(me, tooltipItem, me._chart));
});
// Build the Text Lines
model.title = me.getTitle(tooltipItems, data);
model.beforeBody = me.getBeforeBody(tooltipItems, data);
model.body = me.getBody(tooltipItems, data);
model.afterBody = me.getAfterBody(tooltipItems, data);
model.footer = me.getFooter(tooltipItems, data);
// Initial positioning and colors
model.x = Math.round(tooltipPosition.x);
model.y = Math.round(tooltipPosition.y);
model.caretPadding = opts.caretPadding;
model.labelColors = labelColors;
model.labelTextColors = labelTextColors;
// data points
model.dataPoints = tooltipItems;
// We need to determine alignment of the tooltip
tooltipSize = getTooltipSize(this, model);
alignment = determineAlignment(this, tooltipSize);
// Final Size and Position
backgroundPoint = getBackgroundPoint(model, tooltipSize, alignment, me._chart);
} else {
model.opacity = 0;
}
model.xAlign = alignment.xAlign;
model.yAlign = alignment.yAlign;
model.x = backgroundPoint.x;
model.y = backgroundPoint.y;
model.width = tooltipSize.width;
model.height = tooltipSize.height;
// Point where the caret on the tooltip points to
model.caretX = tooltipPosition.x;
model.caretY = tooltipPosition.y;
me._model = model;
if (changed && opts.custom) {
opts.custom.call(me, model);
}
return me;
},
drawCaret: function(tooltipPoint, size) {
var ctx = this._chart.ctx;
var vm = this._view;
var caretPosition = this.getCaretPosition(tooltipPoint, size, vm);
ctx.lineTo(caretPosition.x1, caretPosition.y1);
ctx.lineTo(caretPosition.x2, caretPosition.y2);
ctx.lineTo(caretPosition.x3, caretPosition.y3);
},
getCaretPosition: function(tooltipPoint, size, vm) {
var x1, x2, x3, y1, y2, y3;
var caretSize = vm.caretSize;
var cornerRadius = vm.cornerRadius;
var xAlign = vm.xAlign;
var yAlign = vm.yAlign;
var ptX = tooltipPoint.x;
var ptY = tooltipPoint.y;
var width = size.width;
var height = size.height;
if (yAlign === 'center') {
y2 = ptY + (height / 2);
if (xAlign === 'left') {
x1 = ptX;
x2 = x1 - caretSize;
x3 = x1;
y1 = y2 + caretSize;
y3 = y2 - caretSize;
} else {
x1 = ptX + width;
x2 = x1 + caretSize;
x3 = x1;
y1 = y2 - caretSize;
y3 = y2 + caretSize;
}
} else {
if (xAlign === 'left') {
x2 = ptX + cornerRadius + (caretSize);
x1 = x2 - caretSize;
x3 = x2 + caretSize;
} else if (xAlign === 'right') {
x2 = ptX + width - cornerRadius - caretSize;
x1 = x2 - caretSize;
x3 = x2 + caretSize;
} else {
x2 = vm.caretX;
x1 = x2 - caretSize;
x3 = x2 + caretSize;
}
if (yAlign === 'top') {
y1 = ptY;
y2 = y1 - caretSize;
y3 = y1;
} else {
y1 = ptY + height;
y2 = y1 + caretSize;
y3 = y1;
// invert drawing order
var tmp = x3;
x3 = x1;
x1 = tmp;
}
}
return {x1: x1, x2: x2, x3: x3, y1: y1, y2: y2, y3: y3};
},
drawTitle: function(pt, vm, ctx, opacity) {
var title = vm.title;
if (title.length) {
ctx.textAlign = vm._titleAlign;
ctx.textBaseline = 'top';
var titleFontSize = vm.titleFontSize;
var titleSpacing = vm.titleSpacing;
ctx.fillStyle = mergeOpacity(vm.titleFontColor, opacity);
ctx.font = helpers.fontString(titleFontSize, vm._titleFontStyle, vm._titleFontFamily);
var i, len;
for (i = 0, len = title.length; i < len; ++i) {
ctx.fillText(title[i], pt.x, pt.y);
pt.y += titleFontSize + titleSpacing; // Line Height and spacing
if (i + 1 === title.length) {
pt.y += vm.titleMarginBottom - titleSpacing; // If Last, add margin, remove spacing
}
}
}
},
drawBody: function(pt, vm, ctx, opacity) {
var bodyFontSize = vm.bodyFontSize;
var bodySpacing = vm.bodySpacing;
var body = vm.body;
ctx.textAlign = vm._bodyAlign;
ctx.textBaseline = 'top';
ctx.font = helpers.fontString(bodyFontSize, vm._bodyFontStyle, vm._bodyFontFamily);
// Before Body
var xLinePadding = 0;
var fillLineOfText = function(line) {
ctx.fillText(line, pt.x + xLinePadding, pt.y);
pt.y += bodyFontSize + bodySpacing;
};
// Before body lines
ctx.fillStyle = mergeOpacity(vm.bodyFontColor, opacity);
helpers.each(vm.beforeBody, fillLineOfText);
var drawColorBoxes = vm.displayColors;
xLinePadding = drawColorBoxes ? (bodyFontSize + 2) : 0;
// Draw body lines now
helpers.each(body, function(bodyItem, i) {
var textColor = mergeOpacity(vm.labelTextColors[i], opacity);
ctx.fillStyle = textColor;
helpers.each(bodyItem.before, fillLineOfText);
helpers.each(bodyItem.lines, function(line) {
// Draw Legend-like boxes if needed
if (drawColorBoxes) {
// Fill a white rect so that colours merge nicely if the opacity is < 1
ctx.fillStyle = mergeOpacity(vm.legendColorBackground, opacity);
ctx.fillRect(pt.x, pt.y, bodyFontSize, bodyFontSize);
// Border
ctx.lineWidth = 1;
ctx.strokeStyle = mergeOpacity(vm.labelColors[i].borderColor, opacity);
ctx.strokeRect(pt.x, pt.y, bodyFontSize, bodyFontSize);
// Inner square
ctx.fillStyle = mergeOpacity(vm.labelColors[i].backgroundColor, opacity);
ctx.fillRect(pt.x + 1, pt.y + 1, bodyFontSize - 2, bodyFontSize - 2);
ctx.fillStyle = textColor;
}
fillLineOfText(line);
});
helpers.each(bodyItem.after, fillLineOfText);
});
// Reset back to 0 for after body
xLinePadding = 0;
// After body lines
helpers.each(vm.afterBody, fillLineOfText);
pt.y -= bodySpacing; // Remove last body spacing
},
drawFooter: function(pt, vm, ctx, opacity) {
var footer = vm.footer;
if (footer.length) {
pt.y += vm.footerMarginTop;
ctx.textAlign = vm._footerAlign;
ctx.textBaseline = 'top';
ctx.fillStyle = mergeOpacity(vm.footerFontColor, opacity);
ctx.font = helpers.fontString(vm.footerFontSize, vm._footerFontStyle, vm._footerFontFamily);
helpers.each(footer, function(line) {
ctx.fillText(line, pt.x, pt.y);
pt.y += vm.footerFontSize + vm.footerSpacing;
});
}
},
drawBackground: function(pt, vm, ctx, tooltipSize, opacity) {
ctx.fillStyle = mergeOpacity(vm.backgroundColor, opacity);
ctx.strokeStyle = mergeOpacity(vm.borderColor, opacity);
ctx.lineWidth = vm.borderWidth;
var xAlign = vm.xAlign;
var yAlign = vm.yAlign;
var x = pt.x;
var y = pt.y;
var width = tooltipSize.width;
var height = tooltipSize.height;
var radius = vm.cornerRadius;
ctx.beginPath();
ctx.moveTo(x + radius, y);
if (yAlign === 'top') {
this.drawCaret(pt, tooltipSize);
}
ctx.lineTo(x + width - radius, y);
ctx.quadraticCurveTo(x + width, y, x + width, y + radius);
if (yAlign === 'center' && xAlign === 'right') {
this.drawCaret(pt, tooltipSize);
}
ctx.lineTo(x + width, y + height - radius);
ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
if (yAlign === 'bottom') {
this.drawCaret(pt, tooltipSize);
}
ctx.lineTo(x + radius, y + height);
ctx.quadraticCurveTo(x, y + height, x, y + height - radius);
if (yAlign === 'center' && xAlign === 'left') {
this.drawCaret(pt, tooltipSize);
}
ctx.lineTo(x, y + radius);
ctx.quadraticCurveTo(x, y, x + radius, y);
ctx.closePath();
ctx.fill();
if (vm.borderWidth > 0) {
ctx.stroke();
}
},
draw: function() {
var ctx = this._chart.ctx;
var vm = this._view;
if (vm.opacity === 0) {
return;
}
var tooltipSize = {
width: vm.width,
height: vm.height
};
var pt = {
x: vm.x,
y: vm.y
};
// IE11/Edge does not like very small opacities, so snap to 0
var opacity = Math.abs(vm.opacity < 1e-3) ? 0 : vm.opacity;
// Truthy/falsey value for empty tooltip
var hasTooltipContent = vm.title.length || vm.beforeBody.length || vm.body.length || vm.afterBody.length || vm.footer.length;
if (this._options.enabled && hasTooltipContent) {
// Draw Background
this.drawBackground(pt, vm, ctx, tooltipSize, opacity);
// Draw Title, Body, and Footer
pt.x += vm.xPadding;
pt.y += vm.yPadding;
// Titles
this.drawTitle(pt, vm, ctx, opacity);
// Body
this.drawBody(pt, vm, ctx, opacity);
// Footer
this.drawFooter(pt, vm, ctx, opacity);
}
},
/**
* Handle an event
* @private
* @param {IEvent} event - The event to handle
* @returns {Boolean} true if the tooltip changed
*/
handleEvent: function(e) {
var me = this;
var options = me._options;
var changed = false;
me._lastActive = me._lastActive || [];
// Find Active Elements for tooltips
if (e.type === 'mouseout') {
me._active = [];
} else {
me._active = me._chart.getElementsAtEventForMode(e, options.mode, options);
}
// Remember Last Actives
changed = !helpers.arrayEquals(me._active, me._lastActive);
// Only handle target event on tooltip change
if (changed) {
me._lastActive = me._active;
if (options.enabled || options.custom) {
me._eventPosition = {
x: e.x,
y: e.y
};
me.update(true);
me.pivot();
}
}
return changed;
}
});
/**
* @namespace Chart.Tooltip.positioners
*/
Chart.Tooltip.positioners = {
/**
* Average mode places the tooltip at the average position of the elements shown
* @function Chart.Tooltip.positioners.average
* @param elements {ChartElement[]} the elements being displayed in the tooltip
* @returns {Point} tooltip position
*/
average: function(elements) {
if (!elements.length) {
return false;
}
var i, len;
var x = 0;
var y = 0;
var count = 0;
for (i = 0, len = elements.length; i < len; ++i) {
var el = elements[i];
if (el && el.hasValue()) {
var pos = el.tooltipPosition();
x += pos.x;
y += pos.y;
++count;
}
}
return {
x: Math.round(x / count),
y: Math.round(y / count)
};
},
/**
* Gets the tooltip position nearest of the item nearest to the event position
* @function Chart.Tooltip.positioners.nearest
* @param elements {Chart.Element[]} the tooltip elements
* @param eventPosition {Point} the position of the event in canvas coordinates
* @returns {Point} the tooltip position
*/
nearest: function(elements, eventPosition) {
var x = eventPosition.x;
var y = eventPosition.y;
var minDistance = Number.POSITIVE_INFINITY;
var i, len, nearestElement;
for (i = 0, len = elements.length; i < len; ++i) {
var el = elements[i];
if (el && el.hasValue()) {
var center = el.getCenterPoint();
var d = helpers.distanceBetweenPoints(eventPosition, center);
if (d < minDistance) {
minDistance = d;
nearestElement = el;
}
}
}
if (nearestElement) {
var tp = nearestElement.tooltipPosition();
x = tp.x;
y = tp.y;
}
return {
x: x,
y: y
};
}
};
};
/***/ }),
/* 440 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var helpers = __webpack_require__(5);
/**
* Generate a set of linear ticks
* @param generationOptions the options used to generate the ticks
* @param dataRange the range of the data
* @returns {Array<Number>} array of tick values
*/
function generateTicks(generationOptions, dataRange) {
var ticks = [];
// To get a "nice" value for the tick spacing, we will use the appropriately named
// "nice number" algorithm. See http://stackoverflow.com/questions/8506881/nice-label-algorithm-for-charts-with-minimum-ticks
// for details.
var spacing;
if (generationOptions.stepSize && generationOptions.stepSize > 0) {
spacing = generationOptions.stepSize;
} else {
var niceRange = helpers.niceNum(dataRange.max - dataRange.min, false);
spacing = helpers.niceNum(niceRange / (generationOptions.maxTicks - 1), true);
}
var niceMin = Math.floor(dataRange.min / spacing) * spacing;
var niceMax = Math.ceil(dataRange.max / spacing) * spacing;
// If min, max and stepSize is set and they make an evenly spaced scale use it.
if (generationOptions.min && generationOptions.max && generationOptions.stepSize) {
// If very close to our whole number, use it.
if (helpers.almostWhole((generationOptions.max - generationOptions.min) / generationOptions.stepSize, spacing / 1000)) {
niceMin = generationOptions.min;
niceMax = generationOptions.max;
}
}
var numSpaces = (niceMax - niceMin) / spacing;
// If very close to our rounded value, use it.
if (helpers.almostEquals(numSpaces, Math.round(numSpaces), spacing / 1000)) {
numSpaces = Math.round(numSpaces);
} else {
numSpaces = Math.ceil(numSpaces);
}
var precision = 1;
if (spacing < 1) {
precision = Math.pow(10, spacing.toString().length - 2);
niceMin = Math.round(niceMin * precision) / precision;
niceMax = Math.round(niceMax * precision) / precision;
}
ticks.push(generationOptions.min !== undefined ? generationOptions.min : niceMin);
for (var j = 1; j < numSpaces; ++j) {
ticks.push(Math.round((niceMin + j * spacing) * precision) / precision);
}
ticks.push(generationOptions.max !== undefined ? generationOptions.max : niceMax);
return ticks;
}
module.exports = function(Chart) {
var noop = helpers.noop;
Chart.LinearScaleBase = Chart.Scale.extend({
getRightValue: function(value) {
if (typeof value === 'string') {
return +value;
}
return Chart.Scale.prototype.getRightValue.call(this, value);
},
handleTickRangeOptions: function() {
var me = this;
var opts = me.options;
var tickOpts = opts.ticks;
// If we are forcing it to begin at 0, but 0 will already be rendered on the chart,
// do nothing since that would make the chart weird. If the user really wants a weird chart
// axis, they can manually override it
if (tickOpts.beginAtZero) {
var minSign = helpers.sign(me.min);
var maxSign = helpers.sign(me.max);
if (minSign < 0 && maxSign < 0) {
// move the top up to 0
me.max = 0;
} else if (minSign > 0 && maxSign > 0) {
// move the bottom down to 0
me.min = 0;
}
}
var setMin = tickOpts.min !== undefined || tickOpts.suggestedMin !== undefined;
var setMax = tickOpts.max !== undefined || tickOpts.suggestedMax !== undefined;
if (tickOpts.min !== undefined) {
me.min = tickOpts.min;
} else if (tickOpts.suggestedMin !== undefined) {
if (me.min === null) {
me.min = tickOpts.suggestedMin;
} else {
me.min = Math.min(me.min, tickOpts.suggestedMin);
}
}
if (tickOpts.max !== undefined) {
me.max = tickOpts.max;
} else if (tickOpts.suggestedMax !== undefined) {
if (me.max === null) {
me.max = tickOpts.suggestedMax;
} else {
me.max = Math.max(me.max, tickOpts.suggestedMax);
}
}
if (setMin !== setMax) {
// We set the min or the max but not both.
// So ensure that our range is good
// Inverted or 0 length range can happen when
// ticks.min is set, and no datasets are visible
if (me.min >= me.max) {
if (setMin) {
me.max = me.min + 1;
} else {
me.min = me.max - 1;
}
}
}
if (me.min === me.max) {
me.max++;
if (!tickOpts.beginAtZero) {
me.min--;
}
}
},
getTickLimit: noop,
handleDirectionalChanges: noop,
buildTicks: function() {
var me = this;
var opts = me.options;
var tickOpts = opts.ticks;
// Figure out what the max number of ticks we can support it is based on the size of
// the axis area. For now, we say that the minimum tick spacing in pixels must be 50
// We also limit the maximum number of ticks to 11 which gives a nice 10 squares on
// the graph. Make sure we always have at least 2 ticks
var maxTicks = me.getTickLimit();
maxTicks = Math.max(2, maxTicks);
var numericGeneratorOptions = {
maxTicks: maxTicks,
min: tickOpts.min,
max: tickOpts.max,
stepSize: helpers.valueOrDefault(tickOpts.fixedStepSize, tickOpts.stepSize)
};
var ticks = me.ticks = generateTicks(numericGeneratorOptions, me);
me.handleDirectionalChanges();
// At this point, we need to update our max and min given the tick values since we have expanded the
// range of the scale
me.max = helpers.max(ticks);
me.min = helpers.min(ticks);
if (tickOpts.reverse) {
ticks.reverse();
me.start = me.max;
me.end = me.min;
} else {
me.start = me.min;
me.end = me.max;
}
},
convertTicksToLabels: function() {
var me = this;
me.ticksAsNumbers = me.ticks.slice();
me.zeroLineIndex = me.ticks.indexOf(0);
Chart.Scale.prototype.convertTicksToLabels.call(me);
}
});
};
/***/ }),
/* 441 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = function(Chart) {
// Default config for a category scale
var defaultConfig = {
position: 'bottom'
};
var DatasetScale = Chart.Scale.extend({
/**
* Internal function to get the correct labels. If data.xLabels or data.yLabels are defined, use those
* else fall back to data.labels
* @private
*/
getLabels: function() {
var data = this.chart.data;
return this.options.labels || (this.isHorizontal() ? data.xLabels : data.yLabels) || data.labels;
},
determineDataLimits: function() {
var me = this;
var labels = me.getLabels();
me.minIndex = 0;
me.maxIndex = labels.length - 1;
var findIndex;
if (me.options.ticks.min !== undefined) {
// user specified min value
findIndex = labels.indexOf(me.options.ticks.min);
me.minIndex = findIndex !== -1 ? findIndex : me.minIndex;
}
if (me.options.ticks.max !== undefined) {
// user specified max value
findIndex = labels.indexOf(me.options.ticks.max);
me.maxIndex = findIndex !== -1 ? findIndex : me.maxIndex;
}
me.min = labels[me.minIndex];
me.max = labels[me.maxIndex];
},
buildTicks: function() {
var me = this;
var labels = me.getLabels();
// If we are viewing some subset of labels, slice the original array
me.ticks = (me.minIndex === 0 && me.maxIndex === labels.length - 1) ? labels : labels.slice(me.minIndex, me.maxIndex + 1);
},
getLabelForIndex: function(index, datasetIndex) {
var me = this;
var data = me.chart.data;
var isHorizontal = me.isHorizontal();
if (data.yLabels && !isHorizontal) {
return me.getRightValue(data.datasets[datasetIndex].data[index]);
}
return me.ticks[index - me.minIndex];
},
// Used to get data value locations. Value can either be an index or a numerical value
getPixelForValue: function(value, index) {
var me = this;
var offset = me.options.offset;
// 1 is added because we need the length but we have the indexes
var offsetAmt = Math.max((me.maxIndex + 1 - me.minIndex - (offset ? 0 : 1)), 1);
// If value is a data object, then index is the index in the data array,
// not the index of the scale. We need to change that.
var valueCategory;
if (value !== undefined && value !== null) {
valueCategory = me.isHorizontal() ? value.x : value.y;
}
if (valueCategory !== undefined || (value !== undefined && isNaN(index))) {
var labels = me.getLabels();
value = valueCategory || value;
var idx = labels.indexOf(value);
index = idx !== -1 ? idx : index;
}
if (me.isHorizontal()) {
var valueWidth = me.width / offsetAmt;
var widthOffset = (valueWidth * (index - me.minIndex));
if (offset) {
widthOffset += (valueWidth / 2);
}
return me.left + Math.round(widthOffset);
}
var valueHeight = me.height / offsetAmt;
var heightOffset = (valueHeight * (index - me.minIndex));
if (offset) {
heightOffset += (valueHeight / 2);
}
return me.top + Math.round(heightOffset);
},
getPixelForTick: function(index) {
return this.getPixelForValue(this.ticks[index], index + this.minIndex, null);
},
getValueForPixel: function(pixel) {
var me = this;
var offset = me.options.offset;
var value;
var offsetAmt = Math.max((me._ticks.length - (offset ? 0 : 1)), 1);
var horz = me.isHorizontal();
var valueDimension = (horz ? me.width : me.height) / offsetAmt;
pixel -= horz ? me.left : me.top;
if (offset) {
pixel -= (valueDimension / 2);
}
if (pixel <= 0) {
value = 0;
} else {
value = Math.round(pixel / valueDimension);
}
return value + me.minIndex;
},
getBasePixel: function() {
return this.bottom;
}
});
Chart.scaleService.registerScaleType('category', DatasetScale, defaultConfig);
};
/***/ }),
/* 442 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var defaults = __webpack_require__(8);
var helpers = __webpack_require__(5);
var Ticks = __webpack_require__(51);
module.exports = function(Chart) {
var defaultConfig = {
position: 'left',
ticks: {
callback: Ticks.formatters.linear
}
};
var LinearScale = Chart.LinearScaleBase.extend({
determineDataLimits: function() {
var me = this;
var opts = me.options;
var chart = me.chart;
var data = chart.data;
var datasets = data.datasets;
var isHorizontal = me.isHorizontal();
var DEFAULT_MIN = 0;
var DEFAULT_MAX = 1;
function IDMatches(meta) {
return isHorizontal ? meta.xAxisID === me.id : meta.yAxisID === me.id;
}
// First Calculate the range
me.min = null;
me.max = null;
var hasStacks = opts.stacked;
if (hasStacks === undefined) {
helpers.each(datasets, function(dataset, datasetIndex) {
if (hasStacks) {
return;
}
var meta = chart.getDatasetMeta(datasetIndex);
if (chart.isDatasetVisible(datasetIndex) && IDMatches(meta) &&
meta.stack !== undefined) {
hasStacks = true;
}
});
}
if (opts.stacked || hasStacks) {
var valuesPerStack = {};
helpers.each(datasets, function(dataset, datasetIndex) {
var meta = chart.getDatasetMeta(datasetIndex);
var key = [
meta.type,
// we have a separate stack for stack=undefined datasets when the opts.stacked is undefined
((opts.stacked === undefined && meta.stack === undefined) ? datasetIndex : ''),
meta.stack
].join('.');
if (valuesPerStack[key] === undefined) {
valuesPerStack[key] = {
positiveValues: [],
negativeValues: []
};
}
// Store these per type
var positiveValues = valuesPerStack[key].positiveValues;
var negativeValues = valuesPerStack[key].negativeValues;
if (chart.isDatasetVisible(datasetIndex) && IDMatches(meta)) {
helpers.each(dataset.data, function(rawValue, index) {
var value = +me.getRightValue(rawValue);
if (isNaN(value) || meta.data[index].hidden) {
return;
}
positiveValues[index] = positiveValues[index] || 0;
negativeValues[index] = negativeValues[index] || 0;
if (opts.relativePoints) {
positiveValues[index] = 100;
} else if (value < 0) {
negativeValues[index] += value;
} else {
positiveValues[index] += value;
}
});
}
});
helpers.each(valuesPerStack, function(valuesForType) {
var values = valuesForType.positiveValues.concat(valuesForType.negativeValues);
var minVal = helpers.min(values);
var maxVal = helpers.max(values);
me.min = me.min === null ? minVal : Math.min(me.min, minVal);
me.max = me.max === null ? maxVal : Math.max(me.max, maxVal);
});
} else {
helpers.each(datasets, function(dataset, datasetIndex) {
var meta = chart.getDatasetMeta(datasetIndex);
if (chart.isDatasetVisible(datasetIndex) && IDMatches(meta)) {
helpers.each(dataset.data, function(rawValue, index) {
var value = +me.getRightValue(rawValue);
if (isNaN(value) || meta.data[index].hidden) {
return;
}
if (me.min === null) {
me.min = value;
} else if (value < me.min) {
me.min = value;
}
if (me.max === null) {
me.max = value;
} else if (value > me.max) {
me.max = value;
}
});
}
});
}
me.min = isFinite(me.min) && !isNaN(me.min) ? me.min : DEFAULT_MIN;
me.max = isFinite(me.max) && !isNaN(me.max) ? me.max : DEFAULT_MAX;
// Common base implementation to handle ticks.min, ticks.max, ticks.beginAtZero
this.handleTickRangeOptions();
},
getTickLimit: function() {
var maxTicks;
var me = this;
var tickOpts = me.options.ticks;
if (me.isHorizontal()) {
maxTicks = Math.min(tickOpts.maxTicksLimit ? tickOpts.maxTicksLimit : 11, Math.ceil(me.width / 50));
} else {
// The factor of 2 used to scale the font size has been experimentally determined.
var tickFontSize = helpers.valueOrDefault(tickOpts.fontSize, defaults.global.defaultFontSize);
maxTicks = Math.min(tickOpts.maxTicksLimit ? tickOpts.maxTicksLimit : 11, Math.ceil(me.height / (2 * tickFontSize)));
}
return maxTicks;
},
// Called after the ticks are built. We need
handleDirectionalChanges: function() {
if (!this.isHorizontal()) {
// We are in a vertical orientation. The top value is the highest. So reverse the array
this.ticks.reverse();
}
},
getLabelForIndex: function(index, datasetIndex) {
return +this.getRightValue(this.chart.data.datasets[datasetIndex].data[index]);
},
// Utils
getPixelForValue: function(value) {
// This must be called after fit has been run so that
// this.left, this.top, this.right, and this.bottom have been defined
var me = this;
var start = me.start;
var rightValue = +me.getRightValue(value);
var pixel;
var range = me.end - start;
if (me.isHorizontal()) {
pixel = me.left + (me.width / range * (rightValue - start));
} else {
pixel = me.bottom - (me.height / range * (rightValue - start));
}
return pixel;
},
getValueForPixel: function(pixel) {
var me = this;
var isHorizontal = me.isHorizontal();
var innerDimension = isHorizontal ? me.width : me.height;
var offset = (isHorizontal ? pixel - me.left : me.bottom - pixel) / innerDimension;
return me.start + ((me.end - me.start) * offset);
},
getPixelForTick: function(index) {
return this.getPixelForValue(this.ticksAsNumbers[index]);
}
});
Chart.scaleService.registerScaleType('linear', LinearScale, defaultConfig);
};
/***/ }),
/* 443 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var helpers = __webpack_require__(5);
var Ticks = __webpack_require__(51);
/**
* Generate a set of logarithmic ticks
* @param generationOptions the options used to generate the ticks
* @param dataRange the range of the data
* @returns {Array<Number>} array of tick values
*/
function generateTicks(generationOptions, dataRange) {
var ticks = [];
var valueOrDefault = helpers.valueOrDefault;
// Figure out what the max number of ticks we can support it is based on the size of
// the axis area. For now, we say that the minimum tick spacing in pixels must be 50
// We also limit the maximum number of ticks to 11 which gives a nice 10 squares on
// the graph
var tickVal = valueOrDefault(generationOptions.min, Math.pow(10, Math.floor(helpers.log10(dataRange.min))));
var endExp = Math.floor(helpers.log10(dataRange.max));
var endSignificand = Math.ceil(dataRange.max / Math.pow(10, endExp));
var exp, significand;
if (tickVal === 0) {
exp = Math.floor(helpers.log10(dataRange.minNotZero));
significand = Math.floor(dataRange.minNotZero / Math.pow(10, exp));
ticks.push(tickVal);
tickVal = significand * Math.pow(10, exp);
} else {
exp = Math.floor(helpers.log10(tickVal));
significand = Math.floor(tickVal / Math.pow(10, exp));
}
var precision = exp < 0 ? Math.pow(10, Math.abs(exp)) : 1;
do {
ticks.push(tickVal);
++significand;
if (significand === 10) {
significand = 1;
++exp;
precision = exp >= 0 ? 1 : precision;
}
tickVal = Math.round(significand * Math.pow(10, exp) * precision) / precision;
} while (exp < endExp || (exp === endExp && significand < endSignificand));
var lastTick = valueOrDefault(generationOptions.max, tickVal);
ticks.push(lastTick);
return ticks;
}
module.exports = function(Chart) {
var defaultConfig = {
position: 'left',
// label settings
ticks: {
callback: Ticks.formatters.logarithmic
}
};
var LogarithmicScale = Chart.Scale.extend({
determineDataLimits: function() {
var me = this;
var opts = me.options;
var chart = me.chart;
var data = chart.data;
var datasets = data.datasets;
var isHorizontal = me.isHorizontal();
function IDMatches(meta) {
return isHorizontal ? meta.xAxisID === me.id : meta.yAxisID === me.id;
}
// Calculate Range
me.min = null;
me.max = null;
me.minNotZero = null;
var hasStacks = opts.stacked;
if (hasStacks === undefined) {
helpers.each(datasets, function(dataset, datasetIndex) {
if (hasStacks) {
return;
}
var meta = chart.getDatasetMeta(datasetIndex);
if (chart.isDatasetVisible(datasetIndex) && IDMatches(meta) &&
meta.stack !== undefined) {
hasStacks = true;
}
});
}
if (opts.stacked || hasStacks) {
var valuesPerStack = {};
helpers.each(datasets, function(dataset, datasetIndex) {
var meta = chart.getDatasetMeta(datasetIndex);
var key = [
meta.type,
// we have a separate stack for stack=undefined datasets when the opts.stacked is undefined
((opts.stacked === undefined && meta.stack === undefined) ? datasetIndex : ''),
meta.stack
].join('.');
if (chart.isDatasetVisible(datasetIndex) && IDMatches(meta)) {
if (valuesPerStack[key] === undefined) {
valuesPerStack[key] = [];
}
helpers.each(dataset.data, function(rawValue, index) {
var values = valuesPerStack[key];
var value = +me.getRightValue(rawValue);
// invalid, hidden and negative values are ignored
if (isNaN(value) || meta.data[index].hidden || value < 0) {
return;
}
values[index] = values[index] || 0;
values[index] += value;
});
}
});
helpers.each(valuesPerStack, function(valuesForType) {
if (valuesForType.length > 0) {
var minVal = helpers.min(valuesForType);
var maxVal = helpers.max(valuesForType);
me.min = me.min === null ? minVal : Math.min(me.min, minVal);
me.max = me.max === null ? maxVal : Math.max(me.max, maxVal);
}
});
} else {
helpers.each(datasets, function(dataset, datasetIndex) {
var meta = chart.getDatasetMeta(datasetIndex);
if (chart.isDatasetVisible(datasetIndex) && IDMatches(meta)) {
helpers.each(dataset.data, function(rawValue, index) {
var value = +me.getRightValue(rawValue);
// invalid, hidden and negative values are ignored
if (isNaN(value) || meta.data[index].hidden || value < 0) {
return;
}
if (me.min === null) {
me.min = value;
} else if (value < me.min) {
me.min = value;
}
if (me.max === null) {
me.max = value;
} else if (value > me.max) {
me.max = value;
}
if (value !== 0 && (me.minNotZero === null || value < me.minNotZero)) {
me.minNotZero = value;
}
});
}
});
}
// Common base implementation to handle ticks.min, ticks.max
this.handleTickRangeOptions();
},
handleTickRangeOptions: function() {
var me = this;
var opts = me.options;
var tickOpts = opts.ticks;
var valueOrDefault = helpers.valueOrDefault;
var DEFAULT_MIN = 1;
var DEFAULT_MAX = 10;
me.min = valueOrDefault(tickOpts.min, me.min);
me.max = valueOrDefault(tickOpts.max, me.max);
if (me.min === me.max) {
if (me.min !== 0 && me.min !== null) {
me.min = Math.pow(10, Math.floor(helpers.log10(me.min)) - 1);
me.max = Math.pow(10, Math.floor(helpers.log10(me.max)) + 1);
} else {
me.min = DEFAULT_MIN;
me.max = DEFAULT_MAX;
}
}
if (me.min === null) {
me.min = Math.pow(10, Math.floor(helpers.log10(me.max)) - 1);
}
if (me.max === null) {
me.max = me.min !== 0
? Math.pow(10, Math.floor(helpers.log10(me.min)) + 1)
: DEFAULT_MAX;
}
if (me.minNotZero === null) {
if (me.min > 0) {
me.minNotZero = me.min;
} else if (me.max < 1) {
me.minNotZero = Math.pow(10, Math.floor(helpers.log10(me.max)));
} else {
me.minNotZero = DEFAULT_MIN;
}
}
},
buildTicks: function() {
var me = this;
var opts = me.options;
var tickOpts = opts.ticks;
var reverse = !me.isHorizontal();
var generationOptions = {
min: tickOpts.min,
max: tickOpts.max
};
var ticks = me.ticks = generateTicks(generationOptions, me);
// At this point, we need to update our max and min given the tick values since we have expanded the
// range of the scale
me.max = helpers.max(ticks);
me.min = helpers.min(ticks);
if (tickOpts.reverse) {
reverse = !reverse;
me.start = me.max;
me.end = me.min;
} else {
me.start = me.min;
me.end = me.max;
}
if (reverse) {
ticks.reverse();
}
},
convertTicksToLabels: function() {
this.tickValues = this.ticks.slice();
Chart.Scale.prototype.convertTicksToLabels.call(this);
},
// Get the correct tooltip label
getLabelForIndex: function(index, datasetIndex) {
return +this.getRightValue(this.chart.data.datasets[datasetIndex].data[index]);
},
getPixelForTick: function(index) {
return this.getPixelForValue(this.tickValues[index]);
},
/**
* Returns the value of the first tick.
* @param {Number} value - The minimum not zero value.
* @return {Number} The first tick value.
* @private
*/
_getFirstTickValue: function(value) {
var exp = Math.floor(helpers.log10(value));
var significand = Math.floor(value / Math.pow(10, exp));
return significand * Math.pow(10, exp);
},
getPixelForValue: function(value) {
var me = this;
var reverse = me.options.ticks.reverse;
var log10 = helpers.log10;
var firstTickValue = me._getFirstTickValue(me.minNotZero);
var offset = 0;
var innerDimension, pixel, start, end, sign;
value = +me.getRightValue(value);
if (reverse) {
start = me.end;
end = me.start;
sign = -1;
} else {
start = me.start;
end = me.end;
sign = 1;
}
if (me.isHorizontal()) {
innerDimension = me.width;
pixel = reverse ? me.right : me.left;
} else {
innerDimension = me.height;
sign *= -1; // invert, since the upper-left corner of the canvas is at pixel (0, 0)
pixel = reverse ? me.top : me.bottom;
}
if (value !== start) {
if (start === 0) { // include zero tick
offset = helpers.getValueOrDefault(
me.options.ticks.fontSize,
Chart.defaults.global.defaultFontSize
);
innerDimension -= offset;
start = firstTickValue;
}
if (value !== 0) {
offset += innerDimension / (log10(end) - log10(start)) * (log10(value) - log10(start));
}
pixel += sign * offset;
}
return pixel;
},
getValueForPixel: function(pixel) {
var me = this;
var reverse = me.options.ticks.reverse;
var log10 = helpers.log10;
var firstTickValue = me._getFirstTickValue(me.minNotZero);
var innerDimension, start, end, value;
if (reverse) {
start = me.end;
end = me.start;
} else {
start = me.start;
end = me.end;
}
if (me.isHorizontal()) {
innerDimension = me.width;
value = reverse ? me.right - pixel : pixel - me.left;
} else {
innerDimension = me.height;
value = reverse ? pixel - me.top : me.bottom - pixel;
}
if (value !== start) {
if (start === 0) { // include zero tick
var offset = helpers.getValueOrDefault(
me.options.ticks.fontSize,
Chart.defaults.global.defaultFontSize
);
value -= offset;
innerDimension -= offset;
start = firstTickValue;
}
value *= log10(end) - log10(start);
value /= innerDimension;
value = Math.pow(10, log10(start) + value);
}
return value;
}
});
Chart.scaleService.registerScaleType('logarithmic', LogarithmicScale, defaultConfig);
};
/***/ }),
/* 444 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var defaults = __webpack_require__(8);
var helpers = __webpack_require__(5);
var Ticks = __webpack_require__(51);
module.exports = function(Chart) {
var globalDefaults = defaults.global;
var defaultConfig = {
display: true,
// Boolean - Whether to animate scaling the chart from the centre
animate: true,
position: 'chartArea',
angleLines: {
display: true,
color: 'rgba(0, 0, 0, 0.1)',
lineWidth: 1
},
gridLines: {
circular: false
},
// label settings
ticks: {
// Boolean - Show a backdrop to the scale label
showLabelBackdrop: true,
// String - The colour of the label backdrop
backdropColor: 'rgba(255,255,255,0.75)',
// Number - The backdrop padding above & below the label in pixels
backdropPaddingY: 2,
// Number - The backdrop padding to the side of the label in pixels
backdropPaddingX: 2,
callback: Ticks.formatters.linear
},
pointLabels: {
// Boolean - if true, show point labels
display: true,
// Number - Point label font size in pixels
fontSize: 10,
// Function - Used to convert point labels
callback: function(label) {
return label;
}
}
};
function getValueCount(scale) {
var opts = scale.options;
return opts.angleLines.display || opts.pointLabels.display ? scale.chart.data.labels.length : 0;
}
function getPointLabelFontOptions(scale) {
var pointLabelOptions = scale.options.pointLabels;
var fontSize = helpers.valueOrDefault(pointLabelOptions.fontSize, globalDefaults.defaultFontSize);
var fontStyle = helpers.valueOrDefault(pointLabelOptions.fontStyle, globalDefaults.defaultFontStyle);
var fontFamily = helpers.valueOrDefault(pointLabelOptions.fontFamily, globalDefaults.defaultFontFamily);
var font = helpers.fontString(fontSize, fontStyle, fontFamily);
return {
size: fontSize,
style: fontStyle,
family: fontFamily,
font: font
};
}
function measureLabelSize(ctx, fontSize, label) {
if (helpers.isArray(label)) {
return {
w: helpers.longestText(ctx, ctx.font, label),
h: (label.length * fontSize) + ((label.length - 1) * 1.5 * fontSize)
};
}
return {
w: ctx.measureText(label).width,
h: fontSize
};
}
function determineLimits(angle, pos, size, min, max) {
if (angle === min || angle === max) {
return {
start: pos - (size / 2),
end: pos + (size / 2)
};
} else if (angle < min || angle > max) {
return {
start: pos - size - 5,
end: pos
};
}
return {
start: pos,
end: pos + size + 5
};
}
/**
* Helper function to fit a radial linear scale with point labels
*/
function fitWithPointLabels(scale) {
/*
* Right, this is really confusing and there is a lot of maths going on here
* The gist of the problem is here: https://gist.github.com/nnnick/696cc9c55f4b0beb8fe9
*
* Reaction: https://dl.dropboxusercontent.com/u/34601363/toomuchscience.gif
*
* Solution:
*
* We assume the radius of the polygon is half the size of the canvas at first
* at each index we check if the text overlaps.
*
* Where it does, we store that angle and that index.
*
* After finding the largest index and angle we calculate how much we need to remove
* from the shape radius to move the point inwards by that x.
*
* We average the left and right distances to get the maximum shape radius that can fit in the box
* along with labels.
*
* Once we have that, we can find the centre point for the chart, by taking the x text protrusion
* on each side, removing that from the size, halving it and adding the left x protrusion width.
*
* This will mean we have a shape fitted to the canvas, as large as it can be with the labels
* and position it in the most space efficient manner
*
* https://dl.dropboxusercontent.com/u/34601363/yeahscience.gif
*/
var plFont = getPointLabelFontOptions(scale);
// Get maximum radius of the polygon. Either half the height (minus the text width) or half the width.
// Use this to calculate the offset + change. - Make sure L/R protrusion is at least 0 to stop issues with centre points
var largestPossibleRadius = Math.min(scale.height / 2, scale.width / 2);
var furthestLimits = {
r: scale.width,
l: 0,
t: scale.height,
b: 0
};
var furthestAngles = {};
var i, textSize, pointPosition;
scale.ctx.font = plFont.font;
scale._pointLabelSizes = [];
var valueCount = getValueCount(scale);
for (i = 0; i < valueCount; i++) {
pointPosition = scale.getPointPosition(i, largestPossibleRadius);
textSize = measureLabelSize(scale.ctx, plFont.size, scale.pointLabels[i] || '');
scale._pointLabelSizes[i] = textSize;
// Add quarter circle to make degree 0 mean top of circle
var angleRadians = scale.getIndexAngle(i);
var angle = helpers.toDegrees(angleRadians) % 360;
var hLimits = determineLimits(angle, pointPosition.x, textSize.w, 0, 180);
var vLimits = determineLimits(angle, pointPosition.y, textSize.h, 90, 270);
if (hLimits.start < furthestLimits.l) {
furthestLimits.l = hLimits.start;
furthestAngles.l = angleRadians;
}
if (hLimits.end > furthestLimits.r) {
furthestLimits.r = hLimits.end;
furthestAngles.r = angleRadians;
}
if (vLimits.start < furthestLimits.t) {
furthestLimits.t = vLimits.start;
furthestAngles.t = angleRadians;
}
if (vLimits.end > furthestLimits.b) {
furthestLimits.b = vLimits.end;
furthestAngles.b = angleRadians;
}
}
scale.setReductions(largestPossibleRadius, furthestLimits, furthestAngles);
}
/**
* Helper function to fit a radial linear scale with no point labels
*/
function fit(scale) {
var largestPossibleRadius = Math.min(scale.height / 2, scale.width / 2);
scale.drawingArea = Math.round(largestPossibleRadius);
scale.setCenterPoint(0, 0, 0, 0);
}
function getTextAlignForAngle(angle) {
if (angle === 0 || angle === 180) {
return 'center';
} else if (angle < 180) {
return 'left';
}
return 'right';
}
function fillText(ctx, text, position, fontSize) {
if (helpers.isArray(text)) {
var y = position.y;
var spacing = 1.5 * fontSize;
for (var i = 0; i < text.length; ++i) {
ctx.fillText(text[i], position.x, y);
y += spacing;
}
} else {
ctx.fillText(text, position.x, position.y);
}
}
function adjustPointPositionForLabelHeight(angle, textSize, position) {
if (angle === 90 || angle === 270) {
position.y -= (textSize.h / 2);
} else if (angle > 270 || angle < 90) {
position.y -= textSize.h;
}
}
function drawPointLabels(scale) {
var ctx = scale.ctx;
var opts = scale.options;
var angleLineOpts = opts.angleLines;
var pointLabelOpts = opts.pointLabels;
ctx.lineWidth = angleLineOpts.lineWidth;
ctx.strokeStyle = angleLineOpts.color;
var outerDistance = scale.getDistanceFromCenterForValue(opts.ticks.reverse ? scale.min : scale.max);
// Point Label Font
var plFont = getPointLabelFontOptions(scale);
ctx.textBaseline = 'top';
for (var i = getValueCount(scale) - 1; i >= 0; i--) {
if (angleLineOpts.display) {
var outerPosition = scale.getPointPosition(i, outerDistance);
ctx.beginPath();
ctx.moveTo(scale.xCenter, scale.yCenter);
ctx.lineTo(outerPosition.x, outerPosition.y);
ctx.stroke();
ctx.closePath();
}
if (pointLabelOpts.display) {
// Extra 3px out for some label spacing
var pointLabelPosition = scale.getPointPosition(i, outerDistance + 5);
// Keep this in loop since we may support array properties here
var pointLabelFontColor = helpers.valueAtIndexOrDefault(pointLabelOpts.fontColor, i, globalDefaults.defaultFontColor);
ctx.font = plFont.font;
ctx.fillStyle = pointLabelFontColor;
var angleRadians = scale.getIndexAngle(i);
var angle = helpers.toDegrees(angleRadians);
ctx.textAlign = getTextAlignForAngle(angle);
adjustPointPositionForLabelHeight(angle, scale._pointLabelSizes[i], pointLabelPosition);
fillText(ctx, scale.pointLabels[i] || '', pointLabelPosition, plFont.size);
}
}
}
function drawRadiusLine(scale, gridLineOpts, radius, index) {
var ctx = scale.ctx;
ctx.strokeStyle = helpers.valueAtIndexOrDefault(gridLineOpts.color, index - 1);
ctx.lineWidth = helpers.valueAtIndexOrDefault(gridLineOpts.lineWidth, index - 1);
if (scale.options.gridLines.circular) {
// Draw circular arcs between the points
ctx.beginPath();
ctx.arc(scale.xCenter, scale.yCenter, radius, 0, Math.PI * 2);
ctx.closePath();
ctx.stroke();
} else {
// Draw straight lines connecting each index
var valueCount = getValueCount(scale);
if (valueCount === 0) {
return;
}
ctx.beginPath();
var pointPosition = scale.getPointPosition(0, radius);
ctx.moveTo(pointPosition.x, pointPosition.y);
for (var i = 1; i < valueCount; i++) {
pointPosition = scale.getPointPosition(i, radius);
ctx.lineTo(pointPosition.x, pointPosition.y);
}
ctx.closePath();
ctx.stroke();
}
}
function numberOrZero(param) {
return helpers.isNumber(param) ? param : 0;
}
var LinearRadialScale = Chart.LinearScaleBase.extend({
setDimensions: function() {
var me = this;
var opts = me.options;
var tickOpts = opts.ticks;
// Set the unconstrained dimension before label rotation
me.width = me.maxWidth;
me.height = me.maxHeight;
me.xCenter = Math.round(me.width / 2);
me.yCenter = Math.round(me.height / 2);
var minSize = helpers.min([me.height, me.width]);
var tickFontSize = helpers.valueOrDefault(tickOpts.fontSize, globalDefaults.defaultFontSize);
me.drawingArea = opts.display ? (minSize / 2) - (tickFontSize / 2 + tickOpts.backdropPaddingY) : (minSize / 2);
},
determineDataLimits: function() {
var me = this;
var chart = me.chart;
var min = Number.POSITIVE_INFINITY;
var max = Number.NEGATIVE_INFINITY;
helpers.each(chart.data.datasets, function(dataset, datasetIndex) {
if (chart.isDatasetVisible(datasetIndex)) {
var meta = chart.getDatasetMeta(datasetIndex);
helpers.each(dataset.data, function(rawValue, index) {
var value = +me.getRightValue(rawValue);
if (isNaN(value) || meta.data[index].hidden) {
return;
}
min = Math.min(value, min);
max = Math.max(value, max);
});
}
});
me.min = (min === Number.POSITIVE_INFINITY ? 0 : min);
me.max = (max === Number.NEGATIVE_INFINITY ? 0 : max);
// Common base implementation to handle ticks.min, ticks.max, ticks.beginAtZero
me.handleTickRangeOptions();
},
getTickLimit: function() {
var tickOpts = this.options.ticks;
var tickFontSize = helpers.valueOrDefault(tickOpts.fontSize, globalDefaults.defaultFontSize);
return Math.min(tickOpts.maxTicksLimit ? tickOpts.maxTicksLimit : 11, Math.ceil(this.drawingArea / (1.5 * tickFontSize)));
},
convertTicksToLabels: function() {
var me = this;
Chart.LinearScaleBase.prototype.convertTicksToLabels.call(me);
// Point labels
me.pointLabels = me.chart.data.labels.map(me.options.pointLabels.callback, me);
},
getLabelForIndex: function(index, datasetIndex) {
return +this.getRightValue(this.chart.data.datasets[datasetIndex].data[index]);
},
fit: function() {
if (this.options.pointLabels.display) {
fitWithPointLabels(this);
} else {
fit(this);
}
},
/**
* Set radius reductions and determine new radius and center point
* @private
*/
setReductions: function(largestPossibleRadius, furthestLimits, furthestAngles) {
var me = this;
var radiusReductionLeft = furthestLimits.l / Math.sin(furthestAngles.l);
var radiusReductionRight = Math.max(furthestLimits.r - me.width, 0) / Math.sin(furthestAngles.r);
var radiusReductionTop = -furthestLimits.t / Math.cos(furthestAngles.t);
var radiusReductionBottom = -Math.max(furthestLimits.b - me.height, 0) / Math.cos(furthestAngles.b);
radiusReductionLeft = numberOrZero(radiusReductionLeft);
radiusReductionRight = numberOrZero(radiusReductionRight);
radiusReductionTop = numberOrZero(radiusReductionTop);
radiusReductionBottom = numberOrZero(radiusReductionBottom);
me.drawingArea = Math.min(
Math.round(largestPossibleRadius - (radiusReductionLeft + radiusReductionRight) / 2),
Math.round(largestPossibleRadius - (radiusReductionTop + radiusReductionBottom) / 2));
me.setCenterPoint(radiusReductionLeft, radiusReductionRight, radiusReductionTop, radiusReductionBottom);
},
setCenterPoint: function(leftMovement, rightMovement, topMovement, bottomMovement) {
var me = this;
var maxRight = me.width - rightMovement - me.drawingArea;
var maxLeft = leftMovement + me.drawingArea;
var maxTop = topMovement + me.drawingArea;
var maxBottom = me.height - bottomMovement - me.drawingArea;
me.xCenter = Math.round(((maxLeft + maxRight) / 2) + me.left);
me.yCenter = Math.round(((maxTop + maxBottom) / 2) + me.top);
},
getIndexAngle: function(index) {
var angleMultiplier = (Math.PI * 2) / getValueCount(this);
var startAngle = this.chart.options && this.chart.options.startAngle ?
this.chart.options.startAngle :
0;
var startAngleRadians = startAngle * Math.PI * 2 / 360;
// Start from the top instead of right, so remove a quarter of the circle
return index * angleMultiplier + startAngleRadians;
},
getDistanceFromCenterForValue: function(value) {
var me = this;
if (value === null) {
return 0; // null always in center
}
// Take into account half font size + the yPadding of the top value
var scalingFactor = me.drawingArea / (me.max - me.min);
if (me.options.ticks.reverse) {
return (me.max - value) * scalingFactor;
}
return (value - me.min) * scalingFactor;
},
getPointPosition: function(index, distanceFromCenter) {
var me = this;
var thisAngle = me.getIndexAngle(index) - (Math.PI / 2);
return {
x: Math.round(Math.cos(thisAngle) * distanceFromCenter) + me.xCenter,
y: Math.round(Math.sin(thisAngle) * distanceFromCenter) + me.yCenter
};
},
getPointPositionForValue: function(index, value) {
return this.getPointPosition(index, this.getDistanceFromCenterForValue(value));
},
getBasePosition: function() {
var me = this;
var min = me.min;
var max = me.max;
return me.getPointPositionForValue(0,
me.beginAtZero ? 0 :
min < 0 && max < 0 ? max :
min > 0 && max > 0 ? min :
0);
},
draw: function() {
var me = this;
var opts = me.options;
var gridLineOpts = opts.gridLines;
var tickOpts = opts.ticks;
var valueOrDefault = helpers.valueOrDefault;
if (opts.display) {
var ctx = me.ctx;
var startAngle = this.getIndexAngle(0);
// Tick Font
var tickFontSize = valueOrDefault(tickOpts.fontSize, globalDefaults.defaultFontSize);
var tickFontStyle = valueOrDefault(tickOpts.fontStyle, globalDefaults.defaultFontStyle);
var tickFontFamily = valueOrDefault(tickOpts.fontFamily, globalDefaults.defaultFontFamily);
var tickLabelFont = helpers.fontString(tickFontSize, tickFontStyle, tickFontFamily);
helpers.each(me.ticks, function(label, index) {
// Don't draw a centre value (if it is minimum)
if (index > 0 || tickOpts.reverse) {
var yCenterOffset = me.getDistanceFromCenterForValue(me.ticksAsNumbers[index]);
// Draw circular lines around the scale
if (gridLineOpts.display && index !== 0) {
drawRadiusLine(me, gridLineOpts, yCenterOffset, index);
}
if (tickOpts.display) {
var tickFontColor = valueOrDefault(tickOpts.fontColor, globalDefaults.defaultFontColor);
ctx.font = tickLabelFont;
ctx.save();
ctx.translate(me.xCenter, me.yCenter);
ctx.rotate(startAngle);
if (tickOpts.showLabelBackdrop) {
var labelWidth = ctx.measureText(label).width;
ctx.fillStyle = tickOpts.backdropColor;
ctx.fillRect(
-labelWidth / 2 - tickOpts.backdropPaddingX,
-yCenterOffset - tickFontSize / 2 - tickOpts.backdropPaddingY,
labelWidth + tickOpts.backdropPaddingX * 2,
tickFontSize + tickOpts.backdropPaddingY * 2
);
}
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.fillStyle = tickFontColor;
ctx.fillText(label, 0, -yCenterOffset);
ctx.restore();
}
}
});
if (opts.angleLines.display || opts.pointLabels.display) {
drawPointLabels(me);
}
}
}
});
Chart.scaleService.registerScaleType('radialLinear', LinearRadialScale, defaultConfig);
};
/***/ }),
/* 445 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* global window: false */
var moment = __webpack_require__(1);
moment = typeof moment === 'function' ? moment : window.moment;
var defaults = __webpack_require__(8);
var helpers = __webpack_require__(5);
// Integer constants are from the ES6 spec.
var MIN_INTEGER = Number.MIN_SAFE_INTEGER || -9007199254740991;
var MAX_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
var INTERVALS = {
millisecond: {
common: true,
size: 1,
steps: [1, 2, 5, 10, 20, 50, 100, 250, 500]
},
second: {
common: true,
size: 1000,
steps: [1, 2, 5, 10, 30]
},
minute: {
common: true,
size: 60000,
steps: [1, 2, 5, 10, 30]
},
hour: {
common: true,
size: 3600000,
steps: [1, 2, 3, 6, 12]
},
day: {
common: true,
size: 86400000,
steps: [1, 2, 5]
},
week: {
common: false,
size: 604800000,
steps: [1, 2, 3, 4]
},
month: {
common: true,
size: 2.628e9,
steps: [1, 2, 3]
},
quarter: {
common: false,
size: 7.884e9,
steps: [1, 2, 3, 4]
},
year: {
common: true,
size: 3.154e10
}
};
var UNITS = Object.keys(INTERVALS);
function sorter(a, b) {
return a - b;
}
function arrayUnique(items) {
var hash = {};
var out = [];
var i, ilen, item;
for (i = 0, ilen = items.length; i < ilen; ++i) {
item = items[i];
if (!hash[item]) {
hash[item] = true;
out.push(item);
}
}
return out;
}
/**
* Returns an array of {time, pos} objects used to interpolate a specific `time` or position
* (`pos`) on the scale, by searching entries before and after the requested value. `pos` is
* a decimal between 0 and 1: 0 being the start of the scale (left or top) and 1 the other
* extremity (left + width or top + height). Note that it would be more optimized to directly
* store pre-computed pixels, but the scale dimensions are not guaranteed at the time we need
* to create the lookup table. The table ALWAYS contains at least two items: min and max.
*
* @param {Number[]} timestamps - timestamps sorted from lowest to highest.
* @param {String} distribution - If 'linear', timestamps will be spread linearly along the min
* and max range, so basically, the table will contains only two items: {min, 0} and {max, 1}.
* If 'series', timestamps will be positioned at the same distance from each other. In this
* case, only timestamps that break the time linearity are registered, meaning that in the
* best case, all timestamps are linear, the table contains only min and max.
*/
function buildLookupTable(timestamps, min, max, distribution) {
if (distribution === 'linear' || !timestamps.length) {
return [
{time: min, pos: 0},
{time: max, pos: 1}
];
}
var table = [];
var items = [min];
var i, ilen, prev, curr, next;
for (i = 0, ilen = timestamps.length; i < ilen; ++i) {
curr = timestamps[i];
if (curr > min && curr < max) {
items.push(curr);
}
}
items.push(max);
for (i = 0, ilen = items.length; i < ilen; ++i) {
next = items[i + 1];
prev = items[i - 1];
curr = items[i];
// only add points that breaks the scale linearity
if (prev === undefined || next === undefined || Math.round((next + prev) / 2) !== curr) {
table.push({time: curr, pos: i / (ilen - 1)});
}
}
return table;
}
// @see adapted from http://www.anujgakhar.com/2014/03/01/binary-search-in-javascript/
function lookup(table, key, value) {
var lo = 0;
var hi = table.length - 1;
var mid, i0, i1;
while (lo >= 0 && lo <= hi) {
mid = (lo + hi) >> 1;
i0 = table[mid - 1] || null;
i1 = table[mid];
if (!i0) {
// given value is outside table (before first item)
return {lo: null, hi: i1};
} else if (i1[key] < value) {
lo = mid + 1;
} else if (i0[key] > value) {
hi = mid - 1;
} else {
return {lo: i0, hi: i1};
}
}
// given value is outside table (after last item)
return {lo: i1, hi: null};
}
/**
* Linearly interpolates the given source `value` using the table items `skey` values and
* returns the associated `tkey` value. For example, interpolate(table, 'time', 42, 'pos')
* returns the position for a timestamp equal to 42. If value is out of bounds, values at
* index [0, 1] or [n - 1, n] are used for the interpolation.
*/
function interpolate(table, skey, sval, tkey) {
var range = lookup(table, skey, sval);
// Note: the lookup table ALWAYS contains at least 2 items (min and max)
var prev = !range.lo ? table[0] : !range.hi ? table[table.length - 2] : range.lo;
var next = !range.lo ? table[1] : !range.hi ? table[table.length - 1] : range.hi;
var span = next[skey] - prev[skey];
var ratio = span ? (sval - prev[skey]) / span : 0;
var offset = (next[tkey] - prev[tkey]) * ratio;
return prev[tkey] + offset;
}
/**
* Convert the given value to a moment object using the given time options.
* @see http://momentjs.com/docs/#/parsing/
*/
function momentify(value, options) {
var parser = options.parser;
var format = options.parser || options.format;
if (typeof parser === 'function') {
return parser(value);
}
if (typeof value === 'string' && typeof format === 'string') {
return moment(value, format);
}
if (!(value instanceof moment)) {
value = moment(value);
}
if (value.isValid()) {
return value;
}
// Labels are in an incompatible moment format and no `parser` has been provided.
// The user might still use the deprecated `format` option to convert his inputs.
if (typeof format === 'function') {
return format(value);
}
return value;
}
function parse(input, scale) {
if (helpers.isNullOrUndef(input)) {
return null;
}
var options = scale.options.time;
var value = momentify(scale.getRightValue(input), options);
if (!value.isValid()) {
return null;
}
if (options.round) {
value.startOf(options.round);
}
return value.valueOf();
}
/**
* Returns the number of unit to skip to be able to display up to `capacity` number of ticks
* in `unit` for the given `min` / `max` range and respecting the interval steps constraints.
*/
function determineStepSize(min, max, unit, capacity) {
var range = max - min;
var interval = INTERVALS[unit];
var milliseconds = interval.size;
var steps = interval.steps;
var i, ilen, factor;
if (!steps) {
return Math.ceil(range / (capacity * milliseconds));
}
for (i = 0, ilen = steps.length; i < ilen; ++i) {
factor = steps[i];
if (Math.ceil(range / (milliseconds * factor)) <= capacity) {
break;
}
}
return factor;
}
/**
* Figures out what unit results in an appropriate number of auto-generated ticks
*/
function determineUnitForAutoTicks(minUnit, min, max, capacity) {
var ilen = UNITS.length;
var i, interval, factor;
for (i = UNITS.indexOf(minUnit); i < ilen - 1; ++i) {
interval = INTERVALS[UNITS[i]];
factor = interval.steps ? interval.steps[interval.steps.length - 1] : MAX_INTEGER;
if (interval.common && Math.ceil((max - min) / (factor * interval.size)) <= capacity) {
return UNITS[i];
}
}
return UNITS[ilen - 1];
}
/**
* Figures out what unit to format a set of ticks with
*/
function determineUnitForFormatting(ticks, minUnit, min, max) {
var duration = moment.duration(moment(max).diff(moment(min)));
var ilen = UNITS.length;
var i, unit;
for (i = ilen - 1; i >= UNITS.indexOf(minUnit); i--) {
unit = UNITS[i];
if (INTERVALS[unit].common && duration.as(unit) >= ticks.length) {
return unit;
}
}
return UNITS[minUnit ? UNITS.indexOf(minUnit) : 0];
}
function determineMajorUnit(unit) {
for (var i = UNITS.indexOf(unit) + 1, ilen = UNITS.length; i < ilen; ++i) {
if (INTERVALS[UNITS[i]].common) {
return UNITS[i];
}
}
}
/**
* Generates a maximum of `capacity` timestamps between min and max, rounded to the
* `minor` unit, aligned on the `major` unit and using the given scale time `options`.
* Important: this method can return ticks outside the min and max range, it's the
* responsibility of the calling code to clamp values if needed.
*/
function generate(min, max, capacity, options) {
var timeOpts = options.time;
var minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, capacity);
var major = determineMajorUnit(minor);
var stepSize = helpers.valueOrDefault(timeOpts.stepSize, timeOpts.unitStepSize);
var weekday = minor === 'week' ? timeOpts.isoWeekday : false;
var majorTicksEnabled = options.ticks.major.enabled;
var interval = INTERVALS[minor];
var first = moment(min);
var last = moment(max);
var ticks = [];
var time;
if (!stepSize) {
stepSize = determineStepSize(min, max, minor, capacity);
}
// For 'week' unit, handle the first day of week option
if (weekday) {
first = first.isoWeekday(weekday);
last = last.isoWeekday(weekday);
}
// Align first/last ticks on unit
first = first.startOf(weekday ? 'day' : minor);
last = last.startOf(weekday ? 'day' : minor);
// Make sure that the last tick include max
if (last < max) {
last.add(1, minor);
}
time = moment(first);
if (majorTicksEnabled && major && !weekday && !timeOpts.round) {
// Align the first tick on the previous `minor` unit aligned on the `major` unit:
// we first aligned time on the previous `major` unit then add the number of full
// stepSize there is between first and the previous major time.
time.startOf(major);
time.add(~~((first - time) / (interval.size * stepSize)) * stepSize, minor);
}
for (; time < last; time.add(stepSize, minor)) {
ticks.push(+time);
}
ticks.push(+time);
return ticks;
}
/**
* Returns the right and left offsets from edges in the form of {left, right}.
* Offsets are added when the `offset` option is true.
*/
function computeOffsets(table, ticks, min, max, options) {
var left = 0;
var right = 0;
var upper, lower;
if (options.offset && ticks.length) {
if (!options.time.min) {
upper = ticks.length > 1 ? ticks[1] : max;
lower = ticks[0];
left = (
interpolate(table, 'time', upper, 'pos') -
interpolate(table, 'time', lower, 'pos')
) / 2;
}
if (!options.time.max) {
upper = ticks[ticks.length - 1];
lower = ticks.length > 1 ? ticks[ticks.length - 2] : min;
right = (
interpolate(table, 'time', upper, 'pos') -
interpolate(table, 'time', lower, 'pos')
) / 2;
}
}
return {left: left, right: right};
}
function ticksFromTimestamps(values, majorUnit) {
var ticks = [];
var i, ilen, value, major;
for (i = 0, ilen = values.length; i < ilen; ++i) {
value = values[i];
major = majorUnit ? value === +moment(value).startOf(majorUnit) : false;
ticks.push({
value: value,
major: major
});
}
return ticks;
}
function determineLabelFormat(data, timeOpts) {
var i, momentDate, hasTime;
var ilen = data.length;
// find the label with the most parts (milliseconds, minutes, etc.)
// format all labels with the same level of detail as the most specific label
for (i = 0; i < ilen; i++) {
momentDate = momentify(data[i], timeOpts);
if (momentDate.millisecond() !== 0) {
return 'MMM D, YYYY h:mm:ss.SSS a';
}
if (momentDate.second() !== 0 || momentDate.minute() !== 0 || momentDate.hour() !== 0) {
hasTime = true;
}
}
if (hasTime) {
return 'MMM D, YYYY h:mm:ss a';
}
return 'MMM D, YYYY';
}
module.exports = function(Chart) {
var defaultConfig = {
position: 'bottom',
/**
* Data distribution along the scale:
* - 'linear': data are spread according to their time (distances can vary),
* - 'series': data are spread at the same distance from each other.
* @see https://github.com/chartjs/Chart.js/pull/4507
* @since 2.7.0
*/
distribution: 'linear',
/**
* Scale boundary strategy (bypassed by min/max time options)
* - `data`: make sure data are fully visible, ticks outside are removed
* - `ticks`: make sure ticks are fully visible, data outside are truncated
* @see https://github.com/chartjs/Chart.js/pull/4556
* @since 2.7.0
*/
bounds: 'data',
time: {
parser: false, // false == a pattern string from http://momentjs.com/docs/#/parsing/string-format/ or a custom callback that converts its argument to a moment
format: false, // DEPRECATED false == date objects, moment object, callback or a pattern string from http://momentjs.com/docs/#/parsing/string-format/
unit: false, // false == automatic or override with week, month, year, etc.
round: false, // none, or override with week, month, year, etc.
displayFormat: false, // DEPRECATED
isoWeekday: false, // override week start day - see http://momentjs.com/docs/#/get-set/iso-weekday/
minUnit: 'millisecond',
// defaults to unit's corresponding unitFormat below or override using pattern string from http://momentjs.com/docs/#/displaying/format/
displayFormats: {
millisecond: 'h:mm:ss.SSS a', // 11:20:01.123 AM,
second: 'h:mm:ss a', // 11:20:01 AM
minute: 'h:mm a', // 11:20 AM
hour: 'hA', // 5PM
day: 'MMM D', // Sep 4
week: 'll', // Week 46, or maybe "[W]WW - YYYY" ?
month: 'MMM YYYY', // Sept 2015
quarter: '[Q]Q - YYYY', // Q3
year: 'YYYY' // 2015
},
},
ticks: {
autoSkip: false,
/**
* Ticks generation input values:
* - 'auto': generates "optimal" ticks based on scale size and time options.
* - 'data': generates ticks from data (including labels from data {t|x|y} objects).
* - 'labels': generates ticks from user given `data.labels` values ONLY.
* @see https://github.com/chartjs/Chart.js/pull/4507
* @since 2.7.0
*/
source: 'auto',
major: {
enabled: false
}
}
};
var TimeScale = Chart.Scale.extend({
initialize: function() {
if (!moment) {
throw new Error('Chart.js - Moment.js could not be found! You must include it before Chart.js to use the time scale. Download at https://momentjs.com');
}
this.mergeTicksOptions();
Chart.Scale.prototype.initialize.call(this);
},
update: function() {
var me = this;
var options = me.options;
// DEPRECATIONS: output a message only one time per update
if (options.time && options.time.format) {
console.warn('options.time.format is deprecated and replaced by options.time.parser.');
}
return Chart.Scale.prototype.update.apply(me, arguments);
},
/**
* Allows data to be referenced via 't' attribute
*/
getRightValue: function(rawValue) {
if (rawValue && rawValue.t !== undefined) {
rawValue = rawValue.t;
}
return Chart.Scale.prototype.getRightValue.call(this, rawValue);
},
determineDataLimits: function() {
var me = this;
var chart = me.chart;
var timeOpts = me.options.time;
var unit = timeOpts.unit || 'day';
var min = MAX_INTEGER;
var max = MIN_INTEGER;
var timestamps = [];
var datasets = [];
var labels = [];
var i, j, ilen, jlen, data, timestamp;
// Convert labels to timestamps
for (i = 0, ilen = chart.data.labels.length; i < ilen; ++i) {
labels.push(parse(chart.data.labels[i], me));
}
// Convert data to timestamps
for (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++i) {
if (chart.isDatasetVisible(i)) {
data = chart.data.datasets[i].data;
// Let's consider that all data have the same format.
if (helpers.isObject(data[0])) {
datasets[i] = [];
for (j = 0, jlen = data.length; j < jlen; ++j) {
timestamp = parse(data[j], me);
timestamps.push(timestamp);
datasets[i][j] = timestamp;
}
} else {
timestamps.push.apply(timestamps, labels);
datasets[i] = labels.slice(0);
}
} else {
datasets[i] = [];
}
}
if (labels.length) {
// Sort labels **after** data have been converted
labels = arrayUnique(labels).sort(sorter);
min = Math.min(min, labels[0]);
max = Math.max(max, labels[labels.length - 1]);
}
if (timestamps.length) {
timestamps = arrayUnique(timestamps).sort(sorter);
min = Math.min(min, timestamps[0]);
max = Math.max(max, timestamps[timestamps.length - 1]);
}
min = parse(timeOpts.min, me) || min;
max = parse(timeOpts.max, me) || max;
// In case there is no valid min/max, set limits based on unit time option
min = min === MAX_INTEGER ? +moment().startOf(unit) : min;
max = max === MIN_INTEGER ? +moment().endOf(unit) + 1 : max;
// Make sure that max is strictly higher than min (required by the lookup table)
me.min = Math.min(min, max);
me.max = Math.max(min + 1, max);
// PRIVATE
me._horizontal = me.isHorizontal();
me._table = [];
me._timestamps = {
data: timestamps,
datasets: datasets,
labels: labels
};
},
buildTicks: function() {
var me = this;
var min = me.min;
var max = me.max;
var options = me.options;
var timeOpts = options.time;
var timestamps = [];
var ticks = [];
var i, ilen, timestamp;
switch (options.ticks.source) {
case 'data':
timestamps = me._timestamps.data;
break;
case 'labels':
timestamps = me._timestamps.labels;
break;
case 'auto':
default:
timestamps = generate(min, max, me.getLabelCapacity(min), options);
}
if (options.bounds === 'ticks' && timestamps.length) {
min = timestamps[0];
max = timestamps[timestamps.length - 1];
}
// Enforce limits with user min/max options
min = parse(timeOpts.min, me) || min;
max = parse(timeOpts.max, me) || max;
// Remove ticks outside the min/max range
for (i = 0, ilen = timestamps.length; i < ilen; ++i) {
timestamp = timestamps[i];
if (timestamp >= min && timestamp <= max) {
ticks.push(timestamp);
}
}
me.min = min;
me.max = max;
// PRIVATE
me._unit = timeOpts.unit || determineUnitForFormatting(ticks, timeOpts.minUnit, me.min, me.max);
me._majorUnit = determineMajorUnit(me._unit);
me._table = buildLookupTable(me._timestamps.data, min, max, options.distribution);
me._offsets = computeOffsets(me._table, ticks, min, max, options);
me._labelFormat = determineLabelFormat(me._timestamps.data, timeOpts);
return ticksFromTimestamps(ticks, me._majorUnit);
},
getLabelForIndex: function(index, datasetIndex) {
var me = this;
var data = me.chart.data;
var timeOpts = me.options.time;
var label = data.labels && index < data.labels.length ? data.labels[index] : '';
var value = data.datasets[datasetIndex].data[index];
if (helpers.isObject(value)) {
label = me.getRightValue(value);
}
if (timeOpts.tooltipFormat) {
return momentify(label, timeOpts).format(timeOpts.tooltipFormat);
}
if (typeof label === 'string') {
return label;
}
return momentify(label, timeOpts).format(me._labelFormat);
},
/**
* Function to format an individual tick mark
* @private
*/
tickFormatFunction: function(tick, index, ticks, formatOverride) {
var me = this;
var options = me.options;
var time = tick.valueOf();
var formats = options.time.displayFormats;
var minorFormat = formats[me._unit];
var majorUnit = me._majorUnit;
var majorFormat = formats[majorUnit];
var majorTime = tick.clone().startOf(majorUnit).valueOf();
var majorTickOpts = options.ticks.major;
var major = majorTickOpts.enabled && majorUnit && majorFormat && time === majorTime;
var label = tick.format(formatOverride ? formatOverride : major ? majorFormat : minorFormat);
var tickOpts = major ? majorTickOpts : options.ticks.minor;
var formatter = helpers.valueOrDefault(tickOpts.callback, tickOpts.userCallback);
return formatter ? formatter(label, index, ticks) : label;
},
convertTicksToLabels: function(ticks) {
var labels = [];
var i, ilen;
for (i = 0, ilen = ticks.length; i < ilen; ++i) {
labels.push(this.tickFormatFunction(moment(ticks[i].value), i, ticks));
}
return labels;
},
/**
* @private
*/
getPixelForOffset: function(time) {
var me = this;
var size = me._horizontal ? me.width : me.height;
var start = me._horizontal ? me.left : me.top;
var pos = interpolate(me._table, 'time', time, 'pos');
return start + size * (me._offsets.left + pos) / (me._offsets.left + 1 + me._offsets.right);
},
getPixelForValue: function(value, index, datasetIndex) {
var me = this;
var time = null;
if (index !== undefined && datasetIndex !== undefined) {
time = me._timestamps.datasets[datasetIndex][index];
}
if (time === null) {
time = parse(value, me);
}
if (time !== null) {
return me.getPixelForOffset(time);
}
},
getPixelForTick: function(index) {
var ticks = this.getTicks();
return index >= 0 && index < ticks.length ?
this.getPixelForOffset(ticks[index].value) :
null;
},
getValueForPixel: function(pixel) {
var me = this;
var size = me._horizontal ? me.width : me.height;
var start = me._horizontal ? me.left : me.top;
var pos = (size ? (pixel - start) / size : 0) * (me._offsets.left + 1 + me._offsets.left) - me._offsets.right;
var time = interpolate(me._table, 'pos', pos, 'time');
return moment(time);
},
/**
* Crude approximation of what the label width might be
* @private
*/
getLabelWidth: function(label) {
var me = this;
var ticksOpts = me.options.ticks;
var tickLabelWidth = me.ctx.measureText(label).width;
var angle = helpers.toRadians(ticksOpts.maxRotation);
var cosRotation = Math.cos(angle);
var sinRotation = Math.sin(angle);
var tickFontSize = helpers.valueOrDefault(ticksOpts.fontSize, defaults.global.defaultFontSize);
return (tickLabelWidth * cosRotation) + (tickFontSize * sinRotation);
},
/**
* @private
*/
getLabelCapacity: function(exampleTime) {
var me = this;
var formatOverride = me.options.time.displayFormats.millisecond; // Pick the longest format for guestimation
var exampleLabel = me.tickFormatFunction(moment(exampleTime), 0, [], formatOverride);
var tickLabelWidth = me.getLabelWidth(exampleLabel);
var innerWidth = me.isHorizontal() ? me.width : me.height;
var capacity = Math.floor(innerWidth / tickLabelWidth);
return capacity > 0 ? capacity : 1;
}
});
Chart.scaleService.registerScaleType('time', TimeScale, defaultConfig);
};
/***/ }),
/* 446 */
/***/ (function(module, exports) {
module.exports = function(module) {
if(!module.webpackPolyfill) {
module.deprecate = function() {};
module.paths = [];
// module.parent = undefined by default
if(!module.children) module.children = [];
Object.defineProperty(module, "loaded", {
enumerable: true,
get: function() {
return module.l;
}
});
Object.defineProperty(module, "id", {
enumerable: true,
get: function() {
return module.i;
}
});
module.webpackPolyfill = 1;
}
return module;
};
/***/ }),
/* 447 */,
/* 448 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var defaults = __webpack_require__(8);
var elements = __webpack_require__(30);
var helpers = __webpack_require__(5);
defaults._set('bar', {
hover: {
mode: 'label'
},
scales: {
xAxes: [{
type: 'category',
// Specific to Bar Controller
categoryPercentage: 0.8,
barPercentage: 0.9,
// offset settings
offset: true,
// grid line settings
gridLines: {
offsetGridLines: true
}
}],
yAxes: [{
type: 'linear'
}]
}
});
defaults._set('horizontalBar', {
hover: {
mode: 'index',
axis: 'y'
},
scales: {
xAxes: [{
type: 'linear',
position: 'bottom'
}],
yAxes: [{
position: 'left',
type: 'category',
// Specific to Horizontal Bar Controller
categoryPercentage: 0.8,
barPercentage: 0.9,
// offset settings
offset: true,
// grid line settings
gridLines: {
offsetGridLines: true
}
}]
},
elements: {
rectangle: {
borderSkipped: 'left'
}
},
tooltips: {
callbacks: {
title: function(item, data) {
// Pick first xLabel for now
var title = '';
if (item.length > 0) {
if (item[0].yLabel) {
title = item[0].yLabel;
} else if (data.labels.length > 0 && item[0].index < data.labels.length) {
title = data.labels[item[0].index];
}
}
return title;
},
label: function(item, data) {
var datasetLabel = data.datasets[item.datasetIndex].label || '';
return datasetLabel + ': ' + item.xLabel;
}
},
mode: 'index',
axis: 'y'
}
});
/**
* Computes the "optimal" sample size to maintain bars equally sized while preventing overlap.
* @private
*/
function computeMinSampleSize(scale, pixels) {
var min = scale.isHorizontal() ? scale.width : scale.height;
var ticks = scale.getTicks();
var prev, curr, i, ilen;
for (i = 1, ilen = pixels.length; i < ilen; ++i) {
min = Math.min(min, pixels[i] - pixels[i - 1]);
}
for (i = 0, ilen = ticks.length; i < ilen; ++i) {
curr = scale.getPixelForTick(i);
min = i > 0 ? Math.min(min, curr - prev) : min;
prev = curr;
}
return min;
}
/**
* Computes an "ideal" category based on the absolute bar thickness or, if undefined or null,
* uses the smallest interval (see computeMinSampleSize) that prevents bar overlapping. This
* mode currently always generates bars equally sized (until we introduce scriptable options?).
* @private
*/
function computeFitCategoryTraits(index, ruler, options) {
var thickness = options.barThickness;
var count = ruler.stackCount;
var curr = ruler.pixels[index];
var size, ratio;
if (helpers.isNullOrUndef(thickness)) {
size = ruler.min * options.categoryPercentage;
ratio = options.barPercentage;
} else {
// When bar thickness is enforced, category and bar percentages are ignored.
// Note(SB): we could add support for relative bar thickness (e.g. barThickness: '50%')
// and deprecate barPercentage since this value is ignored when thickness is absolute.
size = thickness * count;
ratio = 1;
}
return {
chunk: size / count,
ratio: ratio,
start: curr - (size / 2)
};
}
/**
* Computes an "optimal" category that globally arranges bars side by side (no gap when
* percentage options are 1), based on the previous and following categories. This mode
* generates bars with different widths when data are not evenly spaced.
* @private
*/
function computeFlexCategoryTraits(index, ruler, options) {
var pixels = ruler.pixels;
var curr = pixels[index];
var prev = index > 0 ? pixels[index - 1] : null;
var next = index < pixels.length - 1 ? pixels[index + 1] : null;
var percent = options.categoryPercentage;
var start, size;
if (prev === null) {
// first data: its size is double based on the next point or,
// if it's also the last data, we use the scale end extremity.
prev = curr - (next === null ? ruler.end - curr : next - curr);
}
if (next === null) {
// last data: its size is also double based on the previous point.
next = curr + curr - prev;
}
start = curr - ((curr - prev) / 2) * percent;
size = ((next - prev) / 2) * percent;
return {
chunk: size / ruler.stackCount,
ratio: options.barPercentage,
start: start
};
}
module.exports = function(Chart) {
Chart.controllers.bar = Chart.DatasetController.extend({
dataElementType: elements.Rectangle,
initialize: function() {
var me = this;
var meta;
Chart.DatasetController.prototype.initialize.apply(me, arguments);
meta = me.getMeta();
meta.stack = me.getDataset().stack;
meta.bar = true;
},
update: function(reset) {
var me = this;
var rects = me.getMeta().data;
var i, ilen;
me._ruler = me.getRuler();
for (i = 0, ilen = rects.length; i < ilen; ++i) {
me.updateElement(rects[i], i, reset);
}
},
updateElement: function(rectangle, index, reset) {
var me = this;
var chart = me.chart;
var meta = me.getMeta();
var dataset = me.getDataset();
var custom = rectangle.custom || {};
var rectangleOptions = chart.options.elements.rectangle;
rectangle._xScale = me.getScaleForId(meta.xAxisID);
rectangle._yScale = me.getScaleForId(meta.yAxisID);
rectangle._datasetIndex = me.index;
rectangle._index = index;
rectangle._model = {
datasetLabel: dataset.label,
label: chart.data.labels[index],
borderSkipped: custom.borderSkipped ? custom.borderSkipped : rectangleOptions.borderSkipped,
backgroundColor: custom.backgroundColor ? custom.backgroundColor : helpers.valueAtIndexOrDefault(dataset.backgroundColor, index, rectangleOptions.backgroundColor),
borderColor: custom.borderColor ? custom.borderColor : helpers.valueAtIndexOrDefault(dataset.borderColor, index, rectangleOptions.borderColor),
borderWidth: custom.borderWidth ? custom.borderWidth : helpers.valueAtIndexOrDefault(dataset.borderWidth, index, rectangleOptions.borderWidth)
};
me.updateElementGeometry(rectangle, index, reset);
rectangle.pivot();
},
/**
* @private
*/
updateElementGeometry: function(rectangle, index, reset) {
var me = this;
var model = rectangle._model;
var vscale = me.getValueScale();
var base = vscale.getBasePixel();
var horizontal = vscale.isHorizontal();
var ruler = me._ruler || me.getRuler();
var vpixels = me.calculateBarValuePixels(me.index, index);
var ipixels = me.calculateBarIndexPixels(me.index, index, ruler);
model.horizontal = horizontal;
model.base = reset ? base : vpixels.base;
model.x = horizontal ? reset ? base : vpixels.head : ipixels.center;
model.y = horizontal ? ipixels.center : reset ? base : vpixels.head;
model.height = horizontal ? ipixels.size : undefined;
model.width = horizontal ? undefined : ipixels.size;
},
/**
* @private
*/
getValueScaleId: function() {
return this.getMeta().yAxisID;
},
/**
* @private
*/
getIndexScaleId: function() {
return this.getMeta().xAxisID;
},
/**
* @private
*/
getValueScale: function() {
return this.getScaleForId(this.getValueScaleId());
},
/**
* @private
*/
getIndexScale: function() {
return this.getScaleForId(this.getIndexScaleId());
},
/**
* Returns the stacks based on groups and bar visibility.
* @param {Number} [last] - The dataset index
* @returns {Array} The stack list
* @private
*/
_getStacks: function(last) {
var me = this;
var chart = me.chart;
var scale = me.getIndexScale();
var stacked = scale.options.stacked;
var ilen = last === undefined ? chart.data.datasets.length : last + 1;
var stacks = [];
var i, meta;
for (i = 0; i < ilen; ++i) {
meta = chart.getDatasetMeta(i);
if (meta.bar && chart.isDatasetVisible(i) &&
(stacked === false ||
(stacked === true && stacks.indexOf(meta.stack) === -1) ||
(stacked === undefined && (meta.stack === undefined || stacks.indexOf(meta.stack) === -1)))) {
stacks.push(meta.stack);
}
}
return stacks;
},
/**
* Returns the effective number of stacks based on groups and bar visibility.
* @private
*/
getStackCount: function() {
return this._getStacks().length;
},
/**
* Returns the stack index for the given dataset based on groups and bar visibility.
* @param {Number} [datasetIndex] - The dataset index
* @param {String} [name] - The stack name to find
* @returns {Number} The stack index
* @private
*/
getStackIndex: function(datasetIndex, name) {
var stacks = this._getStacks(datasetIndex);
var index = (name !== undefined)
? stacks.indexOf(name)
: -1; // indexOf returns -1 if element is not present
return (index === -1)
? stacks.length - 1
: index;
},
/**
* @private
*/
getRuler: function() {
var me = this;
var scale = me.getIndexScale();
var stackCount = me.getStackCount();
var datasetIndex = me.index;
var isHorizontal = scale.isHorizontal();
var start = isHorizontal ? scale.left : scale.top;
var end = start + (isHorizontal ? scale.width : scale.height);
var pixels = [];
var i, ilen, min;
for (i = 0, ilen = me.getMeta().data.length; i < ilen; ++i) {
pixels.push(scale.getPixelForValue(null, i, datasetIndex));
}
min = helpers.isNullOrUndef(scale.options.barThickness)
? computeMinSampleSize(scale, pixels)
: -1;
return {
min: min,
pixels: pixels,
start: start,
end: end,
stackCount: stackCount,
scale: scale
};
},
/**
* Note: pixel values are not clamped to the scale area.
* @private
*/
calculateBarValuePixels: function(datasetIndex, index) {
var me = this;
var chart = me.chart;
var meta = me.getMeta();
var scale = me.getValueScale();
var datasets = chart.data.datasets;
var value = scale.getRightValue(datasets[datasetIndex].data[index]);
var stacked = scale.options.stacked;
var stack = meta.stack;
var start = 0;
var i, imeta, ivalue, base, head, size;
if (stacked || (stacked === undefined && stack !== undefined)) {
for (i = 0; i < datasetIndex; ++i) {
imeta = chart.getDatasetMeta(i);
if (imeta.bar &&
imeta.stack === stack &&
imeta.controller.getValueScaleId() === scale.id &&
chart.isDatasetVisible(i)) {
ivalue = scale.getRightValue(datasets[i].data[index]);
if ((value < 0 && ivalue < 0) || (value >= 0 && ivalue > 0)) {
start += ivalue;
}
}
}
}
base = scale.getPixelForValue(start);
head = scale.getPixelForValue(start + value);
size = (head - base) / 2;
return {
size: size,
base: base,
head: head,
center: head + size / 2
};
},
/**
* @private
*/
calculateBarIndexPixels: function(datasetIndex, index, ruler) {
var me = this;
var options = ruler.scale.options;
var range = options.barThickness === 'flex'
? computeFlexCategoryTraits(index, ruler, options)
: computeFitCategoryTraits(index, ruler, options);
var stackIndex = me.getStackIndex(datasetIndex, me.getMeta().stack);
var center = range.start + (range.chunk * stackIndex) + (range.chunk / 2);
var size = Math.min(
helpers.valueOrDefault(options.maxBarThickness, Infinity),
range.chunk * range.ratio);
return {
base: center - size / 2,
head: center + size / 2,
center: center,
size: size
};
},
draw: function() {
var me = this;
var chart = me.chart;
var scale = me.getValueScale();
var rects = me.getMeta().data;
var dataset = me.getDataset();
var ilen = rects.length;
var i = 0;
helpers.canvas.clipArea(chart.ctx, chart.chartArea);
for (; i < ilen; ++i) {
if (!isNaN(scale.getRightValue(dataset.data[i]))) {
rects[i].draw();
}
}
helpers.canvas.unclipArea(chart.ctx);
},
setHoverStyle: function(rectangle) {
var dataset = this.chart.data.datasets[rectangle._datasetIndex];
var index = rectangle._index;
var custom = rectangle.custom || {};
var model = rectangle._model;
model.backgroundColor = custom.hoverBackgroundColor ? custom.hoverBackgroundColor : helpers.valueAtIndexOrDefault(dataset.hoverBackgroundColor, index, helpers.getHoverColor(model.backgroundColor));
model.borderColor = custom.hoverBorderColor ? custom.hoverBorderColor : helpers.valueAtIndexOrDefault(dataset.hoverBorderColor, index, helpers.getHoverColor(model.borderColor));
model.borderWidth = custom.hoverBorderWidth ? custom.hoverBorderWidth : helpers.valueAtIndexOrDefault(dataset.hoverBorderWidth, index, model.borderWidth);
},
removeHoverStyle: function(rectangle) {
var dataset = this.chart.data.datasets[rectangle._datasetIndex];
var index = rectangle._index;
var custom = rectangle.custom || {};
var model = rectangle._model;
var rectangleElementOptions = this.chart.options.elements.rectangle;
model.backgroundColor = custom.backgroundColor ? custom.backgroundColor : helpers.valueAtIndexOrDefault(dataset.backgroundColor, index, rectangleElementOptions.backgroundColor);
model.borderColor = custom.borderColor ? custom.borderColor : helpers.valueAtIndexOrDefault(dataset.borderColor, index, rectangleElementOptions.borderColor);
model.borderWidth = custom.borderWidth ? custom.borderWidth : helpers.valueAtIndexOrDefault(dataset.borderWidth, index, rectangleElementOptions.borderWidth);
}
});
Chart.controllers.horizontalBar = Chart.controllers.bar.extend({
/**
* @private
*/
getValueScaleId: function() {
return this.getMeta().xAxisID;
},
/**
* @private
*/
getIndexScaleId: function() {
return this.getMeta().yAxisID;
}
});
};
/***/ }),
/* 449 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var defaults = __webpack_require__(8);
var elements = __webpack_require__(30);
var helpers = __webpack_require__(5);
defaults._set('bubble', {
hover: {
mode: 'single'
},
scales: {
xAxes: [{
type: 'linear', // bubble should probably use a linear scale by default
position: 'bottom',
id: 'x-axis-0' // need an ID so datasets can reference the scale
}],
yAxes: [{
type: 'linear',
position: 'left',
id: 'y-axis-0'
}]
},
tooltips: {
callbacks: {
title: function() {
// Title doesn't make sense for scatter since we format the data as a point
return '';
},
label: function(item, data) {
var datasetLabel = data.datasets[item.datasetIndex].label || '';
var dataPoint = data.datasets[item.datasetIndex].data[item.index];
return datasetLabel + ': (' + item.xLabel + ', ' + item.yLabel + ', ' + dataPoint.r + ')';
}
}
}
});
module.exports = function(Chart) {
Chart.controllers.bubble = Chart.DatasetController.extend({
/**
* @protected
*/
dataElementType: elements.Point,
/**
* @protected
*/
update: function(reset) {
var me = this;
var meta = me.getMeta();
var points = meta.data;
// Update Points
helpers.each(points, function(point, index) {
me.updateElement(point, index, reset);
});
},
/**
* @protected
*/
updateElement: function(point, index, reset) {
var me = this;
var meta = me.getMeta();
var custom = point.custom || {};
var xScale = me.getScaleForId(meta.xAxisID);
var yScale = me.getScaleForId(meta.yAxisID);
var options = me._resolveElementOptions(point, index);
var data = me.getDataset().data[index];
var dsIndex = me.index;
var x = reset ? xScale.getPixelForDecimal(0.5) : xScale.getPixelForValue(typeof data === 'object' ? data : NaN, index, dsIndex);
var y = reset ? yScale.getBasePixel() : yScale.getPixelForValue(data, index, dsIndex);
point._xScale = xScale;
point._yScale = yScale;
point._options = options;
point._datasetIndex = dsIndex;
point._index = index;
point._model = {
backgroundColor: options.backgroundColor,
borderColor: options.borderColor,
borderWidth: options.borderWidth,
hitRadius: options.hitRadius,
pointStyle: options.pointStyle,
radius: reset ? 0 : options.radius,
skip: custom.skip || isNaN(x) || isNaN(y),
x: x,
y: y,
};
point.pivot();
},
/**
* @protected
*/
setHoverStyle: function(point) {
var model = point._model;
var options = point._options;
model.backgroundColor = helpers.valueOrDefault(options.hoverBackgroundColor, helpers.getHoverColor(options.backgroundColor));
model.borderColor = helpers.valueOrDefault(options.hoverBorderColor, helpers.getHoverColor(options.borderColor));
model.borderWidth = helpers.valueOrDefault(options.hoverBorderWidth, options.borderWidth);
model.radius = options.radius + options.hoverRadius;
},
/**
* @protected
*/
removeHoverStyle: function(point) {
var model = point._model;
var options = point._options;
model.backgroundColor = options.backgroundColor;
model.borderColor = options.borderColor;
model.borderWidth = options.borderWidth;
model.radius = options.radius;
},
/**
* @private
*/
_resolveElementOptions: function(point, index) {
var me = this;
var chart = me.chart;
var datasets = chart.data.datasets;
var dataset = datasets[me.index];
var custom = point.custom || {};
var options = chart.options.elements.point;
var resolve = helpers.options.resolve;
var data = dataset.data[index];
var values = {};
var i, ilen, key;
// Scriptable options
var context = {
chart: chart,
dataIndex: index,
dataset: dataset,
datasetIndex: me.index
};
var keys = [
'backgroundColor',
'borderColor',
'borderWidth',
'hoverBackgroundColor',
'hoverBorderColor',
'hoverBorderWidth',
'hoverRadius',
'hitRadius',
'pointStyle'
];
for (i = 0, ilen = keys.length; i < ilen; ++i) {
key = keys[i];
values[key] = resolve([
custom[key],
dataset[key],
options[key]
], context, index);
}
// Custom radius resolution
values.radius = resolve([
custom.radius,
data ? data.r : undefined,
dataset.radius,
options.radius
], context, index);
return values;
}
});
};
/***/ }),
/* 450 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var defaults = __webpack_require__(8);
var elements = __webpack_require__(30);
var helpers = __webpack_require__(5);
defaults._set('doughnut', {
animation: {
// Boolean - Whether we animate the rotation of the Doughnut
animateRotate: true,
// Boolean - Whether we animate scaling the Doughnut from the centre
animateScale: false
},
hover: {
mode: 'single'
},
legendCallback: function(chart) {
var text = [];
text.push('<ul class="' + chart.id + '-legend">');
var data = chart.data;
var datasets = data.datasets;
var labels = data.labels;
if (datasets.length) {
for (var i = 0; i < datasets[0].data.length; ++i) {
text.push('<li><span style="background-color:' + datasets[0].backgroundColor[i] + '"></span>');
if (labels[i]) {
text.push(labels[i]);
}
text.push('</li>');
}
}
text.push('</ul>');
return text.join('');
},
legend: {
labels: {
generateLabels: function(chart) {
var data = chart.data;
if (data.labels.length && data.datasets.length) {
return data.labels.map(function(label, i) {
var meta = chart.getDatasetMeta(0);
var ds = data.datasets[0];
var arc = meta.data[i];
var custom = arc && arc.custom || {};
var valueAtIndexOrDefault = helpers.valueAtIndexOrDefault;
var arcOpts = chart.options.elements.arc;
var fill = custom.backgroundColor ? custom.backgroundColor : valueAtIndexOrDefault(ds.backgroundColor, i, arcOpts.backgroundColor);
var stroke = custom.borderColor ? custom.borderColor : valueAtIndexOrDefault(ds.borderColor, i, arcOpts.borderColor);
var bw = custom.borderWidth ? custom.borderWidth : valueAtIndexOrDefault(ds.borderWidth, i, arcOpts.borderWidth);
return {
text: label,
fillStyle: fill,
strokeStyle: stroke,
lineWidth: bw,
hidden: isNaN(ds.data[i]) || meta.data[i].hidden,
// Extra data used for toggling the correct item
index: i
};
});
}
return [];
}
},
onClick: function(e, legendItem) {
var index = legendItem.index;
var chart = this.chart;
var i, ilen, meta;
for (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++i) {
meta = chart.getDatasetMeta(i);
// toggle visibility of index if exists
if (meta.data[index]) {
meta.data[index].hidden = !meta.data[index].hidden;
}
}
chart.update();
}
},
// The percentage of the chart that we cut out of the middle.
cutoutPercentage: 50,
// The rotation of the chart, where the first data arc begins.
rotation: Math.PI * -0.5,
// The total circumference of the chart.
circumference: Math.PI * 2.0,
// Need to override these to give a nice default
tooltips: {
callbacks: {
title: function() {
return '';
},
label: function(tooltipItem, data) {
var dataLabel = data.labels[tooltipItem.index];
var value = ': ' + data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index];
if (helpers.isArray(dataLabel)) {
// show value on first line of multiline label
// need to clone because we are changing the value
dataLabel = dataLabel.slice();
dataLabel[0] += value;
} else {
dataLabel += value;
}
return dataLabel;
}
}
}
});
defaults._set('pie', helpers.clone(defaults.doughnut));
defaults._set('pie', {
cutoutPercentage: 0
});
module.exports = function(Chart) {
Chart.controllers.doughnut = Chart.controllers.pie = Chart.DatasetController.extend({
dataElementType: elements.Arc,
linkScales: helpers.noop,
// Get index of the dataset in relation to the visible datasets. This allows determining the inner and outer radius correctly
getRingIndex: function(datasetIndex) {
var ringIndex = 0;
for (var j = 0; j < datasetIndex; ++j) {
if (this.chart.isDatasetVisible(j)) {
++ringIndex;
}
}
return ringIndex;
},
update: function(reset) {
var me = this;
var chart = me.chart;
var chartArea = chart.chartArea;
var opts = chart.options;
var arcOpts = opts.elements.arc;
var availableWidth = chartArea.right - chartArea.left - arcOpts.borderWidth;
var availableHeight = chartArea.bottom - chartArea.top - arcOpts.borderWidth;
var minSize = Math.min(availableWidth, availableHeight);
var offset = {x: 0, y: 0};
var meta = me.getMeta();
var cutoutPercentage = opts.cutoutPercentage;
var circumference = opts.circumference;
// If the chart's circumference isn't a full circle, calculate minSize as a ratio of the width/height of the arc
if (circumference < Math.PI * 2.0) {
var startAngle = opts.rotation % (Math.PI * 2.0);
startAngle += Math.PI * 2.0 * (startAngle >= Math.PI ? -1 : startAngle < -Math.PI ? 1 : 0);
var endAngle = startAngle + circumference;
var start = {x: Math.cos(startAngle), y: Math.sin(startAngle)};
var end = {x: Math.cos(endAngle), y: Math.sin(endAngle)};
var contains0 = (startAngle <= 0 && endAngle >= 0) || (startAngle <= Math.PI * 2.0 && Math.PI * 2.0 <= endAngle);
var contains90 = (startAngle <= Math.PI * 0.5 && Math.PI * 0.5 <= endAngle) || (startAngle <= Math.PI * 2.5 && Math.PI * 2.5 <= endAngle);
var contains180 = (startAngle <= -Math.PI && -Math.PI <= endAngle) || (startAngle <= Math.PI && Math.PI <= endAngle);
var contains270 = (startAngle <= -Math.PI * 0.5 && -Math.PI * 0.5 <= endAngle) || (startAngle <= Math.PI * 1.5 && Math.PI * 1.5 <= endAngle);
var cutout = cutoutPercentage / 100.0;
var min = {x: contains180 ? -1 : Math.min(start.x * (start.x < 0 ? 1 : cutout), end.x * (end.x < 0 ? 1 : cutout)), y: contains270 ? -1 : Math.min(start.y * (start.y < 0 ? 1 : cutout), end.y * (end.y < 0 ? 1 : cutout))};
var max = {x: contains0 ? 1 : Math.max(start.x * (start.x > 0 ? 1 : cutout), end.x * (end.x > 0 ? 1 : cutout)), y: contains90 ? 1 : Math.max(start.y * (start.y > 0 ? 1 : cutout), end.y * (end.y > 0 ? 1 : cutout))};
var size = {width: (max.x - min.x) * 0.5, height: (max.y - min.y) * 0.5};
minSize = Math.min(availableWidth / size.width, availableHeight / size.height);
offset = {x: (max.x + min.x) * -0.5, y: (max.y + min.y) * -0.5};
}
chart.borderWidth = me.getMaxBorderWidth(meta.data);
chart.outerRadius = Math.max((minSize - chart.borderWidth) / 2, 0);
chart.innerRadius = Math.max(cutoutPercentage ? (chart.outerRadius / 100) * (cutoutPercentage) : 0, 0);
chart.radiusLength = (chart.outerRadius - chart.innerRadius) / chart.getVisibleDatasetCount();
chart.offsetX = offset.x * chart.outerRadius;
chart.offsetY = offset.y * chart.outerRadius;
meta.total = me.calculateTotal();
me.outerRadius = chart.outerRadius - (chart.radiusLength * me.getRingIndex(me.index));
me.innerRadius = Math.max(me.outerRadius - chart.radiusLength, 0);
helpers.each(meta.data, function(arc, index) {
me.updateElement(arc, index, reset);
});
},
updateElement: function(arc, index, reset) {
var me = this;
var chart = me.chart;
var chartArea = chart.chartArea;
var opts = chart.options;
var animationOpts = opts.animation;
var centerX = (chartArea.left + chartArea.right) / 2;
var centerY = (chartArea.top + chartArea.bottom) / 2;
var startAngle = opts.rotation; // non reset case handled later
var endAngle = opts.rotation; // non reset case handled later
var dataset = me.getDataset();
var circumference = reset && animationOpts.animateRotate ? 0 : arc.hidden ? 0 : me.calculateCircumference(dataset.data[index]) * (opts.circumference / (2.0 * Math.PI));
var innerRadius = reset && animationOpts.animateScale ? 0 : me.innerRadius;
var outerRadius = reset && animationOpts.animateScale ? 0 : me.outerRadius;
var valueAtIndexOrDefault = helpers.valueAtIndexOrDefault;
helpers.extend(arc, {
// Utility
_datasetIndex: me.index,
_index: index,
// Desired view properties
_model: {
x: centerX + chart.offsetX,
y: centerY + chart.offsetY,
startAngle: startAngle,
endAngle: endAngle,
circumference: circumference,
outerRadius: outerRadius,
innerRadius: innerRadius,
label: valueAtIndexOrDefault(dataset.label, index, chart.data.labels[index])
}
});
var model = arc._model;
// Resets the visual styles
this.removeHoverStyle(arc);
// Set correct angles if not resetting
if (!reset || !animationOpts.animateRotate) {
if (index === 0) {
model.startAngle = opts.rotation;
} else {
model.startAngle = me.getMeta().data[index - 1]._model.endAngle;
}
model.endAngle = model.startAngle + model.circumference;
}
arc.pivot();
},
removeHoverStyle: function(arc) {
Chart.DatasetController.prototype.removeHoverStyle.call(this, arc, this.chart.options.elements.arc);
},
calculateTotal: function() {
var dataset = this.getDataset();
var meta = this.getMeta();
var total = 0;
var value;
helpers.each(meta.data, function(element, index) {
value = dataset.data[index];
if (!isNaN(value) && !element.hidden) {
total += Math.abs(value);
}
});
/* if (total === 0) {
total = NaN;
}*/
return total;
},
calculateCircumference: function(value) {
var total = this.getMeta().total;
if (total > 0 && !isNaN(value)) {
return (Math.PI * 2.0) * (Math.abs(value) / total);
}
return 0;
},
// gets the max border or hover width to properly scale pie charts
getMaxBorderWidth: function(arcs) {
var max = 0;
var index = this.index;
var length = arcs.length;
var borderWidth;
var hoverWidth;
for (var i = 0; i < length; i++) {
borderWidth = arcs[i]._model ? arcs[i]._model.borderWidth : 0;
hoverWidth = arcs[i]._chart ? arcs[i]._chart.config.data.datasets[index].hoverBorderWidth : 0;
max = borderWidth > max ? borderWidth : max;
max = hoverWidth > max ? hoverWidth : max;
}
return max;
}
});
};
/***/ }),
/* 451 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var defaults = __webpack_require__(8);
var elements = __webpack_require__(30);
var helpers = __webpack_require__(5);
defaults._set('line', {
showLines: true,
spanGaps: false,
hover: {
mode: 'label'
},
scales: {
xAxes: [{
type: 'category',
id: 'x-axis-0'
}],
yAxes: [{
type: 'linear',
id: 'y-axis-0'
}]
}
});
module.exports = function(Chart) {
function lineEnabled(dataset, options) {
return helpers.valueOrDefault(dataset.showLine, options.showLines);
}
Chart.controllers.line = Chart.DatasetController.extend({
datasetElementType: elements.Line,
dataElementType: elements.Point,
update: function(reset) {
var me = this;
var meta = me.getMeta();
var line = meta.dataset;
var points = meta.data || [];
var options = me.chart.options;
var lineElementOptions = options.elements.line;
var scale = me.getScaleForId(meta.yAxisID);
var i, ilen, custom;
var dataset = me.getDataset();
var showLine = lineEnabled(dataset, options);
// Update Line
if (showLine) {
custom = line.custom || {};
// Compatibility: If the properties are defined with only the old name, use those values
if ((dataset.tension !== undefined) && (dataset.lineTension === undefined)) {
dataset.lineTension = dataset.tension;
}
// Utility
line._scale = scale;
line._datasetIndex = me.index;
// Data
line._children = points;
// Model
line._model = {
// Appearance
// The default behavior of lines is to break at null values, according
// to https://github.com/chartjs/Chart.js/issues/2435#issuecomment-216718158
// This option gives lines the ability to span gaps
spanGaps: dataset.spanGaps ? dataset.spanGaps : options.spanGaps,
tension: custom.tension ? custom.tension : helpers.valueOrDefault(dataset.lineTension, lineElementOptions.tension),
backgroundColor: custom.backgroundColor ? custom.backgroundColor : (dataset.backgroundColor || lineElementOptions.backgroundColor),
borderWidth: custom.borderWidth ? custom.borderWidth : (dataset.borderWidth || lineElementOptions.borderWidth),
borderColor: custom.borderColor ? custom.borderColor : (dataset.borderColor || lineElementOptions.borderColor),
borderCapStyle: custom.borderCapStyle ? custom.borderCapStyle : (dataset.borderCapStyle || lineElementOptions.borderCapStyle),
borderDash: custom.borderDash ? custom.borderDash : (dataset.borderDash || lineElementOptions.borderDash),
borderDashOffset: custom.borderDashOffset ? custom.borderDashOffset : (dataset.borderDashOffset || lineElementOptions.borderDashOffset),
borderJoinStyle: custom.borderJoinStyle ? custom.borderJoinStyle : (dataset.borderJoinStyle || lineElementOptions.borderJoinStyle),
fill: custom.fill ? custom.fill : (dataset.fill !== undefined ? dataset.fill : lineElementOptions.fill),
steppedLine: custom.steppedLine ? custom.steppedLine : helpers.valueOrDefault(dataset.steppedLine, lineElementOptions.stepped),
cubicInterpolationMode: custom.cubicInterpolationMode ? custom.cubicInterpolationMode : helpers.valueOrDefault(dataset.cubicInterpolationMode, lineElementOptions.cubicInterpolationMode),
};
line.pivot();
}
// Update Points
for (i = 0, ilen = points.length; i < ilen; ++i) {
me.updateElement(points[i], i, reset);
}
if (showLine && line._model.tension !== 0) {
me.updateBezierControlPoints();
}
// Now pivot the point for animation
for (i = 0, ilen = points.length; i < ilen; ++i) {
points[i].pivot();
}
},
getPointBackgroundColor: function(point, index) {
var backgroundColor = this.chart.options.elements.point.backgroundColor;
var dataset = this.getDataset();
var custom = point.custom || {};
if (custom.backgroundColor) {
backgroundColor = custom.backgroundColor;
} else if (dataset.pointBackgroundColor) {
backgroundColor = helpers.valueAtIndexOrDefault(dataset.pointBackgroundColor, index, backgroundColor);
} else if (dataset.backgroundColor) {
backgroundColor = dataset.backgroundColor;
}
return backgroundColor;
},
getPointBorderColor: function(point, index) {
var borderColor = this.chart.options.elements.point.borderColor;
var dataset = this.getDataset();
var custom = point.custom || {};
if (custom.borderColor) {
borderColor = custom.borderColor;
} else if (dataset.pointBorderColor) {
borderColor = helpers.valueAtIndexOrDefault(dataset.pointBorderColor, index, borderColor);
} else if (dataset.borderColor) {
borderColor = dataset.borderColor;
}
return borderColor;
},
getPointBorderWidth: function(point, index) {
var borderWidth = this.chart.options.elements.point.borderWidth;
var dataset = this.getDataset();
var custom = point.custom || {};
if (!isNaN(custom.borderWidth)) {
borderWidth = custom.borderWidth;
} else if (!isNaN(dataset.pointBorderWidth) || helpers.isArray(dataset.pointBorderWidth)) {
borderWidth = helpers.valueAtIndexOrDefault(dataset.pointBorderWidth, index, borderWidth);
} else if (!isNaN(dataset.borderWidth)) {
borderWidth = dataset.borderWidth;
}
return borderWidth;
},
updateElement: function(point, index, reset) {
var me = this;
var meta = me.getMeta();
var custom = point.custom || {};
var dataset = me.getDataset();
var datasetIndex = me.index;
var value = dataset.data[index];
var yScale = me.getScaleForId(meta.yAxisID);
var xScale = me.getScaleForId(meta.xAxisID);
var pointOptions = me.chart.options.elements.point;
var x, y;
// Compatibility: If the properties are defined with only the old name, use those values
if ((dataset.radius !== undefined) && (dataset.pointRadius === undefined)) {
dataset.pointRadius = dataset.radius;
}
if ((dataset.hitRadius !== undefined) && (dataset.pointHitRadius === undefined)) {
dataset.pointHitRadius = dataset.hitRadius;
}
x = xScale.getPixelForValue(typeof value === 'object' ? value : NaN, index, datasetIndex);
y = reset ? yScale.getBasePixel() : me.calculatePointY(value, index, datasetIndex);
// Utility
point._xScale = xScale;
point._yScale = yScale;
point._datasetIndex = datasetIndex;
point._index = index;
// Desired view properties
point._model = {
x: x,
y: y,
skip: custom.skip || isNaN(x) || isNaN(y),
// Appearance
radius: custom.radius || helpers.valueAtIndexOrDefault(dataset.pointRadius, index, pointOptions.radius),
pointStyle: custom.pointStyle || helpers.valueAtIndexOrDefault(dataset.pointStyle, index, pointOptions.pointStyle),
backgroundColor: me.getPointBackgroundColor(point, index),
borderColor: me.getPointBorderColor(point, index),
borderWidth: me.getPointBorderWidth(point, index),
tension: meta.dataset._model ? meta.dataset._model.tension : 0,
steppedLine: meta.dataset._model ? meta.dataset._model.steppedLine : false,
// Tooltip
hitRadius: custom.hitRadius || helpers.valueAtIndexOrDefault(dataset.pointHitRadius, index, pointOptions.hitRadius)
};
},
calculatePointY: function(value, index, datasetIndex) {
var me = this;
var chart = me.chart;
var meta = me.getMeta();
var yScale = me.getScaleForId(meta.yAxisID);
var sumPos = 0;
var sumNeg = 0;
var i, ds, dsMeta;
if (yScale.options.stacked) {
for (i = 0; i < datasetIndex; i++) {
ds = chart.data.datasets[i];
dsMeta = chart.getDatasetMeta(i);
if (dsMeta.type === 'line' && dsMeta.yAxisID === yScale.id && chart.isDatasetVisible(i)) {
var stackedRightValue = Number(yScale.getRightValue(ds.data[index]));
if (stackedRightValue < 0) {
sumNeg += stackedRightValue || 0;
} else {
sumPos += stackedRightValue || 0;
}
}
}
var rightValue = Number(yScale.getRightValue(value));
if (rightValue < 0) {
return yScale.getPixelForValue(sumNeg + rightValue);
}
return yScale.getPixelForValue(sumPos + rightValue);
}
return yScale.getPixelForValue(value);
},
updateBezierControlPoints: function() {
var me = this;
var meta = me.getMeta();
var area = me.chart.chartArea;
var points = (meta.data || []);
var i, ilen, point, model, controlPoints;
// Only consider points that are drawn in case the spanGaps option is used
if (meta.dataset._model.spanGaps) {
points = points.filter(function(pt) {
return !pt._model.skip;
});
}
function capControlPoint(pt, min, max) {
return Math.max(Math.min(pt, max), min);
}
if (meta.dataset._model.cubicInterpolationMode === 'monotone') {
helpers.splineCurveMonotone(points);
} else {
for (i = 0, ilen = points.length; i < ilen; ++i) {
point = points[i];
model = point._model;
controlPoints = helpers.splineCurve(
helpers.previousItem(points, i)._model,
model,
helpers.nextItem(points, i)._model,
meta.dataset._model.tension
);
model.controlPointPreviousX = controlPoints.previous.x;
model.controlPointPreviousY = controlPoints.previous.y;
model.controlPointNextX = controlPoints.next.x;
model.controlPointNextY = controlPoints.next.y;
}
}
if (me.chart.options.elements.line.capBezierPoints) {
for (i = 0, ilen = points.length; i < ilen; ++i) {
model = points[i]._model;
model.controlPointPreviousX = capControlPoint(model.controlPointPreviousX, area.left, area.right);
model.controlPointPreviousY = capControlPoint(model.controlPointPreviousY, area.top, area.bottom);
model.controlPointNextX = capControlPoint(model.controlPointNextX, area.left, area.right);
model.controlPointNextY = capControlPoint(model.controlPointNextY, area.top, area.bottom);
}
}
},
draw: function() {
var me = this;
var chart = me.chart;
var meta = me.getMeta();
var points = meta.data || [];
var area = chart.chartArea;
var ilen = points.length;
var i = 0;
helpers.canvas.clipArea(chart.ctx, area);
if (lineEnabled(me.getDataset(), chart.options)) {
meta.dataset.draw();
}
helpers.canvas.unclipArea(chart.ctx);
// Draw the points
for (; i < ilen; ++i) {
points[i].draw(area);
}
},
setHoverStyle: function(point) {
// Point
var dataset = this.chart.data.datasets[point._datasetIndex];
var index = point._index;
var custom = point.custom || {};
var model = point._model;
model.radius = custom.hoverRadius || helpers.valueAtIndexOrDefault(dataset.pointHoverRadius, index, this.chart.options.elements.point.hoverRadius);
model.backgroundColor = custom.hoverBackgroundColor || helpers.valueAtIndexOrDefault(dataset.pointHoverBackgroundColor, index, helpers.getHoverColor(model.backgroundColor));
model.borderColor = custom.hoverBorderColor || helpers.valueAtIndexOrDefault(dataset.pointHoverBorderColor, index, helpers.getHoverColor(model.borderColor));
model.borderWidth = custom.hoverBorderWidth || helpers.valueAtIndexOrDefault(dataset.pointHoverBorderWidth, index, model.borderWidth);
},
removeHoverStyle: function(point) {
var me = this;
var dataset = me.chart.data.datasets[point._datasetIndex];
var index = point._index;
var custom = point.custom || {};
var model = point._model;
// Compatibility: If the properties are defined with only the old name, use those values
if ((dataset.radius !== undefined) && (dataset.pointRadius === undefined)) {
dataset.pointRadius = dataset.radius;
}
model.radius = custom.radius || helpers.valueAtIndexOrDefault(dataset.pointRadius, index, me.chart.options.elements.point.radius);
model.backgroundColor = me.getPointBackgroundColor(point, index);
model.borderColor = me.getPointBorderColor(point, index);
model.borderWidth = me.getPointBorderWidth(point, index);
}
});
};
/***/ }),
/* 452 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var defaults = __webpack_require__(8);
var elements = __webpack_require__(30);
var helpers = __webpack_require__(5);
defaults._set('polarArea', {
scale: {
type: 'radialLinear',
angleLines: {
display: false
},
gridLines: {
circular: true
},
pointLabels: {
display: false
},
ticks: {
beginAtZero: true
}
},
// Boolean - Whether to animate the rotation of the chart
animation: {
animateRotate: true,
animateScale: true
},
startAngle: -0.5 * Math.PI,
legendCallback: function(chart) {
var text = [];
text.push('<ul class="' + chart.id + '-legend">');
var data = chart.data;
var datasets = data.datasets;
var labels = data.labels;
if (datasets.length) {
for (var i = 0; i < datasets[0].data.length; ++i) {
text.push('<li><span style="background-color:' + datasets[0].backgroundColor[i] + '"></span>');
if (labels[i]) {
text.push(labels[i]);
}
text.push('</li>');
}
}
text.push('</ul>');
return text.join('');
},
legend: {
labels: {
generateLabels: function(chart) {
var data = chart.data;
if (data.labels.length && data.datasets.length) {
return data.labels.map(function(label, i) {
var meta = chart.getDatasetMeta(0);
var ds = data.datasets[0];
var arc = meta.data[i];
var custom = arc.custom || {};
var valueAtIndexOrDefault = helpers.valueAtIndexOrDefault;
var arcOpts = chart.options.elements.arc;
var fill = custom.backgroundColor ? custom.backgroundColor : valueAtIndexOrDefault(ds.backgroundColor, i, arcOpts.backgroundColor);
var stroke = custom.borderColor ? custom.borderColor : valueAtIndexOrDefault(ds.borderColor, i, arcOpts.borderColor);
var bw = custom.borderWidth ? custom.borderWidth : valueAtIndexOrDefault(ds.borderWidth, i, arcOpts.borderWidth);
return {
text: label,
fillStyle: fill,
strokeStyle: stroke,
lineWidth: bw,
hidden: isNaN(ds.data[i]) || meta.data[i].hidden,
// Extra data used for toggling the correct item
index: i
};
});
}
return [];
}
},
onClick: function(e, legendItem) {
var index = legendItem.index;
var chart = this.chart;
var i, ilen, meta;
for (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++i) {
meta = chart.getDatasetMeta(i);
meta.data[index].hidden = !meta.data[index].hidden;
}
chart.update();
}
},
// Need to override these to give a nice default
tooltips: {
callbacks: {
title: function() {
return '';
},
label: function(item, data) {
return data.labels[item.index] + ': ' + item.yLabel;
}
}
}
});
module.exports = function(Chart) {
Chart.controllers.polarArea = Chart.DatasetController.extend({
dataElementType: elements.Arc,
linkScales: helpers.noop,
update: function(reset) {
var me = this;
var chart = me.chart;
var chartArea = chart.chartArea;
var meta = me.getMeta();
var opts = chart.options;
var arcOpts = opts.elements.arc;
var minSize = Math.min(chartArea.right - chartArea.left, chartArea.bottom - chartArea.top);
chart.outerRadius = Math.max((minSize - arcOpts.borderWidth / 2) / 2, 0);
chart.innerRadius = Math.max(opts.cutoutPercentage ? (chart.outerRadius / 100) * (opts.cutoutPercentage) : 1, 0);
chart.radiusLength = (chart.outerRadius - chart.innerRadius) / chart.getVisibleDatasetCount();
me.outerRadius = chart.outerRadius - (chart.radiusLength * me.index);
me.innerRadius = me.outerRadius - chart.radiusLength;
meta.count = me.countVisibleElements();
helpers.each(meta.data, function(arc, index) {
me.updateElement(arc, index, reset);
});
},
updateElement: function(arc, index, reset) {
var me = this;
var chart = me.chart;
var dataset = me.getDataset();
var opts = chart.options;
var animationOpts = opts.animation;
var scale = chart.scale;
var labels = chart.data.labels;
var circumference = me.calculateCircumference(dataset.data[index]);
var centerX = scale.xCenter;
var centerY = scale.yCenter;
// If there is NaN data before us, we need to calculate the starting angle correctly.
// We could be way more efficient here, but its unlikely that the polar area chart will have a lot of data
var visibleCount = 0;
var meta = me.getMeta();
for (var i = 0; i < index; ++i) {
if (!isNaN(dataset.data[i]) && !meta.data[i].hidden) {
++visibleCount;
}
}
// var negHalfPI = -0.5 * Math.PI;
var datasetStartAngle = opts.startAngle;
var distance = arc.hidden ? 0 : scale.getDistanceFromCenterForValue(dataset.data[index]);
var startAngle = datasetStartAngle + (circumference * visibleCount);
var endAngle = startAngle + (arc.hidden ? 0 : circumference);
var resetRadius = animationOpts.animateScale ? 0 : scale.getDistanceFromCenterForValue(dataset.data[index]);
helpers.extend(arc, {
// Utility
_datasetIndex: me.index,
_index: index,
_scale: scale,
// Desired view properties
_model: {
x: centerX,
y: centerY,
innerRadius: 0,
outerRadius: reset ? resetRadius : distance,
startAngle: reset && animationOpts.animateRotate ? datasetStartAngle : startAngle,
endAngle: reset && animationOpts.animateRotate ? datasetStartAngle : endAngle,
label: helpers.valueAtIndexOrDefault(labels, index, labels[index])
}
});
// Apply border and fill style
me.removeHoverStyle(arc);
arc.pivot();
},
removeHoverStyle: function(arc) {
Chart.DatasetController.prototype.removeHoverStyle.call(this, arc, this.chart.options.elements.arc);
},
countVisibleElements: function() {
var dataset = this.getDataset();
var meta = this.getMeta();
var count = 0;
helpers.each(meta.data, function(element, index) {
if (!isNaN(dataset.data[index]) && !element.hidden) {
count++;
}
});
return count;
},
calculateCircumference: function(value) {
var count = this.getMeta().count;
if (count > 0 && !isNaN(value)) {
return (2 * Math.PI) / count;
}
return 0;
}
});
};
/***/ }),
/* 453 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var defaults = __webpack_require__(8);
var elements = __webpack_require__(30);
var helpers = __webpack_require__(5);
defaults._set('radar', {
scale: {
type: 'radialLinear'
},
elements: {
line: {
tension: 0 // no bezier in radar
}
}
});
module.exports = function(Chart) {
Chart.controllers.radar = Chart.DatasetController.extend({
datasetElementType: elements.Line,
dataElementType: elements.Point,
linkScales: helpers.noop,
update: function(reset) {
var me = this;
var meta = me.getMeta();
var line = meta.dataset;
var points = meta.data;
var custom = line.custom || {};
var dataset = me.getDataset();
var lineElementOptions = me.chart.options.elements.line;
var scale = me.chart.scale;
// Compatibility: If the properties are defined with only the old name, use those values
if ((dataset.tension !== undefined) && (dataset.lineTension === undefined)) {
dataset.lineTension = dataset.tension;
}
helpers.extend(meta.dataset, {
// Utility
_datasetIndex: me.index,
_scale: scale,
// Data
_children: points,
_loop: true,
// Model
_model: {
// Appearance
tension: custom.tension ? custom.tension : helpers.valueOrDefault(dataset.lineTension, lineElementOptions.tension),
backgroundColor: custom.backgroundColor ? custom.backgroundColor : (dataset.backgroundColor || lineElementOptions.backgroundColor),
borderWidth: custom.borderWidth ? custom.borderWidth : (dataset.borderWidth || lineElementOptions.borderWidth),
borderColor: custom.borderColor ? custom.borderColor : (dataset.borderColor || lineElementOptions.borderColor),
fill: custom.fill ? custom.fill : (dataset.fill !== undefined ? dataset.fill : lineElementOptions.fill),
borderCapStyle: custom.borderCapStyle ? custom.borderCapStyle : (dataset.borderCapStyle || lineElementOptions.borderCapStyle),
borderDash: custom.borderDash ? custom.borderDash : (dataset.borderDash || lineElementOptions.borderDash),
borderDashOffset: custom.borderDashOffset ? custom.borderDashOffset : (dataset.borderDashOffset || lineElementOptions.borderDashOffset),
borderJoinStyle: custom.borderJoinStyle ? custom.borderJoinStyle : (dataset.borderJoinStyle || lineElementOptions.borderJoinStyle),
}
});
meta.dataset.pivot();
// Update Points
helpers.each(points, function(point, index) {
me.updateElement(point, index, reset);
}, me);
// Update bezier control points
me.updateBezierControlPoints();
},
updateElement: function(point, index, reset) {
var me = this;
var custom = point.custom || {};
var dataset = me.getDataset();
var scale = me.chart.scale;
var pointElementOptions = me.chart.options.elements.point;
var pointPosition = scale.getPointPositionForValue(index, dataset.data[index]);
// Compatibility: If the properties are defined with only the old name, use those values
if ((dataset.radius !== undefined) && (dataset.pointRadius === undefined)) {
dataset.pointRadius = dataset.radius;
}
if ((dataset.hitRadius !== undefined) && (dataset.pointHitRadius === undefined)) {
dataset.pointHitRadius = dataset.hitRadius;
}
helpers.extend(point, {
// Utility
_datasetIndex: me.index,
_index: index,
_scale: scale,
// Desired view properties
_model: {
x: reset ? scale.xCenter : pointPosition.x, // value not used in dataset scale, but we want a consistent API between scales
y: reset ? scale.yCenter : pointPosition.y,
// Appearance
tension: custom.tension ? custom.tension : helpers.valueOrDefault(dataset.lineTension, me.chart.options.elements.line.tension),
radius: custom.radius ? custom.radius : helpers.valueAtIndexOrDefault(dataset.pointRadius, index, pointElementOptions.radius),
backgroundColor: custom.backgroundColor ? custom.backgroundColor : helpers.valueAtIndexOrDefault(dataset.pointBackgroundColor, index, pointElementOptions.backgroundColor),
borderColor: custom.borderColor ? custom.borderColor : helpers.valueAtIndexOrDefault(dataset.pointBorderColor, index, pointElementOptions.borderColor),
borderWidth: custom.borderWidth ? custom.borderWidth : helpers.valueAtIndexOrDefault(dataset.pointBorderWidth, index, pointElementOptions.borderWidth),
pointStyle: custom.pointStyle ? custom.pointStyle : helpers.valueAtIndexOrDefault(dataset.pointStyle, index, pointElementOptions.pointStyle),
// Tooltip
hitRadius: custom.hitRadius ? custom.hitRadius : helpers.valueAtIndexOrDefault(dataset.pointHitRadius, index, pointElementOptions.hitRadius)
}
});
point._model.skip = custom.skip ? custom.skip : (isNaN(point._model.x) || isNaN(point._model.y));
},
updateBezierControlPoints: function() {
var chartArea = this.chart.chartArea;
var meta = this.getMeta();
helpers.each(meta.data, function(point, index) {
var model = point._model;
var controlPoints = helpers.splineCurve(
helpers.previousItem(meta.data, index, true)._model,
model,
helpers.nextItem(meta.data, index, true)._model,
model.tension
);
// Prevent the bezier going outside of the bounds of the graph
model.controlPointPreviousX = Math.max(Math.min(controlPoints.previous.x, chartArea.right), chartArea.left);
model.controlPointPreviousY = Math.max(Math.min(controlPoints.previous.y, chartArea.bottom), chartArea.top);
model.controlPointNextX = Math.max(Math.min(controlPoints.next.x, chartArea.right), chartArea.left);
model.controlPointNextY = Math.max(Math.min(controlPoints.next.y, chartArea.bottom), chartArea.top);
// Now pivot the point for animation
point.pivot();
});
},
setHoverStyle: function(point) {
// Point
var dataset = this.chart.data.datasets[point._datasetIndex];
var custom = point.custom || {};
var index = point._index;
var model = point._model;
model.radius = custom.hoverRadius ? custom.hoverRadius : helpers.valueAtIndexOrDefault(dataset.pointHoverRadius, index, this.chart.options.elements.point.hoverRadius);
model.backgroundColor = custom.hoverBackgroundColor ? custom.hoverBackgroundColor : helpers.valueAtIndexOrDefault(dataset.pointHoverBackgroundColor, index, helpers.getHoverColor(model.backgroundColor));
model.borderColor = custom.hoverBorderColor ? custom.hoverBorderColor : helpers.valueAtIndexOrDefault(dataset.pointHoverBorderColor, index, helpers.getHoverColor(model.borderColor));
model.borderWidth = custom.hoverBorderWidth ? custom.hoverBorderWidth : helpers.valueAtIndexOrDefault(dataset.pointHoverBorderWidth, index, model.borderWidth);
},
removeHoverStyle: function(point) {
var dataset = this.chart.data.datasets[point._datasetIndex];
var custom = point.custom || {};
var index = point._index;
var model = point._model;
var pointElementOptions = this.chart.options.elements.point;
model.radius = custom.radius ? custom.radius : helpers.valueAtIndexOrDefault(dataset.pointRadius, index, pointElementOptions.radius);
model.backgroundColor = custom.backgroundColor ? custom.backgroundColor : helpers.valueAtIndexOrDefault(dataset.pointBackgroundColor, index, pointElementOptions.backgroundColor);
model.borderColor = custom.borderColor ? custom.borderColor : helpers.valueAtIndexOrDefault(dataset.pointBorderColor, index, pointElementOptions.borderColor);
model.borderWidth = custom.borderWidth ? custom.borderWidth : helpers.valueAtIndexOrDefault(dataset.pointBorderWidth, index, pointElementOptions.borderWidth);
}
});
};
/***/ }),
/* 454 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var defaults = __webpack_require__(8);
defaults._set('scatter', {
hover: {
mode: 'single'
},
scales: {
xAxes: [{
id: 'x-axis-1', // need an ID so datasets can reference the scale
type: 'linear', // scatter should not use a category axis
position: 'bottom'
}],
yAxes: [{
id: 'y-axis-1',
type: 'linear',
position: 'left'
}]
},
showLines: false,
tooltips: {
callbacks: {
title: function() {
return ''; // doesn't make sense for scatter since data are formatted as a point
},
label: function(item) {
return '(' + item.xLabel + ', ' + item.yLabel + ')';
}
}
}
});
module.exports = function(Chart) {
// Scatter charts use line controllers
Chart.controllers.scatter = Chart.controllers.line;
};
/***/ }),
/* 455 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = function(Chart) {
Chart.Bar = function(context, config) {
config.type = 'bar';
return new Chart(context, config);
};
};
/***/ }),
/* 456 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = function(Chart) {
Chart.Bubble = function(context, config) {
config.type = 'bubble';
return new Chart(context, config);
};
};
/***/ }),
/* 457 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = function(Chart) {
Chart.Doughnut = function(context, config) {
config.type = 'doughnut';
return new Chart(context, config);
};
};
/***/ }),
/* 458 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = function(Chart) {
Chart.Line = function(context, config) {
config.type = 'line';
return new Chart(context, config);
};
};
/***/ }),
/* 459 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = function(Chart) {
Chart.PolarArea = function(context, config) {
config.type = 'polarArea';
return new Chart(context, config);
};
};
/***/ }),
/* 460 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = function(Chart) {
Chart.Radar = function(context, config) {
config.type = 'radar';
return new Chart(context, config);
};
};
/***/ }),
/* 461 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = function(Chart) {
Chart.Scatter = function(context, config) {
config.type = 'scatter';
return new Chart(context, config);
};
};
/***/ }),
/* 462 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = {};
module.exports.filler = __webpack_require__(463);
module.exports.legend = __webpack_require__(464);
module.exports.title = __webpack_require__(465);
/***/ }),
/* 463 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Plugin based on discussion from the following Chart.js issues:
* @see https://github.com/chartjs/Chart.js/issues/2380#issuecomment-279961569
* @see https://github.com/chartjs/Chart.js/issues/2440#issuecomment-256461897
*/
var defaults = __webpack_require__(8);
var elements = __webpack_require__(30);
var helpers = __webpack_require__(5);
defaults._set('global', {
plugins: {
filler: {
propagate: true
}
}
});
var mappers = {
dataset: function(source) {
var index = source.fill;
var chart = source.chart;
var meta = chart.getDatasetMeta(index);
var visible = meta && chart.isDatasetVisible(index);
var points = (visible && meta.dataset._children) || [];
var length = points.length || 0;
return !length ? null : function(point, i) {
return (i < length && points[i]._view) || null;
};
},
boundary: function(source) {
var boundary = source.boundary;
var x = boundary ? boundary.x : null;
var y = boundary ? boundary.y : null;
return function(point) {
return {
x: x === null ? point.x : x,
y: y === null ? point.y : y,
};
};
}
};
// @todo if (fill[0] === '#')
function decodeFill(el, index, count) {
var model = el._model || {};
var fill = model.fill;
var target;
if (fill === undefined) {
fill = !!model.backgroundColor;
}
if (fill === false || fill === null) {
return false;
}
if (fill === true) {
return 'origin';
}
target = parseFloat(fill, 10);
if (isFinite(target) && Math.floor(target) === target) {
if (fill[0] === '-' || fill[0] === '+') {
target = index + target;
}
if (target === index || target < 0 || target >= count) {
return false;
}
return target;
}
switch (fill) {
// compatibility
case 'bottom':
return 'start';
case 'top':
return 'end';
case 'zero':
return 'origin';
// supported boundaries
case 'origin':
case 'start':
case 'end':
return fill;
// invalid fill values
default:
return false;
}
}
function computeBoundary(source) {
var model = source.el._model || {};
var scale = source.el._scale || {};
var fill = source.fill;
var target = null;
var horizontal;
if (isFinite(fill)) {
return null;
}
// Backward compatibility: until v3, we still need to support boundary values set on
// the model (scaleTop, scaleBottom and scaleZero) because some external plugins and
// controllers might still use it (e.g. the Smith chart).
if (fill === 'start') {
target = model.scaleBottom === undefined ? scale.bottom : model.scaleBottom;
} else if (fill === 'end') {
target = model.scaleTop === undefined ? scale.top : model.scaleTop;
} else if (model.scaleZero !== undefined) {
target = model.scaleZero;
} else if (scale.getBasePosition) {
target = scale.getBasePosition();
} else if (scale.getBasePixel) {
target = scale.getBasePixel();
}
if (target !== undefined && target !== null) {
if (target.x !== undefined && target.y !== undefined) {
return target;
}
if (typeof target === 'number' && isFinite(target)) {
horizontal = scale.isHorizontal();
return {
x: horizontal ? target : null,
y: horizontal ? null : target
};
}
}
return null;
}
function resolveTarget(sources, index, propagate) {
var source = sources[index];
var fill = source.fill;
var visited = [index];
var target;
if (!propagate) {
return fill;
}
while (fill !== false && visited.indexOf(fill) === -1) {
if (!isFinite(fill)) {
return fill;
}
target = sources[fill];
if (!target) {
return false;
}
if (target.visible) {
return fill;
}
visited.push(fill);
fill = target.fill;
}
return false;
}
function createMapper(source) {
var fill = source.fill;
var type = 'dataset';
if (fill === false) {
return null;
}
if (!isFinite(fill)) {
type = 'boundary';
}
return mappers[type](source);
}
function isDrawable(point) {
return point && !point.skip;
}
function drawArea(ctx, curve0, curve1, len0, len1) {
var i;
if (!len0 || !len1) {
return;
}
// building first area curve (normal)
ctx.moveTo(curve0[0].x, curve0[0].y);
for (i = 1; i < len0; ++i) {
helpers.canvas.lineTo(ctx, curve0[i - 1], curve0[i]);
}
// joining the two area curves
ctx.lineTo(curve1[len1 - 1].x, curve1[len1 - 1].y);
// building opposite area curve (reverse)
for (i = len1 - 1; i > 0; --i) {
helpers.canvas.lineTo(ctx, curve1[i], curve1[i - 1], true);
}
}
function doFill(ctx, points, mapper, view, color, loop) {
var count = points.length;
var span = view.spanGaps;
var curve0 = [];
var curve1 = [];
var len0 = 0;
var len1 = 0;
var i, ilen, index, p0, p1, d0, d1;
ctx.beginPath();
for (i = 0, ilen = (count + !!loop); i < ilen; ++i) {
index = i % count;
p0 = points[index]._view;
p1 = mapper(p0, index, view);
d0 = isDrawable(p0);
d1 = isDrawable(p1);
if (d0 && d1) {
len0 = curve0.push(p0);
len1 = curve1.push(p1);
} else if (len0 && len1) {
if (!span) {
drawArea(ctx, curve0, curve1, len0, len1);
len0 = len1 = 0;
curve0 = [];
curve1 = [];
} else {
if (d0) {
curve0.push(p0);
}
if (d1) {
curve1.push(p1);
}
}
}
}
drawArea(ctx, curve0, curve1, len0, len1);
ctx.closePath();
ctx.fillStyle = color;
ctx.fill();
}
module.exports = {
id: 'filler',
afterDatasetsUpdate: function(chart, options) {
var count = (chart.data.datasets || []).length;
var propagate = options.propagate;
var sources = [];
var meta, i, el, source;
for (i = 0; i < count; ++i) {
meta = chart.getDatasetMeta(i);
el = meta.dataset;
source = null;
if (el && el._model && el instanceof elements.Line) {
source = {
visible: chart.isDatasetVisible(i),
fill: decodeFill(el, i, count),
chart: chart,
el: el
};
}
meta.$filler = source;
sources.push(source);
}
for (i = 0; i < count; ++i) {
source = sources[i];
if (!source) {
continue;
}
source.fill = resolveTarget(sources, i, propagate);
source.boundary = computeBoundary(source);
source.mapper = createMapper(source);
}
},
beforeDatasetDraw: function(chart, args) {
var meta = args.meta.$filler;
if (!meta) {
return;
}
var ctx = chart.ctx;
var el = meta.el;
var view = el._view;
var points = el._children || [];
var mapper = meta.mapper;
var color = view.backgroundColor || defaults.global.defaultColor;
if (mapper && color && points.length) {
helpers.canvas.clipArea(ctx, chart.chartArea);
doFill(ctx, points, mapper, view, color, el._loop);
helpers.canvas.unclipArea(ctx);
}
}
};
/***/ }),
/* 464 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var defaults = __webpack_require__(8);
var Element = __webpack_require__(22);
var helpers = __webpack_require__(5);
var layouts = __webpack_require__(50);
var noop = helpers.noop;
defaults._set('global', {
legend: {
display: true,
position: 'top',
fullWidth: true,
reverse: false,
weight: 1000,
// a callback that will handle
onClick: function(e, legendItem) {
var index = legendItem.datasetIndex;
var ci = this.chart;
var meta = ci.getDatasetMeta(index);
// See controller.isDatasetVisible comment
meta.hidden = meta.hidden === null ? !ci.data.datasets[index].hidden : null;
// We hid a dataset ... rerender the chart
ci.update();
},
onHover: null,
labels: {
boxWidth: 40,
padding: 10,
// Generates labels shown in the legend
// Valid properties to return:
// text : text to display
// fillStyle : fill of coloured box
// strokeStyle: stroke of coloured box
// hidden : if this legend item refers to a hidden item
// lineCap : cap style for line
// lineDash
// lineDashOffset :
// lineJoin :
// lineWidth :
generateLabels: function(chart) {
var data = chart.data;
return helpers.isArray(data.datasets) ? data.datasets.map(function(dataset, i) {
return {
text: dataset.label,
fillStyle: (!helpers.isArray(dataset.backgroundColor) ? dataset.backgroundColor : dataset.backgroundColor[0]),
hidden: !chart.isDatasetVisible(i),
lineCap: dataset.borderCapStyle,
lineDash: dataset.borderDash,
lineDashOffset: dataset.borderDashOffset,
lineJoin: dataset.borderJoinStyle,
lineWidth: dataset.borderWidth,
strokeStyle: dataset.borderColor,
pointStyle: dataset.pointStyle,
// Below is extra data used for toggling the datasets
datasetIndex: i
};
}, this) : [];
}
}
},
legendCallback: function(chart) {
var text = [];
text.push('<ul class="' + chart.id + '-legend">');
for (var i = 0; i < chart.data.datasets.length; i++) {
text.push('<li><span style="background-color:' + chart.data.datasets[i].backgroundColor + '"></span>');
if (chart.data.datasets[i].label) {
text.push(chart.data.datasets[i].label);
}
text.push('</li>');
}
text.push('</ul>');
return text.join('');
}
});
/**
* Helper function to get the box width based on the usePointStyle option
* @param labelopts {Object} the label options on the legend
* @param fontSize {Number} the label font size
* @return {Number} width of the color box area
*/
function getBoxWidth(labelOpts, fontSize) {
return labelOpts.usePointStyle ?
fontSize * Math.SQRT2 :
labelOpts.boxWidth;
}
/**
* IMPORTANT: this class is exposed publicly as Chart.Legend, backward compatibility required!
*/
var Legend = Element.extend({
initialize: function(config) {
helpers.extend(this, config);
// Contains hit boxes for each dataset (in dataset order)
this.legendHitBoxes = [];
// Are we in doughnut mode which has a different data type
this.doughnutMode = false;
},
// These methods are ordered by lifecycle. Utilities then follow.
// Any function defined here is inherited by all legend types.
// Any function can be extended by the legend type
beforeUpdate: noop,
update: function(maxWidth, maxHeight, margins) {
var me = this;
// Update Lifecycle - Probably don't want to ever extend or overwrite this function ;)
me.beforeUpdate();
// Absorb the master measurements
me.maxWidth = maxWidth;
me.maxHeight = maxHeight;
me.margins = margins;
// Dimensions
me.beforeSetDimensions();
me.setDimensions();
me.afterSetDimensions();
// Labels
me.beforeBuildLabels();
me.buildLabels();
me.afterBuildLabels();
// Fit
me.beforeFit();
me.fit();
me.afterFit();
//
me.afterUpdate();
return me.minSize;
},
afterUpdate: noop,
//
beforeSetDimensions: noop,
setDimensions: function() {
var me = this;
// Set the unconstrained dimension before label rotation
if (me.isHorizontal()) {
// Reset position before calculating rotation
me.width = me.maxWidth;
me.left = 0;
me.right = me.width;
} else {
me.height = me.maxHeight;
// Reset position before calculating rotation
me.top = 0;
me.bottom = me.height;
}
// Reset padding
me.paddingLeft = 0;
me.paddingTop = 0;
me.paddingRight = 0;
me.paddingBottom = 0;
// Reset minSize
me.minSize = {
width: 0,
height: 0
};
},
afterSetDimensions: noop,
//
beforeBuildLabels: noop,
buildLabels: function() {
var me = this;
var labelOpts = me.options.labels || {};
var legendItems = helpers.callback(labelOpts.generateLabels, [me.chart], me) || [];
if (labelOpts.filter) {
legendItems = legendItems.filter(function(item) {
return labelOpts.filter(item, me.chart.data);
});
}
if (me.options.reverse) {
legendItems.reverse();
}
me.legendItems = legendItems;
},
afterBuildLabels: noop,
//
beforeFit: noop,
fit: function() {
var me = this;
var opts = me.options;
var labelOpts = opts.labels;
var display = opts.display;
var ctx = me.ctx;
var globalDefault = defaults.global;
var valueOrDefault = helpers.valueOrDefault;
var fontSize = valueOrDefault(labelOpts.fontSize, globalDefault.defaultFontSize);
var fontStyle = valueOrDefault(labelOpts.fontStyle, globalDefault.defaultFontStyle);
var fontFamily = valueOrDefault(labelOpts.fontFamily, globalDefault.defaultFontFamily);
var labelFont = helpers.fontString(fontSize, fontStyle, fontFamily);
// Reset hit boxes
var hitboxes = me.legendHitBoxes = [];
var minSize = me.minSize;
var isHorizontal = me.isHorizontal();
if (isHorizontal) {
minSize.width = me.maxWidth; // fill all the width
minSize.height = display ? 10 : 0;
} else {
minSize.width = display ? 10 : 0;
minSize.height = me.maxHeight; // fill all the height
}
// Increase sizes here
if (display) {
ctx.font = labelFont;
if (isHorizontal) {
// Labels
// Width of each line of legend boxes. Labels wrap onto multiple lines when there are too many to fit on one
var lineWidths = me.lineWidths = [0];
var totalHeight = me.legendItems.length ? fontSize + (labelOpts.padding) : 0;
ctx.textAlign = 'left';
ctx.textBaseline = 'top';
helpers.each(me.legendItems, function(legendItem, i) {
var boxWidth = getBoxWidth(labelOpts, fontSize);
var width = boxWidth + (fontSize / 2) + ctx.measureText(legendItem.text).width;
if (lineWidths[lineWidths.length - 1] + width + labelOpts.padding >= me.width) {
totalHeight += fontSize + (labelOpts.padding);
lineWidths[lineWidths.length] = me.left;
}
// Store the hitbox width and height here. Final position will be updated in `draw`
hitboxes[i] = {
left: 0,
top: 0,
width: width,
height: fontSize
};
lineWidths[lineWidths.length - 1] += width + labelOpts.padding;
});
minSize.height += totalHeight;
} else {
var vPadding = labelOpts.padding;
var columnWidths = me.columnWidths = [];
var totalWidth = labelOpts.padding;
var currentColWidth = 0;
var currentColHeight = 0;
var itemHeight = fontSize + vPadding;
helpers.each(me.legendItems, function(legendItem, i) {
var boxWidth = getBoxWidth(labelOpts, fontSize);
var itemWidth = boxWidth + (fontSize / 2) + ctx.measureText(legendItem.text).width;
// If too tall, go to new column
if (currentColHeight + itemHeight > minSize.height) {
totalWidth += currentColWidth + labelOpts.padding;
columnWidths.push(currentColWidth); // previous column width
currentColWidth = 0;
currentColHeight = 0;
}
// Get max width
currentColWidth = Math.max(currentColWidth, itemWidth);
currentColHeight += itemHeight;
// Store the hitbox width and height here. Final position will be updated in `draw`
hitboxes[i] = {
left: 0,
top: 0,
width: itemWidth,
height: fontSize
};
});
totalWidth += currentColWidth;
columnWidths.push(currentColWidth);
minSize.width += totalWidth;
}
}
me.width = minSize.width;
me.height = minSize.height;
},
afterFit: noop,
// Shared Methods
isHorizontal: function() {
return this.options.position === 'top' || this.options.position === 'bottom';
},
// Actually draw the legend on the canvas
draw: function() {
var me = this;
var opts = me.options;
var labelOpts = opts.labels;
var globalDefault = defaults.global;
var lineDefault = globalDefault.elements.line;
var legendWidth = me.width;
var lineWidths = me.lineWidths;
if (opts.display) {
var ctx = me.ctx;
var valueOrDefault = helpers.valueOrDefault;
var fontColor = valueOrDefault(labelOpts.fontColor, globalDefault.defaultFontColor);
var fontSize = valueOrDefault(labelOpts.fontSize, globalDefault.defaultFontSize);
var fontStyle = valueOrDefault(labelOpts.fontStyle, globalDefault.defaultFontStyle);
var fontFamily = valueOrDefault(labelOpts.fontFamily, globalDefault.defaultFontFamily);
var labelFont = helpers.fontString(fontSize, fontStyle, fontFamily);
var cursor;
// Canvas setup
ctx.textAlign = 'left';
ctx.textBaseline = 'middle';
ctx.lineWidth = 0.5;
ctx.strokeStyle = fontColor; // for strikethrough effect
ctx.fillStyle = fontColor; // render in correct colour
ctx.font = labelFont;
var boxWidth = getBoxWidth(labelOpts, fontSize);
var hitboxes = me.legendHitBoxes;
// current position
var drawLegendBox = function(x, y, legendItem) {
if (isNaN(boxWidth) || boxWidth <= 0) {
return;
}
// Set the ctx for the box
ctx.save();
ctx.fillStyle = valueOrDefault(legendItem.fillStyle, globalDefault.defaultColor);
ctx.lineCap = valueOrDefault(legendItem.lineCap, lineDefault.borderCapStyle);
ctx.lineDashOffset = valueOrDefault(legendItem.lineDashOffset, lineDefault.borderDashOffset);
ctx.lineJoin = valueOrDefault(legendItem.lineJoin, lineDefault.borderJoinStyle);
ctx.lineWidth = valueOrDefault(legendItem.lineWidth, lineDefault.borderWidth);
ctx.strokeStyle = valueOrDefault(legendItem.strokeStyle, globalDefault.defaultColor);
var isLineWidthZero = (valueOrDefault(legendItem.lineWidth, lineDefault.borderWidth) === 0);
if (ctx.setLineDash) {
// IE 9 and 10 do not support line dash
ctx.setLineDash(valueOrDefault(legendItem.lineDash, lineDefault.borderDash));
}
if (opts.labels && opts.labels.usePointStyle) {
// Recalculate x and y for drawPoint() because its expecting
// x and y to be center of figure (instead of top left)
var radius = fontSize * Math.SQRT2 / 2;
var offSet = radius / Math.SQRT2;
var centerX = x + offSet;
var centerY = y + offSet;
// Draw pointStyle as legend symbol
helpers.canvas.drawPoint(ctx, legendItem.pointStyle, radius, centerX, centerY);
} else {
// Draw box as legend symbol
if (!isLineWidthZero) {
ctx.strokeRect(x, y, boxWidth, fontSize);
}
ctx.fillRect(x, y, boxWidth, fontSize);
}
ctx.restore();
};
var fillText = function(x, y, legendItem, textWidth) {
var halfFontSize = fontSize / 2;
var xLeft = boxWidth + halfFontSize + x;
var yMiddle = y + halfFontSize;
ctx.fillText(legendItem.text, xLeft, yMiddle);
if (legendItem.hidden) {
// Strikethrough the text if hidden
ctx.beginPath();
ctx.lineWidth = 2;
ctx.moveTo(xLeft, yMiddle);
ctx.lineTo(xLeft + textWidth, yMiddle);
ctx.stroke();
}
};
// Horizontal
var isHorizontal = me.isHorizontal();
if (isHorizontal) {
cursor = {
x: me.left + ((legendWidth - lineWidths[0]) / 2),
y: me.top + labelOpts.padding,
line: 0
};
} else {
cursor = {
x: me.left + labelOpts.padding,
y: me.top + labelOpts.padding,
line: 0
};
}
var itemHeight = fontSize + labelOpts.padding;
helpers.each(me.legendItems, function(legendItem, i) {
var textWidth = ctx.measureText(legendItem.text).width;
var width = boxWidth + (fontSize / 2) + textWidth;
var x = cursor.x;
var y = cursor.y;
if (isHorizontal) {
if (x + width >= legendWidth) {
y = cursor.y += itemHeight;
cursor.line++;
x = cursor.x = me.left + ((legendWidth - lineWidths[cursor.line]) / 2);
}
} else if (y + itemHeight > me.bottom) {
x = cursor.x = x + me.columnWidths[cursor.line] + labelOpts.padding;
y = cursor.y = me.top + labelOpts.padding;
cursor.line++;
}
drawLegendBox(x, y, legendItem);
hitboxes[i].left = x;
hitboxes[i].top = y;
// Fill the actual label
fillText(x, y, legendItem, textWidth);
if (isHorizontal) {
cursor.x += width + (labelOpts.padding);
} else {
cursor.y += itemHeight;
}
});
}
},
/**
* Handle an event
* @private
* @param {IEvent} event - The event to handle
* @return {Boolean} true if a change occured
*/
handleEvent: function(e) {
var me = this;
var opts = me.options;
var type = e.type === 'mouseup' ? 'click' : e.type;
var changed = false;
if (type === 'mousemove') {
if (!opts.onHover) {
return;
}
} else if (type === 'click') {
if (!opts.onClick) {
return;
}
} else {
return;
}
// Chart event already has relative position in it
var x = e.x;
var y = e.y;
if (x >= me.left && x <= me.right && y >= me.top && y <= me.bottom) {
// See if we are touching one of the dataset boxes
var lh = me.legendHitBoxes;
for (var i = 0; i < lh.length; ++i) {
var hitBox = lh[i];
if (x >= hitBox.left && x <= hitBox.left + hitBox.width && y >= hitBox.top && y <= hitBox.top + hitBox.height) {
// Touching an element
if (type === 'click') {
// use e.native for backwards compatibility
opts.onClick.call(me, e.native, me.legendItems[i]);
changed = true;
break;
} else if (type === 'mousemove') {
// use e.native for backwards compatibility
opts.onHover.call(me, e.native, me.legendItems[i]);
changed = true;
break;
}
}
}
}
return changed;
}
});
function createNewLegendAndAttach(chart, legendOpts) {
var legend = new Legend({
ctx: chart.ctx,
options: legendOpts,
chart: chart
});
layouts.configure(chart, legend, legendOpts);
layouts.addBox(chart, legend);
chart.legend = legend;
}
module.exports = {
id: 'legend',
/**
* Backward compatibility: since 2.1.5, the legend is registered as a plugin, making
* Chart.Legend obsolete. To avoid a breaking change, we export the Legend as part of
* the plugin, which one will be re-exposed in the chart.js file.
* https://github.com/chartjs/Chart.js/pull/2640
* @private
*/
_element: Legend,
beforeInit: function(chart) {
var legendOpts = chart.options.legend;
if (legendOpts) {
createNewLegendAndAttach(chart, legendOpts);
}
},
beforeUpdate: function(chart) {
var legendOpts = chart.options.legend;
var legend = chart.legend;
if (legendOpts) {
helpers.mergeIf(legendOpts, defaults.global.legend);
if (legend) {
layouts.configure(chart, legend, legendOpts);
legend.options = legendOpts;
} else {
createNewLegendAndAttach(chart, legendOpts);
}
} else if (legend) {
layouts.removeBox(chart, legend);
delete chart.legend;
}
},
afterEvent: function(chart, e) {
var legend = chart.legend;
if (legend) {
legend.handleEvent(e);
}
}
};
/***/ }),
/* 465 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var defaults = __webpack_require__(8);
var Element = __webpack_require__(22);
var helpers = __webpack_require__(5);
var layouts = __webpack_require__(50);
var noop = helpers.noop;
defaults._set('global', {
title: {
display: false,
fontStyle: 'bold',
fullWidth: true,
lineHeight: 1.2,
padding: 10,
position: 'top',
text: '',
weight: 2000 // by default greater than legend (1000) to be above
}
});
/**
* IMPORTANT: this class is exposed publicly as Chart.Legend, backward compatibility required!
*/
var Title = Element.extend({
initialize: function(config) {
var me = this;
helpers.extend(me, config);
// Contains hit boxes for each dataset (in dataset order)
me.legendHitBoxes = [];
},
// These methods are ordered by lifecycle. Utilities then follow.
beforeUpdate: noop,
update: function(maxWidth, maxHeight, margins) {
var me = this;
// Update Lifecycle - Probably don't want to ever extend or overwrite this function ;)
me.beforeUpdate();
// Absorb the master measurements
me.maxWidth = maxWidth;
me.maxHeight = maxHeight;
me.margins = margins;
// Dimensions
me.beforeSetDimensions();
me.setDimensions();
me.afterSetDimensions();
// Labels
me.beforeBuildLabels();
me.buildLabels();
me.afterBuildLabels();
// Fit
me.beforeFit();
me.fit();
me.afterFit();
//
me.afterUpdate();
return me.minSize;
},
afterUpdate: noop,
//
beforeSetDimensions: noop,
setDimensions: function() {
var me = this;
// Set the unconstrained dimension before label rotation
if (me.isHorizontal()) {
// Reset position before calculating rotation
me.width = me.maxWidth;
me.left = 0;
me.right = me.width;
} else {
me.height = me.maxHeight;
// Reset position before calculating rotation
me.top = 0;
me.bottom = me.height;
}
// Reset padding
me.paddingLeft = 0;
me.paddingTop = 0;
me.paddingRight = 0;
me.paddingBottom = 0;
// Reset minSize
me.minSize = {
width: 0,
height: 0
};
},
afterSetDimensions: noop,
//
beforeBuildLabels: noop,
buildLabels: noop,
afterBuildLabels: noop,
//
beforeFit: noop,
fit: function() {
var me = this;
var valueOrDefault = helpers.valueOrDefault;
var opts = me.options;
var display = opts.display;
var fontSize = valueOrDefault(opts.fontSize, defaults.global.defaultFontSize);
var minSize = me.minSize;
var lineCount = helpers.isArray(opts.text) ? opts.text.length : 1;
var lineHeight = helpers.options.toLineHeight(opts.lineHeight, fontSize);
var textSize = display ? (lineCount * lineHeight) + (opts.padding * 2) : 0;
if (me.isHorizontal()) {
minSize.width = me.maxWidth; // fill all the width
minSize.height = textSize;
} else {
minSize.width = textSize;
minSize.height = me.maxHeight; // fill all the height
}
me.width = minSize.width;
me.height = minSize.height;
},
afterFit: noop,
// Shared Methods
isHorizontal: function() {
var pos = this.options.position;
return pos === 'top' || pos === 'bottom';
},
// Actually draw the title block on the canvas
draw: function() {
var me = this;
var ctx = me.ctx;
var valueOrDefault = helpers.valueOrDefault;
var opts = me.options;
var globalDefaults = defaults.global;
if (opts.display) {
var fontSize = valueOrDefault(opts.fontSize, globalDefaults.defaultFontSize);
var fontStyle = valueOrDefault(opts.fontStyle, globalDefaults.defaultFontStyle);
var fontFamily = valueOrDefault(opts.fontFamily, globalDefaults.defaultFontFamily);
var titleFont = helpers.fontString(fontSize, fontStyle, fontFamily);
var lineHeight = helpers.options.toLineHeight(opts.lineHeight, fontSize);
var offset = lineHeight / 2 + opts.padding;
var rotation = 0;
var top = me.top;
var left = me.left;
var bottom = me.bottom;
var right = me.right;
var maxWidth, titleX, titleY;
ctx.fillStyle = valueOrDefault(opts.fontColor, globalDefaults.defaultFontColor); // render in correct colour
ctx.font = titleFont;
// Horizontal
if (me.isHorizontal()) {
titleX = left + ((right - left) / 2); // midpoint of the width
titleY = top + offset;
maxWidth = right - left;
} else {
titleX = opts.position === 'left' ? left + offset : right - offset;
titleY = top + ((bottom - top) / 2);
maxWidth = bottom - top;
rotation = Math.PI * (opts.position === 'left' ? -0.5 : 0.5);
}
ctx.save();
ctx.translate(titleX, titleY);
ctx.rotate(rotation);
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
var text = opts.text;
if (helpers.isArray(text)) {
var y = 0;
for (var i = 0; i < text.length; ++i) {
ctx.fillText(text[i], 0, y, maxWidth);
y += lineHeight;
}
} else {
ctx.fillText(text, 0, 0, maxWidth);
}
ctx.restore();
}
}
});
function createNewTitleBlockAndAttach(chart, titleOpts) {
var title = new Title({
ctx: chart.ctx,
options: titleOpts,
chart: chart
});
layouts.configure(chart, title, titleOpts);
layouts.addBox(chart, title);
chart.titleBlock = title;
}
module.exports = {
id: 'title',
/**
* Backward compatibility: since 2.1.5, the title is registered as a plugin, making
* Chart.Title obsolete. To avoid a breaking change, we export the Title as part of
* the plugin, which one will be re-exposed in the chart.js file.
* https://github.com/chartjs/Chart.js/pull/2640
* @private
*/
_element: Title,
beforeInit: function(chart) {
var titleOpts = chart.options.title;
if (titleOpts) {
createNewTitleBlockAndAttach(chart, titleOpts);
}
},
beforeUpdate: function(chart) {
var titleOpts = chart.options.title;
var titleBlock = chart.titleBlock;
if (titleOpts) {
helpers.mergeIf(titleOpts, defaults.global.title);
if (titleBlock) {
layouts.configure(chart, titleBlock, titleOpts);
titleBlock.options = titleOpts;
} else {
createNewTitleBlockAndAttach(chart, titleOpts);
}
} else if (titleBlock) {
layouts.removeBox(chart, titleBlock);
delete chart.titleBlock;
}
}
};
/***/ }),
/* 466 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var Observable_1 = __webpack_require__(9);
var interval_1 = __webpack_require__(467);
Observable_1.Observable.interval = interval_1.interval;
//# sourceMappingURL=interval.js.map
/***/ }),
/* 467 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var IntervalObservable_1 = __webpack_require__(468);
exports.interval = IntervalObservable_1.IntervalObservable.create;
//# sourceMappingURL=interval.js.map
/***/ }),
/* 468 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var isNumeric_1 = __webpack_require__(469);
var Observable_1 = __webpack_require__(9);
var async_1 = __webpack_require__(470);
/**
* We need this JSDoc comment for affecting ESDoc.
* @extends {Ignored}
* @hide true
*/
var IntervalObservable = (function (_super) {
__extends(IntervalObservable, _super);
function IntervalObservable(period, scheduler) {
if (period === void 0) { period = 0; }
if (scheduler === void 0) { scheduler = async_1.async; }
_super.call(this);
this.period = period;
this.scheduler = scheduler;
if (!isNumeric_1.isNumeric(period) || period < 0) {
this.period = 0;
}
if (!scheduler || typeof scheduler.schedule !== 'function') {
this.scheduler = async_1.async;
}
}
/**
* Creates an Observable that emits sequential numbers every specified
* interval of time, on a specified IScheduler.
*
* <span class="informal">Emits incremental numbers periodically in time.
* </span>
*
* <img src="./img/interval.png" width="100%">
*
* `interval` returns an Observable that emits an infinite sequence of
* ascending integers, with a constant interval of time of your choosing
* between those emissions. The first emission is not sent immediately, but
* only after the first period has passed. By default, this operator uses the
* `async` IScheduler to provide a notion of time, but you may pass any
* IScheduler to it.
*
* @example <caption>Emits ascending numbers, one every second (1000ms)</caption>
* var numbers = Rx.Observable.interval(1000);
* numbers.subscribe(x => console.log(x));
*
* @see {@link timer}
* @see {@link delay}
*
* @param {number} [period=0] The interval size in milliseconds (by default)
* or the time unit determined by the scheduler's clock.
* @param {Scheduler} [scheduler=async] The IScheduler to use for scheduling
* the emission of values, and providing a notion of "time".
* @return {Observable} An Observable that emits a sequential number each time
* interval.
* @static true
* @name interval
* @owner Observable
*/
IntervalObservable.create = function (period, scheduler) {
if (period === void 0) { period = 0; }
if (scheduler === void 0) { scheduler = async_1.async; }
return new IntervalObservable(period, scheduler);
};
IntervalObservable.dispatch = function (state) {
var index = state.index, subscriber = state.subscriber, period = state.period;
subscriber.next(index);
if (subscriber.closed) {
return;
}
state.index += 1;
this.schedule(state, period);
};
IntervalObservable.prototype._subscribe = function (subscriber) {
var index = 0;
var period = this.period;
var scheduler = this.scheduler;
subscriber.add(scheduler.schedule(IntervalObservable.dispatch, period, {
index: index, subscriber: subscriber, period: period
}));
};
return IntervalObservable;
}(Observable_1.Observable));
exports.IntervalObservable = IntervalObservable;
//# sourceMappingURL=IntervalObservable.js.map
/***/ }),
/* 469 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var isArray_1 = __webpack_require__(70);
function isNumeric(val) {
// parseFloat NaNs numeric-cast false positives (null|true|false|"")
// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
// subtraction forces infinities to NaN
// adding 1 corrects loss of precision from parseFloat (#15100)
return !isArray_1.isArray(val) && (val - parseFloat(val) + 1) >= 0;
}
exports.isNumeric = isNumeric;
;
//# sourceMappingURL=isNumeric.js.map
/***/ }),
/* 470 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var AsyncAction_1 = __webpack_require__(471);
var AsyncScheduler_1 = __webpack_require__(473);
/**
*
* Async Scheduler
*
* <span class="informal">Schedule task as if you used setTimeout(task, duration)</span>
*
* `async` scheduler schedules tasks asynchronously, by putting them on the JavaScript
* event loop queue. It is best used to delay tasks in time or to schedule tasks repeating
* in intervals.
*
* If you just want to "defer" task, that is to perform it right after currently
* executing synchronous code ends (commonly achieved by `setTimeout(deferredTask, 0)`),
* better choice will be the {@link asap} scheduler.
*
* @example <caption>Use async scheduler to delay task</caption>
* const task = () => console.log('it works!');
*
* Rx.Scheduler.async.schedule(task, 2000);
*
* // After 2 seconds logs:
* // "it works!"
*
*
* @example <caption>Use async scheduler to repeat task in intervals</caption>
* function task(state) {
* console.log(state);
* this.schedule(state + 1, 1000); // `this` references currently executing Action,
* // which we reschedule with new state and delay
* }
*
* Rx.Scheduler.async.schedule(task, 3000, 0);
*
* // Logs:
* // 0 after 3s
* // 1 after 4s
* // 2 after 5s
* // 3 after 6s
*
* @static true
* @name async
* @owner Scheduler
*/
exports.async = new AsyncScheduler_1.AsyncScheduler(AsyncAction_1.AsyncAction);
//# sourceMappingURL=async.js.map
/***/ }),
/* 471 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var root_1 = __webpack_require__(32);
var Action_1 = __webpack_require__(472);
/**
* We need this JSDoc comment for affecting ESDoc.
* @ignore
* @extends {Ignored}
*/
var AsyncAction = (function (_super) {
__extends(AsyncAction, _super);
function AsyncAction(scheduler, work) {
_super.call(this, scheduler, work);
this.scheduler = scheduler;
this.work = work;
this.pending = false;
}
AsyncAction.prototype.schedule = function (state, delay) {
if (delay === void 0) { delay = 0; }
if (this.closed) {
return this;
}
// Always replace the current state with the new state.
this.state = state;
// Set the pending flag indicating that this action has been scheduled, or
// has recursively rescheduled itself.
this.pending = true;
var id = this.id;
var scheduler = this.scheduler;
//
// Important implementation note:
//
// Actions only execute once by default, unless rescheduled from within the
// scheduled callback. This allows us to implement single and repeat
// actions via the same code path, without adding API surface area, as well
// as mimic traditional recursion but across asynchronous boundaries.
//
// However, JS runtimes and timers distinguish between intervals achieved by
// serial `setTimeout` calls vs. a single `setInterval` call. An interval of
// serial `setTimeout` calls can be individually delayed, which delays
// scheduling the next `setTimeout`, and so on. `setInterval` attempts to
// guarantee the interval callback will be invoked more precisely to the
// interval period, regardless of load.
//
// Therefore, we use `setInterval` to schedule single and repeat actions.
// If the action reschedules itself with the same delay, the interval is not
// canceled. If the action doesn't reschedule, or reschedules with a
// different delay, the interval will be canceled after scheduled callback
// execution.
//
if (id != null) {
this.id = this.recycleAsyncId(scheduler, id, delay);
}
this.delay = delay;
// If this action has already an async Id, don't request a new one.
this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);
return this;
};
AsyncAction.prototype.requestAsyncId = function (scheduler, id, delay) {
if (delay === void 0) { delay = 0; }
return root_1.root.setInterval(scheduler.flush.bind(scheduler, this), delay);
};
AsyncAction.prototype.recycleAsyncId = function (scheduler, id, delay) {
if (delay === void 0) { delay = 0; }
// If this action is rescheduled with the same delay time, don't clear the interval id.
if (delay !== null && this.delay === delay && this.pending === false) {
return id;
}
// Otherwise, if the action's delay time is different from the current delay,
// or the action has been rescheduled before it's executed, clear the interval id
return root_1.root.clearInterval(id) && undefined || undefined;
};
/**
* Immediately executes this action and the `work` it contains.
* @return {any}
*/
AsyncAction.prototype.execute = function (state, delay) {
if (this.closed) {
return new Error('executing a cancelled action');
}
this.pending = false;
var error = this._execute(state, delay);
if (error) {
return error;
}
else if (this.pending === false && this.id != null) {
// Dequeue if the action didn't reschedule itself. Don't call
// unsubscribe(), because the action could reschedule later.
// For example:
// ```
// scheduler.schedule(function doWork(counter) {
// /* ... I'm a busy worker bee ... */
// var originalAction = this;
// /* wait 100ms before rescheduling the action */
// setTimeout(function () {
// originalAction.schedule(counter + 1);
// }, 100);
// }, 1000);
// ```
this.id = this.recycleAsyncId(this.scheduler, this.id, null);
}
};
AsyncAction.prototype._execute = function (state, delay) {
var errored = false;
var errorValue = undefined;
try {
this.work(state);
}
catch (e) {
errored = true;
errorValue = !!e && e || new Error(e);
}
if (errored) {
this.unsubscribe();
return errorValue;
}
};
AsyncAction.prototype._unsubscribe = function () {
var id = this.id;
var scheduler = this.scheduler;
var actions = scheduler.actions;
var index = actions.indexOf(this);
this.work = null;
this.state = null;
this.pending = false;
this.scheduler = null;
if (index !== -1) {
actions.splice(index, 1);
}
if (id != null) {
this.id = this.recycleAsyncId(scheduler, id, null);
}
this.delay = null;
};
return AsyncAction;
}(Action_1.Action));
exports.AsyncAction = AsyncAction;
//# sourceMappingURL=AsyncAction.js.map
/***/ }),
/* 472 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Subscription_1 = __webpack_require__(39);
/**
* A unit of work to be executed in a {@link Scheduler}. An action is typically
* created from within a Scheduler and an RxJS user does not need to concern
* themselves about creating and manipulating an Action.
*
* ```ts
* class Action<T> extends Subscription {
* new (scheduler: Scheduler, work: (state?: T) => void);
* schedule(state?: T, delay: number = 0): Subscription;
* }
* ```
*
* @class Action<T>
*/
var Action = (function (_super) {
__extends(Action, _super);
function Action(scheduler, work) {
_super.call(this);
}
/**
* Schedules this action on its parent Scheduler for execution. May be passed
* some context object, `state`. May happen at some point in the future,
* according to the `delay` parameter, if specified.
* @param {T} [state] Some contextual data that the `work` function uses when
* called by the Scheduler.
* @param {number} [delay] Time to wait before executing the work, where the
* time unit is implicit and defined by the Scheduler.
* @return {void}
*/
Action.prototype.schedule = function (state, delay) {
if (delay === void 0) { delay = 0; }
return this;
};
return Action;
}(Subscription_1.Subscription));
exports.Action = Action;
//# sourceMappingURL=Action.js.map
/***/ }),
/* 473 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var Scheduler_1 = __webpack_require__(474);
var AsyncScheduler = (function (_super) {
__extends(AsyncScheduler, _super);
function AsyncScheduler() {
_super.apply(this, arguments);
this.actions = [];
/**
* A flag to indicate whether the Scheduler is currently executing a batch of
* queued actions.
* @type {boolean}
*/
this.active = false;
/**
* An internal ID used to track the latest asynchronous task such as those
* coming from `setTimeout`, `setInterval`, `requestAnimationFrame`, and
* others.
* @type {any}
*/
this.scheduled = undefined;
}
AsyncScheduler.prototype.flush = function (action) {
var actions = this.actions;
if (this.active) {
actions.push(action);
return;
}
var error;
this.active = true;
do {
if (error = action.execute(action.state, action.delay)) {
break;
}
} while (action = actions.shift()); // exhaust the scheduler queue
this.active = false;
if (error) {
while (action = actions.shift()) {
action.unsubscribe();
}
throw error;
}
};
return AsyncScheduler;
}(Scheduler_1.Scheduler));
exports.AsyncScheduler = AsyncScheduler;
//# sourceMappingURL=AsyncScheduler.js.map
/***/ }),
/* 474 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* An execution context and a data structure to order tasks and schedule their
* execution. Provides a notion of (potentially virtual) time, through the
* `now()` getter method.
*
* Each unit of work in a Scheduler is called an {@link Action}.
*
* ```ts
* class Scheduler {
* now(): number;
* schedule(work, delay?, state?): Subscription;
* }
* ```
*
* @class Scheduler
*/
var Scheduler = (function () {
function Scheduler(SchedulerAction, now) {
if (now === void 0) { now = Scheduler.now; }
this.SchedulerAction = SchedulerAction;
this.now = now;
}
/**
* Schedules a function, `work`, for execution. May happen at some point in
* the future, according to the `delay` parameter, if specified. May be passed
* some context object, `state`, which will be passed to the `work` function.
*
* The given arguments will be processed an stored as an Action object in a
* queue of actions.
*
* @param {function(state: ?T): ?Subscription} work A function representing a
* task, or some unit of work to be executed by the Scheduler.
* @param {number} [delay] Time to wait before executing the work, where the
* time unit is implicit and defined by the Scheduler itself.
* @param {T} [state] Some contextual data that the `work` function uses when
* called by the Scheduler.
* @return {Subscription} A subscription in order to be able to unsubscribe
* the scheduled work.
*/
Scheduler.prototype.schedule = function (work, delay, state) {
if (delay === void 0) { delay = 0; }
return new this.SchedulerAction(this, work).schedule(state, delay);
};
Scheduler.now = Date.now ? Date.now : function () { return +new Date(); };
return Scheduler;
}());
exports.Scheduler = Scheduler;
//# sourceMappingURL=Scheduler.js.map
/***/ }),
/* 475 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ModalSlideIn; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return ModalSlideOut; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ModalMDSlideIn; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ModalMDSlideOut; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__animations_animation__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__transitions_page_transition__ = __webpack_require__(40);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* Animations for modals
*/
var ModalSlideIn = (function (_super) {
__extends(ModalSlideIn, _super);
function ModalSlideIn() {
return _super !== null && _super.apply(this, arguments) || this;
}
ModalSlideIn.prototype.init = function () {
_super.prototype.init.call(this);
var ele = this.enteringView.pageRef().nativeElement;
var backdropEle = ele.querySelector('ion-backdrop');
var backdrop = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, backdropEle);
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.modal-wrapper'));
wrapper.beforeStyles({ 'opacity': 1 });
wrapper.fromTo('translateY', '100%', '0%');
backdrop.fromTo('opacity', 0.01, 0.4);
this
.element(this.enteringView.pageRef())
.easing('cubic-bezier(0.36,0.66,0.04,1)')
.duration(400)
.add(backdrop)
.add(wrapper);
};
return ModalSlideIn;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_page_transition__["a" /* PageTransition */]));
var ModalSlideOut = (function (_super) {
__extends(ModalSlideOut, _super);
function ModalSlideOut() {
return _super !== null && _super.apply(this, arguments) || this;
}
ModalSlideOut.prototype.init = function () {
_super.prototype.init.call(this);
var ele = this.leavingView.pageRef().nativeElement;
var backdrop = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('ion-backdrop'));
var wrapperEle = ele.querySelector('.modal-wrapper');
var wrapperEleRect = wrapperEle.getBoundingClientRect();
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, wrapperEle);
// height of the screen - top of the container tells us how much to scoot it down
// so it's off-screen
wrapper.fromTo('translateY', '0px', this.plt.height() - wrapperEleRect.top + "px");
backdrop.fromTo('opacity', 0.4, 0.0);
this
.element(this.leavingView.pageRef())
.easing('ease-out')
.duration(250)
.add(backdrop)
.add(wrapper);
};
return ModalSlideOut;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_page_transition__["a" /* PageTransition */]));
var ModalMDSlideIn = (function (_super) {
__extends(ModalMDSlideIn, _super);
function ModalMDSlideIn() {
return _super !== null && _super.apply(this, arguments) || this;
}
ModalMDSlideIn.prototype.init = function () {
_super.prototype.init.call(this);
var ele = this.enteringView.pageRef().nativeElement;
var backdrop = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('ion-backdrop'));
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.modal-wrapper'));
backdrop.fromTo('opacity', 0.01, 0.4);
wrapper.fromTo('translateY', '40px', '0px');
wrapper.fromTo('opacity', 0.01, 1);
var DURATION = 280;
var EASING = 'cubic-bezier(0.36,0.66,0.04,1)';
this.element(this.enteringView.pageRef()).easing(EASING).duration(DURATION)
.add(backdrop)
.add(wrapper);
};
return ModalMDSlideIn;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_page_transition__["a" /* PageTransition */]));
var ModalMDSlideOut = (function (_super) {
__extends(ModalMDSlideOut, _super);
function ModalMDSlideOut() {
return _super !== null && _super.apply(this, arguments) || this;
}
ModalMDSlideOut.prototype.init = function () {
_super.prototype.init.call(this);
var ele = this.leavingView.pageRef().nativeElement;
var backdrop = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('ion-backdrop'));
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.modal-wrapper'));
backdrop.fromTo('opacity', 0.4, 0.0);
wrapper.fromTo('translateY', '0px', '40px');
wrapper.fromTo('opacity', 0.99, 0);
this
.element(this.leavingView.pageRef())
.duration(200)
.easing('cubic-bezier(0.47,0,0.745,0.715)')
.add(wrapper)
.add(backdrop);
};
return ModalMDSlideOut;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_page_transition__["a" /* PageTransition */]));
//# sourceMappingURL=modal-transitions.js.map
/***/ }),
/* 476 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PopoverImpl; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__popover_component__ = __webpack_require__(105);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__popover_transitions__ = __webpack_require__(477);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__navigation_view_controller__ = __webpack_require__(7);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
*/
var PopoverImpl = (function (_super) {
__extends(PopoverImpl, _super);
function PopoverImpl(app, component, data, opts, config) {
if (data === void 0) { data = {}; }
if (opts === void 0) { opts = {}; }
var _this = this;
opts.showBackdrop = Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["l" /* isPresent */])(opts.showBackdrop) ? !!opts.showBackdrop : true;
opts.enableBackdropDismiss = Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["l" /* isPresent */])(opts.enableBackdropDismiss) ? !!opts.enableBackdropDismiss : true;
data.component = component;
data.opts = opts;
_this = _super.call(this, __WEBPACK_IMPORTED_MODULE_1__popover_component__["a" /* PopoverCmp */], data, null) || this;
_this._app = app;
_this.isOverlay = true;
config.setTransition('popover-pop-in', __WEBPACK_IMPORTED_MODULE_2__popover_transitions__["c" /* PopoverPopIn */]);
config.setTransition('popover-pop-out', __WEBPACK_IMPORTED_MODULE_2__popover_transitions__["d" /* PopoverPopOut */]);
config.setTransition('popover-md-pop-in', __WEBPACK_IMPORTED_MODULE_2__popover_transitions__["a" /* PopoverMdPopIn */]);
config.setTransition('popover-md-pop-out', __WEBPACK_IMPORTED_MODULE_2__popover_transitions__["b" /* PopoverMdPopOut */]);
return _this;
}
/**
* @hidden
*/
PopoverImpl.prototype.getTransitionName = function (direction) {
var key = (direction === 'back' ? 'popoverLeave' : 'popoverEnter');
return this._nav && this._nav.config.get(key);
};
/**
* Present the popover instance.
*
* @param {NavOptions} [navOptions={}] Nav options to go with this transition.
* @returns {Promise} Returns a promise which is resolved when the transition has completed.
*/
PopoverImpl.prototype.present = function (navOptions) {
if (navOptions === void 0) { navOptions = {}; }
return this._app.present(this, navOptions);
};
return PopoverImpl;
}(__WEBPACK_IMPORTED_MODULE_3__navigation_view_controller__["a" /* ViewController */]));
//# sourceMappingURL=popover-impl.js.map
/***/ }),
/* 477 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export PopoverTransition */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return PopoverPopIn; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return PopoverPopOut; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PopoverMdPopIn; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return PopoverMdPopOut; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__animations_animation__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__transitions_page_transition__ = __webpack_require__(40);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* Animations for popover
*/
var PopoverTransition = (function (_super) {
__extends(PopoverTransition, _super);
function PopoverTransition() {
return _super !== null && _super.apply(this, arguments) || this;
}
PopoverTransition.prototype.mdPositionView = function (nativeEle, ev) {
var originY = 'top';
var originX = 'left';
var popoverWrapperEle = nativeEle.querySelector('.popover-wrapper');
// Popover content width and height
var popoverEle = nativeEle.querySelector('.popover-content');
var popoverDim = popoverEle.getBoundingClientRect();
var popoverWidth = popoverDim.width;
var popoverHeight = popoverDim.height;
// Window body width and height
var bodyWidth = this.plt.width();
var bodyHeight = this.plt.height();
// If ev was passed, use that for target element
var targetDim = ev && ev.target && ev.target.getBoundingClientRect();
var targetTop = (targetDim && 'top' in targetDim) ? targetDim.top : (bodyHeight / 2) - (popoverHeight / 2);
var targetLeft = (targetDim && 'left' in targetDim) ? targetDim.left : (bodyWidth / 2) - (popoverWidth / 2);
var targetHeight = targetDim && targetDim.height || 0;
var popoverCSS = {
top: targetTop,
left: targetLeft
};
// If the popover left is less than the padding it is off screen
// to the left so adjust it, else if the width of the popover
// exceeds the body width it is off screen to the right so adjust
if (popoverCSS.left < POPOVER_MD_BODY_PADDING) {
popoverCSS.left = POPOVER_MD_BODY_PADDING;
}
else if (popoverWidth + POPOVER_MD_BODY_PADDING + popoverCSS.left > bodyWidth) {
popoverCSS.left = bodyWidth - popoverWidth - POPOVER_MD_BODY_PADDING;
originX = 'right';
}
// If the popover when popped down stretches past bottom of screen,
// make it pop up if there's room above
if (targetTop + targetHeight + popoverHeight > bodyHeight && targetTop - popoverHeight > 0) {
popoverCSS.top = targetTop - popoverHeight;
nativeEle.className = nativeEle.className + ' popover-bottom';
originY = 'bottom';
// If there isn't room for it to pop up above the target cut it off
}
else if (targetTop + targetHeight + popoverHeight > bodyHeight) {
popoverEle.style.bottom = POPOVER_MD_BODY_PADDING + 'px';
}
popoverEle.style.top = popoverCSS.top + 'px';
popoverEle.style.left = popoverCSS.left + 'px';
popoverEle.style[this.plt.Css.transformOrigin] = originY + ' ' + originX;
// Since the transition starts before styling is done we
// want to wait for the styles to apply before showing the wrapper
popoverWrapperEle.style.opacity = '1';
};
PopoverTransition.prototype.iosPositionView = function (nativeEle, ev) {
var originY = 'top';
var originX = 'left';
var popoverWrapperEle = nativeEle.querySelector('.popover-wrapper');
// Popover content width and height
var popoverEle = nativeEle.querySelector('.popover-content');
var popoverDim = popoverEle.getBoundingClientRect();
var popoverWidth = popoverDim.width;
var popoverHeight = popoverDim.height;
// Window body width and height
var bodyWidth = this.plt.width();
var bodyHeight = this.plt.height();
// If ev was passed, use that for target element
var targetDim = ev && ev.target && ev.target.getBoundingClientRect();
var targetTop = (targetDim && 'top' in targetDim) ? targetDim.top : (bodyHeight / 2) - (popoverHeight / 2);
var targetLeft = (targetDim && 'left' in targetDim) ? targetDim.left : (bodyWidth / 2);
var targetWidth = targetDim && targetDim.width || 0;
var targetHeight = targetDim && targetDim.height || 0;
// The arrow that shows above the popover on iOS
var arrowEle = nativeEle.querySelector('.popover-arrow');
var arrowDim = arrowEle.getBoundingClientRect();
var arrowWidth = arrowDim.width;
var arrowHeight = arrowDim.height;
// If no ev was passed, hide the arrow
if (!targetDim) {
arrowEle.style.display = 'none';
}
var arrowCSS = {
top: targetTop + targetHeight,
left: targetLeft + (targetWidth / 2) - (arrowWidth / 2)
};
var popoverCSS = {
top: targetTop + targetHeight + (arrowHeight - 1),
left: targetLeft + (targetWidth / 2) - (popoverWidth / 2)
};
// If the popover left is less than the padding it is off screen
// to the left so adjust it, else if the width of the popover
// exceeds the body width it is off screen to the right so adjust
//
var checkSafeAreaLeft = false;
var checkSafeAreaRight = false;
// If the popover left is less than the padding it is off screen
// to the left so adjust it, else if the width of the popover
// exceeds the body width it is off screen to the right so adjust
// 25 is a random/arbitrary number. It seems to work fine for ios11
// and iPhoneX. Is it perfect? No. Does it work? Yes.
if (popoverCSS.left < (POPOVER_IOS_BODY_PADDING + 25)) {
checkSafeAreaLeft = true;
popoverCSS.left = POPOVER_IOS_BODY_PADDING;
}
else if ((popoverWidth + POPOVER_IOS_BODY_PADDING + popoverCSS.left + 25) > bodyWidth) {
// Ok, so we're on the right side of the screen,
// but now we need to make sure we're still a bit further right
// cus....notchurally... Again, 25 is random. It works tho
checkSafeAreaRight = true;
popoverCSS.left = bodyWidth - popoverWidth - POPOVER_IOS_BODY_PADDING;
originX = 'right';
}
// make it pop up if there's room above
if (targetTop + targetHeight + popoverHeight > bodyHeight && targetTop - popoverHeight > 0) {
arrowCSS.top = targetTop - (arrowHeight + 1);
popoverCSS.top = targetTop - popoverHeight - (arrowHeight - 1);
nativeEle.className = nativeEle.className + ' popover-bottom';
originY = 'bottom';
// If there isn't room for it to pop up above the target cut it off
}
else if (targetTop + targetHeight + popoverHeight > bodyHeight) {
popoverEle.style.bottom = POPOVER_IOS_BODY_PADDING + '%';
}
arrowEle.style.top = arrowCSS.top + 'px';
arrowEle.style.left = arrowCSS.left + 'px';
popoverEle.style.top = popoverCSS.top + 'px';
popoverEle.style.left = popoverCSS.left + 'px';
if (checkSafeAreaLeft) {
if (CSS.supports('left', 'constant(safe-area-inset-left)')) {
popoverEle.style.left = "calc(" + popoverCSS.left + "px + constant(safe-area-inset-left)";
}
else if (CSS.supports('left', 'env(safe-area-inset-left)')) {
popoverEle.style.left = "calc(" + popoverCSS.left + "px + env(safe-area-inset-left)";
}
}
if (checkSafeAreaRight) {
if (CSS.supports('right', 'constant(safe-area-inset-right)')) {
popoverEle.style.left = "calc(" + popoverCSS.left + "px - constant(safe-area-inset-right)";
}
else if (CSS.supports('right', 'env(safe-area-inset-right)')) {
popoverEle.style.left = "calc(" + popoverCSS.left + "px - env(safe-area-inset-right)";
}
}
popoverEle.style[this.plt.Css.transformOrigin] = originY + ' ' + originX;
// Since the transition starts before styling is done we
// want to wait for the styles to apply before showing the wrapper
popoverWrapperEle.style.opacity = '1';
};
return PopoverTransition;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_page_transition__["a" /* PageTransition */]));
var PopoverPopIn = (function (_super) {
__extends(PopoverPopIn, _super);
function PopoverPopIn() {
return _super !== null && _super.apply(this, arguments) || this;
}
PopoverPopIn.prototype.init = function () {
var ele = this.enteringView.pageRef().nativeElement;
var backdrop = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('ion-backdrop'));
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.popover-wrapper'));
wrapper.fromTo('opacity', 0.01, 1);
backdrop.fromTo('opacity', 0.01, 0.08);
this
.easing('ease')
.duration(100)
.add(backdrop)
.add(wrapper);
};
PopoverPopIn.prototype.play = function () {
var _this = this;
this.plt.raf(function () {
_this.iosPositionView(_this.enteringView.pageRef().nativeElement, _this.opts.ev);
_super.prototype.play.call(_this);
});
};
return PopoverPopIn;
}(PopoverTransition));
var PopoverPopOut = (function (_super) {
__extends(PopoverPopOut, _super);
function PopoverPopOut() {
return _super !== null && _super.apply(this, arguments) || this;
}
PopoverPopOut.prototype.init = function () {
var ele = this.leavingView.pageRef().nativeElement;
var backdrop = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('ion-backdrop'));
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.popover-wrapper'));
wrapper.fromTo('opacity', 0.99, 0);
backdrop.fromTo('opacity', 0.08, 0);
this
.easing('ease')
.duration(500)
.add(backdrop)
.add(wrapper);
};
return PopoverPopOut;
}(PopoverTransition));
var PopoverMdPopIn = (function (_super) {
__extends(PopoverMdPopIn, _super);
function PopoverMdPopIn() {
return _super !== null && _super.apply(this, arguments) || this;
}
PopoverMdPopIn.prototype.init = function () {
var ele = this.enteringView.pageRef().nativeElement;
var content = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.popover-content'));
var viewport = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.popover-viewport'));
content.fromTo('scale', 0.001, 1);
viewport.fromTo('opacity', 0.01, 1);
this
.easing('cubic-bezier(0.36,0.66,0.04,1)')
.duration(300)
.add(content)
.add(viewport);
};
PopoverMdPopIn.prototype.play = function () {
var _this = this;
this.plt.raf(function () {
_this.mdPositionView(_this.enteringView.pageRef().nativeElement, _this.opts.ev);
_super.prototype.play.call(_this);
});
};
return PopoverMdPopIn;
}(PopoverTransition));
var PopoverMdPopOut = (function (_super) {
__extends(PopoverMdPopOut, _super);
function PopoverMdPopOut() {
return _super !== null && _super.apply(this, arguments) || this;
}
PopoverMdPopOut.prototype.init = function () {
var ele = this.leavingView.pageRef().nativeElement;
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, ele.querySelector('.popover-wrapper'));
wrapper.fromTo('opacity', 0.99, 0);
this
.easing('ease')
.duration(500)
.fromTo('opacity', 0.01, 1)
.add(wrapper);
};
return PopoverMdPopOut;
}(PopoverTransition));
var POPOVER_IOS_BODY_PADDING = 2;
var POPOVER_MD_BODY_PADDING = 12;
//# sourceMappingURL=popover-transitions.js.map
/***/ }),
/* 478 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (immutable) */ __webpack_exports__["a"] = enableKeyboardControl;
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__swiper_utils__ = __webpack_require__(17);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__swiper__ = __webpack_require__(64);
/*=========================
Keyboard Control
===========================*/
function handleKeyboard(s, plt, e) {
var win = plt.win();
var kc = e.keyCode || e.charCode;
// Directions locks
if (!s._allowSwipeToNext && (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) && kc === 39 || !Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) && kc === 40)) {
return false;
}
if (!s._allowSwipeToPrev && (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) && kc === 37 || !Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) && kc === 38)) {
return false;
}
if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) {
return;
}
var activeEle = plt.getActiveElement();
if (activeEle && activeEle.nodeName && (activeEle.nodeName.toLowerCase() === 'input' || activeEle.nodeName.toLowerCase() === 'textarea')) {
return;
}
if (kc === 37 || kc === 39 || kc === 38 || kc === 40) {
var inView = false;
// Check that swiper should be inside of visible area of window
if (s.container.closest('.' + __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].slide) && !s.container.closest('.' + __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].slideActive)) {
return;
}
var windowScroll = {
left: win.pageXOffset,
top: win.pageYOffset
};
var windowWidth = plt.width();
var windowHeight = plt.height();
var swiperOffset = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["j" /* offset */])(s.container, plt);
if (s._rtl) {
swiperOffset.left = swiperOffset.left - s.container.scrollLeft;
}
var swiperCoord = [
[swiperOffset.left, swiperOffset.top],
[swiperOffset.left + s.renderedWidth, swiperOffset.top],
[swiperOffset.left, swiperOffset.top + s.renderedHeight],
[swiperOffset.left + s.renderedWidth, swiperOffset.top + s.renderedHeight]
];
for (var i = 0; i < swiperCoord.length; i++) {
var point = swiperCoord[i];
if (point[0] >= windowScroll.left && point[0] <= windowScroll.left + windowWidth &&
point[1] >= windowScroll.top && point[1] <= windowScroll.top + windowHeight) {
inView = true;
}
}
if (!inView)
return;
}
if (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s)) {
if (kc === 37 || kc === 39) {
if (e.preventDefault) {
e.preventDefault();
}
else {
e.returnValue = false;
}
}
if ((kc === 39 && !s._rtl) || (kc === 37 && s._rtl)) {
Object(__WEBPACK_IMPORTED_MODULE_1__swiper__["h" /* slideNext */])(s, plt);
}
if ((kc === 37 && !s._rtl) || (kc === 39 && s._rtl)) {
Object(__WEBPACK_IMPORTED_MODULE_1__swiper__["i" /* slidePrev */])(s, plt);
}
}
else {
if (kc === 38 || kc === 40) {
if (e.preventDefault) {
e.preventDefault();
}
else {
e.returnValue = false;
}
}
if (kc === 40) {
Object(__WEBPACK_IMPORTED_MODULE_1__swiper__["h" /* slideNext */])(s, plt);
}
if (kc === 38) {
Object(__WEBPACK_IMPORTED_MODULE_1__swiper__["i" /* slidePrev */])(s, plt);
}
}
}
function enableKeyboardControl(s, plt, shouldEnable) {
if (shouldEnable && !s._keyboardUnReg) {
s._keyboardUnReg = plt.registerListener(plt.doc(), 'keydown', function (ev) {
handleKeyboard(s, plt, ev);
}, { zone: false });
}
else if (!shouldEnable && s._keyboardUnReg) {
s._keyboardUnReg();
}
}
//# sourceMappingURL=swiper-keyboard.js.map
/***/ }),
/* 479 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export initA11y */
/* unused harmony export makeFocusable */
/* unused harmony export addRole */
/* unused harmony export addLabel */
/* harmony export (immutable) */ __webpack_exports__["a"] = ariaDisable;
/* harmony export (immutable) */ __webpack_exports__["b"] = ariaHidden;
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__swiper_utils__ = __webpack_require__(17);
function initA11y(s, plt) {
var unregs = [];
s._liveRegion = plt.doc().createElement('span');
s._liveRegion.className = __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].notification;
s._liveRegion.setAttribute('aria-live', 'assertive');
s._liveRegion.setAttribute('aria-atomic', 'true');
s.container.appendChild(s._liveRegion);
// Setup accessibility
if (s.nextButton) {
makeFocusable(s.nextButton);
addRole(s.nextButton, 'button');
addLabel(s.nextButton, s.nextSlideMessage);
plt.registerListener(s.nextButton, 'keydown', function (ev) {
onEnterKey(s, ev);
}, { zone: false }, unregs);
}
if (s.prevButton) {
makeFocusable(s.prevButton);
addRole(s.prevButton, 'button');
addLabel(s.prevButton, s.prevSlideMessage);
plt.registerListener(s.prevButton, 'keydown', function (ev) {
onEnterKey(s, ev);
}, { zone: false }, unregs);
}
return function () {
unregs.forEach(function (unreg) {
unreg();
});
unregs = null;
if (s._liveRegion) {
s._liveRegion.parentElement.removeChild(s._liveRegion);
}
};
}
function makeFocusable(ele) {
ele.setAttribute('tabIndex', '0');
}
function addRole(ele, role) {
ele.setAttribute('role', role);
}
function addLabel(ele, label) {
ele.setAttribute('aria-label', label);
}
function ariaDisable(ele, isDisabled) {
if (isDisabled) {
ele.setAttribute('aria-disabled', 'true');
}
else if (ele.hasAttribute('aria-disabled')) {
ele.removeAttribute('aria-disabled');
}
}
function ariaHidden(ele, isHidden) {
if (isHidden) {
ele.setAttribute('aria-hidden', 'true');
}
else if (ele.hasAttribute('aria-hidden')) {
ele.removeAttribute('aria-hidden');
}
}
function onEnterKey(_, __) {
// if (event.keyCode !== 13) return;
// const target: HTMLElement = <any>event.target;
// if (target.classList.contains(PARAMS.nextButtonClass)) {
// if (s.isEnd) {
// notify(s, PARAMS.lastSlideMessage);
// } else {
// notify(s, PARAMS.nextSlideMessage);
// }
// } else if (target.classList.contains(PARAMS.prevButtonClass)) {
// if (s.isBeginning) {
// notify(s, PARAMS.firstSlideMessage);
// } else {
// notify(s, PARAMS.prevSlideMessage);
// }
// }
}
// function notify(s: Slides, message: string) {
// var notification = s._liveRegion;
// if (notification) {
// notification.innerHTML = message || '';
// }
// }
//# sourceMappingURL=swiper-a11y.js.map
/***/ }),
/* 480 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SWIPER_CONTROLLER; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__swiper__ = __webpack_require__(64);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__swiper_index__ = __webpack_require__(66);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__swiper_utils__ = __webpack_require__(17);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__swiper_progress__ = __webpack_require__(65);
/*=========================
Controller
===========================*/
var SWIPER_CONTROLLER = {
LinearSpline: function (_s, _platform, x, y) {
this.x = x;
this.y = y;
this.lastIndex = x.length - 1;
// Given an x value (x2), return the expected y2 value:
// (x1,y1) is the known point before given value,
// (x3,y3) is the known point after given value.
var i1, i3;
this.interpolate = function (x2) {
if (!x2)
return 0;
// Get the indexes of x1 and x3 (the array indexes before and after given x2):
i3 = binarySearch(this.x, x2);
i1 = i3 - 1;
// We have our indexes i1 & i3, so we can calculate already:
// y2 := ((x2−x1) × (y3−y1)) ÷ (x3−x1) + y1
return ((x2 - this.x[i1]) * (this.y[i3] - this.y[i1])) / (this.x[i3] - this.x[i1]) + this.y[i1];
};
var binarySearch = (function () {
var maxIndex, minIndex, guess;
return function (array, val) {
minIndex = -1;
maxIndex = array.length;
while (maxIndex - minIndex > 1)
if (array[guess = maxIndex + minIndex >> 1] <= val) {
minIndex = guess;
}
else {
maxIndex = guess;
}
return maxIndex;
};
})();
},
// xxx: for now i will just save one spline function to to
getInterpolateFunction: function (s, plt, c) {
if (!s._spline)
s._spline = s.loop ?
new SWIPER_CONTROLLER.LinearSpline(s, plt, s._slidesGrid, c._slidesGrid) :
new SWIPER_CONTROLLER.LinearSpline(s, plt, s._snapGrid, c._snapGrid);
},
setTranslate: function (s, plt, translate, byController, setWrapperTranslate) {
var controlled = s.control;
var multiplier, controlledTranslate;
function setControlledTranslate(c) {
// this will create an Interpolate function based on the snapGrids
// x is the Grid of the scrolled scroller and y will be the controlled scroller
// it makes sense to create this only once and recall it for the interpolation
// the function does a lot of value caching for performance
translate = c._rtl && Object(__WEBPACK_IMPORTED_MODULE_2__swiper_utils__["g" /* isHorizontal */])(c) ? -s._translate : s._translate;
if (s.controlBy === 'slide') {
SWIPER_CONTROLLER.getInterpolateFunction(s, plt, c);
// i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid
// but it did not work out
controlledTranslate = -s._spline.interpolate(-translate);
}
if (!controlledTranslate || s.controlBy === 'container') {
multiplier = (Object(__WEBPACK_IMPORTED_MODULE_2__swiper_utils__["h" /* maxTranslate */])(c) - Object(__WEBPACK_IMPORTED_MODULE_2__swiper_utils__["i" /* minTranslate */])(c)) / (Object(__WEBPACK_IMPORTED_MODULE_2__swiper_utils__["h" /* maxTranslate */])(s) - Object(__WEBPACK_IMPORTED_MODULE_2__swiper_utils__["i" /* minTranslate */])(s));
controlledTranslate = (translate - Object(__WEBPACK_IMPORTED_MODULE_2__swiper_utils__["i" /* minTranslate */])(s)) * multiplier + Object(__WEBPACK_IMPORTED_MODULE_2__swiper_utils__["i" /* minTranslate */])(c);
}
if (s.controlInverse) {
controlledTranslate = Object(__WEBPACK_IMPORTED_MODULE_2__swiper_utils__["h" /* maxTranslate */])(c) - controlledTranslate;
}
Object(__WEBPACK_IMPORTED_MODULE_3__swiper_progress__["a" /* updateProgress */])(c, controlledTranslate);
setWrapperTranslate(c, plt, controlledTranslate, false, s);
Object(__WEBPACK_IMPORTED_MODULE_1__swiper_index__["a" /* updateActiveIndex */])(c);
}
if (Array.isArray(controlled)) {
for (var i = 0; i < controlled.length; i++) {
if (controlled[i] !== byController) {
setControlledTranslate(controlled[i]);
}
}
}
else if (byController !== controlled) {
setControlledTranslate(controlled);
}
},
setTransition: function (s, plt, duration, byController, setWrapperTransition) {
var controlled = s.control;
var i;
function setControlledTransition(c) {
setWrapperTransition(c, plt, duration, s);
if (duration !== 0) {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper__["f" /* onTransitionStart */])(c);
plt.transitionEnd(c._wrapper, function () {
if (!controlled)
return;
if (c.loop && s.controlBy === 'slide') {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper__["c" /* fixLoop */])(c, plt);
}
Object(__WEBPACK_IMPORTED_MODULE_0__swiper__["e" /* onTransitionEnd */])(c, plt);
});
}
}
if (Array.isArray(controlled)) {
for (i = 0; i < controlled.length; i++) {
if (controlled[i] !== byController) {
setControlledTransition(controlled[i]);
}
}
}
else if (byController !== controlled) {
setControlledTransition(controlled);
}
}
};
//# sourceMappingURL=swiper-controller.js.map
/***/ }),
/* 481 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (immutable) */ __webpack_exports__["a"] = initEvents;
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__swiper_utils__ = __webpack_require__(17);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__swiper_transition__ = __webpack_require__(112);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__swiper__ = __webpack_require__(64);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__swiper_progress__ = __webpack_require__(65);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__swiper_index__ = __webpack_require__(66);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__swiper_pagination__ = __webpack_require__(114);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__swiper_classes__ = __webpack_require__(113);
/*=========================
Events
===========================*/
// Attach/detach events
function initEvents(s, plt) {
var win = plt.win();
var doc = plt.doc();
s._supportTouch = (function () {
return !!(('ontouchstart' in win) || win.DocumentTouch && doc instanceof win.DocumentTouch);
})();
// Define Touch Events
s._touchEventsDesktop = { start: 'mousedown', move: 'mousemove', end: 'mouseup' };
if (win.navigator.pointerEnabled) {
s._touchEventsDesktop = { start: 'pointerdown', move: 'pointermove', end: 'pointerup' };
}
else if (win.navigator.msPointerEnabled) {
s._touchEventsDesktop = { start: 'MSPointerDown', move: 'MSPointerMove', end: 'MSPointerUp' };
}
s._touchEvents = {
start: s._supportTouch || !s.simulateTouch ? 'touchstart' : s._touchEventsDesktop.start,
move: s._supportTouch || !s.simulateTouch ? 'touchmove' : s._touchEventsDesktop.move,
end: s._supportTouch || !s.simulateTouch ? 'touchend' : s._touchEventsDesktop.end
};
// WP8 Touch Events Fix
if (win.navigator.pointerEnabled || win.navigator.msPointerEnabled) {
(s.touchEventsTarget === 'container' ? s.container : s._wrapper).classList.add('swiper-wp8-' + s.direction);
}
var unregs = [];
var touchEventsTarget = s.touchEventsTarget === 'container' ? s.container : s._wrapper;
// Touch Events
if (s._supportTouch) {
// touchstart
plt.registerListener(touchEventsTarget, s._touchEvents.start, function (ev) {
onTouchStart(s, plt, ev);
}, { passive: true, zone: false }, unregs);
// touchmove
plt.registerListener(touchEventsTarget, s._touchEvents.move, function (ev) {
onTouchMove(s, plt, ev);
}, { zone: false }, unregs);
// touchend
plt.registerListener(touchEventsTarget, s._touchEvents.end, function (ev) {
onTouchEnd(s, plt, ev);
}, { passive: true, zone: false }, unregs);
}
if ((s.simulateTouch && !plt.is('ios') && !plt.is('android')) || (s.simulateTouch && !s._supportTouch && plt.is('ios')) || plt.getQueryParam('ionicPlatform')) {
// mousedown
plt.registerListener(touchEventsTarget, 'mousedown', function (ev) {
onTouchStart(s, plt, ev);
}, { zone: false }, unregs);
// mousemove
plt.registerListener(touchEventsTarget, 'mousemove', function (ev) {
onTouchMove(s, plt, ev);
}, { zone: false }, unregs);
// mouseup
plt.registerListener(touchEventsTarget, 'mouseup', function (ev) {
onTouchEnd(s, plt, ev);
}, { zone: false }, unregs);
}
// onresize
var resizeObs = plt.resize.subscribe(function () { return onResize(s, plt, false); });
// Next, Prev, Index
if (s.nextButton) {
plt.registerListener(s.nextButton, 'click', function (ev) {
onClickNext(s, plt, ev);
}, { zone: false }, unregs);
}
if (s.prevButton) {
plt.registerListener(s.prevButton, 'click', function (ev) {
onClickPrev(s, plt, ev);
}, { zone: false }, unregs);
}
if (s.paginationType) {
plt.registerListener(s._paginationContainer, 'click', function (ev) {
onClickIndex(s, plt, ev);
}, { zone: false }, unregs);
}
// Prevent Links Clicks
if (s.preventClicks || s.preventClicksPropagation) {
plt.registerListener(touchEventsTarget, 'click', function (ev) {
preventClicks(s, ev);
}, { zone: false, capture: true }, unregs);
}
// return a function that removes all of the added listeners
return function () {
resizeObs.unsubscribe();
unregs.forEach(function (unreg) {
unreg();
});
unregs = null;
};
}
/*=========================
Handle Clicks
===========================*/
// Prevent Clicks
function preventClicks(s, e) {
if (!s._allowClick) {
if (s.preventClicks) {
e.preventDefault();
}
if (s.preventClicksPropagation && s._animating) {
e.stopPropagation();
e.stopImmediatePropagation();
}
}
}
// Clicks
function onClickNext(s, plt, e) {
e.preventDefault();
if (s._isEnd && !s.loop) {
return;
}
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["h" /* slideNext */])(s, plt);
}
function onClickPrev(s, plt, e) {
e.preventDefault();
if (s._isBeginning && !s.loop) {
return;
}
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["i" /* slidePrev */])(s, plt);
}
function onClickIndex(s, plt, e) {
var indexStr = e.target.getAttribute('data-slide-index');
if (indexStr) {
var index = parseInt(indexStr, 10);
e.preventDefault();
if (s.loop) {
index = index + s.loopedSlides;
}
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["k" /* slideTo */])(s, plt, index);
}
}
/*=========================
Handle Touches
===========================*/
function findElementInEvent(e, selector) {
var el = e.target;
if (!el.matches(selector)) {
if (typeof selector === 'string') {
el = el.closest(selector);
}
else if (selector.nodeType) {
var parentEl = el.parentElement;
while (parentEl) {
if (parentEl === selector) {
return selector;
}
}
return undefined;
}
}
return el;
}
function updateClickedSlide(s, plt, e) {
var slide = findElementInEvent(e, '.' + __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].slide);
var slideIndex = -1;
if (slide) {
for (var i = 0; i < s._slides.length; i++) {
if (s._slides[i] === slide) {
slideIndex = i;
break;
}
}
}
if (slide && slideIndex > -1) {
s.clickedSlide = slide;
s.clickedIndex = slideIndex;
}
else {
s.clickedSlide = undefined;
s.clickedIndex = undefined;
return;
}
if (s.slideToClickedSlide && s.clickedIndex !== undefined && s.clickedIndex !== s._activeIndex) {
var slideToIndex = s.clickedIndex;
var realIndex;
var slidesPerView = s.slidesPerView === 'auto' ? Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["a" /* currentSlidesPerView */])(s) : s.slidesPerView;
if (s.loop) {
if (s._animating)
return;
realIndex = parseInt(s.clickedSlide.getAttribute('data-swiper-slide-index'), 10);
if (s.centeredSlides) {
if ((slideToIndex < s.loopedSlides - slidesPerView / 2) || (slideToIndex > s._slides.length - s.loopedSlides + slidesPerView / 2)) {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["c" /* fixLoop */])(s, plt);
slideToIndex = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["d" /* getElementIndex */])(s._wrapper.querySelector('.' + __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].slide + '[data-swiper-slide-index="' + realIndex + '"]:not(.' + __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].slideDuplicate + ')'));
plt.timeout(function () {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["k" /* slideTo */])(s, plt, slideToIndex);
});
}
else {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["k" /* slideTo */])(s, plt, slideToIndex);
}
}
else {
if (slideToIndex > s._slides.length - slidesPerView) {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["c" /* fixLoop */])(s, plt);
slideToIndex = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["d" /* getElementIndex */])(s._wrapper.querySelector('.' + __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].slide + '[data-swiper-slide-index="' + realIndex + '"]:not(.' + __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].slideDuplicate + ')'));
plt.timeout(function () {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["k" /* slideTo */])(s, plt, slideToIndex);
});
}
else {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["k" /* slideTo */])(s, plt, slideToIndex);
}
}
}
else {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["k" /* slideTo */])(s, plt, slideToIndex);
}
}
}
var isTouched;
var isMoved;
var allowTouchCallbacks;
var touchStartTime;
var isScrolling;
var currentTranslate;
var startTranslate;
var allowThresholdMove;
// Last click time
var lastClickTime = Date.now();
var clickTimeout;
// Velocities
var velocities = [];
var allowMomentumBounce;
// Touch handlers
var isTouchEvent;
var startMoving;
function onTouchStart(s, plt, ev) {
(void 0) /* console.debug */;
if (ev.originalEvent) {
ev = ev.originalEvent;
}
s.originalEvent = ev;
isTouchEvent = ev.type === 'touchstart';
if (!isTouchEvent && 'which' in ev && ev.which === 3) {
return;
}
if (s.noSwiping && findElementInEvent(ev, '.' + __WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].noSwiping)) {
s._allowClick = true;
return;
}
if (s.swipeHandler) {
if (!findElementInEvent(ev, s.swipeHandler))
return;
}
var startX = s._touches.currentX = ev.type === 'touchstart' ? ev.targetTouches[0].pageX : ev.pageX;
var startY = s._touches.currentY = ev.type === 'touchstart' ? ev.targetTouches[0].pageY : ev.pageY;
// Do NOT start if iOS edge swipe is detected. Otherwise iOS app (UIWebView) cannot swipe-to-go-back anymore
if (plt.is('ios') && s.iOSEdgeSwipeDetection && startX <= s.iOSEdgeSwipeThreshold) {
return;
}
isTouched = true;
isMoved = false;
allowTouchCallbacks = true;
isScrolling = undefined;
startMoving = undefined;
s._touches.startX = startX;
s._touches.startY = startY;
touchStartTime = Date.now();
s._allowClick = true;
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["p" /* updateContainerSize */])(s, plt);
s.swipeDirection = undefined;
if (s.threshold > 0) {
allowThresholdMove = false;
}
if (ev.type !== 'touchstart') {
var preventDefault = true;
if (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["f" /* isFormElement */])(ev.target)) {
preventDefault = false;
}
plt.focusOutActiveElement();
if (preventDefault) {
ev.preventDefault();
}
}
s.ionSlideTouchStart.emit(ev);
}
function onTouchMove(s, plt, ev) {
(void 0) /* console.debug */;
if (ev.originalEvent) {
ev = ev.originalEvent;
}
s.originalEvent = ev;
if (isTouchEvent && ev.type === 'mousemove')
return;
if (ev.preventedByNestedSwiper) {
s._touches.startX = ev.type === 'touchmove' ? ev.targetTouches[0].pageX : ev.pageX;
s._touches.startY = ev.type === 'touchmove' ? ev.targetTouches[0].pageY : ev.pageY;
return;
}
if (s.onlyExternal) {
// isMoved = true;
s._allowClick = false;
if (isTouched) {
s._touches.startX = s._touches.currentX = ev.type === 'touchmove' ? ev.targetTouches[0].pageX : ev.pageX;
s._touches.startY = s._touches.currentY = ev.type === 'touchmove' ? ev.targetTouches[0].pageY : ev.pageY;
touchStartTime = Date.now();
}
return;
}
if (isTouchEvent && s.touchReleaseOnEdges && !s.loop) {
if (!Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s)) {
// Vertical
if ((s._touches.currentY < s._touches.startY && s._translate <= Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["h" /* maxTranslate */])(s)) ||
(s._touches.currentY > s._touches.startY && s._translate >= Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["i" /* minTranslate */])(s))) {
return;
}
}
else {
if ((s._touches.currentX < s._touches.startX && s._translate <= Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["h" /* maxTranslate */])(s)) ||
(s._touches.currentX > s._touches.startX && s._translate >= Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["i" /* minTranslate */])(s))) {
return;
}
}
}
var activeEle = plt.getActiveElement();
if (isTouchEvent && activeEle) {
if (ev.target === activeEle && Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["f" /* isFormElement */])(ev.target)) {
isMoved = true;
s._allowClick = false;
return;
}
}
if (ev.targetTouches && ev.targetTouches.length > 1)
return;
s._touches.currentX = ev.type === 'touchmove' ? ev.targetTouches[0].pageX : ev.pageX;
s._touches.currentY = ev.type === 'touchmove' ? ev.targetTouches[0].pageY : ev.pageY;
if (typeof isScrolling === 'undefined') {
var touchAngle;
if (Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) && s._touches.currentY === s._touches.startY || !Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) && s._touches.currentX === s._touches.startX) {
isScrolling = false;
}
else {
touchAngle = Math.atan2(Math.abs(s._touches.currentY - s._touches.startY), Math.abs(s._touches.currentX - s._touches.startX)) * 180 / Math.PI;
isScrolling = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? touchAngle > s.touchAngle : (90 - touchAngle > s.touchAngle);
}
}
if (!isTouched)
return;
if (isScrolling) {
isTouched = false;
return;
}
s._allowClick = false;
s.ionSlideDrag.emit(s);
ev.preventDefault();
if (s.touchMoveStopPropagation) {
ev.stopPropagation();
}
if (!isMoved) {
if (s.loop) {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["c" /* fixLoop */])(s, plt);
}
startTranslate = Object(__WEBPACK_IMPORTED_MODULE_1__swiper_transition__["b" /* getWrapperTranslate */])(s, plt);
Object(__WEBPACK_IMPORTED_MODULE_1__swiper_transition__["c" /* setWrapperTransition */])(s, plt, 0);
if (s._animating) {
Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["p" /* triggerTransitionEnd */])(plt, s._wrapper);
}
if (s.autoplay && s._autoplaying) {
if (s.autoplayDisableOnInteraction) {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["m" /* stopAutoplay */])(s);
}
else {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["g" /* pauseAutoplay */])(s, plt);
}
}
allowMomentumBounce = false;
}
isMoved = true;
var diff = s._touches.diff = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? s._touches.currentX - s._touches.startX : s._touches.currentY - s._touches.startY;
diff = diff * s.touchRatio;
if (s._rtl)
diff = -diff;
s.swipeDirection = diff > 0 ? 'prev' : 'next';
currentTranslate = diff + startTranslate;
var disableParentSwiper = true;
if ((diff > 0 && currentTranslate > Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["i" /* minTranslate */])(s))) {
disableParentSwiper = false;
if (s.resistance) {
currentTranslate = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["i" /* minTranslate */])(s) - 1 + Math.pow(-Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["i" /* minTranslate */])(s) + startTranslate + diff, s.resistanceRatio);
}
}
else if (diff < 0 && currentTranslate < Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["h" /* maxTranslate */])(s)) {
disableParentSwiper = false;
if (s.resistance)
currentTranslate = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["h" /* maxTranslate */])(s) + 1 - Math.pow(Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["h" /* maxTranslate */])(s) - startTranslate - diff, s.resistanceRatio);
}
if (disableParentSwiper) {
ev.preventedByNestedSwiper = true;
}
// Directions locks
if (!s._allowSwipeToNext && s.swipeDirection === 'next' && currentTranslate < startTranslate) {
currentTranslate = startTranslate;
}
if (!s._allowSwipeToPrev && s.swipeDirection === 'prev' && currentTranslate > startTranslate) {
currentTranslate = startTranslate;
}
// Threshold
if (s.threshold > 0) {
if (Math.abs(diff) > s.threshold || allowThresholdMove) {
if (!allowThresholdMove) {
allowThresholdMove = true;
s._touches.startX = s._touches.currentX;
s._touches.startY = s._touches.currentY;
currentTranslate = startTranslate;
s._touches.diff = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? s._touches.currentX - s._touches.startX : s._touches.currentY - s._touches.startY;
return;
}
}
else {
currentTranslate = startTranslate;
return;
}
}
if (!s.followFinger)
return;
// Update active index in free mode
if (s.freeMode || s.watchSlidesProgress) {
Object(__WEBPACK_IMPORTED_MODULE_4__swiper_index__["a" /* updateActiveIndex */])(s);
}
if (s.freeMode) {
// Velocity
if (velocities.length === 0) {
velocities.push({
position: s._touches[Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? 'startX' : 'startY'],
time: touchStartTime
});
}
velocities.push({
position: s._touches[Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["g" /* isHorizontal */])(s) ? 'currentX' : 'currentY'],
time: (new Date()).getTime()
});
}
// Update progress
Object(__WEBPACK_IMPORTED_MODULE_3__swiper_progress__["a" /* updateProgress */])(s, currentTranslate);
// Update translate
Object(__WEBPACK_IMPORTED_MODULE_1__swiper_transition__["d" /* setWrapperTranslate */])(s, plt, currentTranslate);
}
function onTouchEnd(s, plt, ev) {
(void 0) /* console.debug */;
if (ev.originalEvent) {
ev = ev.originalEvent;
}
s.originalEvent = ev;
if (allowTouchCallbacks) {
s.ionSlideTouchEnd.emit(ev);
}
allowTouchCallbacks = false;
if (!isTouched)
return;
// Time diff
var touchEndTime = Date.now();
var timeDiff = touchEndTime - touchStartTime;
// Tap, doubleTap, Click
if (s._allowClick) {
updateClickedSlide(s, plt, ev);
s._zone.run(function () {
s.ionSlideTap.emit(s);
if (timeDiff < 300 && (touchEndTime - lastClickTime) > 300) {
if (clickTimeout) {
plt.cancelTimeout(clickTimeout);
}
clickTimeout = plt.timeout(function () {
if (!s)
return;
if (s.paginationHide && s._paginationContainer && !ev.target.classList.contains(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].bullet)) {
s._paginationContainer.classList.toggle(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["a" /* CLS */].paginationHidden);
}
}, 300);
}
if (timeDiff < 300 && (touchEndTime - lastClickTime) < 300) {
if (clickTimeout)
clearTimeout(clickTimeout);
s.ionSlideDoubleTap.emit(s);
}
});
}
lastClickTime = Date.now();
plt.timeout(function () {
if (s) {
s._allowClick = true;
}
});
if (!isTouched || !isMoved || !s.swipeDirection || s._touches.diff === 0 || currentTranslate === startTranslate) {
isTouched = isMoved = false;
return;
}
isTouched = isMoved = false;
var currentPos;
if (s.followFinger) {
currentPos = s._rtl ? s._translate : -s._translate;
}
else {
currentPos = -currentTranslate;
}
if (s.freeMode) {
if (currentPos < -Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["i" /* minTranslate */])(s)) {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["k" /* slideTo */])(s, plt, s._activeIndex);
return;
}
else if (currentPos > -Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["h" /* maxTranslate */])(s)) {
if (s._slides.length < s._snapGrid.length) {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["k" /* slideTo */])(s, plt, s._snapGrid.length - 1);
}
else {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["k" /* slideTo */])(s, plt, s._slides.length - 1);
}
return;
}
if (s.freeModeMomentum) {
if (velocities.length > 1) {
var lastMoveEvent = velocities.pop(), velocityEvent = velocities.pop();
var distance = lastMoveEvent.position - velocityEvent.position;
var time = lastMoveEvent.time - velocityEvent.time;
s.velocity = distance / time;
s.velocity = s.velocity / 2;
if (Math.abs(s.velocity) < s.freeModeMinimumVelocity) {
s.velocity = 0;
}
// this implies that the user stopped moving a finger then released.
// There would be no events with distance zero, so the last event is stale.
if (time > 150 || (new Date().getTime() - lastMoveEvent.time) > 300) {
s.velocity = 0;
}
}
else {
s.velocity = 0;
}
s.velocity = s.velocity * s.freeModeMomentumVelocityRatio;
velocities.length = 0;
var momentumDuration = 1000 * s.freeModeMomentumRatio;
var momentumDistance = s.velocity * momentumDuration;
var newPosition = s._translate + momentumDistance;
if (s._rtl)
newPosition = -newPosition;
var doBounce = false;
var afterBouncePosition;
var bounceAmount = Math.abs(s.velocity) * 20 * s.freeModeMomentumBounceRatio;
if (newPosition < Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["h" /* maxTranslate */])(s)) {
if (s.freeModeMomentumBounce) {
if (newPosition + Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["h" /* maxTranslate */])(s) < -bounceAmount) {
newPosition = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["h" /* maxTranslate */])(s) - bounceAmount;
}
afterBouncePosition = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["h" /* maxTranslate */])(s);
doBounce = true;
allowMomentumBounce = true;
}
else {
newPosition = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["h" /* maxTranslate */])(s);
}
}
else if (newPosition > Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["i" /* minTranslate */])(s)) {
if (s.freeModeMomentumBounce) {
if (newPosition - Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["i" /* minTranslate */])(s) > bounceAmount) {
newPosition = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["i" /* minTranslate */])(s) + bounceAmount;
}
afterBouncePosition = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["i" /* minTranslate */])(s);
doBounce = true;
allowMomentumBounce = true;
}
else {
newPosition = Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["i" /* minTranslate */])(s);
}
}
else if (s.freeModeSticky) {
var j = 0;
var nextSlide;
for (j = 0; j < s._snapGrid.length; j += 1) {
if (s._snapGrid[j] > -newPosition) {
nextSlide = j;
break;
}
}
if (Math.abs(s._snapGrid[nextSlide] - newPosition) < Math.abs(s._snapGrid[nextSlide - 1] - newPosition) || s.swipeDirection === 'next') {
newPosition = s._snapGrid[nextSlide];
}
else {
newPosition = s._snapGrid[nextSlide - 1];
}
if (!s._rtl)
newPosition = -newPosition;
}
// Fix duration
if (s.velocity !== 0) {
if (s._rtl) {
momentumDuration = Math.abs((-newPosition - s._translate) / s.velocity);
}
else {
momentumDuration = Math.abs((newPosition - s._translate) / s.velocity);
}
}
else if (s.freeModeSticky) {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["j" /* slideReset */])(s, plt);
return;
}
if (s.freeModeMomentumBounce && doBounce) {
Object(__WEBPACK_IMPORTED_MODULE_3__swiper_progress__["a" /* updateProgress */])(s, afterBouncePosition);
Object(__WEBPACK_IMPORTED_MODULE_1__swiper_transition__["c" /* setWrapperTransition */])(s, plt, momentumDuration);
Object(__WEBPACK_IMPORTED_MODULE_1__swiper_transition__["d" /* setWrapperTranslate */])(s, plt, newPosition);
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["f" /* onTransitionStart */])(s);
s._animating = true;
plt.transitionEnd(s._wrapper, function () {
if (!s || !allowMomentumBounce)
return;
Object(__WEBPACK_IMPORTED_MODULE_1__swiper_transition__["c" /* setWrapperTransition */])(s, plt, s.speed);
Object(__WEBPACK_IMPORTED_MODULE_1__swiper_transition__["d" /* setWrapperTranslate */])(s, plt, afterBouncePosition);
plt.transitionEnd(s._wrapper, function () {
if (!s)
return;
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["e" /* onTransitionEnd */])(s, plt);
});
});
}
else if (s.velocity) {
Object(__WEBPACK_IMPORTED_MODULE_3__swiper_progress__["a" /* updateProgress */])(s, newPosition);
Object(__WEBPACK_IMPORTED_MODULE_1__swiper_transition__["c" /* setWrapperTransition */])(s, plt, momentumDuration);
Object(__WEBPACK_IMPORTED_MODULE_1__swiper_transition__["d" /* setWrapperTranslate */])(s, plt, newPosition);
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["f" /* onTransitionStart */])(s);
if (!s._animating) {
s._animating = true;
plt.transitionEnd(s._wrapper, function () {
if (!s)
return;
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["e" /* onTransitionEnd */])(s, plt);
});
}
}
else {
Object(__WEBPACK_IMPORTED_MODULE_3__swiper_progress__["a" /* updateProgress */])(s, newPosition);
}
Object(__WEBPACK_IMPORTED_MODULE_4__swiper_index__["a" /* updateActiveIndex */])(s);
}
if (!s.freeModeMomentum || timeDiff >= s.longSwipesMs) {
Object(__WEBPACK_IMPORTED_MODULE_3__swiper_progress__["a" /* updateProgress */])(s);
Object(__WEBPACK_IMPORTED_MODULE_4__swiper_index__["a" /* updateActiveIndex */])(s);
}
return;
}
// Find current slide
var stopIndex = 0;
var groupSize = s._slidesSizesGrid[0];
for (var i = 0; i < s._slidesGrid.length; i += s.slidesPerGroup) {
if (typeof s._slidesGrid[i + s.slidesPerGroup] !== 'undefined') {
if (currentPos >= s._slidesGrid[i] && currentPos < s._slidesGrid[i + s.slidesPerGroup]) {
stopIndex = i;
groupSize = s._slidesGrid[i + s.slidesPerGroup] - s._slidesGrid[i];
}
}
else {
if (currentPos >= s._slidesGrid[i]) {
stopIndex = i;
groupSize = s._slidesGrid[s._slidesGrid.length - 1] - s._slidesGrid[s._slidesGrid.length - 2];
}
}
}
// Find current slide size
var ratio = (currentPos - s._slidesGrid[stopIndex]) / groupSize;
if (timeDiff > s.longSwipesMs) {
// Long touches
if (!s.longSwipes) {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["k" /* slideTo */])(s, plt, s._activeIndex);
return;
}
if (s.swipeDirection === 'next') {
if (ratio >= s.longSwipesRatio) {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["k" /* slideTo */])(s, plt, stopIndex + s.slidesPerGroup);
}
else {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["k" /* slideTo */])(s, plt, stopIndex);
}
}
if (s.swipeDirection === 'prev') {
if (ratio > (1 - s.longSwipesRatio)) {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["k" /* slideTo */])(s, plt, stopIndex + s.slidesPerGroup);
}
else {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["k" /* slideTo */])(s, plt, stopIndex);
}
}
}
else {
// Short swipes
if (!s.shortSwipes) {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["k" /* slideTo */])(s, plt, s._activeIndex);
return;
}
if (s.swipeDirection === 'next') {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["k" /* slideTo */])(s, plt, stopIndex + s.slidesPerGroup);
}
if (s.swipeDirection === 'prev') {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["k" /* slideTo */])(s, plt, stopIndex);
}
}
}
/*=========================
Resize Handler
===========================*/
var resizeId;
function onResize(s, plt, forceUpdatePagination) {
// TODO: hacky, we should use Resize Observer in the future
if (resizeId) {
plt.cancelTimeout(resizeId);
resizeId = null;
}
resizeId = plt.timeout(function () { return doResize(s, plt, forceUpdatePagination); }, 200);
}
function doResize(s, plt, forceUpdatePagination) {
resizeId = null;
// Disable locks on resize
var allowSwipeToPrev = s._allowSwipeToPrev;
var allowSwipeToNext = s._allowSwipeToNext;
s._allowSwipeToPrev = s._allowSwipeToNext = true;
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["p" /* updateContainerSize */])(s, plt);
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["q" /* updateSlidesSize */])(s, plt);
if (s.slidesPerView === 'auto' || s.freeMode || forceUpdatePagination) {
Object(__WEBPACK_IMPORTED_MODULE_5__swiper_pagination__["a" /* updatePagination */])(s);
}
if (s._spline) {
s._spline = undefined;
}
var slideChangedBySlideTo = false;
if (s.freeMode) {
var newTranslate = Math.min(Math.max(s._translate, Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["h" /* maxTranslate */])(s)), Object(__WEBPACK_IMPORTED_MODULE_0__swiper_utils__["i" /* minTranslate */])(s));
Object(__WEBPACK_IMPORTED_MODULE_1__swiper_transition__["d" /* setWrapperTranslate */])(s, plt, newTranslate);
Object(__WEBPACK_IMPORTED_MODULE_4__swiper_index__["a" /* updateActiveIndex */])(s);
Object(__WEBPACK_IMPORTED_MODULE_6__swiper_classes__["a" /* updateClasses */])(s);
if (s.autoHeight) {
Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["o" /* updateAutoHeight */])(s);
}
}
else {
Object(__WEBPACK_IMPORTED_MODULE_6__swiper_classes__["a" /* updateClasses */])(s);
if ((s.slidesPerView === 'auto' || s.slidesPerView > 1) && s._isEnd && !s.centeredSlides) {
slideChangedBySlideTo = Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["k" /* slideTo */])(s, plt, s._slides.length - 1, 0, false, true);
}
else {
slideChangedBySlideTo = Object(__WEBPACK_IMPORTED_MODULE_2__swiper__["k" /* slideTo */])(s, plt, s._activeIndex, 0, false, true);
}
}
// Return locks after resize
s._allowSwipeToPrev = allowSwipeToPrev;
s._allowSwipeToNext = allowSwipeToNext;
}
//# sourceMappingURL=swiper-events.js.map
/***/ }),
/* 482 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ToastSlideIn; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return ToastSlideOut; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ToastMdSlideIn; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ToastMdSlideOut; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return ToastWpPopIn; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return ToastWpPopOut; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__animations_animation__ = __webpack_require__(15);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__transitions_transition__ = __webpack_require__(35);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var ToastSlideIn = (function (_super) {
__extends(ToastSlideIn, _super);
function ToastSlideIn() {
return _super !== null && _super.apply(this, arguments) || this;
}
ToastSlideIn.prototype.init = function () {
// DOM READS
var ele = this.enteringView.pageRef().nativeElement;
var wrapperEle = ele.querySelector('.toast-wrapper');
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, wrapperEle);
if (this.enteringView.data && this.enteringView.data.position === TOAST_POSITION_TOP) {
// top
// by default, it is -100% hidden (above the screen)
// so move from that to 10px below top: 0px;
wrapper.fromTo('translateY', '-100%', 10 + "px");
}
else if (this.enteringView.data && this.enteringView.data.position === TOAST_POSITION_MIDDLE) {
// Middle
// just center it and fade it in
var topPosition = Math.floor(ele.clientHeight / 2 - wrapperEle.clientHeight / 2);
// DOM WRITE
wrapperEle.style.top = topPosition + "px";
wrapper.fromTo('opacity', 0.01, 1);
}
else {
// bottom
// by default, it is 100% hidden (below the screen),
// so move from that to 10 px above bottom: 0px
wrapper.fromTo('translateY', '100%', 0 - 10 + "px");
}
this.easing('cubic-bezier(.36,.66,.04,1)').duration(400).add(wrapper);
};
return ToastSlideIn;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_transition__["a" /* Transition */]));
var ToastSlideOut = (function (_super) {
__extends(ToastSlideOut, _super);
function ToastSlideOut() {
return _super !== null && _super.apply(this, arguments) || this;
}
ToastSlideOut.prototype.init = function () {
var ele = this.leavingView.pageRef().nativeElement;
var wrapperEle = ele.querySelector('.toast-wrapper');
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, wrapperEle);
if (this.leavingView.data && this.leavingView.data.position === TOAST_POSITION_TOP) {
// top
// reverse arguments from enter transition
wrapper.fromTo('translateY', 10 + "px", '-100%');
}
else if (this.leavingView.data && this.leavingView.data.position === TOAST_POSITION_MIDDLE) {
// Middle
// just fade it out
wrapper.fromTo('opacity', 0.99, 0);
}
else {
// bottom
// reverse arguments from enter transition
wrapper.fromTo('translateY', 0 - 10 + "px", '100%');
}
this.easing('cubic-bezier(.36,.66,.04,1)').duration(300).add(wrapper);
};
return ToastSlideOut;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_transition__["a" /* Transition */]));
var ToastMdSlideIn = (function (_super) {
__extends(ToastMdSlideIn, _super);
function ToastMdSlideIn() {
return _super !== null && _super.apply(this, arguments) || this;
}
ToastMdSlideIn.prototype.init = function () {
// DOM reads
var ele = this.enteringView.pageRef().nativeElement;
var wrapperEle = ele.querySelector('.toast-wrapper');
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, wrapperEle);
if (this.enteringView.data && this.enteringView.data.position === TOAST_POSITION_TOP) {
// top
// by default, it is -100% hidden (above the screen)
// so move from that to top: 0px;
wrapper.fromTo('translateY', '-100%', "0%");
}
else if (this.enteringView.data && this.enteringView.data.position === TOAST_POSITION_MIDDLE) {
// Middle
// just center it and fade it in
var topPosition = Math.floor(ele.clientHeight / 2 - wrapperEle.clientHeight / 2);
// DOM WRITE
wrapperEle.style.top = topPosition + "px";
wrapper.fromTo('opacity', 0.01, 1);
}
else {
// bottom
// by default, it is 100% hidden (below the screen),
// so move from that to bottom: 0px
wrapper.fromTo('translateY', '100%', "0%");
}
this.easing('cubic-bezier(.36,.66,.04,1)').duration(400).add(wrapper);
};
return ToastMdSlideIn;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_transition__["a" /* Transition */]));
var ToastMdSlideOut = (function (_super) {
__extends(ToastMdSlideOut, _super);
function ToastMdSlideOut() {
return _super !== null && _super.apply(this, arguments) || this;
}
ToastMdSlideOut.prototype.init = function () {
var ele = this.leavingView.pageRef().nativeElement;
var wrapperEle = ele.querySelector('.toast-wrapper');
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, wrapperEle);
if (this.leavingView.data && this.leavingView.data.position === TOAST_POSITION_TOP) {
// top
// reverse arguments from enter transition
wrapper.fromTo('translateY', 0 + "%", '-100%');
}
else if (this.leavingView.data && this.leavingView.data.position === TOAST_POSITION_MIDDLE) {
// Middle
// just fade it out
wrapper.fromTo('opacity', 0.99, 0);
}
else {
// bottom
// reverse arguments from enter transition
wrapper.fromTo('translateY', 0 + "%", '100%');
}
this.easing('cubic-bezier(.36,.66,.04,1)').duration(450).add(wrapper);
};
return ToastMdSlideOut;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_transition__["a" /* Transition */]));
var ToastWpPopIn = (function (_super) {
__extends(ToastWpPopIn, _super);
function ToastWpPopIn() {
return _super !== null && _super.apply(this, arguments) || this;
}
ToastWpPopIn.prototype.init = function () {
var ele = this.enteringView.pageRef().nativeElement;
var wrapperEle = ele.querySelector('.toast-wrapper');
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, wrapperEle);
if (this.enteringView.data && this.enteringView.data.position === TOAST_POSITION_TOP) {
// top
wrapper.fromTo('opacity', 0.01, 1);
wrapper.fromTo('scale', 1.3, 1);
}
else if (this.enteringView.data && this.enteringView.data.position === TOAST_POSITION_MIDDLE) {
// Middle
// just center it and fade it in
var topPosition = Math.floor(ele.clientHeight / 2 - wrapperEle.clientHeight / 2);
// DOM WRITE
wrapperEle.style.top = topPosition + "px";
wrapper.fromTo('opacity', 0.01, 1);
wrapper.fromTo('scale', 1.3, 1);
}
else {
// bottom
wrapper.fromTo('opacity', 0.01, 1);
wrapper.fromTo('scale', 1.3, 1);
}
this.easing('cubic-bezier(0,0,0.05,1)').duration(200).add(wrapper);
};
return ToastWpPopIn;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_transition__["a" /* Transition */]));
var ToastWpPopOut = (function (_super) {
__extends(ToastWpPopOut, _super);
function ToastWpPopOut() {
return _super !== null && _super.apply(this, arguments) || this;
}
ToastWpPopOut.prototype.init = function () {
// DOM reads
var ele = this.leavingView.pageRef().nativeElement;
var wrapperEle = ele.querySelector('.toast-wrapper');
var wrapper = new __WEBPACK_IMPORTED_MODULE_0__animations_animation__["a" /* Animation */](this.plt, wrapperEle);
if (this.leavingView.data && this.leavingView.data.position === TOAST_POSITION_TOP) {
// top
// reverse arguments from enter transition
wrapper.fromTo('opacity', 0.99, 0);
wrapper.fromTo('scale', 1, 1.3);
}
else if (this.leavingView.data && this.leavingView.data.position === TOAST_POSITION_MIDDLE) {
// Middle
// just fade it out
wrapper.fromTo('opacity', 0.99, 0);
wrapper.fromTo('scale', 1, 1.3);
}
else {
// bottom
// reverse arguments from enter transition
wrapper.fromTo('opacity', 0.99, 0);
wrapper.fromTo('scale', 1, 1.3);
}
// DOM writes
var EASE = 'ease-out';
var DURATION = 150;
this.easing(EASE).duration(DURATION).add(wrapper);
};
return ToastWpPopOut;
}(__WEBPACK_IMPORTED_MODULE_1__transitions_transition__["a" /* Transition */]));
var TOAST_POSITION_TOP = 'top';
var TOAST_POSITION_MIDDLE = 'middle';
//# sourceMappingURL=toast-transitions.js.map
/***/ }),
/* 483 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ToggleGesture; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__gestures_gesture_controller__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__gestures_pan_gesture__ = __webpack_require__(54);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_dom__ = __webpack_require__(14);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @hidden
*/
var ToggleGesture = (function (_super) {
__extends(ToggleGesture, _super);
function ToggleGesture(plt, toggle, gestureCtrl, domCtrl) {
var _this = _super.call(this, plt, toggle.getNativeElement(), {
threshold: 0,
zone: false,
domController: domCtrl,
gesture: gestureCtrl.createGesture({
name: __WEBPACK_IMPORTED_MODULE_0__gestures_gesture_controller__["k" /* GESTURE_TOGGLE */],
priority: __WEBPACK_IMPORTED_MODULE_0__gestures_gesture_controller__["i" /* GESTURE_PRIORITY_TOGGLE */]
})
}) || this;
_this.toggle = toggle;
return _this;
}
ToggleGesture.prototype.canStart = function () {
return true;
};
ToggleGesture.prototype.onDragStart = function (ev) {
ev.preventDefault();
this.toggle._onDragStart(Object(__WEBPACK_IMPORTED_MODULE_2__util_dom__["f" /* pointerCoord */])(ev).x);
};
ToggleGesture.prototype.onDragMove = function (ev) {
ev.preventDefault();
this.toggle._onDragMove(Object(__WEBPACK_IMPORTED_MODULE_2__util_dom__["f" /* pointerCoord */])(ev).x);
};
ToggleGesture.prototype.onDragEnd = function (ev) {
ev.preventDefault();
this.toggle._onDragEnd(Object(__WEBPACK_IMPORTED_MODULE_2__util_dom__["f" /* pointerCoord */])(ev).x);
};
return ToggleGesture;
}(__WEBPACK_IMPORTED_MODULE_1__gestures_pan_gesture__["a" /* PanGesture */]));
//# sourceMappingURL=toggle-gesture.js.map
/***/ }),
/* 484 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (immutable) */ __webpack_exports__["f"] = processRecords;
/* harmony export (immutable) */ __webpack_exports__["e"] = populateNodeData;
/* harmony export (immutable) */ __webpack_exports__["d"] = initReadNodes;
/* harmony export (immutable) */ __webpack_exports__["g"] = updateDimensions;
/* harmony export (immutable) */ __webpack_exports__["h"] = updateNodeContext;
/* harmony export (immutable) */ __webpack_exports__["i"] = writeToNodes;
/* harmony export (immutable) */ __webpack_exports__["a"] = adjustRendered;
/* unused harmony export getVirtualHeight */
/* harmony export (immutable) */ __webpack_exports__["c"] = estimateHeight;
/* harmony export (immutable) */ __webpack_exports__["b"] = calcDimensions;
/* unused harmony export VirtualContext */
var PREVIOUS_CELL = {
row: 0,
width: 0,
height: 0,
top: 0,
left: 0,
tmpl: -1
};
/**
* NO DOM
*/
function processRecords(stopAtHeight, records, cells, headerFn, footerFn, data) {
var record;
var startRecordIndex;
var previousCell;
var tmpData;
var lastRecordIndex = records ? (records.length - 1) : -1;
if (cells.length) {
// we already have cells
previousCell = cells[cells.length - 1];
if (previousCell.top + previousCell.height > stopAtHeight) {
return;
}
startRecordIndex = (previousCell.record + 1);
}
else {
// no cells have been created yet
previousCell = PREVIOUS_CELL;
startRecordIndex = 0;
}
var processedTotal = 0;
for (var recordIndex = startRecordIndex; recordIndex <= lastRecordIndex; recordIndex++) {
record = records[recordIndex];
if (headerFn) {
tmpData = headerFn(record, recordIndex, records);
if (tmpData !== null) {
// add header data
previousCell = addCell(previousCell, recordIndex, 1 /* Header */, tmpData, data.hdrWidth, data.hdrHeight, data.viewWidth);
cells.push(previousCell);
}
}
// add item data
previousCell = addCell(previousCell, recordIndex, 0 /* Item */, null, data.itmWidth, data.itmHeight, data.viewWidth);
cells.push(previousCell);
if (footerFn) {
tmpData = footerFn(record, recordIndex, records);
if (tmpData !== null) {
// add footer data
previousCell = addCell(previousCell, recordIndex, 2 /* Footer */, tmpData, data.ftrWidth, data.ftrHeight, data.viewWidth);
cells.push(previousCell);
}
}
if (previousCell.record === lastRecordIndex) {
previousCell.isLast = true;
}
// should always process at least 3 records
processedTotal++;
if (previousCell.top + previousCell.height + data.itmHeight > stopAtHeight && processedTotal > 3) {
return;
}
}
}
function addCell(previousCell, recordIndex, tmpl, tmplData, cellWidth, cellHeight, viewportWidth) {
var newCell = {
record: recordIndex,
tmpl: tmpl,
width: cellWidth,
height: cellHeight,
reads: 0
};
if (previousCell.left + previousCell.width + cellWidth > viewportWidth) {
// add a new cell in a new row
newCell.row = (previousCell.row + 1);
newCell.top = (previousCell.top + previousCell.height);
newCell.left = 0;
}
else {
// add a new cell in the same row
newCell.row = previousCell.row;
newCell.top = previousCell.top;
newCell.left = (previousCell.left + previousCell.width);
}
if (tmplData) {
newCell.data = tmplData;
}
return newCell;
}
/**
* NO DOM
*/
function populateNodeData(startCellIndex, endCellIndex, scrollingDown, cells, records, nodes, viewContainer, itmTmp, hdrTmp, ftrTmp) {
if (!records || records.length === 0) {
nodes.length = 0;
viewContainer.clear();
return true;
}
var recordsLength = records.length;
var hasChanges = false;
// let node: VirtualNode;
var availableNode;
var cell;
var viewInsertIndex = null;
var totalNodes = nodes.length;
var templateRef;
startCellIndex = Math.max(startCellIndex, 0);
endCellIndex = Math.min(endCellIndex, cells.length - 1);
var usedNodes = [];
for (var cellIndex = startCellIndex; cellIndex <= endCellIndex; cellIndex++) {
cell = cells[cellIndex];
availableNode = null;
// find the first one that's available
var existingNode = nodes.find(function (n) { return n.cell === cellIndex && n.tmpl === cell.tmpl; });
if (existingNode) {
if (existingNode.view.context.$implicit === records[cell.record]) {
usedNodes.push(existingNode);
continue; // optimization: node data is the same no need to update
}
(void 0) /* console.debug */;
availableNode = existingNode; // update existing node
}
else {
(void 0) /* console.debug */;
for (var i = 0; i < totalNodes; i++) {
var node = nodes[i];
if (cell.tmpl !== node.tmpl || i === 0 && cellIndex !== 0) {
// the cell must use the correct template
// first node can only be used by the first cell (css :first-child reasons)
// this node is never available to be reused
continue;
}
if (node.cell < startCellIndex || node.cell > endCellIndex) {
if (!availableNode) {
// havent gotten an available node yet
availableNode = node;
(void 0) /* console.debug */;
}
else if (scrollingDown) {
// scrolling down
if (node.cell < availableNode.cell) {
availableNode = node;
(void 0) /* console.debug */;
}
}
else {
// scrolling up
if (node.cell > availableNode.cell) {
availableNode = node;
(void 0) /* console.debug */;
}
}
}
}
}
if (!availableNode) {
// did not find an available node to put the cell data into
// insert a new node after existing ones
if (viewInsertIndex === null) {
viewInsertIndex = -1;
for (var j = totalNodes - 1; j >= 0; j--) {
var node = nodes[j];
if (node) {
viewInsertIndex = viewContainer.indexOf(node.view);
break;
}
}
}
// select which templateRef should be used for this cell
templateRef = cell.tmpl === 1 /* Header */ ? hdrTmp : cell.tmpl === 2 /* Footer */ ? ftrTmp : itmTmp;
if (!templateRef) {
console.error("virtual" + (cell.tmpl === 1 /* Header */ ? 'Header' : cell.tmpl === 2 /* Footer */ ? 'Footer' : 'Item') + " template required");
continue;
}
availableNode = {
tmpl: cell.tmpl,
view: viewContainer.createEmbeddedView(templateRef, new VirtualContext(null, null, null), viewInsertIndex)
};
totalNodes = nodes.push(availableNode);
}
// assign who's the new cell index for this node
availableNode.cell = cellIndex;
// apply the cell's data to this node
var context = availableNode.view.context;
context.$implicit = cell.data || records[cell.record];
context.index = cellIndex;
context.count = recordsLength;
availableNode.hasChanges = true;
availableNode.lastTransform = null;
hasChanges = true;
usedNodes.push(availableNode);
}
var unusedNodes = nodes.filter(function (n) { return usedNodes.indexOf(n) < 0; });
unusedNodes.forEach(function (node) {
var index = viewContainer.indexOf(node.view);
viewContainer.remove(index);
var removeIndex = nodes.findIndex(function (n) { return n === node; });
nodes.splice(removeIndex, 1);
});
usedNodes.length = 0;
unusedNodes.length = 0;
return hasChanges;
}
/**
* DOM READ
*/
function initReadNodes(plt, nodes, cells, data) {
if (nodes.length && cells.length) {
// first node
// ******** DOM READ ****************
var ele = getElement(nodes[0]);
var firstCell = cells[0];
firstCell.top = ele.clientTop;
firstCell.left = ele.clientLeft;
firstCell.row = 0;
// ******** DOM READ ****************
updateDimensions(plt, nodes, cells, data, true);
}
}
/**
* DOM READ
*/
function updateDimensions(plt, nodes, cells, data, initialUpdate) {
var node;
var element;
var cell;
var previousCell;
var totalCells = cells.length;
for (var i = 0; i < nodes.length; i++) {
node = nodes[i];
cell = cells[node.cell];
// read element dimensions if they haven't been checked enough times
if (cell && cell.reads < REQUIRED_DOM_READS) {
element = getElement(node);
// ******** DOM READ ****************
readElements(plt, cell, element);
if (initialUpdate) {
// update estimated dimensions with more accurate dimensions
if (cell.tmpl === 1 /* Header */) {
data.hdrHeight = cell.height;
if (cell.left === 0) {
data.hdrWidth = cell.width;
}
}
else if (cell.tmpl === 2 /* Footer */) {
data.ftrHeight = cell.height;
if (cell.left === 0) {
data.ftrWidth = cell.width;
}
}
else {
data.itmHeight = cell.height;
if (cell.left === 0) {
data.itmWidth = cell.width;
}
}
}
cell.reads++;
}
}
// figure out which cells are currently viewable within the viewport
var viewableBottom = (data.scrollTop + data.viewHeight);
data.topViewCell = totalCells;
data.bottomViewCell = 0;
if (totalCells > 0) {
// completely realign position to ensure they're all accurately placed
cell = cells[0];
previousCell = {
row: 0,
width: 0,
height: 0,
top: cell.top,
left: 0,
tmpl: -1
};
for (var i_1 = 0; i_1 < totalCells; i_1++) {
cell = cells[i_1];
if (previousCell.left + previousCell.width + cell.width > data.viewWidth) {
// new row
cell.row++;
cell.top = (previousCell.top + previousCell.height);
cell.left = 0;
}
else {
// same row
cell.row = previousCell.row;
cell.top = previousCell.top;
cell.left = (previousCell.left + previousCell.width);
}
// figure out which cells are viewable within the viewport
if (cell.top + cell.height > data.scrollTop && i_1 < data.topViewCell) {
data.topViewCell = i_1;
}
else if (cell.top < viewableBottom && i_1 > data.bottomViewCell) {
data.bottomViewCell = i_1;
}
previousCell = cell;
}
}
}
function updateNodeContext(nodes, cells, data) {
// ensure each node has the correct bounds in its context
var node;
var cell;
var bounds;
for (var i = 0, ilen = nodes.length; i < ilen; i++) {
node = nodes[i];
cell = cells[node.cell];
if (node && cell) {
bounds = node.view.context.bounds;
bounds.top = cell.top + data.viewTop;
bounds.bottom = bounds.top + cell.height;
bounds.left = cell.left + data.viewLeft;
bounds.right = bounds.left + cell.width;
bounds.width = cell.width;
bounds.height = cell.height;
}
}
}
/**
* DOM READ
*/
function readElements(plt, cell, element) {
// ******** DOM READ ****************
var styles = plt.getElementComputedStyle(element);
// ******** DOM READ ****************
cell.left = (element.clientLeft - parseFloat(styles.marginLeft));
// ******** DOM READ ****************
cell.width = (element.offsetWidth + parseFloat(styles.marginLeft) + parseFloat(styles.marginRight));
// ******** DOM READ ****************
cell.height = (element.offsetHeight + parseFloat(styles.marginTop) + parseFloat(styles.marginBottom));
}
/**
* DOM WRITE
*/
function writeToNodes(plt, nodes, cells, totalRecords) {
var node;
var element;
var cell;
var transform;
var totalCells = Math.max(totalRecords, cells.length);
for (var i = 0, ilen = nodes.length; i < ilen; i++) {
node = nodes[i];
cell = cells[node.cell];
transform = "translate3d(" + cell.left + "px," + cell.top + "px,0px)";
if (node.lastTransform !== transform) {
element = getElement(node);
if (element) {
// ******** DOM WRITE ****************
element.style[plt.Css.transform] = node.lastTransform = transform;
// ******** DOM WRITE ****************
element.classList.add('virtual-position');
// https://www.w3.org/TR/wai-aria/states_and_properties#aria-posinset
// ******** DOM WRITE ****************
element.setAttribute('aria-posinset', node.cell + 1);
// https://www.w3.org/TR/wai-aria/states_and_properties#aria-setsize
// ******** DOM WRITE ****************
element.setAttribute('aria-setsize', totalCells);
}
}
}
}
/**
* NO DOM
*/
function adjustRendered(cells, data) {
var maxRenderHeight = (data.renderHeight - data.itmHeight);
var totalCells = cells.length;
var viewableRenderedPadding = (data.itmHeight < 90 ? VIEWABLE_RENDERED_PADDING : 0);
if (data.scrollDiff > 0) {
// scrolling down
data.topCell = Math.max(data.topViewCell - viewableRenderedPadding, 0);
data.bottomCell = data.topCell;
var cellsRenderHeight = 0;
for (var i = data.topCell; i < totalCells; i++) {
cellsRenderHeight += cells[i].height;
if (i > data.bottomCell)
data.bottomCell = i;
if (cellsRenderHeight >= maxRenderHeight)
break;
}
if (cellsRenderHeight < maxRenderHeight) {
// there are no more cells at the bottom, so move topCell to a smaller index
for (var i = data.topCell - 1; i >= 0; i--) {
cellsRenderHeight += cells[i].height;
data.topCell = i;
if (cellsRenderHeight >= maxRenderHeight)
break;
}
}
}
else {
// scroll up
data.bottomCell = Math.min(data.bottomViewCell + viewableRenderedPadding, totalCells - 1);
data.topCell = data.bottomCell;
var cellsRenderHeight = 0;
(void 0) /* assert */;
for (var i = data.bottomCell; i >= 0; i--) {
cellsRenderHeight += cells[i].height;
if (i < data.topCell)
data.topCell = i;
if (cellsRenderHeight >= maxRenderHeight)
break;
}
if (cellsRenderHeight < maxRenderHeight) {
// there are no more cells at the top, so move bottomCell to a higher index
for (var i = data.bottomCell; i < totalCells; i++) {
cellsRenderHeight += cells[i].height;
data.bottomCell = i;
if (cellsRenderHeight >= maxRenderHeight)
break;
}
}
}
}
/**
* NO DOM
*/
function getVirtualHeight(totalRecords, lastCell) {
if (lastCell.record >= totalRecords - 1) {
return (lastCell.top + lastCell.height);
}
var unknownRecords = (totalRecords - lastCell.record - 1);
var knownHeight = (lastCell.top + lastCell.height);
return Math.ceil(knownHeight + ((knownHeight / (totalRecords - unknownRecords)) * unknownRecords));
}
/**
* NO DOM
*/
function estimateHeight(totalRecords, lastCell, existingHeight, difference) {
if (!totalRecords || !lastCell) {
return 0;
}
var newHeight = getVirtualHeight(totalRecords, lastCell);
var percentToBottom = (lastCell.record / (totalRecords - 1));
var diff = Math.abs(existingHeight - newHeight);
if ((diff > (newHeight * difference)) ||
(percentToBottom > .995)) {
return newHeight;
}
return existingHeight;
}
/**
* DOM READ
*/
function calcDimensions(data, virtualScrollElement, approxItemWidth, approxItemHeight, appoxHeaderWidth, approxHeaderHeight, approxFooterWidth, approxFooterHeight, bufferRatio) {
// get the parent container's viewport bounds
var viewportElement = virtualScrollElement.parentElement;
// ******** DOM READ ****************
data.viewWidth = viewportElement.offsetWidth;
// ******** DOM READ ****************
data.viewHeight = viewportElement.offsetHeight;
// get the virtual scroll element's offset data
// ******** DOM READ ****************
data.viewTop = virtualScrollElement.offsetTop;
// ******** DOM READ ****************
data.viewLeft = virtualScrollElement.offsetLeft;
// the height we'd like to render, which is larger than viewable
data.renderHeight = (data.viewHeight * bufferRatio);
if (data.viewWidth > 0 && data.viewHeight > 0) {
data.itmWidth = calcWidth(data.viewWidth, approxItemWidth);
data.itmHeight = calcHeight(data.viewHeight, approxItemHeight);
data.hdrWidth = calcWidth(data.viewWidth, appoxHeaderWidth);
data.hdrHeight = calcHeight(data.viewHeight, approxHeaderHeight);
data.ftrWidth = calcWidth(data.viewWidth, approxFooterWidth);
data.ftrHeight = calcHeight(data.viewHeight, approxFooterHeight);
data.valid = true;
}
}
/**
* NO DOM
*/
function calcWidth(viewportWidth, approxWidth) {
if (approxWidth.indexOf('%') > 0) {
return (viewportWidth * (parseFloat(approxWidth) / 100));
}
else if (approxWidth.indexOf('px') > 0) {
return parseFloat(approxWidth);
}
throw new Error('virtual scroll width can only use "%" or "px" units');
}
/**
* NO DOM
*/
function calcHeight(_viewportHeight, approxHeight) {
if (approxHeight.indexOf('px') > 0) {
return parseFloat(approxHeight);
}
throw new Error('virtual scroll height must use "px" units');
}
/**
* NO DOM
*/
function getElement(node) {
var rootNodes = node.view.rootNodes;
for (var i = 0; i < rootNodes.length; i++) {
if (rootNodes[i].nodeType === 1) {
return rootNodes[i];
}
}
return null;
}
var VirtualContext = (function () {
function VirtualContext($implicit, index, count) {
this.$implicit = $implicit;
this.index = index;
this.count = count;
this.bounds = {};
}
Object.defineProperty(VirtualContext.prototype, "first", {
get: function () { return this.index === 0; },
enumerable: true,
configurable: true
});
Object.defineProperty(VirtualContext.prototype, "last", {
get: function () { return this.index === this.count - 1; },
enumerable: true,
configurable: true
});
Object.defineProperty(VirtualContext.prototype, "even", {
get: function () { return this.index % 2 === 0; },
enumerable: true,
configurable: true
});
Object.defineProperty(VirtualContext.prototype, "odd", {
get: function () { return !this.even; },
enumerable: true,
configurable: true
});
return VirtualContext;
}());
var VIEWABLE_RENDERED_PADDING = 3;
var REQUIRED_DOM_READS = 2;
//# sourceMappingURL=virtual-util.js.map
/***/ }),
/* 485 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export IonicPage */
/**
* @name IonicPage
* @description
* The Ionic Page handles registering and displaying specific pages based on URLs. It's used
* underneath `NavController` so it will never have to be interacted with directly. When a new
* page is pushed with `NavController`, the URL is updated to match the path to this page.
*
* Unlike traditional web apps, URLs don't dictate navigation in Ionic apps.
* Instead, URLs help us link to specific pieces of content as a breadcrumb.
* The current URL gets updated as we navigate, but we use the `NavController`
* push and pop, or `NavPush` and `NavPop` to move around. This makes it much easier
* to handle complicated nested navigation.
*
* We refer to our URL system as a deep link system instead of a router to encourage
* Ionic developers to think of URLs as a breadcrumb rather than as the source of
* truth in navigation. This encourages flexible navigation design and happy apps all
* over the world.
*
*
* @usage
*
* The first step to setting up deep links is to add the page that should be
* a deep link in the `IonicPageModule.forChild` import of the page's module.
* For our examples, this will be `MyPage`:
*
* ```ts
* @NgModule({
* declarations: [
* MyPage
* ],
* imports: [
* IonicPageModule.forChild(MyPage)
* ],
* entryComponents: [
* MyPage
* ]
* })
* export class MyPageModule {}
* ```
*
* Then, add the `@IonicPage` decorator to the component. The most simple usage is adding an
* empty decorator:
*
* ```ts
* @IonicPage()
* @Component({
* templateUrl: 'main.html'
* })
* export class MyPage {}
* ```
*
* This will automatically create a link to the `MyPage` component using the same name as the class,
* `name`: `'MyPage'`. The page can now be navigated to by using this name. For example:
*
* ```ts
* @Component({
* templateUrl: 'another-page.html'
* })
* export class AnotherPage {
* constructor(public navCtrl: NavController) {}
*
* goToMyPage() {
* // go to the MyPage component
* this.navCtrl.push('MyPage');
* }
* }
* ```
*
* The `@IonicPage` decorator accepts a `DeepLinkMetadataType` object. This object accepts
* the following properties: `name`, `segment`, `defaultHistory`, and `priority`. All of them
* are optional but can be used to create complex navigation links.
*
*
* ### Changing Name
*
* As mentioned previously, the `name` property will be set to the class name if it isn't provided.
* Changing the name of the link is extremely simple. To change the name used to link to the
* component, simply pass it in the decorator like so:
*
* ```ts
* @IonicPage({
* name: 'my-page'
* })
* ```
*
* This will create a link to the `MyPage` component using the name `'my-page'`. Similar to the previous
* example, the page can be navigated to by using the name:
*
* ```ts
* goToMyPage() {
* // go to the MyPage component
* this.navCtrl.push('my-page');
* }
* ```
*
*
* ### Setting URL Path
*
* The `segment` property is used to set the URL to the page. If this property isn't provided, the
* `segment` will use the value of `name`. Since components can be loaded anywhere in the app, the
* `segment` doesn't require a full URL path. When a page becomes the active page, the `segment` is
* appended to the URL.
*
* The `segment` can be changed to anything and doesn't have to match the `name`. For example, passing
* a value for `name` and `segment`:
*
* ```ts
* @IonicPage({
* name: 'my-page',
* segment: 'some-path'
* })
* ```
*
* When navigating to this page as the first page in the app, the URL will look something like:
*
* ```
* http://localhost:8101/#/some-path
* ```
*
* However, navigating to the page will still use the `name` like the previous examples do.
*
*
* ### Dynamic Links
*
* The `segment` property is useful for creating dynamic links. Sometimes the URL isn't known ahead
* of time, so it can be passed as a variable.
*
* Since passing data around is common practice in an app, it can be reflected in the app's URL by
* using the `:param` syntax. For example, set the `segment` in the `@IonicPage` decorator:
*
* ```ts
* @IonicPage({
* name: 'detail-page',
* segment: 'detail/:id'
* })
* ```
*
* In this case, when we `push` to a new instance of `'detail-page'`, the value of `id` will
* in the `detailInfo` data being passed to `push` will replace `:id` in the URL.
*
* Important: The property needs to be something that can be converted into a string, objects
* are not supported.
*
* For example, to push the `'detail-page'` in the `ListPage` component, the following code could
* be used:
*
* ```ts
* @IonicPage({
* name: 'list'
* })
* export class ListPage {
* constructor(public navCtrl: NavController) {}
*
* pushPage(detailInfo) {
* // Push an `id` to the `'detail-page'`
* this.navCtrl.push('detail-page', {
* 'id': detailInfo.id
* })
* }
* }
* ```
*
* If the value of `detailInfo.id` is `12`, for example, the URL would end up looking like this:
*
* ```
* http://localhost:8101/#/list/detail/12
* ```
*
* Since this `id` will be used to pull in the data of the specific detail page, it's Important
* that the `id` is unique.
*
* Note: Even though the `name` is `detail-page`, the `segment` uses `detail/:id`, and the URL
* will use the `segment`.
*
*
* ### Default History
*
* Pages can be navigated to using deep links from anywhere in the app, but sometimes the app is
* launched from a URL and the page needs to have the same history as if it were navigated to from
* inside of the app.
*
* By default, the page would be navigated to as the first page in the stack with no prior history.
* A good example is the App Store on iOS. Clicking on a URL to an application in the App Store will
* load the details of the application with no back button, as if it were the first page ever viewed.
*
* The default history of any page can be set in the `defaultHistory` property. This history will only
* be used if the history doesn't already exist, meaning if you navigate to the page the history will
* be the pages that were navigated from.
*
* The `defaultHistory` property takes an array of page names. The page names are specified as statically
* analyzable strings (which means you must use strings and not variables or delared constants). If the
* parent page does not have a `name` specified in its `IonicPage` decorator its name is its class name.
*
* For example, setting the history of the detail page to the list page where the `name` is `list`:
*
* ```ts
* @IonicPage({
* name: 'detail-page',
* segment: 'detail/:id',
* defaultHistory: ['list']
* })
* ```
*
* In this example, if the app is launched at `http://localhost:8101/#/detail/my-detail` the displayed page
* will be the `'detail-page'` with an id of `my-detail` and it will show a back button that goes back to
* the `'list'` page.
*
* For a deeper example:
*
* ```ts
* @IonicPage({
* segment: 'contact-more-info',
* defaultHistory: ['ContactDetailPage', 'Contact']
* })
* ...
* export class ContactMoreInfoPage {
* ...
* }
* ```
*
* In this example, if the app is launched at `http://localhost:8101/#/contact/contact-more-info` the displayed page
* will be the `'ContactMoreInfoPage'`. It will show a back button that will go to the `'ContactDetailPage'` which
* will also show a back button which will go to the `'Constact'` page.
*
* An example of an application with a set history stack is the Instagram application. Opening a link
* to an image on Instagram will show the details for that image with a back button to the user's profile
* page. There is no "right" way of setting the history for a page, it is up to the application.
*
* ### Priority
*
* The `priority` property is only used during preloading. By default, preloading is turned off so setting
* this property would do nothing. Preloading eagerly loads all deep links after the application boots
* instead of on demand as needed. To enable preloading, set `preloadModules` in the main application module
* config to `true`:
*
* ```ts
* @NgModule({
* declarations: [
* MyApp
* ],
* imports: [
* BrowserModule,
* IonicModule.forRoot(MyApp, {
* preloadModules: true
* })
* ],
* bootstrap: [IonicApp],
* entryComponents: [
* MyApp
* ]
* })
* export class AppModule { }
* ```
*
* If preloading is turned on, it will load the modules based on the value of `priority`. The following
* values are possible for `priority`: `"high"`, `"low"`, and `"off"`. When there is no `priority`, it
* will be set to `"low"`.
*
* All deep links with their priority set to `"high"` will be loaded first. Upon completion of loading the
* `"high"` priority modules, all deep links with a priority of `"low"` (or no priority) will be loaded. If
* the priority is set to `"off"` the link will not be preloaded. Setting the `priority` is as simple as
* passing it to the `@IonicPage` decorator:
*
* ```ts
* @IonicPage({
* name: 'my-page',
* priority: 'high'
* })
* ```
*
* We recommend setting the `priority` to `"high"` on the pages that will be viewed first when launching
* the application.
*
*/
function IonicPage(_config) {
return function (clazz) {
return clazz;
};
}
//# sourceMappingURL=ionic-page.js.map
/***/ }),
/* 486 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return RippleActivator; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__activator_base__ = __webpack_require__(347);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__activator__ = __webpack_require__(346);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_dom__ = __webpack_require__(14);
/**
* @hidden
*/
var RippleActivator = (function () {
function RippleActivator(app, config, dom) {
this.dom = dom;
this.highlight = new __WEBPACK_IMPORTED_MODULE_1__activator__["a" /* Activator */](app, config, dom);
}
RippleActivator.prototype.clickAction = function (ev, activatableEle, startCoord) {
// Highlight
this.highlight && this.highlight.clickAction(ev, activatableEle, startCoord);
// Ripple
this._clickAction(ev, activatableEle, startCoord);
};
RippleActivator.prototype.downAction = function (ev, activatableEle, startCoord) {
// Highlight
this.highlight && this.highlight.downAction(ev, activatableEle, startCoord);
// Ripple
this._downAction(ev, activatableEle, startCoord);
};
RippleActivator.prototype.upAction = function (ev, activatableEle, startCoord) {
// Highlight
this.highlight && this.highlight.upAction(ev, activatableEle, startCoord);
// Ripple
this._upAction(ev, activatableEle, startCoord);
};
RippleActivator.prototype.clearState = function (animated) {
// Highlight
this.highlight && this.highlight.clearState(animated);
};
RippleActivator.prototype._downAction = function (ev, activatableEle, _startCoord) {
if (Object(__WEBPACK_IMPORTED_MODULE_0__activator_base__["a" /* isActivatedDisabled */])(ev, activatableEle)) {
return;
}
var j = activatableEle.childElementCount;
while (j--) {
var rippleEle = activatableEle.children[j];
if (rippleEle.classList.contains('button-effect')) {
// DOM READ
var clientRect = activatableEle.getBoundingClientRect();
rippleEle.$top = clientRect.top;
rippleEle.$left = clientRect.left;
rippleEle.$width = clientRect.width;
rippleEle.$height = clientRect.height;
break;
}
}
};
RippleActivator.prototype._upAction = function (ev, activatableEle, startCoord) {
if (!Object(__WEBPACK_IMPORTED_MODULE_2__util_dom__["d" /* hasPointerMoved */])(6, startCoord, Object(__WEBPACK_IMPORTED_MODULE_2__util_dom__["f" /* pointerCoord */])(ev))) {
var i = activatableEle.childElementCount;
while (i--) {
var rippleEle = activatableEle.children[i];
if (rippleEle.classList.contains('button-effect')) {
// DOM WRITE
this.startRippleEffect(rippleEle, activatableEle, startCoord);
break;
}
}
}
};
RippleActivator.prototype._clickAction = function (_ev, _activatableEle, _startCoord) {
// NOTHING
};
RippleActivator.prototype.startRippleEffect = function (rippleEle, activatableEle, startCoord) {
if (!startCoord) {
return;
}
var clientPointerX = (startCoord.x - rippleEle.$left);
var clientPointerY = (startCoord.y - rippleEle.$top);
var x = Math.max(Math.abs(rippleEle.$width - clientPointerX), clientPointerX) * 2;
var y = Math.max(Math.abs(rippleEle.$height - clientPointerY), clientPointerY) * 2;
var diameter = Math.min(Math.max(Math.hypot(x, y), 64), 240);
if (activatableEle.hasAttribute('ion-item')) {
diameter = Math.min(diameter, 140);
}
clientPointerX -= diameter / 2;
clientPointerY -= diameter / 2;
clientPointerX = Math.round(clientPointerX);
clientPointerY = Math.round(clientPointerY);
diameter = Math.round(diameter);
// Reset ripple
// DOM WRITE
var Css = this.dom.plt.Css;
rippleEle.style.opacity = '';
rippleEle.style[Css.transform] = "translate3d(" + clientPointerX + "px, " + clientPointerY + "px, 0px) scale(0.001)";
rippleEle.style[Css.transition] = '';
// Start ripple animation
var radius = Math.sqrt(rippleEle.$width + rippleEle.$height);
var scaleTransitionDuration = Math.max(1600 * Math.sqrt(radius / TOUCH_DOWN_ACCEL) + 0.5, 260);
var opacityTransitionDuration = Math.round(scaleTransitionDuration * 0.7);
var opacityTransitionDelay = Math.round(scaleTransitionDuration - opacityTransitionDuration);
scaleTransitionDuration = Math.round(scaleTransitionDuration);
var transform = "translate3d(" + clientPointerX + "px, " + clientPointerY + "px, 0px) scale(1)";
var transition = "transform " + scaleTransitionDuration + "ms,opacity " + opacityTransitionDuration + "ms " + opacityTransitionDelay + "ms";
this.dom.write(function () {
// DOM WRITE
rippleEle.style.width = rippleEle.style.height = diameter + 'px';
rippleEle.style.opacity = '0';
rippleEle.style[Css.transform] = transform;
rippleEle.style[Css.transition] = transition;
}, 16);
};
return RippleActivator;
}());
var TOUCH_DOWN_ACCEL = 300;
//# sourceMappingURL=ripple.js.map
/***/ }),
/* 487 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export Gesture */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_util__ = __webpack_require__(3);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__hammer__ = __webpack_require__(488);
/**
* @hidden
* A gesture recognizer class.
*
* TODO(mlynch): Re-enable the DOM event simulation that was causing issues (or verify hammer does this already, it might);
*/
var Gesture = (function () {
function Gesture(element, opts) {
if (opts === void 0) { opts = {}; }
this._callbacks = {};
this.isListening = false;
Object(__WEBPACK_IMPORTED_MODULE_0__util_util__["d" /* defaults */])(opts, {
domEvents: true
});
this.element = element;
// Map 'x' or 'y' string to hammerjs opts
this.direction = opts.direction || 'x';
opts.direction = this.direction === 'x' ?
__WEBPACK_IMPORTED_MODULE_1__hammer__["a" /* DIRECTION_HORIZONTAL */] :
__WEBPACK_IMPORTED_MODULE_1__hammer__["b" /* DIRECTION_VERTICAL */];
this._options = opts;
}
Gesture.prototype.options = function (opts) {
Object.assign(this._options, opts);
};
Gesture.prototype.on = function (type, cb) {
if (type === 'pinch' || type === 'rotate') {
this._hammer.get(type).set({ enable: true });
}
this._hammer.on(type, cb);
(this._callbacks[type] || (this._callbacks[type] = [])).push(cb);
};
Gesture.prototype.off = function (type, cb) {
this._hammer.off(type, this._callbacks[type] ? cb : null);
};
Gesture.prototype.listen = function () {
if (!this.isListening) {
this._hammer = Object(__WEBPACK_IMPORTED_MODULE_1__hammer__["c" /* Hammer */])(this.element, this._options);
}
this.isListening = true;
};
Gesture.prototype.unlisten = function () {
var eventType;
var i;
if (this._hammer && this.isListening) {
for (eventType in this._callbacks) {
for (i = 0; i < this._callbacks[eventType].length; i++) {
this._hammer.off(eventType, this._callbacks[eventType]);
}
}
this._hammer.destroy();
}
this._callbacks = {};
this._hammer = null;
this.isListening = false;
};
Gesture.prototype.destroy = function () {
this.unlisten();
this.element = this._options = null;
};
return Gesture;
}());
//# sourceMappingURL=gesture.js.map
/***/ }),
/* 488 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export DIRECTION_LEFT */
/* unused harmony export DIRECTION_RIGHT */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DIRECTION_HORIZONTAL; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return DIRECTION_VERTICAL; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return Hammer; });
/* tslint:disable */
var win = window;
var doc = document;
/*! Hammer.JS - v2.0.6 - 2015-12-23
* http://hammerjs.github.io/
*
* Copyright (c) 2015 Jorik Tangelder;
* Licensed under the license */
var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];
var TEST_ELEMENT = doc.createElement('div');
var TYPE_FUNCTION = 'function';
var round = Math.round;
var abs = Math.abs;
var now = Date.now;
/**
* set a timeout with a given scope
* @param {Function} fn
* @param {Number} timeout
* @param {Object} context
* @returns {number}
*/
function setTimeoutContext(fn, timeout, context) {
return setTimeout(bindFn(fn, context), timeout);
}
/**
* if the argument is an array, we want to execute the fn on each entry
* if it aint an array we don't want to do a thing.
* this is used by all the methods that accept a single and array argument.
* @param {*|Array} arg
* @param {String} fn
* @param {Object} [context]
* @returns {Boolean}
*/
function invokeArrayArg(arg, fn, context) {
if (Array.isArray(arg)) {
each(arg, context[fn], context);
return true;
}
return false;
}
/**
* walk objects and arrays
* @param {Object} obj
* @param {Function} iterator
* @param {Object} context
*/
function each(obj, iterator, context) {
var i;
if (!obj) {
return;
}
if (obj.forEach) {
obj.forEach(iterator, context);
}
else if (obj.length !== undefined) {
i = 0;
while (i < obj.length) {
iterator.call(context, obj[i], i, obj);
i++;
}
}
else {
for (i in obj) {
obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);
}
}
}
/**
* simple class inheritance
* @param {Function} child
* @param {Function} base
* @param {Object} [properties]
*/
function inherit(child, base, properties) {
var baseP = base.prototype, childP;
childP = child.prototype = Object.create(baseP);
childP.constructor = child;
childP._super = baseP;
if (properties) {
Object.assign(childP, properties);
}
}
/**
* simple function bind
* @param {Function} fn
* @param {Object} context
* @returns {Function}
*/
function bindFn(fn, context) {
return function boundFn() {
return fn.apply(context, arguments);
};
}
/**
* let a boolean value also be a function that must return a boolean
* this first item in args will be used as the context
* @param {Boolean|Function} val
* @param {Array} [args]
* @returns {Boolean}
*/
function boolOrFn(val, args) {
if (typeof val == TYPE_FUNCTION) {
return val.apply(args ? args[0] || undefined : undefined, args);
}
return val;
}
/**
* use the val2 when val1 is undefined
* @param {*} val1
* @param {*} val2
* @returns {*}
*/
function ifUndefined(val1, val2) {
return (val1 === undefined) ? val2 : val1;
}
/**
* addEventListener with multiple events at once
* @param {EventTarget} target
* @param {String} types
* @param {Function} handler
*/
function addEventListeners(target, types, handler) {
each(splitStr(types), function (type) {
target.addEventListener(type, handler, false);
});
}
/**
* removeEventListener with multiple events at once
* @param {EventTarget} target
* @param {String} types
* @param {Function} handler
*/
function removeEventListeners(target, types, handler) {
each(splitStr(types), function (type) {
target.removeEventListener(type, handler, false);
});
}
/**
* find if a node is in the given parent
* @method hasParent
* @param {HTMLElement} node
* @param {HTMLElement} parent
* @return {Boolean} found
*/
function hasParent(node, parent) {
while (node) {
if (node == parent) {
return true;
}
node = node.parentNode;
}
return false;
}
/**
* small indexOf wrapper
* @param {String} str
* @param {String} find
* @returns {Boolean} found
*/
function inStr(str, find) {
return str.indexOf(find) > -1;
}
/**
* split string on whitespace
* @param {String} str
* @returns {Array} words
*/
function splitStr(str) {
return str.trim().split(/\s+/g);
}
/**
* find if a array contains the object using indexOf or a simple polyFill
* @param {Array} src
* @param {String} find
* @param {String} [findByKey]
* @return {Boolean|Number} false when not found, or the index
*/
function inArray(src, find, findByKey) {
if (src.indexOf && !findByKey) {
return src.indexOf(find);
}
else {
var i = 0;
while (i < src.length) {
if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) {
return i;
}
i++;
}
return -1;
}
}
/**
* convert array-like objects to real arrays
* @param {Object} obj
* @returns {Array}
*/
function toArray(obj) {
return Array.prototype.slice.call(obj, 0);
}
/**
* unique array with objects based on a key (like 'id') or just by the array's value
* @param {Array} src [{id:1},{id:2},{id:1}]
* @param {String} [key]
* @param {Boolean} [sort=False]
* @returns {Array} [{id:1},{id:2}]
*/
function uniqueArray(src, key, sort) {
var results = [];
var values = [];
var i = 0;
while (i < src.length) {
var val = key ? src[i][key] : src[i];
if (inArray(values, val) < 0) {
results.push(src[i]);
}
values[i] = val;
i++;
}
if (sort) {
if (!key) {
results = results.sort();
}
else {
results = results.sort(function sortUniqueArray(a, b) {
return a[key] > b[key] ? 1 : 0;
});
}
}
return results;
}
/**
* get the prefixed property
* @param {Object} obj
* @param {String} property
* @returns {String|Undefined} prefixed
*/
function prefixed(obj, property) {
var prefix, prop;
var camelProp = property[0].toUpperCase() + property.slice(1);
var i = 0;
while (i < VENDOR_PREFIXES.length) {
prefix = VENDOR_PREFIXES[i];
prop = (prefix) ? prefix + camelProp : property;
if (prop in obj) {
return prop;
}
i++;
}
return undefined;
}
/**
* get a unique id
* @returns {number} uniqueId
*/
var _uniqueId = 1;
function uniqueId() {
return _uniqueId++;
}
/**
* get the window object of an element
* @param {HTMLElement} element
* @returns {DocumentView|Window}
*/
function getWindowForElement(element) {
var doc = element.ownerDocument || element;
return (doc.defaultView || doc.parentWindow || window);
}
var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;
var SUPPORT_TOUCH = ('ontouchstart' in window);
var SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;
var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);
var INPUT_TYPE_TOUCH = 'touch';
var INPUT_TYPE_PEN = 'pen';
var INPUT_TYPE_MOUSE = 'mouse';
var INPUT_TYPE_KINECT = 'kinect';
var COMPUTE_INTERVAL = 25;
var INPUT_START = 1;
var INPUT_MOVE = 2;
var INPUT_END = 4;
var INPUT_CANCEL = 8;
var DIRECTION_NONE = 1;
var DIRECTION_LEFT = 2;
var DIRECTION_RIGHT = 4;
var DIRECTION_UP = 8;
var DIRECTION_DOWN = 16;
var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;
var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;
var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;
var PROPS_XY = ['x', 'y'];
var PROPS_CLIENT_XY = ['clientX', 'clientY'];
/**
* create new input type manager
* @param {Manager} manager
* @param {Function} callback
* @returns {Input}
* @constructor
*/
function Input(manager, callback) {
var self = this;
this.manager = manager;
this.callback = callback;
this.element = manager.element;
this.target = manager.options.inputTarget;
// smaller wrapper around the handler, for the scope and the enabled state of the manager,
// so when disabled the input events are completely bypassed.
this.domHandler = function (ev) {
if (boolOrFn(manager.options.enable, [manager])) {
self.handler(ev);
}
};
this.init();
}
Input.prototype = {
/**
* should handle the inputEvent data and trigger the callback
* @virtual
*/
handler: function () { },
/**
* bind the events
*/
init: function () {
this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);
this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);
this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
},
/**
* unbind the events
*/
destroy: function () {
this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);
this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);
this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);
}
};
/**
* create new input type manager
* called by the Manager constructor
* @param {Hammer} manager
* @returns {Input}
*/
function createInputInstance(manager) {
var Type;
var inputClass = manager.options.inputClass;
if (inputClass) {
Type = inputClass;
}
else if (SUPPORT_POINTER_EVENTS) {
Type = PointerEventInput;
}
else if (SUPPORT_ONLY_TOUCH) {
Type = TouchInput;
}
else if (!SUPPORT_TOUCH) {
Type = MouseInput;
}
else {
Type = TouchMouseInput;
}
return new (Type)(manager, inputHandler);
}
/**
* handle input events
* @param {Manager} manager
* @param {String} eventType
* @param {Object} input
*/
function inputHandler(manager, eventType, input) {
var pointersLen = input.pointers.length;
var changedPointersLen = input.changedPointers.length;
var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0));
var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0));
input.isFirst = !!isFirst;
input.isFinal = !!isFinal;
if (isFirst) {
manager.session = {};
}
// source event is the normalized value of the domEvents
// like 'touchstart, mouseup, pointerdown'
input.eventType = eventType;
// compute scale, rotation etc
computeInputData(manager, input);
// emit secret event
manager.emit('hammer.input', input);
manager.recognize(input);
manager.session.prevInput = input;
}
/**
* extend the data with some usable properties like scale, rotate, velocity etc
* @param {Object} manager
* @param {Object} input
*/
function computeInputData(manager, input) {
var session = manager.session;
var pointers = input.pointers;
var pointersLength = pointers.length;
// store the first input to calculate the distance and direction
if (!session.firstInput) {
session.firstInput = simpleCloneInputData(input);
}
// to compute scale and rotation we need to store the multiple touches
if (pointersLength > 1 && !session.firstMultiple) {
session.firstMultiple = simpleCloneInputData(input);
}
else if (pointersLength === 1) {
session.firstMultiple = false;
}
var firstInput = session.firstInput;
var firstMultiple = session.firstMultiple;
var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;
var center = input.center = getCenter(pointers);
input.timeStamp = now();
input.deltaTime = input.timeStamp - firstInput.timeStamp;
input.angle = getAngle(offsetCenter, center);
input.distance = getDistance(offsetCenter, center);
computeDeltaXY(session, input);
input.offsetDirection = getDirection(input.deltaX, input.deltaY);
var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);
input.overallVelocityX = overallVelocity.x;
input.overallVelocityY = overallVelocity.y;
input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y;
input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;
input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;
input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length >
session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers);
computeIntervalInputData(session, input);
// find the correct target
var target = manager.element;
if (hasParent(input.srcEvent.target, target)) {
target = input.srcEvent.target;
}
input.target = target;
}
function computeDeltaXY(session, input) {
var center = input.center;
var offset = session.offsetDelta || {};
var prevDelta = session.prevDelta || {};
var prevInput = session.prevInput || {};
if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {
prevDelta = session.prevDelta = {
x: prevInput.deltaX || 0,
y: prevInput.deltaY || 0
};
offset = session.offsetDelta = {
x: center.x,
y: center.y
};
}
input.deltaX = prevDelta.x + (center.x - offset.x);
input.deltaY = prevDelta.y + (center.y - offset.y);
}
/**
* velocity is calculated every x ms
* @param {Object} session
* @param {Object} input
*/
function computeIntervalInputData(session, input) {
var last = session.lastInterval || input, deltaTime = input.timeStamp - last.timeStamp, velocity, velocityX, velocityY, direction;
if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {
var deltaX = input.deltaX - last.deltaX;
var deltaY = input.deltaY - last.deltaY;
var v = getVelocity(deltaTime, deltaX, deltaY);
velocityX = v.x;
velocityY = v.y;
velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y;
direction = getDirection(deltaX, deltaY);
session.lastInterval = input;
}
else {
// use latest velocity info if it doesn't overtake a minimum period
velocity = last.velocity;
velocityX = last.velocityX;
velocityY = last.velocityY;
direction = last.direction;
}
input.velocity = velocity;
input.velocityX = velocityX;
input.velocityY = velocityY;
input.direction = direction;
}
/**
* create a simple clone from the input used for storage of firstInput and firstMultiple
* @param {Object} input
* @returns {Object} clonedInputData
*/
function simpleCloneInputData(input) {
// make a simple copy of the pointers because we will get a reference if we don't
// we only need clientXY for the calculations
var pointers = [];
var i = 0;
while (i < input.pointers.length) {
pointers[i] = {
clientX: round(input.pointers[i].clientX),
clientY: round(input.pointers[i].clientY)
};
i++;
}
return {
timeStamp: now(),
pointers: pointers,
center: getCenter(pointers),
deltaX: input.deltaX,
deltaY: input.deltaY
};
}
/**
* get the center of all the pointers
* @param {Array} pointers
* @return {Object} center contains `x` and `y` properties
*/
function getCenter(pointers) {
var pointersLength = pointers.length;
// no need to loop when only one touch
if (pointersLength === 1) {
return {
x: round(pointers[0].clientX),
y: round(pointers[0].clientY)
};
}
var x = 0, y = 0, i = 0;
while (i < pointersLength) {
x += pointers[i].clientX;
y += pointers[i].clientY;
i++;
}
return {
x: round(x / pointersLength),
y: round(y / pointersLength)
};
}
/**
* calculate the velocity between two points. unit is in px per ms.
* @param {Number} deltaTime
* @param {Number} x
* @param {Number} y
* @return {Object} velocity `x` and `y`
*/
function getVelocity(deltaTime, x, y) {
return {
x: x / deltaTime || 0,
y: y / deltaTime || 0
};
}
/**
* get the direction between two points
* @param {Number} x
* @param {Number} y
* @return {Number} direction
*/
function getDirection(x, y) {
if (x === y) {
return DIRECTION_NONE;
}
if (abs(x) >= abs(y)) {
return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;
}
return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;
}
/**
* calculate the absolute distance between two points
* @param {Object} p1 {x, y}
* @param {Object} p2 {x, y}
* @param {Array} [props] containing x and y keys
* @return {Number} distance
*/
function getDistance(p1, p2, props) {
if (!props) {
props = PROPS_XY;
}
var x = p2[props[0]] - p1[props[0]], y = p2[props[1]] - p1[props[1]];
return Math.sqrt((x * x) + (y * y));
}
/**
* calculate the angle between two coordinates
* @param {Object} p1
* @param {Object} p2
* @param {Array} [props] containing x and y keys
* @return {Number} angle
*/
function getAngle(p1, p2, props) {
if (!props) {
props = PROPS_XY;
}
var x = p2[props[0]] - p1[props[0]], y = p2[props[1]] - p1[props[1]];
return Math.atan2(y, x) * 180 / Math.PI;
}
/**
* calculate the rotation degrees between two pointersets
* @param {Array} start array of pointers
* @param {Array} end array of pointers
* @return {Number} rotation
*/
function getRotation(start, end) {
return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);
}
/**
* calculate the scale factor between two pointersets
* no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out
* @param {Array} start array of pointers
* @param {Array} end array of pointers
* @return {Number} scale
*/
function getScale(start, end) {
return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);
}
var MOUSE_INPUT_MAP = {
mousedown: INPUT_START,
mousemove: INPUT_MOVE,
mouseup: INPUT_END
};
var MOUSE_ELEMENT_EVENTS = 'mousedown';
var MOUSE_WINDOW_EVENTS = 'mousemove mouseup';
/**
* Mouse events input
* @constructor
* @extends Input
*/
function MouseInput(_manager, _handler) {
this.evEl = MOUSE_ELEMENT_EVENTS;
this.evWin = MOUSE_WINDOW_EVENTS;
this.allow = true; // used by Input.TouchMouse to disable mouse events
this.pressed = false; // mousedown state
Input.apply(this, arguments);
}
inherit(MouseInput, Input, {
/**
* handle mouse events
* @param {Object} ev
*/
handler: function MEhandler(ev) {
var eventType = MOUSE_INPUT_MAP[ev.type];
// on start we want to have the left mouse button down
if (eventType & INPUT_START && ev.button === 0) {
this.pressed = true;
}
if (eventType & INPUT_MOVE && ev.which !== 1) {
eventType = INPUT_END;
}
// mouse must be down, and mouse events are allowed (see the TouchMouse input)
if (!this.pressed || !this.allow) {
return;
}
if (eventType & INPUT_END) {
this.pressed = false;
}
this.callback(this.manager, eventType, {
pointers: [ev],
changedPointers: [ev],
pointerType: INPUT_TYPE_MOUSE,
srcEvent: ev
});
}
});
var POINTER_INPUT_MAP = {
pointerdown: INPUT_START,
pointermove: INPUT_MOVE,
pointerup: INPUT_END,
pointercancel: INPUT_CANCEL,
pointerout: INPUT_CANCEL
};
// in IE10 the pointer types is defined as an enum
var IE10_POINTER_TYPE_ENUM = {
2: INPUT_TYPE_TOUCH,
3: INPUT_TYPE_PEN,
4: INPUT_TYPE_MOUSE,
5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816
};
var POINTER_ELEMENT_EVENTS = 'pointerdown';
var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';
// IE10 has prefixed support, and case-sensitive
if (win.MSPointerEvent && !win.PointerEvent) {
POINTER_ELEMENT_EVENTS = 'MSPointerDown';
POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';
}
/**
* Pointer events input
* @constructor
* @extends Input
*/
function PointerEventInput() {
this.evEl = POINTER_ELEMENT_EVENTS;
this.evWin = POINTER_WINDOW_EVENTS;
Input.apply(this, arguments);
this.store = (this.manager.session.pointerEvents = []);
}
inherit(PointerEventInput, Input, {
/**
* handle mouse events
* @param {Object} ev
*/
handler: function PEhandler(ev) {
var store = this.store;
var removePointer = false;
var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');
var eventType = POINTER_INPUT_MAP[eventTypeNormalized];
var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;
var isTouch = (pointerType == INPUT_TYPE_TOUCH);
// get index of the event in the store
var storeIndex = inArray(store, ev.pointerId, 'pointerId');
// start and mouse must be down
if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {
if (storeIndex < 0) {
store.push(ev);
storeIndex = store.length - 1;
}
}
else if (eventType & (INPUT_END | INPUT_CANCEL)) {
removePointer = true;
}
// it not found, so the pointer hasn't been down (so it's probably a hover)
if (storeIndex < 0) {
return;
}
// update the event in the store
store[storeIndex] = ev;
this.callback(this.manager, eventType, {
pointers: store,
changedPointers: [ev],
pointerType: pointerType,
srcEvent: ev
});
if (removePointer) {
// remove from the store
store.splice(storeIndex, 1);
}
}
});
var SINGLE_TOUCH_INPUT_MAP = {
touchstart: INPUT_START,
touchmove: INPUT_MOVE,
touchend: INPUT_END,
touchcancel: INPUT_CANCEL
};
var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';
var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';
/**
* Touch events input
* @constructor
* @extends Input
*/
function SingleTouchInput() {
this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;
this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;
this.started = false;
Input.apply(this, arguments);
}
inherit(SingleTouchInput, Input, {
handler: function TEhandler(ev) {
var type = SINGLE_TOUCH_INPUT_MAP[ev.type];
// should we handle the touch events?
if (type === INPUT_START) {
this.started = true;
}
if (!this.started) {
return;
}
var touches = normalizeSingleTouches.call(this, ev, type);
// when done, reset the started state
if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {
this.started = false;
}
this.callback(this.manager, type, {
pointers: touches[0],
changedPointers: touches[1],
pointerType: INPUT_TYPE_TOUCH,
srcEvent: ev
});
}
});
/**
* @this {TouchInput}
* @param {Object} ev
* @param {Number} type flag
* @returns {undefined|Array} [all, changed]
*/
function normalizeSingleTouches(ev, type) {
var all = toArray(ev.touches);
var changed = toArray(ev.changedTouches);
if (type & (INPUT_END | INPUT_CANCEL)) {
all = uniqueArray(all.concat(changed), 'identifier', true);
}
return [all, changed];
}
var TOUCH_INPUT_MAP = {
touchstart: INPUT_START,
touchmove: INPUT_MOVE,
touchend: INPUT_END,
touchcancel: INPUT_CANCEL
};
var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';
/**
* Multi-user touch events input
* @constructor
* @extends Input
*/
function TouchInput(_manager, _handler) {
this.evTarget = TOUCH_TARGET_EVENTS;
this.targetIds = {};
Input.apply(this, arguments);
}
inherit(TouchInput, Input, {
handler: function MTEhandler(ev) {
var type = TOUCH_INPUT_MAP[ev.type];
var touches = getTouches.call(this, ev, type);
if (!touches) {
return;
}
this.callback(this.manager, type, {
pointers: touches[0],
changedPointers: touches[1],
pointerType: INPUT_TYPE_TOUCH,
srcEvent: ev
});
}
});
/**
* @this {TouchInput}
* @param {Object} ev
* @param {Number} type flag
* @returns {undefined|Array} [all, changed]
*/
function getTouches(ev, type) {
var allTouches = toArray(ev.touches);
var targetIds = this.targetIds;
// when there is only one touch, the process can be simplified
if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {
targetIds[allTouches[0].identifier] = true;
return [allTouches, allTouches];
}
var i, targetTouches, changedTouches = toArray(ev.changedTouches), changedTargetTouches = [], target = this.target;
// get target touches from touches
targetTouches = allTouches.filter(function (touch) {
return hasParent(touch.target, target);
});
// collect touches
if (type === INPUT_START) {
i = 0;
while (i < targetTouches.length) {
targetIds[targetTouches[i].identifier] = true;
i++;
}
}
// filter changed touches to only contain touches that exist in the collected target ids
i = 0;
while (i < changedTouches.length) {
if (targetIds[changedTouches[i].identifier]) {
changedTargetTouches.push(changedTouches[i]);
}
// cleanup removed touches
if (type & (INPUT_END | INPUT_CANCEL)) {
delete targetIds[changedTouches[i].identifier];
}
i++;
}
if (!changedTargetTouches.length) {
return;
}
return [
// merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'
uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true),
changedTargetTouches
];
}
/**
* Combined touch and mouse input
*
* Touch has a higher priority then mouse, and while touching no mouse events are allowed.
* This because touch devices also emit mouse events while doing a touch.
*
* @constructor
* @extends Input
*/
function TouchMouseInput() {
Input.apply(this, arguments);
var handler = bindFn(this.handler, this);
this.touch = new TouchInput(this.manager, handler);
this.mouse = new MouseInput(this.manager, handler);
}
inherit(TouchMouseInput, Input, {
/**
* handle mouse and touch events
* @param {Hammer} manager
* @param {String} inputEvent
* @param {Object} inputData
*/
handler: function TMEhandler(manager, inputEvent, inputData) {
var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH), isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE);
// when we're in a touch event, so block all upcoming mouse events
// most mobile browser also emit mouseevents, right after touchstart
if (isTouch) {
this.mouse.allow = false;
}
else if (isMouse && !this.mouse.allow) {
return;
}
// reset the allowMouse when we're done
if (inputEvent & (INPUT_END | INPUT_CANCEL)) {
this.mouse.allow = true;
}
this.callback(manager, inputEvent, inputData);
},
/**
* remove the event listeners
*/
destroy: function destroy() {
this.touch.destroy();
this.mouse.destroy();
}
});
var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');
var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;
// magical touchAction value
var TOUCH_ACTION_COMPUTE = 'compute';
var TOUCH_ACTION_AUTO = 'auto';
var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented
var TOUCH_ACTION_NONE = 'none';
var TOUCH_ACTION_PAN_X = 'pan-x';
var TOUCH_ACTION_PAN_Y = 'pan-y';
/**
* Touch Action
* sets the touchAction property or uses the js alternative
* @param {Manager} manager
* @param {String} value
* @constructor
*/
function TouchAction(manager, value) {
this.manager = manager;
this.set(value);
}
TouchAction.prototype = {
/**
* set the touchAction value on the element or enable the polyfill
* @param {String} value
*/
set: function (value) {
// find out the touch-action by the event handlers
if (value == TOUCH_ACTION_COMPUTE) {
value = this.compute();
}
if (NATIVE_TOUCH_ACTION && this.manager.element.style) {
this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;
}
this.actions = value.toLowerCase().trim();
},
/**
* just re-set the touchAction value
*/
update: function () {
this.set(this.manager.options.touchAction);
},
/**
* compute the value for the touchAction property based on the recognizer's settings
* @returns {String} value
*/
compute: function () {
var actions = [];
each(this.manager.recognizers, function (recognizer) {
if (boolOrFn(recognizer.options.enable, [recognizer])) {
actions = actions.concat(recognizer.getTouchAction());
}
});
return cleanTouchActions(actions.join(' '));
},
/**
* this method is called on each input cycle and provides the preventing of the browser behavior
* @param {Object} input
*/
preventDefaults: function (input) {
// not needed with native support for the touchAction property
if (NATIVE_TOUCH_ACTION) {
return;
}
var srcEvent = input.srcEvent;
var direction = input.offsetDirection;
// if the touch action did prevented once this session
if (this.manager.session.prevented) {
srcEvent.preventDefault();
return;
}
var actions = this.actions;
var hasNone = inStr(actions, TOUCH_ACTION_NONE);
var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
if (hasNone) {
//do not prevent defaults if this is a tap gesture
var isTapPointer = input.pointers.length === 1;
var isTapMovement = input.distance < 2;
var isTapTouchTime = input.deltaTime < 250;
if (isTapPointer && isTapMovement && isTapTouchTime) {
return;
}
}
if (hasPanX && hasPanY) {
// `pan-x pan-y` means browser handles all scrolling/panning, do not prevent
return;
}
if (hasNone ||
(hasPanY && direction & DIRECTION_HORIZONTAL) ||
(hasPanX && direction & DIRECTION_VERTICAL)) {
return this.preventSrc(srcEvent);
}
},
/**
* call preventDefault to prevent the browser's default behavior (scrolling in most cases)
* @param {Object} srcEvent
*/
preventSrc: function (srcEvent) {
this.manager.session.prevented = true;
srcEvent.preventDefault();
}
};
/**
* when the touchActions are collected they are not a valid value, so we need to clean things up. *
* @param {String} actions
* @returns {*}
*/
function cleanTouchActions(actions) {
// none
if (inStr(actions, TOUCH_ACTION_NONE)) {
return TOUCH_ACTION_NONE;
}
var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);
var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);
// if both pan-x and pan-y are set (different recognizers
// for different directions, e.g. horizontal pan but vertical swipe?)
// we need none (as otherwise with pan-x pan-y combined none of these
// recognizers will work, since the browser would handle all panning
if (hasPanX && hasPanY) {
return TOUCH_ACTION_NONE;
}
// pan-x OR pan-y
if (hasPanX || hasPanY) {
return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;
}
// manipulation
if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {
return TOUCH_ACTION_MANIPULATION;
}
return TOUCH_ACTION_AUTO;
}
/**
* Recognizer flow explained; *
* All recognizers have the initial state of POSSIBLE when a input session starts.
* The definition of a input session is from the first input until the last input, with all it's movement in it. *
* Example session for mouse-input: mousedown -> mousemove -> mouseup
*
* On each recognizing cycle (see Manager.recognize) the .recognize() method is executed
* which determines with state it should be.
*
* If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to
* POSSIBLE to give it another change on the next cycle.
*
* Possible
* |
* +-----+---------------+
* | |
* +-----+-----+ |
* | | |
* Failed Cancelled |
* +-------+------+
* | |
* Recognized Began
* |
* Changed
* |
* Ended/Recognized
*/
var STATE_POSSIBLE = 1;
var STATE_BEGAN = 2;
var STATE_CHANGED = 4;
var STATE_ENDED = 8;
var STATE_RECOGNIZED = STATE_ENDED;
var STATE_CANCELLED = 16;
var STATE_FAILED = 32;
/**
* Recognizer
* Every recognizer needs to extend from this class.
* @constructor
* @param {Object} options
*/
function Recognizer(options) {
this.options = Object.assign({}, this.defaults, options || {});
this.id = uniqueId();
this.manager = null;
// default is enable true
this.options.enable = ifUndefined(this.options.enable, true);
this.state = STATE_POSSIBLE;
this.simultaneous = {};
this.requireFail = [];
}
Recognizer.prototype = {
/**
* @virtual
* @type {Object}
*/
defaults: {},
/**
* set options
* @param {Object} options
* @return {Recognizer}
*/
set: function (options) {
Object.assign(this.options, options);
// also update the touchAction, in case something changed about the directions/enabled state
this.manager && this.manager.touchAction.update();
return this;
},
/**
* recognize simultaneous with an other recognizer.
* @param {Recognizer} otherRecognizer
* @returns {Recognizer} this
*/
recognizeWith: function (otherRecognizer) {
if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {
return this;
}
var simultaneous = this.simultaneous;
otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
if (!simultaneous[otherRecognizer.id]) {
simultaneous[otherRecognizer.id] = otherRecognizer;
otherRecognizer.recognizeWith(this);
}
return this;
},
/**
* drop the simultaneous link. it doesnt remove the link on the other recognizer.
* @param {Recognizer} otherRecognizer
* @returns {Recognizer} this
*/
dropRecognizeWith: function (otherRecognizer) {
if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {
return this;
}
otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
delete this.simultaneous[otherRecognizer.id];
return this;
},
/**
* recognizer can only run when an other is failing
* @param {Recognizer} otherRecognizer
* @returns {Recognizer} this
*/
requireFailure: function (otherRecognizer) {
if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {
return this;
}
var requireFail = this.requireFail;
otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
if (inArray(requireFail, otherRecognizer) === -1) {
requireFail.push(otherRecognizer);
otherRecognizer.requireFailure(this);
}
return this;
},
/**
* drop the requireFailure link. it does not remove the link on the other recognizer.
* @param {Recognizer} otherRecognizer
* @returns {Recognizer} this
*/
dropRequireFailure: function (otherRecognizer) {
if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {
return this;
}
otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);
var index = inArray(this.requireFail, otherRecognizer);
if (index > -1) {
this.requireFail.splice(index, 1);
}
return this;
},
/**
* has require failures boolean
* @returns {boolean}
*/
hasRequireFailures: function () {
return this.requireFail.length > 0;
},
/**
* if the recognizer can recognize simultaneous with an other recognizer
* @param {Recognizer} otherRecognizer
* @returns {Boolean}
*/
canRecognizeWith: function (otherRecognizer) {
return !!this.simultaneous[otherRecognizer.id];
},
/**
* You should use `tryEmit` instead of `emit` directly to check
* that all the needed recognizers has failed before emitting.
* @param {Object} input
*/
emit: function (input) {
var self = this;
var state = this.state;
function emit(event) {
self.manager.emit(event, input);
}
// 'panstart' and 'panmove'
if (state < STATE_ENDED) {
emit(self.options.event + stateStr(state));
}
emit(self.options.event); // simple 'eventName' events
if (input.additionalEvent) {
emit(input.additionalEvent);
}
// panend and pancancel
if (state >= STATE_ENDED) {
emit(self.options.event + stateStr(state));
}
},
/**
* Check that all the require failure recognizers has failed,
* if true, it emits a gesture event,
* otherwise, setup the state to FAILED.
* @param {Object} input
*/
tryEmit: function (input) {
if (this.canEmit()) {
return this.emit(input);
}
// it's failing anyway
this.state = STATE_FAILED;
},
/**
* can we emit?
* @returns {boolean}
*/
canEmit: function () {
var i = 0;
while (i < this.requireFail.length) {
if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {
return false;
}
i++;
}
return true;
},
/**
* update the recognizer
* @param {Object} inputData
*/
recognize: function (inputData) {
// make a new copy of the inputData
// so we can change the inputData without messing up the other recognizers
var inputDataClone = Object.assign({}, inputData);
// is is enabled and allow recognizing?
if (!boolOrFn(this.options.enable, [this, inputDataClone])) {
this.reset();
this.state = STATE_FAILED;
return;
}
// reset when we've reached the end
if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {
this.state = STATE_POSSIBLE;
}
this.state = this.process(inputDataClone);
// the recognizer has recognized a gesture
// so trigger an event
if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {
this.tryEmit(inputDataClone);
}
},
/**
* return the state of the recognizer
* the actual recognizing happens in this method
* @virtual
* @param {Object} inputData
* @returns {Const} STATE
*/
process: function (_inputData) { },
/**
* return the preferred touch-action
* @virtual
* @returns {Array}
*/
getTouchAction: function () { },
/**
* called when the gesture isn't allowed to recognize
* like when another is being recognized or it is disabled
* @virtual
*/
reset: function () { }
};
/**
* get a usable string, used as event postfix
* @param {Const} state
* @returns {String} state
*/
function stateStr(state) {
if (state & STATE_CANCELLED) {
return 'cancel';
}
else if (state & STATE_ENDED) {
return 'end';
}
else if (state & STATE_CHANGED) {
return 'move';
}
else if (state & STATE_BEGAN) {
return 'start';
}
return '';
}
/**
* direction cons to string
* @param {Const} direction
* @returns {String}
*/
function directionStr(direction) {
if (direction == DIRECTION_DOWN) {
return 'down';
}
else if (direction == DIRECTION_UP) {
return 'up';
}
else if (direction == DIRECTION_LEFT) {
return 'left';
}
else if (direction == DIRECTION_RIGHT) {
return 'right';
}
return '';
}
/**
* get a recognizer by name if it is bound to a manager
* @param {Recognizer|String} otherRecognizer
* @param {Recognizer} recognizer
* @returns {Recognizer}
*/
function getRecognizerByNameIfManager(otherRecognizer, recognizer) {
var manager = recognizer.manager;
if (manager) {
return manager.get(otherRecognizer);
}
return otherRecognizer;
}
/**
* This recognizer is just used as a base for the simple attribute recognizers.
* @constructor
* @extends Recognizer
*/
function AttrRecognizer() {
Recognizer.apply(this, arguments);
}
inherit(AttrRecognizer, Recognizer, {
/**
* @namespace
* @memberof AttrRecognizer
*/
defaults: {
/**
* @type {Number}
* @default 1
*/
pointers: 1
},
/**
* Used to check if it the recognizer receives valid input, like input.distance > 10.
* @memberof AttrRecognizer
* @param {Object} input
* @returns {Boolean} recognized
*/
attrTest: function (input) {
var optionPointers = this.options.pointers;
return optionPointers === 0 || input.pointers.length === optionPointers;
},
/**
* Process the input and return the state for the recognizer
* @memberof AttrRecognizer
* @param {Object} input
* @returns {*} State
*/
process: function (input) {
var state = this.state;
var eventType = input.eventType;
var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);
var isValid = this.attrTest(input);
// on cancel input and we've recognized before, return STATE_CANCELLED
if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {
return state | STATE_CANCELLED;
}
else if (isRecognized || isValid) {
if (eventType & INPUT_END) {
return state | STATE_ENDED;
}
else if (!(state & STATE_BEGAN)) {
return STATE_BEGAN;
}
return state | STATE_CHANGED;
}
return STATE_FAILED;
}
});
/**
* Pan
* Recognized when the pointer is down and moved in the allowed direction.
* @constructor
* @extends AttrRecognizer
*/
function PanRecognizer() {
AttrRecognizer.apply(this, arguments);
this.pX = null;
this.pY = null;
}
inherit(PanRecognizer, AttrRecognizer, {
/**
* @namespace
* @memberof PanRecognizer
*/
defaults: {
event: 'pan',
threshold: 10,
pointers: 1,
direction: DIRECTION_ALL
},
getTouchAction: function () {
var direction = this.options.direction;
var actions = [];
if (direction & DIRECTION_HORIZONTAL) {
actions.push(TOUCH_ACTION_PAN_Y);
}
if (direction & DIRECTION_VERTICAL) {
actions.push(TOUCH_ACTION_PAN_X);
}
return actions;
},
directionTest: function (input) {
var options = this.options;
var hasMoved = true;
var distance = input.distance;
var direction = input.direction;
var x = input.deltaX;
var y = input.deltaY;
// lock to axis?
if (!(direction & options.direction)) {
if (options.direction & DIRECTION_HORIZONTAL) {
direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT;
hasMoved = x != this.pX;
distance = Math.abs(input.deltaX);
}
else {
direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN;
hasMoved = y != this.pY;
distance = Math.abs(input.deltaY);
}
}
input.direction = direction;
return hasMoved && distance > options.threshold && direction & options.direction;
},
attrTest: function (input) {
return AttrRecognizer.prototype.attrTest.call(this, input) &&
(this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input)));
},
emit: function (input) {
this.pX = input.deltaX;
this.pY = input.deltaY;
var direction = directionStr(input.direction);
if (direction) {
input.additionalEvent = this.options.event + direction;
}
this._super.emit.call(this, input);
}
});
/**
* Pinch
* Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).
* @constructor
* @extends AttrRecognizer
*/
function PinchRecognizer() {
AttrRecognizer.apply(this, arguments);
}
inherit(PinchRecognizer, AttrRecognizer, {
/**
* @namespace
* @memberof PinchRecognizer
*/
defaults: {
event: 'pinch',
threshold: 0,
pointers: 2
},
getTouchAction: function () {
return [TOUCH_ACTION_NONE];
},
attrTest: function (input) {
return this._super.attrTest.call(this, input) &&
(Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);
},
emit: function (input) {
if (input.scale !== 1) {
var inOut = input.scale < 1 ? 'in' : 'out';
input.additionalEvent = this.options.event + inOut;
}
this._super.emit.call(this, input);
}
});
/**
* Press
* Recognized when the pointer is down for x ms without any movement.
* @constructor
* @extends Recognizer
*/
function PressRecognizer() {
Recognizer.apply(this, arguments);
this._timer = null;
this._input = null;
}
inherit(PressRecognizer, Recognizer, {
/**
* @namespace
* @memberof PressRecognizer
*/
defaults: {
event: 'press',
pointers: 1,
time: 251,
threshold: 9 // a minimal movement is ok, but keep it low
},
getTouchAction: function () {
return [TOUCH_ACTION_AUTO];
},
process: function (input) {
var options = this.options;
var validPointers = input.pointers.length === options.pointers;
var validMovement = input.distance < options.threshold;
var validTime = input.deltaTime > options.time;
this._input = input;
// we only allow little movement
// and we've reached an end event, so a tap is possible
if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) {
this.reset();
}
else if (input.eventType & INPUT_START) {
this.reset();
this._timer = setTimeoutContext(function () {
this.state = STATE_RECOGNIZED;
this.tryEmit();
}, options.time, this);
}
else if (input.eventType & INPUT_END) {
return STATE_RECOGNIZED;
}
return STATE_FAILED;
},
reset: function () {
clearTimeout(this._timer);
},
emit: function (input) {
if (this.state !== STATE_RECOGNIZED) {
return;
}
if (input && (input.eventType & INPUT_END)) {
this.manager.emit(this.options.event + 'up', input);
}
else {
this._input.timeStamp = now();
this.manager.emit(this.options.event, this._input);
}
}
});
/**
* Rotate
* Recognized when two or more pointer are moving in a circular motion.
* @constructor
* @extends AttrRecognizer
*/
function RotateRecognizer() {
AttrRecognizer.apply(this, arguments);
}
inherit(RotateRecognizer, AttrRecognizer, {
/**
* @namespace
* @memberof RotateRecognizer
*/
defaults: {
event: 'rotate',
threshold: 0,
pointers: 2
},
getTouchAction: function () {
return [TOUCH_ACTION_NONE];
},
attrTest: function (input) {
return this._super.attrTest.call(this, input) &&
(Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);
}
});
/**
* Swipe
* Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.
* @constructor
* @extends AttrRecognizer
*/
function SwipeRecognizer() {
AttrRecognizer.apply(this, arguments);
}
inherit(SwipeRecognizer, AttrRecognizer, {
/**
* @namespace
* @memberof SwipeRecognizer
*/
defaults: {
event: 'swipe',
threshold: 10,
velocity: 0.3,
direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,
pointers: 1
},
getTouchAction: function () {
return PanRecognizer.prototype.getTouchAction.call(this);
},
attrTest: function (input) {
var direction = this.options.direction;
var velocity;
if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {
velocity = input.overallVelocity;
}
else if (direction & DIRECTION_HORIZONTAL) {
velocity = input.overallVelocityX;
}
else if (direction & DIRECTION_VERTICAL) {
velocity = input.overallVelocityY;
}
return this._super.attrTest.call(this, input) &&
direction & input.offsetDirection &&
input.distance > this.options.threshold &&
input.maxPointers == this.options.pointers &&
abs(velocity) > this.options.velocity && input.eventType & INPUT_END;
},
emit: function (input) {
var direction = directionStr(input.offsetDirection);
if (direction) {
this.manager.emit(this.options.event + direction, input);
}
this.manager.emit(this.options.event, input);
}
});
/**
* A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur
* between the given interval and position. The delay option can be used to recognize multi-taps without firing
* a single tap.
*
* The eventData from the emitted event contains the property `tapCount`, which contains the amount of
* multi-taps being recognized.
* @constructor
* @extends Recognizer
*/
function TapRecognizer() {
Recognizer.apply(this, arguments);
// previous time and center,
// used for tap counting
this.pTime = false;
this.pCenter = false;
this._timer = null;
this._input = null;
this.count = 0;
}
inherit(TapRecognizer, Recognizer, {
/**
* @namespace
* @memberof PinchRecognizer
*/
defaults: {
event: 'tap',
pointers: 1,
taps: 1,
interval: 300,
time: 250,
threshold: 9,
posThreshold: 10 // a multi-tap can be a bit off the initial position
},
getTouchAction: function () {
return [TOUCH_ACTION_MANIPULATION];
},
process: function (input) {
var options = this.options;
var validPointers = input.pointers.length === options.pointers;
var validMovement = input.distance < options.threshold;
var validTouchTime = input.deltaTime < options.time;
this.reset();
if ((input.eventType & INPUT_START) && (this.count === 0)) {
return this.failTimeout();
}
// we only allow little movement
// and we've reached an end event, so a tap is possible
if (validMovement && validTouchTime && validPointers) {
if (input.eventType != INPUT_END) {
return this.failTimeout();
}
var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true;
var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;
this.pTime = input.timeStamp;
this.pCenter = input.center;
if (!validMultiTap || !validInterval) {
this.count = 1;
}
else {
this.count += 1;
}
this._input = input;
// if tap count matches we have recognized it,
// else it has began recognizing...
var tapCount = this.count % options.taps;
if (tapCount === 0) {
// no failing requirements, immediately trigger the tap event
// or wait as long as the multitap interval to trigger
if (!this.hasRequireFailures()) {
return STATE_RECOGNIZED;
}
else {
this._timer = setTimeoutContext(function () {
this.state = STATE_RECOGNIZED;
this.tryEmit();
}, options.interval, this);
return STATE_BEGAN;
}
}
}
return STATE_FAILED;
},
failTimeout: function () {
this._timer = setTimeoutContext(function () {
this.state = STATE_FAILED;
}, this.options.interval, this);
return STATE_FAILED;
},
reset: function () {
clearTimeout(this._timer);
},
emit: function () {
if (this.state == STATE_RECOGNIZED) {
this._input.tapCount = this.count;
this.manager.emit(this.options.event, this._input);
}
}
});
/**
* Simple way to create a manager with a default set of recognizers.
* @param {HTMLElement} element
* @param {Object} [options]
* @constructor
*/
function Hammer(element, options) {
options = options || {};
options.recognizers = ifUndefined(options.recognizers, _defaults.preset);
return new Manager(element, options);
}
/**
* default settings
* @namespace
*/
var _defaults = {
/**
* set if DOM events are being triggered.
* But this is slower and unused by simple implementations, so disabled by default.
* @type {Boolean}
* @default false
*/
domEvents: false,
/**
* The value for the touchAction property/fallback.
* When set to `compute` it will magically set the correct value based on the added recognizers.
* @type {String}
* @default compute
*/
touchAction: TOUCH_ACTION_COMPUTE,
/**
* @type {Boolean}
* @default true
*/
enable: true,
/**
* EXPERIMENTAL FEATURE -- can be removed/changed
* Change the parent input target element.
* If Null, then it is being set the to main element.
* @type {Null|EventTarget}
* @default null
*/
inputTarget: null,
/**
* force an input class
* @type {Null|Function}
* @default null
*/
inputClass: null,
/**
* Default recognizer setup when calling `Hammer()`
* When creating a new Manager these will be skipped.
* @type {Array}
*/
preset: [
// RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]
[RotateRecognizer, { enable: false }],
[PinchRecognizer, { enable: false }, ['rotate']],
[SwipeRecognizer, { direction: DIRECTION_HORIZONTAL }],
[PanRecognizer, { direction: DIRECTION_HORIZONTAL }, ['swipe']],
[TapRecognizer],
[TapRecognizer, { event: 'doubletap', taps: 2 }, ['tap']],
[PressRecognizer]
],
/**
* Some CSS properties can be used to improve the working of Hammer.
* Add them to this method and they will be set when creating a new Manager.
* @namespace
*/
cssProps: {
/**
* Disables text selection to improve the dragging gesture. Mainly for desktop browsers.
* @type {String}
* @default 'none'
*/
userSelect: 'none',
/**
* Disable the Windows Phone grippers when pressing an element.
* @type {String}
* @default 'none'
*/
touchSelect: 'none',
/**
* Disables the default callout shown when you touch and hold a touch target.
* On iOS, when you touch and hold a touch target such as a link, Safari displays
* a callout containing information about the link. This property allows you to disable that callout.
* @type {String}
* @default 'none'
*/
touchCallout: 'none',
/**
* Specifies whether zooming is enabled. Used by IE10>
* @type {String}
* @default 'none'
*/
contentZooming: 'none',
/**
* Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.
* @type {String}
* @default 'none'
*/
userDrag: 'none',
/**
* Overrides the highlight color shown when the user taps a link or a JavaScript
* clickable element in iOS. This property obeys the alpha value, if specified.
* @type {String}
* @default 'rgba(0,0,0,0)'
*/
tapHighlightColor: 'rgba(0,0,0,0)'
}
};
var STOP = 1;
var FORCED_STOP = 2;
/**
* Manager
* @param {HTMLElement} element
* @param {Object} [options]
* @constructor
*/
function Manager(element, options) {
this.options = Object.assign({}, _defaults, options || {});
this.options.inputTarget = this.options.inputTarget || element;
this.handlers = {};
this.session = {};
this.recognizers = [];
this.element = element;
this.input = createInputInstance(this);
this.touchAction = new TouchAction(this, this.options.touchAction);
toggleCssProps(this, true);
each(this.options.recognizers, function (item) {
var recognizer = this.add(new (item[0])(item[1]));
item[2] && recognizer.recognizeWith(item[2]);
item[3] && recognizer.requireFailure(item[3]);
}, this);
}
Manager.prototype = {
/**
* set options
* @param {Object} options
* @returns {Manager}
*/
set: function (options) {
Object.assign(this.options, options);
// Options that need a little more setup
if (options.touchAction) {
this.touchAction.update();
}
if (options.inputTarget) {
// Clean up existing event listeners and reinitialize
this.input.destroy();
this.input.target = options.inputTarget;
this.input.init();
}
return this;
},
/**
* stop recognizing for this session.
* This session will be discarded, when a new [input]start event is fired.
* When forced, the recognizer cycle is stopped immediately.
* @param {Boolean} [force]
*/
stop: function (force) {
this.session.stopped = force ? FORCED_STOP : STOP;
},
/**
* run the recognizers!
* called by the inputHandler function on every movement of the pointers (touches)
* it walks through all the recognizers and tries to detect the gesture that is being made
* @param {Object} inputData
*/
recognize: function (inputData) {
var session = this.session;
if (session.stopped) {
return;
}
// run the touch-action polyfill
this.touchAction.preventDefaults(inputData);
var recognizer;
var recognizers = this.recognizers;
// this holds the recognizer that is being recognized.
// so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED
// if no recognizer is detecting a thing, it is set to `null`
var curRecognizer = session.curRecognizer;
// reset when the last recognizer is recognized
// or when we're in a new session
if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) {
curRecognizer = session.curRecognizer = null;
}
var i = 0;
while (i < recognizers.length) {
recognizer = recognizers[i];
// find out if we are allowed try to recognize the input for this one.
// 1. allow if the session is NOT forced stopped (see the .stop() method)
// 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one
// that is being recognized.
// 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.
// this can be setup with the `recognizeWith()` method on the recognizer.
if (session.stopped !== FORCED_STOP && (!curRecognizer || recognizer == curRecognizer ||
recognizer.canRecognizeWith(curRecognizer))) {
recognizer.recognize(inputData);
}
else {
recognizer.reset();
}
// if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the
// current active recognizer. but only if we don't already have an active recognizer
if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {
curRecognizer = session.curRecognizer = recognizer;
}
i++;
}
},
/**
* get a recognizer by its event name.
* @param {Recognizer|String} recognizer
* @returns {Recognizer|Null}
*/
get: function (recognizer) {
if (recognizer instanceof Recognizer) {
return recognizer;
}
var recognizers = this.recognizers;
for (var i = 0; i < recognizers.length; i++) {
if (recognizers[i].options.event == recognizer) {
return recognizers[i];
}
}
return null;
},
/**
* add a recognizer to the manager
* existing recognizers with the same event name will be removed
* @param {Recognizer} recognizer
* @returns {Recognizer|Manager}
*/
add: function (recognizer) {
if (invokeArrayArg(recognizer, 'add', this)) {
return this;
}
// remove existing
var existing = this.get(recognizer.options.event);
if (existing) {
this.remove(existing);
}
this.recognizers.push(recognizer);
recognizer.manager = this;
this.touchAction.update();
return recognizer;
},
/**
* remove a recognizer by name or instance
* @param {Recognizer|String} recognizer
* @returns {Manager}
*/
remove: function (recognizer) {
if (invokeArrayArg(recognizer, 'remove', this)) {
return this;
}
recognizer = this.get(recognizer);
// let's make sure this recognizer exists
if (recognizer) {
var recognizers = this.recognizers;
var index = inArray(recognizers, recognizer);
if (index !== -1) {
recognizers.splice(index, 1);
this.touchAction.update();
}
}
return this;
},
/**
* bind event
* @param {String} events
* @param {Function} handler
* @returns {EventEmitter} this
*/
on: function (events, handler) {
var handlers = this.handlers;
each(splitStr(events), function (event) {
handlers[event] = handlers[event] || [];
handlers[event].push(handler);
});
return this;
},
/**
* unbind event, leave emit blank to remove all handlers
* @param {String} events
* @param {Function} [handler]
* @returns {EventEmitter} this
*/
off: function (events, handler) {
var handlers = this.handlers;
each(splitStr(events), function (event) {
if (!handler) {
delete handlers[event];
}
else {
handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);
}
});
return this;
},
/**
* emit event to the listeners
* @param {String} event
* @param {Object} data
*/
emit: function (event, data) {
// we also want to trigger dom events
if (this.options.domEvents) {
triggerDomEvent(event, data);
}
// no handlers, so skip it all
var handlers = this.handlers[event] && this.handlers[event].slice();
if (!handlers || !handlers.length) {
return;
}
data.type = event;
data.preventDefault = function () {
data.srcEvent.preventDefault();
};
var i = 0;
while (i < handlers.length) {
handlers[i](data);
i++;
}
},
/**
* destroy the manager and unbinds all events
* it doesn't unbind dom events, that is the user own responsibility
*/
destroy: function () {
this.element && toggleCssProps(this, false);
this.handlers = {};
this.session = {};
this.input.destroy();
this.element = null;
}
};
/**
* add/remove the css properties as defined in manager.options.cssProps
* @param {Manager} manager
* @param {Boolean} add
*/
function toggleCssProps(manager, add) {
var element = manager.element;
if (!element.style) {
return;
}
each(manager.options.cssProps, function (value, name) {
element.style[prefixed(element.style, name)] = add ? value : '';
});
}
/**
* trigger dom event
* @param {String} event
* @param {Object} data
*/
function triggerDomEvent(event, data) {
var gestureEvent = doc.createEvent('Event');
gestureEvent.initEvent(event, true, true);
gestureEvent.gesture = data;
data.target.dispatchEvent(gestureEvent);
}
Object.assign(Hammer, {
INPUT_START: INPUT_START,
INPUT_MOVE: INPUT_MOVE,
INPUT_END: INPUT_END,
INPUT_CANCEL: INPUT_CANCEL,
STATE_POSSIBLE: STATE_POSSIBLE,
STATE_BEGAN: STATE_BEGAN,
STATE_CHANGED: STATE_CHANGED,
STATE_ENDED: STATE_ENDED,
STATE_RECOGNIZED: STATE_RECOGNIZED,
STATE_CANCELLED: STATE_CANCELLED,
STATE_FAILED: STATE_FAILED,
DIRECTION_NONE: DIRECTION_NONE,
DIRECTION_LEFT: DIRECTION_LEFT,
DIRECTION_RIGHT: DIRECTION_RIGHT,
DIRECTION_UP: DIRECTION_UP,
DIRECTION_DOWN: DIRECTION_DOWN,
DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,
DIRECTION_VERTICAL: DIRECTION_VERTICAL,
DIRECTION_ALL: DIRECTION_ALL,
Manager: Manager,
Input: Input,
TouchAction: TouchAction,
TouchInput: TouchInput,
MouseInput: MouseInput,
PointerEventInput: PointerEventInput,
TouchMouseInput: TouchMouseInput,
SingleTouchInput: SingleTouchInput,
Recognizer: Recognizer,
AttrRecognizer: AttrRecognizer,
Tap: TapRecognizer,
Pan: PanRecognizer,
Swipe: SwipeRecognizer,
Pinch: PinchRecognizer,
Rotate: RotateRecognizer,
Press: PressRecognizer,
on: addEventListeners,
off: removeEventListeners,
each: each,
inherit: inherit,
bindFn: bindFn,
prefixed: prefixed
});
win.Hammer = Hammer;
//# sourceMappingURL=hammer.js.map
/***/ }),
/* 489 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return IonicErrorHandler; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* @name IonicErrorHandler
* @description
* The `IonicErrorHandler` intercepts the default `Console` error handling
* and displays runtime errors as an overlay when using Ionic's Dev Build Server.
*
*
* ### IonicErrorHandler Example
*
* ```typescript
* import { ErrorHandler, NgModule } from '@angular/core';
* import { IonicErrorHandler } from 'ionic-angular';
*
* @NgModule({
* providers: [{ provide: ErrorHandler, useClass: IonicErrorHandler }]
* })
* class AppModule { }
* ```
*
*
* ### Custom Error Handlers
*
* Custom error handlers can be built to replace the default, or extend Ionic's
* error handler.
*
* ```typescript
* class MyErrorHandler implements ErrorHandler {
* handleError(err: any): void {
* // do something with the error
* }
* }
*
* @NgModule({
* providers: [{ provide: ErrorHandler, useClass: MyErrorHandler }]
* })
* class AppModule { }
* ```
*
* More information about Angular's [`ErrorHandler`](https://angular.io/docs/ts/latest/api/core/index/ErrorHandler-class.html).
*/
var IonicErrorHandler = (function (_super) {
__extends(IonicErrorHandler, _super);
function IonicErrorHandler() {
return _super.call(this) || this;
}
/**
* @internal
*/
IonicErrorHandler.prototype.handleError = function (err) {
_super.prototype.handleError.call(this, err);
try {
var win = window;
var monitor = void 0;
monitor = win['IonicDevServer'];
monitor && monitor.handleError && monitor.handleError(err);
monitor = (win['Ionic'] = win['Ionic'] || {}).Monitor;
monitor && monitor.handleError && monitor.handleError(err);
}
catch (e) { }
};
return IonicErrorHandler;
}(__WEBPACK_IMPORTED_MODULE_0__angular_core__["u" /* ErrorHandler */]));
//# sourceMappingURL=ionic-error-handler.js.map
/***/ }),
/* 490 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return IonicModule; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return IonicPageModule; });
/* unused harmony export provideLocationStrategy */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_common__ = __webpack_require__(43);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__angular_platform_browser__ = __webpack_require__(33);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__angular_forms__ = __webpack_require__(16);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__components_app_app__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__components_app_app_root__ = __webpack_require__(75);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__navigation_deep_linker__ = __webpack_require__(19);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__platform_dom_controller__ = __webpack_require__(12);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__util_events__ = __webpack_require__(348);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__util_form__ = __webpack_require__(20);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__gestures_gesture_controller__ = __webpack_require__(11);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__gestures_gesture_config__ = __webpack_require__(351);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__tap_click_haptic__ = __webpack_require__(47);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__platform_keyboard__ = __webpack_require__(46);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__util_module_loader__ = __webpack_require__(96);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__util_ng_module_loader__ = __webpack_require__(174);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__platform_platform__ = __webpack_require__(4);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__platform_platform_registry__ = __webpack_require__(349);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__tap_click_tap_click__ = __webpack_require__(345);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__config_mode_registry__ = __webpack_require__(350);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__transitions_transition_controller__ = __webpack_require__(55);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__navigation_url_serializer__ = __webpack_require__(52);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__components_action_sheet_action_sheet_component__ = __webpack_require__(78);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__components_action_sheet_action_sheet_controller__ = __webpack_require__(138);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__components_alert_alert_component__ = __webpack_require__(80);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__components_alert_alert_controller__ = __webpack_require__(139);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__components_app_click_block__ = __webpack_require__(491);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__components_app_overlay_portal__ = __webpack_require__(135);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__components_avatar_avatar__ = __webpack_require__(140);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__components_backdrop_backdrop__ = __webpack_require__(81);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__components_badge_badge__ = __webpack_require__(141);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_32__components_button_button__ = __webpack_require__(45);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_33__components_card_card__ = __webpack_require__(142);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_34__components_card_card_content__ = __webpack_require__(143);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_35__components_card_card_header__ = __webpack_require__(144);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_36__components_card_card_title__ = __webpack_require__(145);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_37__components_checkbox_checkbox__ = __webpack_require__(146);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_38__components_chip_chip__ = __webpack_require__(150);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_39__components_content_content__ = __webpack_require__(24);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_40__components_datetime_datetime__ = __webpack_require__(151);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_41__components_fab_fab__ = __webpack_require__(56);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_42__components_fab_fab_container__ = __webpack_require__(153);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_43__components_fab_fab_list__ = __webpack_require__(88);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_44__components_grid_col__ = __webpack_require__(154);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_45__components_grid_grid__ = __webpack_require__(155);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_46__components_grid_row__ = __webpack_require__(156);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_47__components_icon_icon__ = __webpack_require__(82);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_48__components_img_img__ = __webpack_require__(157);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_49__components_infinite_scroll_infinite_scroll__ = __webpack_require__(89);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_50__components_infinite_scroll_infinite_scroll_content__ = __webpack_require__(158);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_51__components_input_input__ = __webpack_require__(159);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_52__components_item_item__ = __webpack_require__(21);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_53__components_item_item_content__ = __webpack_require__(161);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_54__components_item_item_divider__ = __webpack_require__(162);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_55__components_item_item_group__ = __webpack_require__(163);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_56__components_item_item_options__ = __webpack_require__(90);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_57__components_item_item_reorder__ = __webpack_require__(84);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_58__components_item_item_sliding__ = __webpack_require__(164);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_59__components_item_reorder__ = __webpack_require__(165);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_60__components_label_label__ = __webpack_require__(83);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_61__components_list_list__ = __webpack_require__(91);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_62__components_list_list_header__ = __webpack_require__(92);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_63__components_loading_loading_component__ = __webpack_require__(93);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_64__components_loading_loading_controller__ = __webpack_require__(167);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_65__components_menu_menu__ = __webpack_require__(168);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_66__components_menu_menu_close__ = __webpack_require__(169);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_67__components_app_menu_controller__ = __webpack_require__(34);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_68__components_menu_menu_toggle__ = __webpack_require__(170);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_69__components_modal_modal_component__ = __webpack_require__(95);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_70__components_modal_modal_controller__ = __webpack_require__(313);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_71__components_nav_nav__ = __webpack_require__(94);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_72__components_nav_nav_pop__ = __webpack_require__(101);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_73__components_nav_nav_pop_anchor__ = __webpack_require__(314);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_74__components_nav_nav_push__ = __webpack_require__(102);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_75__components_nav_nav_push_anchor__ = __webpack_require__(315);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_76__components_note_note__ = __webpack_require__(316);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_77__components_option_option__ = __webpack_require__(103);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_78__components_picker_picker_component__ = __webpack_require__(86);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_79__components_picker_picker_column__ = __webpack_require__(87);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_80__components_picker_picker_controller__ = __webpack_require__(85);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_81__components_popover_popover_component__ = __webpack_require__(105);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_82__components_popover_popover_controller__ = __webpack_require__(317);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_83__components_radio_radio_button__ = __webpack_require__(318);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_84__components_radio_radio_group__ = __webpack_require__(106);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_85__components_range_range__ = __webpack_require__(319);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_86__components_range_range_knob__ = __webpack_require__(320);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_87__components_refresher_refresher__ = __webpack_require__(107);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_88__components_refresher_refresher_content__ = __webpack_require__(321);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_89__components_scroll_scroll__ = __webpack_require__(322);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_90__components_searchbar_searchbar__ = __webpack_require__(323);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_91__components_segment_segment__ = __webpack_require__(324);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_92__components_select_select__ = __webpack_require__(325);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_93__components_select_select_popover_component__ = __webpack_require__(109);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_94__components_segment_segment_button__ = __webpack_require__(108);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_95__components_show_hide_when_show_when__ = __webpack_require__(326);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_96__components_show_hide_when_hide_when__ = __webpack_require__(327);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_97__components_slides_slide__ = __webpack_require__(328);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_98__components_slides_slides__ = __webpack_require__(111);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_99__components_spinner_spinner__ = __webpack_require__(332);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_100__components_split_pane_split_pane__ = __webpack_require__(48);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_101__components_tabs_tab__ = __webpack_require__(333);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_102__components_tabs_tab_button__ = __webpack_require__(334);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_103__components_tabs_tab_highlight__ = __webpack_require__(117);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_104__components_tabs_tabs__ = __webpack_require__(116);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_105__components_thumbnail_thumbnail__ = __webpack_require__(342);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_106__components_toast_toast_component__ = __webpack_require__(118);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_107__components_toast_toast_controller__ = __webpack_require__(336);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_108__components_toggle_toggle__ = __webpack_require__(337);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_109__components_toolbar_toolbar_footer__ = __webpack_require__(338);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_110__components_toolbar_toolbar_header__ = __webpack_require__(339);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_111__components_toolbar_toolbar__ = __webpack_require__(67);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_112__components_toolbar_toolbar_item__ = __webpack_require__(340);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_113__components_toolbar_toolbar_title__ = __webpack_require__(341);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_114__components_toolbar_navbar__ = __webpack_require__(49);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_115__components_typography_typography__ = __webpack_require__(343);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_116__components_virtual_scroll_virtual_footer__ = __webpack_require__(119);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_117__components_virtual_scroll_virtual_header__ = __webpack_require__(120);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_118__components_virtual_scroll_virtual_item__ = __webpack_require__(121);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_119__components_virtual_scroll_virtual_scroll__ = __webpack_require__(344);
/**
* Import Angular
*/
/**
* Global Providers
*/
/**
* Import Components/Directives/Etc
*/
/**
* @name IonicModule
* @description
* IonicModule is an [NgModule](https://angular.io/docs/ts/latest/guide/ngmodule.html) that bootstraps
* an Ionic App. By passing a root component, IonicModule will make sure that all of the components,
* directives, and providers from the framework are imported.
*
* Any configuration for the app can be passed as the second argument to `forRoot`. This can be any
* valid property from the [Config](/docs/api/config/Config/).
*
* @usage
* ```ts
* import { NgModule } from '@angular/core';
*
* import { IonicApp, IonicModule } from 'ionic-angular';
*
* import { MyApp } from './app.component';
* import { HomePage } from '../pages/home/home';
*
* @NgModule({
* declarations: [
* MyApp,
* HomePage
* ],
* imports: [
* BrowserModule,
* IonicModule.forRoot(MyApp, {
*
* })
* ],
* bootstrap: [IonicApp],
* entryComponents: [
* MyApp,
* HomePage
* ],
* providers: []
* })
* export class AppModule {}
* ```
*/
var IonicModule = (function () {
function IonicModule() {
}
/**
* Set the root app component for you IonicModule
* @param {any} appRoot The root AppComponent for this app.
* @param {any} config Config Options for the app. Accepts any config property.
* @param {any} deepLinkConfig Any configuration needed for the Ionic Deeplinker.
*/
IonicModule.forRoot = function (appRoot, config, deepLinkConfig) {
if (config === void 0) { config = null; }
if (deepLinkConfig === void 0) { deepLinkConfig = null; }
return {
ngModule: IonicModule,
providers: [
// useValue: bootstrap values
{ provide: __WEBPACK_IMPORTED_MODULE_5__components_app_app_root__["a" /* AppRootToken */], useValue: appRoot },
{ provide: __WEBPACK_IMPORTED_MODULE_6__config_config__["b" /* ConfigToken */], useValue: config },
{ provide: __WEBPACK_IMPORTED_MODULE_22__navigation_url_serializer__["a" /* DeepLinkConfigToken */], useValue: deepLinkConfig },
{ provide: __WEBPACK_IMPORTED_MODULE_1__angular_common__["a" /* APP_BASE_HREF */], useValue: '/' },
// useFactory: user values
{ provide: __WEBPACK_IMPORTED_MODULE_18__platform_platform_registry__["a" /* PlatformConfigToken */], useFactory: __WEBPACK_IMPORTED_MODULE_18__platform_platform_registry__["b" /* providePlatformConfigs */] },
// useFactory: ionic core providers
{ provide: __WEBPACK_IMPORTED_MODULE_17__platform_platform__["a" /* Platform */], useFactory: __WEBPACK_IMPORTED_MODULE_17__platform_platform__["b" /* setupPlatform */], deps: [__WEBPACK_IMPORTED_MODULE_2__angular_platform_browser__["b" /* DOCUMENT */], __WEBPACK_IMPORTED_MODULE_18__platform_platform_registry__["a" /* PlatformConfigToken */], __WEBPACK_IMPORTED_MODULE_0__angular_core__["M" /* NgZone */]] },
{ provide: __WEBPACK_IMPORTED_MODULE_6__config_config__["a" /* Config */], useFactory: __WEBPACK_IMPORTED_MODULE_6__config_config__["c" /* setupConfig */], deps: [__WEBPACK_IMPORTED_MODULE_6__config_config__["b" /* ConfigToken */], __WEBPACK_IMPORTED_MODULE_17__platform_platform__["a" /* Platform */]] },
// useFactory: ionic app initializers
{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_core__["c" /* APP_INITIALIZER */], useFactory: __WEBPACK_IMPORTED_MODULE_20__config_mode_registry__["a" /* registerModeConfigs */], deps: [__WEBPACK_IMPORTED_MODULE_6__config_config__["a" /* Config */]], multi: true },
{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_core__["c" /* APP_INITIALIZER */], useFactory: __WEBPACK_IMPORTED_MODULE_9__util_events__["b" /* setupProvideEvents */], deps: [__WEBPACK_IMPORTED_MODULE_17__platform_platform__["a" /* Platform */], __WEBPACK_IMPORTED_MODULE_8__platform_dom_controller__["a" /* DomController */]], multi: true },
{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_core__["c" /* APP_INITIALIZER */], useFactory: __WEBPACK_IMPORTED_MODULE_19__tap_click_tap_click__["b" /* setupTapClick */], deps: [__WEBPACK_IMPORTED_MODULE_6__config_config__["a" /* Config */], __WEBPACK_IMPORTED_MODULE_17__platform_platform__["a" /* Platform */], __WEBPACK_IMPORTED_MODULE_8__platform_dom_controller__["a" /* DomController */], __WEBPACK_IMPORTED_MODULE_4__components_app_app__["a" /* App */], __WEBPACK_IMPORTED_MODULE_11__gestures_gesture_controller__["l" /* GestureController */]], multi: true },
{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_core__["c" /* APP_INITIALIZER */], useFactory: __WEBPACK_IMPORTED_MODULE_15__util_module_loader__["d" /* setupPreloading */], deps: [__WEBPACK_IMPORTED_MODULE_6__config_config__["a" /* Config */], __WEBPACK_IMPORTED_MODULE_22__navigation_url_serializer__["a" /* DeepLinkConfigToken */], __WEBPACK_IMPORTED_MODULE_15__util_module_loader__["b" /* ModuleLoader */], __WEBPACK_IMPORTED_MODULE_0__angular_core__["M" /* NgZone */]], multi: true },
// useClass
{ provide: __WEBPACK_IMPORTED_MODULE_2__angular_platform_browser__["d" /* HAMMER_GESTURE_CONFIG */], useClass: __WEBPACK_IMPORTED_MODULE_12__gestures_gesture_config__["a" /* IonicGestureConfig */] },
// useValue
{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_core__["a" /* ANALYZE_FOR_ENTRY_COMPONENTS */], useValue: appRoot, multi: true },
// ionic providers
__WEBPACK_IMPORTED_MODULE_24__components_action_sheet_action_sheet_controller__["a" /* ActionSheetController */],
__WEBPACK_IMPORTED_MODULE_26__components_alert_alert_controller__["a" /* AlertController */],
__WEBPACK_IMPORTED_MODULE_4__components_app_app__["a" /* App */],
__WEBPACK_IMPORTED_MODULE_8__platform_dom_controller__["a" /* DomController */],
__WEBPACK_IMPORTED_MODULE_9__util_events__["a" /* Events */],
__WEBPACK_IMPORTED_MODULE_10__util_form__["a" /* Form */],
__WEBPACK_IMPORTED_MODULE_11__gestures_gesture_controller__["l" /* GestureController */],
__WEBPACK_IMPORTED_MODULE_13__tap_click_haptic__["a" /* Haptic */],
__WEBPACK_IMPORTED_MODULE_14__platform_keyboard__["a" /* Keyboard */],
__WEBPACK_IMPORTED_MODULE_64__components_loading_loading_controller__["a" /* LoadingController */],
__WEBPACK_IMPORTED_MODULE_1__angular_common__["e" /* Location */],
__WEBPACK_IMPORTED_MODULE_67__components_app_menu_controller__["a" /* MenuController */],
__WEBPACK_IMPORTED_MODULE_70__components_modal_modal_controller__["a" /* ModalController */],
__WEBPACK_IMPORTED_MODULE_16__util_ng_module_loader__["a" /* NgModuleLoader */],
__WEBPACK_IMPORTED_MODULE_80__components_picker_picker_controller__["a" /* PickerController */],
__WEBPACK_IMPORTED_MODULE_82__components_popover_popover_controller__["a" /* PopoverController */],
__WEBPACK_IMPORTED_MODULE_19__tap_click_tap_click__["a" /* TapClick */],
__WEBPACK_IMPORTED_MODULE_107__components_toast_toast_controller__["a" /* ToastController */],
__WEBPACK_IMPORTED_MODULE_21__transitions_transition_controller__["a" /* TransitionController */],
{ provide: __WEBPACK_IMPORTED_MODULE_15__util_module_loader__["b" /* ModuleLoader */], useFactory: __WEBPACK_IMPORTED_MODULE_15__util_module_loader__["c" /* provideModuleLoader */], deps: [__WEBPACK_IMPORTED_MODULE_16__util_ng_module_loader__["a" /* NgModuleLoader */], __WEBPACK_IMPORTED_MODULE_0__angular_core__["C" /* Injector */]] },
{ provide: __WEBPACK_IMPORTED_MODULE_1__angular_common__["f" /* LocationStrategy */], useFactory: provideLocationStrategy, deps: [__WEBPACK_IMPORTED_MODULE_1__angular_common__["h" /* PlatformLocation */], [new __WEBPACK_IMPORTED_MODULE_0__angular_core__["z" /* Inject */](__WEBPACK_IMPORTED_MODULE_1__angular_common__["a" /* APP_BASE_HREF */]), new __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* Optional */]()], __WEBPACK_IMPORTED_MODULE_6__config_config__["a" /* Config */]] },
{ provide: __WEBPACK_IMPORTED_MODULE_22__navigation_url_serializer__["b" /* UrlSerializer */], useFactory: __WEBPACK_IMPORTED_MODULE_22__navigation_url_serializer__["d" /* setupUrlSerializer */], deps: [__WEBPACK_IMPORTED_MODULE_4__components_app_app__["a" /* App */], __WEBPACK_IMPORTED_MODULE_22__navigation_url_serializer__["a" /* DeepLinkConfigToken */]] },
{ provide: __WEBPACK_IMPORTED_MODULE_7__navigation_deep_linker__["a" /* DeepLinker */], useFactory: __WEBPACK_IMPORTED_MODULE_7__navigation_deep_linker__["b" /* setupDeepLinker */], deps: [__WEBPACK_IMPORTED_MODULE_4__components_app_app__["a" /* App */], __WEBPACK_IMPORTED_MODULE_22__navigation_url_serializer__["b" /* UrlSerializer */], __WEBPACK_IMPORTED_MODULE_1__angular_common__["e" /* Location */], __WEBPACK_IMPORTED_MODULE_15__util_module_loader__["b" /* ModuleLoader */], __WEBPACK_IMPORTED_MODULE_0__angular_core__["o" /* ComponentFactoryResolver */]] },
]
};
};
IonicModule.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["I" /* NgModule */], args: [{
declarations: [
__WEBPACK_IMPORTED_MODULE_23__components_action_sheet_action_sheet_component__["a" /* ActionSheetCmp */],
__WEBPACK_IMPORTED_MODULE_25__components_alert_alert_component__["a" /* AlertCmp */],
__WEBPACK_IMPORTED_MODULE_27__components_app_click_block__["a" /* ClickBlock */],
__WEBPACK_IMPORTED_MODULE_5__components_app_app_root__["b" /* IonicApp */],
__WEBPACK_IMPORTED_MODULE_28__components_app_overlay_portal__["a" /* OverlayPortal */],
__WEBPACK_IMPORTED_MODULE_29__components_avatar_avatar__["a" /* Avatar */],
__WEBPACK_IMPORTED_MODULE_30__components_backdrop_backdrop__["a" /* Backdrop */],
__WEBPACK_IMPORTED_MODULE_31__components_badge_badge__["a" /* Badge */],
__WEBPACK_IMPORTED_MODULE_32__components_button_button__["a" /* Button */],
__WEBPACK_IMPORTED_MODULE_33__components_card_card__["a" /* Card */],
__WEBPACK_IMPORTED_MODULE_34__components_card_card_content__["a" /* CardContent */],
__WEBPACK_IMPORTED_MODULE_35__components_card_card_header__["a" /* CardHeader */],
__WEBPACK_IMPORTED_MODULE_36__components_card_card_title__["a" /* CardTitle */],
__WEBPACK_IMPORTED_MODULE_37__components_checkbox_checkbox__["a" /* Checkbox */],
__WEBPACK_IMPORTED_MODULE_38__components_chip_chip__["a" /* Chip */],
__WEBPACK_IMPORTED_MODULE_44__components_grid_col__["a" /* Col */],
__WEBPACK_IMPORTED_MODULE_39__components_content_content__["a" /* Content */],
__WEBPACK_IMPORTED_MODULE_40__components_datetime_datetime__["a" /* DateTime */],
__WEBPACK_IMPORTED_MODULE_41__components_fab_fab__["a" /* FabButton */],
__WEBPACK_IMPORTED_MODULE_42__components_fab_fab_container__["a" /* FabContainer */],
__WEBPACK_IMPORTED_MODULE_43__components_fab_fab_list__["a" /* FabList */],
__WEBPACK_IMPORTED_MODULE_45__components_grid_grid__["a" /* Grid */],
__WEBPACK_IMPORTED_MODULE_48__components_img_img__["a" /* Img */],
__WEBPACK_IMPORTED_MODULE_47__components_icon_icon__["a" /* Icon */],
__WEBPACK_IMPORTED_MODULE_49__components_infinite_scroll_infinite_scroll__["a" /* InfiniteScroll */],
__WEBPACK_IMPORTED_MODULE_50__components_infinite_scroll_infinite_scroll_content__["a" /* InfiniteScrollContent */],
__WEBPACK_IMPORTED_MODULE_52__components_item_item__["a" /* Item */],
__WEBPACK_IMPORTED_MODULE_53__components_item_item_content__["a" /* ItemContent */],
__WEBPACK_IMPORTED_MODULE_54__components_item_item_divider__["a" /* ItemDivider */],
__WEBPACK_IMPORTED_MODULE_55__components_item_item_group__["a" /* ItemGroup */],
__WEBPACK_IMPORTED_MODULE_56__components_item_item_options__["a" /* ItemOptions */],
__WEBPACK_IMPORTED_MODULE_57__components_item_item_reorder__["a" /* ItemReorder */],
__WEBPACK_IMPORTED_MODULE_58__components_item_item_sliding__["a" /* ItemSliding */],
__WEBPACK_IMPORTED_MODULE_60__components_label_label__["a" /* Label */],
__WEBPACK_IMPORTED_MODULE_61__components_list_list__["a" /* List */],
__WEBPACK_IMPORTED_MODULE_62__components_list_list_header__["a" /* ListHeader */],
__WEBPACK_IMPORTED_MODULE_59__components_item_reorder__["a" /* Reorder */],
__WEBPACK_IMPORTED_MODULE_63__components_loading_loading_component__["a" /* LoadingCmp */],
__WEBPACK_IMPORTED_MODULE_65__components_menu_menu__["a" /* Menu */],
__WEBPACK_IMPORTED_MODULE_66__components_menu_menu_close__["a" /* MenuClose */],
__WEBPACK_IMPORTED_MODULE_68__components_menu_menu_toggle__["a" /* MenuToggle */],
__WEBPACK_IMPORTED_MODULE_69__components_modal_modal_component__["a" /* ModalCmp */],
__WEBPACK_IMPORTED_MODULE_71__components_nav_nav__["a" /* Nav */],
__WEBPACK_IMPORTED_MODULE_72__components_nav_nav_pop__["a" /* NavPop */],
__WEBPACK_IMPORTED_MODULE_73__components_nav_nav_pop_anchor__["a" /* NavPopAnchor */],
__WEBPACK_IMPORTED_MODULE_74__components_nav_nav_push__["a" /* NavPush */],
__WEBPACK_IMPORTED_MODULE_75__components_nav_nav_push_anchor__["a" /* NavPushAnchor */],
__WEBPACK_IMPORTED_MODULE_76__components_note_note__["a" /* Note */],
__WEBPACK_IMPORTED_MODULE_77__components_option_option__["a" /* Option */],
__WEBPACK_IMPORTED_MODULE_78__components_picker_picker_component__["a" /* PickerCmp */],
__WEBPACK_IMPORTED_MODULE_79__components_picker_picker_column__["a" /* PickerColumnCmp */],
__WEBPACK_IMPORTED_MODULE_81__components_popover_popover_component__["a" /* PopoverCmp */],
__WEBPACK_IMPORTED_MODULE_83__components_radio_radio_button__["a" /* RadioButton */],
__WEBPACK_IMPORTED_MODULE_84__components_radio_radio_group__["a" /* RadioGroup */],
__WEBPACK_IMPORTED_MODULE_85__components_range_range__["a" /* Range */],
__WEBPACK_IMPORTED_MODULE_86__components_range_range_knob__["a" /* RangeKnob */],
__WEBPACK_IMPORTED_MODULE_87__components_refresher_refresher__["a" /* Refresher */],
__WEBPACK_IMPORTED_MODULE_88__components_refresher_refresher_content__["a" /* RefresherContent */],
__WEBPACK_IMPORTED_MODULE_46__components_grid_row__["a" /* Row */],
__WEBPACK_IMPORTED_MODULE_89__components_scroll_scroll__["a" /* Scroll */],
__WEBPACK_IMPORTED_MODULE_90__components_searchbar_searchbar__["a" /* Searchbar */],
__WEBPACK_IMPORTED_MODULE_91__components_segment_segment__["a" /* Segment */],
__WEBPACK_IMPORTED_MODULE_94__components_segment_segment_button__["a" /* SegmentButton */],
__WEBPACK_IMPORTED_MODULE_92__components_select_select__["a" /* Select */],
__WEBPACK_IMPORTED_MODULE_93__components_select_select_popover_component__["a" /* SelectPopover */],
__WEBPACK_IMPORTED_MODULE_95__components_show_hide_when_show_when__["a" /* ShowWhen */],
__WEBPACK_IMPORTED_MODULE_96__components_show_hide_when_hide_when__["a" /* HideWhen */],
__WEBPACK_IMPORTED_MODULE_97__components_slides_slide__["a" /* Slide */],
__WEBPACK_IMPORTED_MODULE_98__components_slides_slides__["a" /* Slides */],
__WEBPACK_IMPORTED_MODULE_99__components_spinner_spinner__["a" /* Spinner */],
__WEBPACK_IMPORTED_MODULE_100__components_split_pane_split_pane__["b" /* SplitPane */],
__WEBPACK_IMPORTED_MODULE_101__components_tabs_tab__["a" /* Tab */],
__WEBPACK_IMPORTED_MODULE_102__components_tabs_tab_button__["a" /* TabButton */],
__WEBPACK_IMPORTED_MODULE_103__components_tabs_tab_highlight__["a" /* TabHighlight */],
__WEBPACK_IMPORTED_MODULE_104__components_tabs_tabs__["a" /* Tabs */],
__WEBPACK_IMPORTED_MODULE_51__components_input_input__["a" /* TextInput */],
__WEBPACK_IMPORTED_MODULE_105__components_thumbnail_thumbnail__["a" /* Thumbnail */],
__WEBPACK_IMPORTED_MODULE_106__components_toast_toast_component__["a" /* ToastCmp */],
__WEBPACK_IMPORTED_MODULE_108__components_toggle_toggle__["a" /* Toggle */],
__WEBPACK_IMPORTED_MODULE_109__components_toolbar_toolbar_footer__["a" /* Footer */],
__WEBPACK_IMPORTED_MODULE_110__components_toolbar_toolbar_header__["a" /* Header */],
__WEBPACK_IMPORTED_MODULE_111__components_toolbar_toolbar__["a" /* Toolbar */],
__WEBPACK_IMPORTED_MODULE_112__components_toolbar_toolbar_item__["a" /* ToolbarItem */],
__WEBPACK_IMPORTED_MODULE_113__components_toolbar_toolbar_title__["a" /* ToolbarTitle */],
__WEBPACK_IMPORTED_MODULE_114__components_toolbar_navbar__["a" /* Navbar */],
__WEBPACK_IMPORTED_MODULE_115__components_typography_typography__["a" /* Typography */],
__WEBPACK_IMPORTED_MODULE_116__components_virtual_scroll_virtual_footer__["a" /* VirtualFooter */],
__WEBPACK_IMPORTED_MODULE_117__components_virtual_scroll_virtual_header__["a" /* VirtualHeader */],
__WEBPACK_IMPORTED_MODULE_118__components_virtual_scroll_virtual_item__["a" /* VirtualItem */],
__WEBPACK_IMPORTED_MODULE_119__components_virtual_scroll_virtual_scroll__["a" /* VirtualScroll */]
],
imports: [
__WEBPACK_IMPORTED_MODULE_1__angular_common__["b" /* CommonModule */],
__WEBPACK_IMPORTED_MODULE_3__angular_forms__["b" /* FormsModule */],
__WEBPACK_IMPORTED_MODULE_3__angular_forms__["e" /* ReactiveFormsModule */],
],
exports: [
__WEBPACK_IMPORTED_MODULE_1__angular_common__["b" /* CommonModule */],
__WEBPACK_IMPORTED_MODULE_3__angular_forms__["b" /* FormsModule */],
__WEBPACK_IMPORTED_MODULE_3__angular_forms__["e" /* ReactiveFormsModule */],
__WEBPACK_IMPORTED_MODULE_23__components_action_sheet_action_sheet_component__["a" /* ActionSheetCmp */],
__WEBPACK_IMPORTED_MODULE_25__components_alert_alert_component__["a" /* AlertCmp */],
__WEBPACK_IMPORTED_MODULE_27__components_app_click_block__["a" /* ClickBlock */],
__WEBPACK_IMPORTED_MODULE_5__components_app_app_root__["b" /* IonicApp */],
__WEBPACK_IMPORTED_MODULE_28__components_app_overlay_portal__["a" /* OverlayPortal */],
__WEBPACK_IMPORTED_MODULE_29__components_avatar_avatar__["a" /* Avatar */],
__WEBPACK_IMPORTED_MODULE_30__components_backdrop_backdrop__["a" /* Backdrop */],
__WEBPACK_IMPORTED_MODULE_31__components_badge_badge__["a" /* Badge */],
__WEBPACK_IMPORTED_MODULE_32__components_button_button__["a" /* Button */],
__WEBPACK_IMPORTED_MODULE_33__components_card_card__["a" /* Card */],
__WEBPACK_IMPORTED_MODULE_34__components_card_card_content__["a" /* CardContent */],
__WEBPACK_IMPORTED_MODULE_35__components_card_card_header__["a" /* CardHeader */],
__WEBPACK_IMPORTED_MODULE_36__components_card_card_title__["a" /* CardTitle */],
__WEBPACK_IMPORTED_MODULE_37__components_checkbox_checkbox__["a" /* Checkbox */],
__WEBPACK_IMPORTED_MODULE_38__components_chip_chip__["a" /* Chip */],
__WEBPACK_IMPORTED_MODULE_44__components_grid_col__["a" /* Col */],
__WEBPACK_IMPORTED_MODULE_39__components_content_content__["a" /* Content */],
__WEBPACK_IMPORTED_MODULE_40__components_datetime_datetime__["a" /* DateTime */],
__WEBPACK_IMPORTED_MODULE_41__components_fab_fab__["a" /* FabButton */],
__WEBPACK_IMPORTED_MODULE_42__components_fab_fab_container__["a" /* FabContainer */],
__WEBPACK_IMPORTED_MODULE_43__components_fab_fab_list__["a" /* FabList */],
__WEBPACK_IMPORTED_MODULE_45__components_grid_grid__["a" /* Grid */],
__WEBPACK_IMPORTED_MODULE_48__components_img_img__["a" /* Img */],
__WEBPACK_IMPORTED_MODULE_47__components_icon_icon__["a" /* Icon */],
__WEBPACK_IMPORTED_MODULE_49__components_infinite_scroll_infinite_scroll__["a" /* InfiniteScroll */],
__WEBPACK_IMPORTED_MODULE_50__components_infinite_scroll_infinite_scroll_content__["a" /* InfiniteScrollContent */],
__WEBPACK_IMPORTED_MODULE_52__components_item_item__["a" /* Item */],
__WEBPACK_IMPORTED_MODULE_53__components_item_item_content__["a" /* ItemContent */],
__WEBPACK_IMPORTED_MODULE_54__components_item_item_divider__["a" /* ItemDivider */],
__WEBPACK_IMPORTED_MODULE_55__components_item_item_group__["a" /* ItemGroup */],
__WEBPACK_IMPORTED_MODULE_56__components_item_item_options__["a" /* ItemOptions */],
__WEBPACK_IMPORTED_MODULE_57__components_item_item_reorder__["a" /* ItemReorder */],
__WEBPACK_IMPORTED_MODULE_58__components_item_item_sliding__["a" /* ItemSliding */],
__WEBPACK_IMPORTED_MODULE_60__components_label_label__["a" /* Label */],
__WEBPACK_IMPORTED_MODULE_61__components_list_list__["a" /* List */],
__WEBPACK_IMPORTED_MODULE_62__components_list_list_header__["a" /* ListHeader */],
__WEBPACK_IMPORTED_MODULE_59__components_item_reorder__["a" /* Reorder */],
__WEBPACK_IMPORTED_MODULE_63__components_loading_loading_component__["a" /* LoadingCmp */],
__WEBPACK_IMPORTED_MODULE_65__components_menu_menu__["a" /* Menu */],
__WEBPACK_IMPORTED_MODULE_66__components_menu_menu_close__["a" /* MenuClose */],
__WEBPACK_IMPORTED_MODULE_68__components_menu_menu_toggle__["a" /* MenuToggle */],
__WEBPACK_IMPORTED_MODULE_69__components_modal_modal_component__["a" /* ModalCmp */],
__WEBPACK_IMPORTED_MODULE_71__components_nav_nav__["a" /* Nav */],
__WEBPACK_IMPORTED_MODULE_72__components_nav_nav_pop__["a" /* NavPop */],
__WEBPACK_IMPORTED_MODULE_73__components_nav_nav_pop_anchor__["a" /* NavPopAnchor */],
__WEBPACK_IMPORTED_MODULE_74__components_nav_nav_push__["a" /* NavPush */],
__WEBPACK_IMPORTED_MODULE_75__components_nav_nav_push_anchor__["a" /* NavPushAnchor */],
__WEBPACK_IMPORTED_MODULE_76__components_note_note__["a" /* Note */],
__WEBPACK_IMPORTED_MODULE_77__components_option_option__["a" /* Option */],
__WEBPACK_IMPORTED_MODULE_78__components_picker_picker_component__["a" /* PickerCmp */],
__WEBPACK_IMPORTED_MODULE_79__components_picker_picker_column__["a" /* PickerColumnCmp */],
__WEBPACK_IMPORTED_MODULE_81__components_popover_popover_component__["a" /* PopoverCmp */],
__WEBPACK_IMPORTED_MODULE_83__components_radio_radio_button__["a" /* RadioButton */],
__WEBPACK_IMPORTED_MODULE_84__components_radio_radio_group__["a" /* RadioGroup */],
__WEBPACK_IMPORTED_MODULE_85__components_range_range__["a" /* Range */],
__WEBPACK_IMPORTED_MODULE_86__components_range_range_knob__["a" /* RangeKnob */],
__WEBPACK_IMPORTED_MODULE_87__components_refresher_refresher__["a" /* Refresher */],
__WEBPACK_IMPORTED_MODULE_88__components_refresher_refresher_content__["a" /* RefresherContent */],
__WEBPACK_IMPORTED_MODULE_46__components_grid_row__["a" /* Row */],
__WEBPACK_IMPORTED_MODULE_89__components_scroll_scroll__["a" /* Scroll */],
__WEBPACK_IMPORTED_MODULE_90__components_searchbar_searchbar__["a" /* Searchbar */],
__WEBPACK_IMPORTED_MODULE_91__components_segment_segment__["a" /* Segment */],
__WEBPACK_IMPORTED_MODULE_94__components_segment_segment_button__["a" /* SegmentButton */],
__WEBPACK_IMPORTED_MODULE_92__components_select_select__["a" /* Select */],
__WEBPACK_IMPORTED_MODULE_93__components_select_select_popover_component__["a" /* SelectPopover */],
__WEBPACK_IMPORTED_MODULE_95__components_show_hide_when_show_when__["a" /* ShowWhen */],
__WEBPACK_IMPORTED_MODULE_96__components_show_hide_when_hide_when__["a" /* HideWhen */],
__WEBPACK_IMPORTED_MODULE_97__components_slides_slide__["a" /* Slide */],
__WEBPACK_IMPORTED_MODULE_98__components_slides_slides__["a" /* Slides */],
__WEBPACK_IMPORTED_MODULE_99__components_spinner_spinner__["a" /* Spinner */],
__WEBPACK_IMPORTED_MODULE_100__components_split_pane_split_pane__["b" /* SplitPane */],
__WEBPACK_IMPORTED_MODULE_101__components_tabs_tab__["a" /* Tab */],
__WEBPACK_IMPORTED_MODULE_102__components_tabs_tab_button__["a" /* TabButton */],
__WEBPACK_IMPORTED_MODULE_103__components_tabs_tab_highlight__["a" /* TabHighlight */],
__WEBPACK_IMPORTED_MODULE_104__components_tabs_tabs__["a" /* Tabs */],
__WEBPACK_IMPORTED_MODULE_51__components_input_input__["a" /* TextInput */],
__WEBPACK_IMPORTED_MODULE_105__components_thumbnail_thumbnail__["a" /* Thumbnail */],
__WEBPACK_IMPORTED_MODULE_106__components_toast_toast_component__["a" /* ToastCmp */],
__WEBPACK_IMPORTED_MODULE_108__components_toggle_toggle__["a" /* Toggle */],
__WEBPACK_IMPORTED_MODULE_109__components_toolbar_toolbar_footer__["a" /* Footer */],
__WEBPACK_IMPORTED_MODULE_110__components_toolbar_toolbar_header__["a" /* Header */],
__WEBPACK_IMPORTED_MODULE_111__components_toolbar_toolbar__["a" /* Toolbar */],
__WEBPACK_IMPORTED_MODULE_112__components_toolbar_toolbar_item__["a" /* ToolbarItem */],
__WEBPACK_IMPORTED_MODULE_113__components_toolbar_toolbar_title__["a" /* ToolbarTitle */],
__WEBPACK_IMPORTED_MODULE_114__components_toolbar_navbar__["a" /* Navbar */],
__WEBPACK_IMPORTED_MODULE_115__components_typography_typography__["a" /* Typography */],
__WEBPACK_IMPORTED_MODULE_116__components_virtual_scroll_virtual_footer__["a" /* VirtualFooter */],
__WEBPACK_IMPORTED_MODULE_117__components_virtual_scroll_virtual_header__["a" /* VirtualHeader */],
__WEBPACK_IMPORTED_MODULE_118__components_virtual_scroll_virtual_item__["a" /* VirtualItem */],
__WEBPACK_IMPORTED_MODULE_119__components_virtual_scroll_virtual_scroll__["a" /* VirtualScroll */]
],
entryComponents: [
__WEBPACK_IMPORTED_MODULE_23__components_action_sheet_action_sheet_component__["a" /* ActionSheetCmp */],
__WEBPACK_IMPORTED_MODULE_25__components_alert_alert_component__["a" /* AlertCmp */],
__WEBPACK_IMPORTED_MODULE_5__components_app_app_root__["b" /* IonicApp */],
__WEBPACK_IMPORTED_MODULE_63__components_loading_loading_component__["a" /* LoadingCmp */],
__WEBPACK_IMPORTED_MODULE_69__components_modal_modal_component__["a" /* ModalCmp */],
__WEBPACK_IMPORTED_MODULE_78__components_picker_picker_component__["a" /* PickerCmp */],
__WEBPACK_IMPORTED_MODULE_81__components_popover_popover_component__["a" /* PopoverCmp */],
__WEBPACK_IMPORTED_MODULE_93__components_select_select_popover_component__["a" /* SelectPopover */],
__WEBPACK_IMPORTED_MODULE_106__components_toast_toast_component__["a" /* ToastCmp */]
]
},] },
];
/** @nocollapse */
IonicModule.ctorParameters = function () { return []; };
return IonicModule;
}());
/**
* @name IonicPageModule
* @description
* IonicPageModule is an [NgModule](https://angular.io/docs/ts/latest/guide/ngmodule.html) that
* bootstraps a child [IonicPage](../navigation/IonicPage/) in order to set up routing.
*
* @usage
* ```ts
* import { NgModule } from '@angular/core';
*
* import { IonicPageModule } from 'ionic-angular';
*
* import { HomePage } from './home';
*
* @NgModule({
* declarations: [
* HomePage
* ],
* imports: [
* IonicPageModule.forChild(HomePage)
* ],
* entryComponents: [
* HomePage
* ]
* })
* export class HomePageModule { }
* ```
*/
var IonicPageModule = (function () {
function IonicPageModule() {
}
IonicPageModule.forChild = function (page) {
return {
ngModule: IonicPageModule,
providers: [
{ provide: __WEBPACK_IMPORTED_MODULE_15__util_module_loader__["a" /* LAZY_LOADED_TOKEN */], useValue: page },
{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_core__["a" /* ANALYZE_FOR_ENTRY_COMPONENTS */], useValue: page, multi: true },
]
};
};
IonicPageModule.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["I" /* NgModule */], args: [{
imports: [IonicModule],
exports: [IonicModule]
},] },
];
/** @nocollapse */
IonicPageModule.ctorParameters = function () { return []; };
return IonicPageModule;
}());
/**
* @hidden
*/
function provideLocationStrategy(platformLocationStrategy, baseHref, config) {
return config.get('locationStrategy') === 'path' ?
new __WEBPACK_IMPORTED_MODULE_1__angular_common__["g" /* PathLocationStrategy */](platformLocationStrategy, baseHref) :
new __WEBPACK_IMPORTED_MODULE_1__angular_common__["d" /* HashLocationStrategy */](platformLocationStrategy, baseHref);
}
//# sourceMappingURL=module.js.map
/***/ }),
/* 491 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ClickBlock; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__app_app__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__config_config__ = __webpack_require__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__platform_platform__ = __webpack_require__(4);
/**
* @hidden
*/
var ClickBlock = (function () {
function ClickBlock(app, config, plt, elementRef, renderer) {
this.plt = plt;
this.elementRef = elementRef;
this.renderer = renderer;
this._showing = false;
app._clickBlock = this;
var enabled = this.isEnabled = config.getBoolean('clickBlock', true);
if (enabled) {
this._setElementClass('click-block-enabled', true);
}
}
ClickBlock.prototype.activate = function (shouldShow, expire, minDuration) {
if (expire === void 0) { expire = 100; }
if (minDuration === void 0) { minDuration = 0; }
if (this.isEnabled) {
this.plt.cancelTimeout(this._tmr);
if (shouldShow) {
// remember when we started the click block
this._start = Date.now();
// figure out the minimum time it should be showing until
// this is useful for transitions that are less than 300ms
this._minEnd = this._start + (minDuration || 0);
this._activate(true);
}
this._tmr = this.plt.timeout(this._activate.bind(this, false), expire);
}
};
/** @internal */
ClickBlock.prototype._activate = function (shouldShow) {
if (this._showing !== shouldShow) {
if (!shouldShow) {
// check if it was enabled before the minimum duration
// this is useful for transitions that are less than 300ms
var now = Date.now();
if (now < this._minEnd) {
this._tmr = this.plt.timeout(this._activate.bind(this, false), this._minEnd - now);
return;
}
}
this._setElementClass('click-block-active', shouldShow);
this._showing = shouldShow;
}
};
ClickBlock.prototype._setElementClass = function (className, add) {
this.renderer.setElementClass(this.elementRef.nativeElement, className, add);
};
ClickBlock.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* Directive */], args: [{
selector: '.click-block'
},] },
];
/** @nocollapse */
ClickBlock.ctorParameters = function () { return [
{ type: __WEBPACK_IMPORTED_MODULE_1__app_app__["a" /* App */], decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["z" /* Inject */], args: [Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["_14" /* forwardRef */])(function () { return __WEBPACK_IMPORTED_MODULE_1__app_app__["a" /* App */]; }),] },] },
{ type: __WEBPACK_IMPORTED_MODULE_2__config_config__["a" /* Config */], },
{ type: __WEBPACK_IMPORTED_MODULE_3__platform_platform__["a" /* Platform */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["t" /* ElementRef */], },
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Renderer */], },
]; };
return ClickBlock;
}());
//# sourceMappingURL=click-block.js.map
/***/ }),
/* 492 */,
/* 493 */,
/* 494 */,
/* 495 */,
/* 496 */,
/* 497 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Push; });
/* unused harmony export PushObject */
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__ionic_native_core__ = __webpack_require__(59);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_Observable__ = __webpack_require__(9);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_Observable___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_rxjs_Observable__);
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
/**
* @name Push
* @description
* Register and receive push notifications.
*
* Requires Cordova plugin: `phonegap-plugin-push`. For more info, please see the [Push plugin docs](https://github.com/phonegap/phonegap-plugin-push).
*
* For TypeScript users, see the [Push plugin docs about using TypeScript for custom notifications](https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/TYPESCRIPT.md).
*
* @usage
* ```typescript
* import { Push, PushObject, PushOptions } from '@ionic-native/push';
*
* constructor(private push: Push) { }
*
* ...
*
*
* // to check if we have permission
* this.push.hasPermission()
* .then((res: any) => {
*
* if (res.isEnabled) {
* console.log('We have permission to send push notifications');
* } else {
* console.log('We do not have permission to send push notifications');
* }
*
* });
*
* // Create a channel (Android O and above). You'll need to provide the id, description and importance properties.
* this.push.createChannel({
* id: "testchannel1",
* description: "My first test channel",
* // The importance property goes from 1 = Lowest, 2 = Low, 3 = Normal, 4 = High and 5 = Highest.
* importance: 3
* }).then(() => console.log('Channel created'));
*
* // Delete a channel (Android O and above)
* this.push.deleteChannel('testchannel1').then(() => console.log('Channel deleted'));
*
* // Return a list of currently configured channels
* this.push.listChannels().then((channels) => console.log('List of channels', channels))
*
* // to initialize push notifications
*
* const options: PushOptions = {
* android: {},
* ios: {
* alert: 'true',
* badge: true,
* sound: 'false'
* },
* windows: {},
* browser: {
* pushServiceURL: 'http://push.api.phonegap.com/v1/push'
* }
* };
*
* const pushObject: PushObject = this.push.init(options);
*
*
* pushObject.on('notification').subscribe((notification: any) => console.log('Received a notification', notification));
*
* pushObject.on('registration').subscribe((registration: any) => console.log('Device registered', registration));
*
* pushObject.on('error').subscribe(error => console.error('Error with Push plugin', error));
*
*
* ```
*
* @interfaces
* RegistrationEventResponse
* NotificationEventResponse
* NotificationEventAdditionalData
* IOSPushOptions
* AndroidPushOptions
* BrowserPushOptions
* PushOptions
*/
var Push = (function (_super) {
__extends(Push, _super);
function Push() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Init push notifications
* @param options {PushOptions}
* @return {PushObject}
*/
Push.prototype.init = function (options) {
return new PushObject(options);
};
/**
* Check whether the push notification permission has been granted.
* @return {Promise<{isEnabled: boolean}>} Returns a Promise that resolves with an object with one property: isEnabled, a boolean that indicates if permission has been granted.
*/
Push.prototype.hasPermission = function () { return; };
/**
* Create a new notification channel for Android O and above.
* @param channel {Channel}
*/
Push.prototype.createChannel = function (channel) { return; };
/**
* Delete a notification channel for Android O and above.
* @param id {string}
*/
Push.prototype.deleteChannel = function (id) { return; };
/**
* Returns a list of currently configured channels.
* @return {Promise<Channel[]>}
*/
Push.prototype.listChannels = function () { return; };
Push.decorators = [
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["A" /* Injectable */] },
];
/** @nocollapse */
Push.ctorParameters = function () { return []; };
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], Push.prototype, "hasPermission", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])({
callbackOrder: 'reverse'
}),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", Promise)
], Push.prototype, "createChannel", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])({
callbackOrder: 'reverse'
}),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", Promise)
], Push.prototype, "deleteChannel", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["a" /* Cordova */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], Push.prototype, "listChannels", null);
Push = __decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["e" /* Plugin */])({
pluginName: 'Push',
plugin: 'phonegap-plugin-push',
pluginRef: 'PushNotification',
repo: 'https://github.com/phonegap/phonegap-plugin-push',
install: 'ionic cordova plugin add phonegap-plugin-push',
platforms: ['Android', 'Browser', 'iOS', 'Windows']
})
], Push);
return Push;
}(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["d" /* IonicNativePlugin */]));
/**
* @hidden
*/
var PushObject = (function () {
function PushObject(options) {
if (Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["f" /* checkAvailability */])('PushNotification', 'init', 'PushNotification') === true) {
this._objectInstance = window.PushNotification.init(options);
}
}
/**
* Adds an event listener
* @param event {string}
* @return {Observable<EventResponse>}
*/
PushObject.prototype.on = function (event) { return; };
/**
* The unregister method is used when the application no longer wants to receive push notifications.
* Beware that this cleans up all event handlers previously registered,
* so you will need to re-register them if you want them to function again without an application reload.
*/
PushObject.prototype.unregister = function () { return; };
/**
* Set the badge count visible when the app is not running
*
* The count is an integer indicating what number should show up in the badge.
* Passing 0 will clear the badge.
* Each notification event contains a data.count value which can be used to set the badge to correct number.
* @param count
*/
PushObject.prototype.setApplicationIconBadgeNumber = function (count) { return; };
;
/**
* Get the current badge count visible when the app is not running
* successHandler gets called with an integer which is the current badge count
*/
PushObject.prototype.getApplicationIconBadgeNumber = function () { return; };
/**
* iOS only
* Tells the OS that you are done processing a background push notification.
* successHandler gets called when background push processing is successfully completed.
* @param [id]
*/
PushObject.prototype.finish = function (id) { return; };
/**
* Tells the OS to clear all notifications from the Notification Center
*/
PushObject.prototype.clearAllNotifications = function () { return; };
/**
* The subscribe method is used when the application wants to subscribe a new topic to receive push notifications.
* @param topic {string} Topic to subscribe to.
* @return {Promise<any>}
*/
PushObject.prototype.subscribe = function (topic) { return; };
/**
* The unsubscribe method is used when the application no longer wants to receive push notifications from a specific topic but continue to receive other push messages.
* @param topic {string} Topic to unsubscribe from.
* @return {Promise<any>}
*/
PushObject.prototype.unsubscribe = function (topic) { return; };
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["b" /* CordovaInstance */])({
observable: true,
clearFunction: 'off',
clearWithArgs: true
}),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", __WEBPACK_IMPORTED_MODULE_2_rxjs_Observable__["Observable"])
], PushObject.prototype, "on", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["b" /* CordovaInstance */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], PushObject.prototype, "unregister", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["b" /* CordovaInstance */])({
callbackOrder: 'reverse'
}),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Number]),
__metadata("design:returntype", Promise)
], PushObject.prototype, "setApplicationIconBadgeNumber", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["b" /* CordovaInstance */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], PushObject.prototype, "getApplicationIconBadgeNumber", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["b" /* CordovaInstance */])({
callbackOrder: 'reverse'
}),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", Promise)
], PushObject.prototype, "finish", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["b" /* CordovaInstance */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", Promise)
], PushObject.prototype, "clearAllNotifications", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["b" /* CordovaInstance */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", Promise)
], PushObject.prototype, "subscribe", null);
__decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["b" /* CordovaInstance */])(),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", Promise)
], PushObject.prototype, "unsubscribe", null);
PushObject = __decorate([
Object(__WEBPACK_IMPORTED_MODULE_1__ionic_native_core__["e" /* Plugin */])({
pluginName: 'Push',
plugin: 'phonegap-plugin-push',
pluginRef: 'PushNotification'
}),
__metadata("design:paramtypes", [Object])
], PushObject);
return PushObject;
}());
//# sourceMappingURL=index.js.map
/***/ })
/******/ ]);
//# sourceMappingURL=vendor.js.map